From ac1b6c01454b8969e59becf066bba14f9ed0d310 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Thu, 5 Mar 2015 11:00:53 +0100 Subject: Add QMainWindow::GroupedDragging DockOption If this setting is enabled, the entire group of docked tabs will be draggable by the title bar of the group and and individual dock can be dragged by dragging the tab. When tabs are detached, the docks that are contained are reparented to a QDockWidgetGroupWindow. [ChangeLog][QtWidgets][QMainWindow] Added GroupedDragging as a DockOption which allow users to drag all the tabs together when dragging the title of a QDockWidget which is tabbed with others. Change-Id: I5285685b129770498eb3e4fd5f4556e41225a595 Reviewed-by: Friedemann Kleint Reviewed-by: Paul Olav Tvete --- src/widgets/widgets/qmainwindowlayout_p.h | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'src/widgets/widgets/qmainwindowlayout_p.h') diff --git a/src/widgets/widgets/qmainwindowlayout_p.h b/src/widgets/widgets/qmainwindowlayout_p.h index 8ccb4d303f..9155c5fb23 100644 --- a/src/widgets/widgets/qmainwindowlayout_p.h +++ b/src/widgets/widgets/qmainwindowlayout_p.h @@ -77,6 +77,23 @@ QT_BEGIN_NAMESPACE class QToolBar; class QRubberBand; +#ifndef QT_NO_DOCKWIDGET +class QDockWidgetGroupWindow : public QWidget +{ + Q_OBJECT +public: + explicit QDockWidgetGroupWindow(QWidget* parent = 0, Qt::WindowFlags f = 0) + : QWidget(parent, f) {} + QDockAreaLayoutInfo *layoutInfo() const; + QDockWidget *topDockWidget() const; + void destroyIfEmpty(); + void adjustFlags(); +protected: + bool event(QEvent *) Q_DECL_OVERRIDE; + void paintEvent(QPaintEvent*) Q_DECL_OVERRIDE; +}; +#endif + /* This data structure represents the state of all the tool-bars and dock-widgets. It's value based so it can be easilly copied into a temporary variable. All operations are performed without moving any widgets. Only when we are sure we have the desired state, we call apply(), which moves the @@ -196,10 +213,11 @@ public: QDockWidget *dockwidget, Qt::Orientation orientation); void tabifyDockWidget(QDockWidget *first, QDockWidget *second); - Qt::DockWidgetArea dockWidgetArea(QDockWidget *dockwidget) const; + Qt::DockWidgetArea dockWidgetArea(QWidget* widget) const; void raise(QDockWidget *widget); void setVerticalTabsEnabled(bool enabled); bool restoreDockWidget(QDockWidget *dockwidget); + QDockAreaLayoutInfo *dockInfo(QWidget *w); #ifndef QT_NO_TABBAR bool _documentMode; @@ -224,6 +242,8 @@ public: void setTabShape(QTabWidget::TabShape tabShape); QTabWidget::TabPosition tabPosition(Qt::DockWidgetArea area) const; void setTabPosition(Qt::DockWidgetAreas areas, QTabWidget::TabPosition tabPosition); + + QDockWidgetGroupWindow *createTabbedDockWindow(); #endif // QT_NO_TABWIDGET #endif // QT_NO_TABBAR @@ -273,7 +293,7 @@ public: QList hover(QLayoutItem *widgetItem, const QPoint &mousePos); bool plug(QLayoutItem *widgetItem); - QLayoutItem *unplug(QWidget *widget); + QLayoutItem *unplug(QWidget *widget, bool group = false); void revert(QLayoutItem *widgetItem); void updateGapIndicator(); void paintDropIndicator(QPainter *p, QWidget *widget, const QRegion &clip); -- cgit v1.2.3