DockWidget.h
Go to the documentation of this file.
1 #ifndef DockWidgetH
2 #define DockWidgetH
3 /*******************************************************************************
4 ** Qt Advanced Docking System
5 ** Copyright (C) 2017 Uwe Kindler
6 **
7 ** This library is free software; you can redistribute it and/or
8 ** modify it under the terms of the GNU Lesser General Public
9 ** License as published by the Free Software Foundation; either
10 ** version 2.1 of the License, or (at your option) any later version.
11 **
12 ** This library is distributed in the hope that it will be useful,
13 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 ** Lesser General Public License for more details.
16 **
17 ** You should have received a copy of the GNU Lesser General Public
18 ** License along with this library; If not, see <http://www.gnu.org/licenses/>.
19 ******************************************************************************/
20 
21 
22 //============================================================================
27 //============================================================================
28 
29 
30 //============================================================================
31 // INCLUDES
32 //============================================================================
33 #include <QFrame>
34 
35 #include "ads_globals.h"
36 
37 QT_FORWARD_DECLARE_CLASS(QToolBar)
38 QT_FORWARD_DECLARE_CLASS(QXmlStreamWriter)
39 
40 namespace ads
41 {
42 struct DockWidgetPrivate;
43 class CDockWidgetTab;
44 class CDockManager;
45 class CDockContainerWidget;
46 class CDockAreaWidget;
47 class DockContainerWidgetPrivate;
48 class CFloatingDockContainer;
49 
54 class ADS_EXPORT CDockWidget : public QFrame
55 {
56  Q_OBJECT
57 private:
59  friend struct DockWidgetPrivate;
60 
61 private slots:
65  void setToolbarFloatingStyle(bool topLevel);
66 
67 protected:
68  friend class CDockContainerWidget;
69  friend class CDockAreaWidget;
70  friend class CFloatingDockContainer;
71  friend class CDockManager;
72  friend struct DockManagerPrivate;
74  friend class CDockAreaTabBar;
75  friend class CDockWidgetTab;
76  friend struct DockWidgetTabPrivate;
77  friend struct DockAreaTitleBarPrivate;
78 
82  void setDockManager(CDockManager* DockManager);
83 
90  void setDockArea(CDockAreaWidget* DockArea);
91 
96  void setToggleViewActionChecked(bool Checked);
97 
101  void saveState(QXmlStreamWriter& Stream) const;
102 
112  void flagAsUnassigned();
113 
118  static void emitTopLevelEventForWidget(CDockWidget* TopLevelDockWidget, bool Floating);
119 
125  void emitTopLevelChanged(bool Floating);
126 
131  void setClosedState(bool Closed);
132 
137  void toggleViewInternal(bool Open);
138 
143  bool closeDockWidgetInternal(bool ForceClose = false);
144 
145 public:
146  using Super = QFrame;
147 
149  {
150  DockWidgetClosable = 0x01,
151  DockWidgetMovable = 0x02,
152  DockWidgetFloatable = 0x04,
153  DockWidgetDeleteOnClose = 0x08,
154  CustomCloseHandling = 0x10,
155  DockWidgetFocusable = 0x20,
156  DockWidgetForceCloseWithArea = 0x40,
157  DefaultDockWidgetFeatures = DockWidgetClosable | DockWidgetMovable | DockWidgetFloatable | DockWidgetFocusable,
158  AllDockWidgetFeatures = DefaultDockWidgetFeatures | DockWidgetDeleteOnClose | CustomCloseHandling,
159  DockWidgetAlwaysCloseAndDelete = DockWidgetForceCloseWithArea | DockWidgetDeleteOnClose,
160  NoDockWidgetFeatures = 0x00
161  };
162  Q_DECLARE_FLAGS(DockWidgetFeatures, DockWidgetFeature)
163 
164  enum eState
165  {
168  StateFloating
169  };
170 
189  {
192  ForceNoScrollArea
193  };
194 
195 
206  {
208  MinimumSizeHintFromContent
209  };
210 
211 
221  {
223  ActionModeShow
224  };
225 
226 
240  CDockWidget(const QString &title, QWidget* parent = 0);
241 
245  virtual ~CDockWidget();
246 
251  virtual QSize minimumSizeHint() const override;
252 
270  void setWidget(QWidget* widget, eInsertMode InsertMode = AutoScrollArea);
271 
275  QWidget* takeWidget();
276 
281  QWidget* widget() const;
282 
287  CDockWidgetTab* tabWidget() const;
288 
292  void setFeatures(DockWidgetFeatures features);
293 
298  void setFeature(DockWidgetFeature flag, bool on);
299 
306  DockWidgetFeatures features() const;
307 
312  CDockManager* dockManager() const;
313 
318  CDockContainerWidget* dockContainer() const;
319 
324  CDockAreaWidget* dockAreaWidget() const;
325 
332  bool isFloating() const;
333 
339  bool isInFloatingContainer() const;
340 
344  bool isClosed() const;
345 
350  QAction* toggleViewAction() const;
351 
356  void setToggleViewActionMode(eToggleViewActionMode Mode);
357 
363  void setMinimumSizeHintMode(eMinimumSizeHintMode Mode);
364 
368  bool isCentralWidget() const;
369 
374  void setIcon(const QIcon& Icon);
375 
379  QIcon icon() const;
380 
388  QToolBar* toolBar() const;
389 
396  QToolBar* createDefaultToolBar();
397 
403  void setToolBar(QToolBar* ToolBar);
404 
413  void setToolBarStyle(Qt::ToolButtonStyle Style, eState State);
414 
419  Qt::ToolButtonStyle toolBarStyle(eState State) const;
420 
427  void setToolBarIconSize(const QSize& IconSize, eState State);
428 
433  QSize toolBarIconSize(eState State) const;
434 
443  void setTitleBarActions(QList<QAction*> actions);
444 
449  virtual QList<QAction*> titleBarActions() const;
450 
451 
452 #ifndef QT_NO_TOOLTIP
453 
457  void setTabToolTip(const QString &text);
458 #endif
459 
464  bool isFullScreen() const;
465 
470  bool isTabbed() const;
471 
478  bool isCurrentTab() const;
479 
480 public: // reimplements QFrame -----------------------------------------------
484  virtual bool event(QEvent *e) override;
485 
486 public slots:
491  void toggleView(bool Open = true);
492 
499  void setAsCurrentTab();
500 
508  void raise();
509 
513  void setFloating();
514 
519  void deleteDockWidget();
520 
524  void closeDockWidget();
525 
538  void showFullScreen();
539 
544  void showNormal();
545 
546 
547 signals:
551  void viewToggled(bool Open);
552 
556  void closed();
557 
562  void titleChanged(const QString& Title);
563 
569  void topLevelChanged(bool topLevel);
570 
574  void closeRequested();
575 
581  void visibilityChanged(bool visible);
582 
587  void featuresChanged(ads::CDockWidget::DockWidgetFeatures features);
588 }; // class DockWidget
589 }
590  // namespace ads
591 //-----------------------------------------------------------------------------
592 #endif // DockWidgetH
ads::CDockWidget::eInsertMode
eInsertMode
Definition: DockWidget.h:188
ads_globals.h
Declaration of.
ads::CDockWidget::d
DockWidgetPrivate * d
private data (pimpl)
Definition: DockWidget.h:58
ads::CDockWidget::AutoScrollArea
@ AutoScrollArea
Definition: DockWidget.h:190
ads::CDockWidget::ActionModeToggle
@ ActionModeToggle
ActionModeToggle.
Definition: DockWidget.h:222
ads::DockAreaTitleBarPrivate
Definition: DockAreaTitleBar.cpp:63
QList< QAction * >
ads::CDockAreaWidget
Definition: DockAreaWidget.h:55
ads::CDockWidget::ForceScrollArea
@ ForceScrollArea
Definition: DockWidget.h:191
ads::DockContainerWidgetPrivate
Definition: DockContainerWidget.cpp:127
ads::CDockManager
Definition: DockManager.h:69
ads::CDockWidget::eState
eState
Definition: DockWidget.h:164
ads
Definition: ads_globals.h:69
ads::DockManagerPrivate
Definition: DockManager.cpp:97
ads::CDockAreaTabBar
Definition: DockAreaTabBar.h:53
ads::CDockWidget
Definition: DockWidget.h:54
ads::CDockWidget::eToggleViewActionMode
eToggleViewActionMode
Definition: DockWidget.h:220
ads::CDockWidget::DockWidgetFeature
DockWidgetFeature
Definition: DockWidget.h:148
ads::CDockWidget::StateHidden
@ StateHidden
Definition: DockWidget.h:166
ads::CDockWidget::eMinimumSizeHintMode
eMinimumSizeHintMode
Definition: DockWidget.h:205
ads::DockWidgetPrivate
Definition: DockWidget.cpp:67
ads::CFloatingDockContainer
Definition: FloatingDockContainer.h:104
ads::CDockContainerWidget
Definition: DockContainerWidget.h:61
ads::CDockWidget::MinimumSizeHintFromDockWidget
@ MinimumSizeHintFromDockWidget
Definition: DockWidget.h:207
ads::DockWidgetTabPrivate
Definition: DockWidgetTab.cpp:63
ads::CDockWidget::StateDocked
@ StateDocked
Definition: DockWidget.h:167
ads::CDockWidgetTab
Definition: DockWidgetTab.h:50
ADS_EXPORT
#define ADS_EXPORT
Definition: ads_globals.h:50
ads::CDockWidget::Super
QFrame Super
Definition: DockWidget.h:146


plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:44