From 5778dfe929741d7136f964a06dd54f5a138cbc83 Mon Sep 17 00:00:00 2001 From: Hugo Slepicka Date: Wed, 18 Dec 2019 14:21:34 -0800 Subject: [PATCH 1/2] WIP: Changes between 2.5.2 and 2.7.0. --- setup.py | 4 ++-- sip/DockAreaTabBar.sip | 2 +- sip/DockContainerWidget.sip | 3 ++- sip/DockManager.sip | 15 ++++++++++++--- sip/DockWidget.sip | 1 + sip/DockingStateReader.sip | 21 +++++++++++++++++++++ sip/FloatingDockContainer.sip | 18 ++++++++++++++++-- sip/FloatingOverlay.sip | 30 ++++++++++++++++++++++++++++++ sip/IconProvider.sip | 28 ++++++++++++++++++++++++++++ sip/ads.sip | 3 +++ sip/ads_globals.sip | 10 ++++++++++ 11 files changed, 126 insertions(+), 9 deletions(-) create mode 100644 sip/DockingStateReader.sip create mode 100644 sip/FloatingOverlay.sip create mode 100644 sip/IconProvider.sip diff --git a/setup.py b/setup.py index 1918272..695fef9 100644 --- a/setup.py +++ b/setup.py @@ -14,8 +14,8 @@ from PyQt5.QtCore import PYQT_CONFIGURATION from PyQt5.pyrcc_main import processResourceFile MAJOR = 2 -MINOR = 5 -MICRO = 1 +MINOR = 7 +MICRO = 0 ISRELEASED = True VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO) MODULE_NAME = "ads" diff --git a/sip/DockAreaTabBar.sip b/sip/DockAreaTabBar.sip index 09de7e1..a069f66 100644 --- a/sip/DockAreaTabBar.sip +++ b/sip/DockAreaTabBar.sip @@ -18,7 +18,7 @@ protected: virtual void mouseMoveEvent(QMouseEvent* ev); virtual void mouseDoubleClickEvent(QMouseEvent *event); void startFloating(const QPoint& Offset); - ads::CFloatingDockContainer* makeAreaFloating(const QPoint& Offset, + ads::IFloatingWidget* makeAreaFloating(const QPoint& Offset, ads::eDragState DragState); public: diff --git a/sip/DockContainerWidget.sip b/sip/DockContainerWidget.sip index e6ec964..b226453 100644 --- a/sip/DockContainerWidget.sip +++ b/sip/DockContainerWidget.sip @@ -23,10 +23,11 @@ protected: QSplitter* rootSplitter() const; void createRootSplitter(); void dropFloatingWidget(ads::CFloatingDockContainer* FloatingWidget, const QPoint& TargetPos); + void dropWidget(QWidget* widget, const QPoint& TargetPos); void addDockArea(ads::CDockAreaWidget* DockAreaWidget /Transfer/, ads::DockWidgetArea area = ads::CenterDockWidgetArea); void removeDockArea(ads::CDockAreaWidget* area /Transfer/); void saveState(QXmlStreamWriter& Stream) const; - bool restoreState(QXmlStreamReader& Stream, bool Testing); + bool restoreState(CDockingStateReader& Stream, bool Testing); ads::CDockAreaWidget* lastAddedDockAreaWidget(ads::DockWidgetArea area) const; bool hasTopLevelDockWidget() const; ads::CDockWidget* topLevelDockWidget() const; diff --git a/sip/DockManager.sip b/sip/DockManager.sip index 2ce20ca..ab2a03c 100644 --- a/sip/DockManager.sip +++ b/sip/DockManager.sip @@ -152,7 +152,13 @@ public: TabCloseButtonIsToolButton, AllTabsHaveCloseButton, RetainTabSizeWhenCloseButtonHidden, + OpaqueUndocking, + DragPreviewIsDynamic, + DragPreviewShowsContentPixmap, + DragPreviewHasWindowFrame, DefaultConfig, + DefaultNonOpaqueConfig, + NonOpaqueWithWindowFrame, }; typedef QFlags ConfigFlags; @@ -161,20 +167,22 @@ public: static ads::CDockManager::ConfigFlags configFlags(); static void setConfigFlags(const ads::CDockManager::ConfigFlags Flags); static void setConfigFlag(ads::CDockManager::eConfigFlag Flag, bool On = true); + static ads::CIconProvider& iconProvider(); ads::CDockAreaWidget* addDockWidget(ads::DockWidgetArea area, ads::CDockWidget* Dockwidget /Transfer/, ads::CDockAreaWidget* DockAreaWidget /Transfer/ = 0); ads::CDockAreaWidget* addDockWidgetTab(ads::DockWidgetArea area, ads::CDockWidget* Dockwidget /Transfer/); ads::CDockAreaWidget* addDockWidgetTabToArea(ads::CDockWidget* Dockwidget /Transfer/, ads::CDockAreaWidget* DockAreaWidget /Transfer/); + ads::CFloatingDockContainer* addDockWidgetFloating(ads::CDockWidget* DockWidget /Transfer/); ads::CDockWidget* findDockWidget(const QString& ObjectName) const; void removeDockWidget(ads::CDockWidget* Dockwidget) /TransferBack/; QMap dockWidgetsMap() const; const QList dockContainers() const; const QList floatingWidgets() const; virtual unsigned int zOrderIndex() const; - QByteArray saveState(int version = 0) const; - bool restoreState(const QByteArray &state, int version = 0); + QByteArray saveState(int version = 1) const; + bool restoreState(const QByteArray &state, int version = 1); void addPerspective(const QString& UniquePrespectiveName); void removePerspective(const QString& Name); void removePerspectives(const QStringList& Names); @@ -198,8 +206,9 @@ signals: void stateRestored(); void openingPerspective(const QString& PerspectiveName); void perspectiveOpened(const QString& PerspectiveName); + void dockAreaCreated(ads::CDockAreaWidget* DockArea); }; }; -%End \ No newline at end of file +%End diff --git a/sip/DockWidget.sip b/sip/DockWidget.sip index 9dfb78e..e2f6d34 100644 --- a/sip/DockWidget.sip +++ b/sip/DockWidget.sip @@ -88,6 +88,7 @@ public: public slots: void toggleView(bool Open = true); + void setFloating(); signals: void viewToggled(bool Open); diff --git a/sip/DockingStateReader.sip b/sip/DockingStateReader.sip new file mode 100644 index 0000000..e235efb --- /dev/null +++ b/sip/DockingStateReader.sip @@ -0,0 +1,21 @@ +%If (Qt_5_0_0 -) + +namespace ads +{ + +class CDockingStateReader : QXmlStreamReader +{ + + %TypeHeaderCode + #include + %End + + +public: + void setFileVersion(int FileVersion); + int fileVersion() const; +}; + +}; + +%End \ No newline at end of file diff --git a/sip/FloatingDockContainer.sip b/sip/FloatingDockContainer.sip index ba30e6f..6f73b76 100644 --- a/sip/FloatingDockContainer.sip +++ b/sip/FloatingDockContainer.sip @@ -5,7 +5,21 @@ namespace ads { -class CFloatingDockContainer : QWidget +class IFloatingWidget +{ + %TypeHeaderCode + #include + %End + +public: + virtual void startFloating(const QPoint& DragStartMousePos, const QSize& Size, + ads::eDragState DragState, QWidget* MouseEventHandler) = 0; + + virtual void moveFloating() = 0; +}; + + +class CFloatingDockContainer : QWidget, ads::IFloatingWidget { %TypeHeaderCode @@ -20,7 +34,7 @@ protected: void finishDragging(); void initFloatingGeometry(const QPoint& DragStartMousePos, const QSize& Size); void moveFloating(); - bool restoreState(QXmlStreamReader& Stream, bool Testing); + bool restoreState(ads::CDockingStateReader& Stream, bool Testing); void updateWindowTitle(); diff --git a/sip/FloatingOverlay.sip b/sip/FloatingOverlay.sip new file mode 100644 index 0000000..9aa799c --- /dev/null +++ b/sip/FloatingOverlay.sip @@ -0,0 +1,30 @@ +%Import QtWidgets/QtWidgetsmod.sip + +%If (Qt_5_0_0 -) + +namespace ads +{ + +class CFloatingOverlay : QWidget, ads::IFloatingWidget +{ + + %TypeHeaderCode + #include + %End + + +public: + CFloatingOverlay(ads::CDockWidget* Content /TransferThis/ ); + CFloatingOverlay(ads::CDockAreaWidget* Content /TransferThis/ ); + + virtual ~CFloatingOverlay(); + + virtual void startFloating(const QPoint& DragStartMousePos, const QSize& Size, + ads::eDragState DragState, QWidget* MouseEventHandler); + + virtual void moveFloating(); +}; + +}; + +%End \ No newline at end of file diff --git a/sip/IconProvider.sip b/sip/IconProvider.sip new file mode 100644 index 0000000..e271651 --- /dev/null +++ b/sip/IconProvider.sip @@ -0,0 +1,28 @@ +%Import QtWidgets/QtWidgetsmod.sip + +%If (Qt_5_0_0 -) + +namespace ads +{ + +class CIconProvider +{ + + %TypeHeaderCode + #include + %End + + +public: + CIconProvider(); + + virtual ~CIconProvider(); + + QIcon customIcon(eIcon IconId); + + void registerCustomIcon(eIcon IconId, const QIcon& icon /TransferThis/ ); +}; + +}; + +%End \ No newline at end of file diff --git a/sip/ads.sip b/sip/ads.sip index 8f71957..31b8aa2 100644 --- a/sip/ads.sip +++ b/sip/ads.sip @@ -9,12 +9,15 @@ %Include DockAreaTitleBar.sip %Include DockAreaWidget.sip %Include DockContainerWidget.sip +%Include DockingStateReader.sip %Include DockManager.sip %Include DockOverlay.sip %Include DockSplitter.sip %Include DockWidgetTab.sip %Include ElidingLabel.sip %Include FloatingDockContainer.sip +%Include FloatingOverlay.sip +%Include IconProvider.sip %If (Linux) %Include linux/FloatingWidgetTitleBar.sip %End \ No newline at end of file diff --git a/sip/ads_globals.sip b/sip/ads_globals.sip index b9451d5..a60f5ec 100644 --- a/sip/ads_globals.sip +++ b/sip/ads_globals.sip @@ -39,6 +39,16 @@ namespace ads DraggingFloatingWidget }; + enum eIcon + { + TabCloseIcon, + DockAreaMenuIcon, + DockAreaUndockIcon, + DockAreaCloseIcon, + + IconCount, + }; + }; %End \ No newline at end of file From f9927cef2963269926ba76edc9ef434001eb0c6f Mon Sep 17 00:00:00 2001 From: Hugo Slepicka Date: Wed, 18 Dec 2019 15:17:28 -0800 Subject: [PATCH 2/2] FIX: SIP Binding changes to reflect changes from 2.7.0 to master. --- sip/DockAreaTabBar.sip | 3 ++- sip/DockManager.sip | 2 ++ sip/DockWidget.sip | 2 ++ sip/FloatingDockContainer.sip | 5 +++-- sip/FloatingDragPreview.sip | 38 +++++++++++++++++++++++++++++++++++ sip/FloatingOverlay.sip | 30 --------------------------- sip/ads.sip | 2 +- 7 files changed, 48 insertions(+), 34 deletions(-) create mode 100644 sip/FloatingDragPreview.sip delete mode 100644 sip/FloatingOverlay.sip diff --git a/sip/DockAreaTabBar.sip b/sip/DockAreaTabBar.sip index a069f66..2e648cb 100644 --- a/sip/DockAreaTabBar.sip +++ b/sip/DockAreaTabBar.sip @@ -20,7 +20,8 @@ protected: void startFloating(const QPoint& Offset); ads::IFloatingWidget* makeAreaFloating(const QPoint& Offset, ads::eDragState DragState); - + ads::eDragState dragState() const; + public: CDockAreaTabBar(ads::CDockAreaWidget* parent /TransferThis/); virtual ~CDockAreaTabBar(); diff --git a/sip/DockManager.sip b/sip/DockManager.sip index ab2a03c..968cb6d 100644 --- a/sip/DockManager.sip +++ b/sip/DockManager.sip @@ -207,6 +207,8 @@ signals: void openingPerspective(const QString& PerspectiveName); void perspectiveOpened(const QString& PerspectiveName); void dockAreaCreated(ads::CDockAreaWidget* DockArea); + void dockWidgetAboutToBeRemoved(ads::CDockWidget* DockWidget); + void dockWidgetRemoved(ads::CDockWidget* DockWidget); }; }; diff --git a/sip/DockWidget.sip b/sip/DockWidget.sip index e2f6d34..f12f25c 100644 --- a/sip/DockWidget.sip +++ b/sip/DockWidget.sip @@ -28,6 +28,7 @@ public: DockWidgetClosable, DockWidgetMovable, DockWidgetFloatable, + DockWidgetDeleteOnClose, AllDockWidgetFeatures, NoDockWidgetFeatures }; @@ -89,6 +90,7 @@ public: public slots: void toggleView(bool Open = true); void setFloating(); + void deleteDockWidget(); signals: void viewToggled(bool Open); diff --git a/sip/FloatingDockContainer.sip b/sip/FloatingDockContainer.sip index 6f73b76..9b40e97 100644 --- a/sip/FloatingDockContainer.sip +++ b/sip/FloatingDockContainer.sip @@ -16,6 +16,7 @@ public: ads::eDragState DragState, QWidget* MouseEventHandler) = 0; virtual void moveFloating() = 0; + virtual void finishDragging() = 0; }; @@ -27,11 +28,11 @@ class CFloatingDockContainer : QWidget, ads::IFloatingWidget %End protected: - void startFloating(const QPoint& DragStartMousePos, const QSize& Size, + virtual void startFloating(const QPoint& DragStartMousePos, const QSize& Size, ads::eDragState DragState, QWidget* MouseEventHandler); void startDragging(const QPoint& DragStartMousePos, const QSize& Size, QWidget* MouseEventHandler); - void finishDragging(); + virtual void finishDragging(); void initFloatingGeometry(const QPoint& DragStartMousePos, const QSize& Size); void moveFloating(); bool restoreState(ads::CDockingStateReader& Stream, bool Testing); diff --git a/sip/FloatingDragPreview.sip b/sip/FloatingDragPreview.sip new file mode 100644 index 0000000..992ead8 --- /dev/null +++ b/sip/FloatingDragPreview.sip @@ -0,0 +1,38 @@ +%Import QtWidgets/QtWidgetsmod.sip + +%If (Qt_5_0_0 -) + +namespace ads +{ + +class CFloatingDragPreview : QWidget, ads::IFloatingWidget +{ + + %TypeHeaderCode + #include + %End + + +public: + CFloatingDragPreview(ads::CDockWidget* Content /TransferThis/ ); + CFloatingDragPreview(ads::CDockAreaWidget* Content /TransferThis/ ); + + virtual ~CFloatingDragPreview(); + + virtual bool eventFilter(QObject* watched, QEvent* event); + + virtual void startFloating(const QPoint& DragStartMousePos, const QSize& Size, + ads::eDragState DragState, QWidget* MouseEventHandler); + + virtual void moveFloating(); + + virtual void finishDragging(); + +signals: + void draggingCanceled(); + +}; + +}; + +%End \ No newline at end of file diff --git a/sip/FloatingOverlay.sip b/sip/FloatingOverlay.sip deleted file mode 100644 index 9aa799c..0000000 --- a/sip/FloatingOverlay.sip +++ /dev/null @@ -1,30 +0,0 @@ -%Import QtWidgets/QtWidgetsmod.sip - -%If (Qt_5_0_0 -) - -namespace ads -{ - -class CFloatingOverlay : QWidget, ads::IFloatingWidget -{ - - %TypeHeaderCode - #include - %End - - -public: - CFloatingOverlay(ads::CDockWidget* Content /TransferThis/ ); - CFloatingOverlay(ads::CDockAreaWidget* Content /TransferThis/ ); - - virtual ~CFloatingOverlay(); - - virtual void startFloating(const QPoint& DragStartMousePos, const QSize& Size, - ads::eDragState DragState, QWidget* MouseEventHandler); - - virtual void moveFloating(); -}; - -}; - -%End \ No newline at end of file diff --git a/sip/ads.sip b/sip/ads.sip index 31b8aa2..6e07ef8 100644 --- a/sip/ads.sip +++ b/sip/ads.sip @@ -16,7 +16,7 @@ %Include DockWidgetTab.sip %Include ElidingLabel.sip %Include FloatingDockContainer.sip -%Include FloatingOverlay.sip +%Include FloatingDragPreview.sip %Include IconProvider.sip %If (Linux) %Include linux/FloatingWidgetTitleBar.sip