diff options
Diffstat (limited to 'src/widgets/widgets/qmainwindowlayout_p.h')
-rw-r--r-- | src/widgets/widgets/qmainwindowlayout_p.h | 47 |
1 files changed, 39 insertions, 8 deletions
diff --git a/src/widgets/widgets/qmainwindowlayout_p.h b/src/widgets/widgets/qmainwindowlayout_p.h index 9196e8b269..55a27e4849 100644 --- a/src/widgets/widgets/qmainwindowlayout_p.h +++ b/src/widgets/widgets/qmainwindowlayout_p.h @@ -1,8 +1,8 @@ // Copyright (C) 2016 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only -#ifndef QDYNAMICMAINWINDOWLAYOUT_P_H -#define QDYNAMICMAINWINDOWLAYOUT_P_H +#ifndef QMAINWINDOWLAYOUT_P_H +#define QMAINWINDOWLAYOUT_P_H // // W A R N I N G @@ -29,21 +29,30 @@ #include "QtCore/qset.h" #include "private/qlayoutengine_p.h" #include "private/qwidgetanimator_p.h" - #if QT_CONFIG(dockwidget) +#include "private/qdockwidget_p.h" + #include "qdockarealayout_p.h" #include "qdockwidget.h" +#else +struct QDockWidgetPrivate { + enum class DragScope { + Group + }; +}; #endif #if QT_CONFIG(toolbar) #include "qtoolbararealayout_p.h" #endif + #include <QtCore/qloggingcategory.h> +#include <QtCore/qpointer.h> QT_REQUIRE_CONFIG(mainwindow); QT_BEGIN_NAMESPACE -Q_DECLARE_EXPORTED_LOGGING_CATEGORY(lcQpaDockWidgets, Q_WIDGETS_EXPORT); +Q_DECLARE_LOGGING_CATEGORY(lcQpaDockWidgets); class QToolBar; class QRubberBand; @@ -306,14 +315,17 @@ class Q_AUTOTEST_EXPORT QDockWidgetGroupWindow : public QWidget { Q_OBJECT public: - explicit QDockWidgetGroupWindow(QWidget* parent = nullptr, Qt::WindowFlags f = { }) - : QWidget(parent, f) {} + explicit QDockWidgetGroupWindow(QWidget *parent = nullptr, Qt::WindowFlags f = {}) + : QWidget(parent, f) + { + } QDockAreaLayoutInfo *layoutInfo() const; #if QT_CONFIG(tabbar) const QDockAreaLayoutInfo *tabLayoutInfo() const; QDockWidget *activeTabbedDockWidget() const; #endif void destroyOrHideIfEmpty(); + bool hasVisibleDockWidgets() const; void adjustFlags(); bool hasNativeDecos() const; @@ -321,6 +333,10 @@ public: void updateCurrentGapRect(); void restore(); void apply(); + void childEvent(QChildEvent *event) override; + void reparent(QDockWidget *dockWidget); + void destroyIfSingleItemLeft(); + QList<QDockWidget *> dockWidgets() const { return findChildren<QDockWidget *>(); } QRect currentGapRect; QList<int> currentGapPos; @@ -330,6 +346,7 @@ signals: protected: bool event(QEvent *) override; + bool eventFilter(QObject *obj, QEvent *event) override; void paintEvent(QPaintEvent*) override; private: @@ -433,6 +450,7 @@ public: bool restoreState(QDataStream &stream, const QMainWindowLayoutState &oldState); }; +class QMainWindowTabBar; class Q_AUTOTEST_EXPORT QMainWindowLayout : public QLayout, public QMainWindowLayoutSeparatorHelper<QMainWindowLayout> @@ -560,17 +578,29 @@ public: #if QT_CONFIG(dockwidget) QPointer<QDockWidgetGroupWindow> currentHoveredFloat; // set when dragging over a floating dock widget void setCurrentHoveredFloat(QDockWidgetGroupWindow *w); +#if QT_CONFIG(tabbar) + bool isDockWidgetTabbed(const QDockWidget *dockWidget) const; + QList<QDockWidget *> tabifiedDockWidgets(const QDockWidget *dockWidget) const; + QMainWindowTabBar *findTabBar(const QDockWidget *dockWidget) const; +#endif #endif bool isInApplyState = false; void hover(QLayoutItem *hoverTarget, const QPoint &mousePos); bool plug(QLayoutItem *widgetItem); - QLayoutItem *unplug(QWidget *widget, bool group = false); + QLayoutItem *unplug(QWidget *widget, QDockWidgetPrivate::DragScope scope); void revert(QLayoutItem *widgetItem); void applyState(QMainWindowLayoutState &newState, bool animate = true); + void applyRestoredState(); void restore(bool keepSavedState = false); void animationFinished(QWidget *widget); +#if QT_CONFIG(draganddrop) + static bool needsPlatformDrag(); + Qt::DropAction performPlatformWidgetDrag(QLayoutItem *widgetItem, const QPoint &pressPosition); + QLayoutItem *draggingWidget = nullptr; +#endif + protected: void timerEvent(QTimerEvent *e) override; @@ -586,6 +616,7 @@ private: #if QT_CONFIG(tabbar) void updateTabBarShapes(); #endif + bool isInRestoreState = false; }; #if QT_CONFIG(dockwidget) && !defined(QT_NO_DEBUG_STREAM) @@ -596,4 +627,4 @@ QDebug operator<<(QDebug debug, const QMainWindowLayout *layout); QT_END_NAMESPACE -#endif // QDYNAMICMAINWINDOWLAYOUT_P_H +#endif // QMAINWINDOWLAYOUT_P_H |