From 4d2de7bb2afc0c976e04af17d9b78eb723bb8e77 Mon Sep 17 00:00:00 2001 From: Hugo Slepicka Date: Thu, 4 Jun 2020 14:55:02 -0700 Subject: [PATCH] FIX: Update Python bindings for 3.4.2 and current master. (#193) * FIX: Update python bindings for 3.4.2. * FIX: Try to fix windows build. * FIX: Add const at nativeEvent argument. * FIX: Adjusting sip bindings for changes from 8b6df4aaa5c2. --- setup.py | 25 +++++++++++++++++++++++ sip/DockAreaTitleBar_p.sip | 37 +++++++++++++++++++++++++++++++++++ sip/DockAreaWidget.sip | 3 ++- sip/DockManager.sip | 4 ++-- sip/FloatingDockContainer.sip | 5 +++++ sip/FloatingDragPreview.sip | 1 - sip/ads.sip | 1 + sip/ads_globals.sip | 7 ------- 8 files changed, 72 insertions(+), 11 deletions(-) create mode 100644 sip/DockAreaTitleBar_p.sip diff --git a/setup.py b/setup.py index 2e0d0d6..52e5616 100644 --- a/setup.py +++ b/setup.py @@ -214,6 +214,7 @@ class build_ext(sipdistutils.build_ext): # /usr/bin/rcc -name ads ../../Qt-Advanced-Docking-System/src/ads.qrc -o release/qrc_ads.cpp cppsources = [source for source in ext.sources if source.endswith(".cpp")] + headersources = ['src/DockAreaTitleBar_p.h'] dir_util.mkpath(self.build_temp, dry_run=self.dry_run) @@ -247,6 +248,30 @@ class build_ext(sipdistutils.build_ext): if os.path.getsize(out_file) > 0: ext.sources.append(out_file) + # Run moc on all orphan header files. + for source in headersources: + # *.cpp -> *.moc + moc_file = os.path.basename(source).replace(".h", ".moc") + out_file = os.path.join(self.build_temp, moc_file) + + if newer(source, out_file) or self.force: + spawn.spawn(get_moc_args(out_file, source), + dry_run=self.dry_run) + + header = source + if os.path.exists(header): + # *.h -> moc_*.cpp + moc_file = "moc_" + os.path.basename(header).replace( + ".h", ".cpp") + out_file = os.path.join(self.build_temp, moc_file) + + if newer(header, out_file) or self.force: + spawn.spawn(get_moc_args(out_file, header), + dry_run=self.dry_run) + + if os.path.getsize(out_file) > 0: + ext.sources.append(out_file) + # Add the temp build directory to include path, for compiler to find # the created .moc files ext.include_dirs += [self._sip_output_dir()] diff --git a/sip/DockAreaTitleBar_p.sip b/sip/DockAreaTitleBar_p.sip new file mode 100644 index 0000000..0ae3339 --- /dev/null +++ b/sip/DockAreaTitleBar_p.sip @@ -0,0 +1,37 @@ +%Import QtWidgets/QtWidgetsmod.sip + +%If (Qt_5_0_0 -) + +namespace ads +{ + +class CTitleBarButton : QToolButton +{ + %TypeHeaderCode + #include + %End + +protected: + bool event(QEvent *ev); + +public: + CTitleBarButton(bool visible = true, QWidget* parent /TransferThis/ = Q_NULLPTR ); + virtual void setVisible(bool visible); +}; + + +class CSpacerWidget : QWidget +{ + %TypeHeaderCode + #include + %End + +public: + CSpacerWidget(QWidget* Parent /TransferThis/ = 0 ); + virtual QSize sizeHint() const; + virtual QSize minimumSizeHint() const; +}; + +}; + +%End diff --git a/sip/DockAreaWidget.sip b/sip/DockAreaWidget.sip index e105f69..dbe1c7e 100644 --- a/sip/DockAreaWidget.sip +++ b/sip/DockAreaWidget.sip @@ -4,7 +4,7 @@ namespace ads { - + class CDockAreaWidget : QFrame { @@ -32,6 +32,7 @@ public: virtual ~CDockAreaWidget(); ads::CDockManager* dockManager() const; ads::CDockContainerWidget* dockContainer() const; + virtual QSize minimumSizeHint() const; QRect titleBarGeometry() const; QRect contentAreaGeometry() const; int dockWidgetsCount() const; diff --git a/sip/DockManager.sip b/sip/DockManager.sip index 7a6d5e7..dcb9cbf 100644 --- a/sip/DockManager.sip +++ b/sip/DockManager.sip @@ -194,8 +194,8 @@ public: const QList dockContainers() const; const QList floatingWidgets() const; unsigned int zOrderIndex() const; - QByteArray saveState(int version = 1) const; - bool restoreState(const QByteArray &state, int version = 1); + QByteArray saveState(int version = 0) const; + bool restoreState(const QByteArray &state, int version = 0); void addPerspective(const QString& UniquePrespectiveName); void removePerspective(const QString& Name); void removePerspectives(const QStringList& Names); diff --git a/sip/FloatingDockContainer.sip b/sip/FloatingDockContainer.sip index 38c4ab6..4e80db5 100644 --- a/sip/FloatingDockContainer.sip +++ b/sip/FloatingDockContainer.sip @@ -27,6 +27,7 @@ public: virtual void moveFloating() = 0; virtual void finishDragging() = 0; + virtual ~IFloatingWidget(); }; @@ -56,6 +57,10 @@ protected: virtual void closeEvent(QCloseEvent *event); virtual void hideEvent(QHideEvent *event); virtual void showEvent(QShowEvent *event); + %If (WS_WIN) + virtual bool nativeEvent(const QByteArray &eventType, void *message, long *result); + %End + public: CFloatingDockContainer(ads::CDockManager* DockManager /TransferThis/); diff --git a/sip/FloatingDragPreview.sip b/sip/FloatingDragPreview.sip index 659af35..9a76e0b 100644 --- a/sip/FloatingDragPreview.sip +++ b/sip/FloatingDragPreview.sip @@ -13,7 +13,6 @@ class CFloatingDragPreview : QWidget, ads::IFloatingWidget %End protected: - virtual void moveEvent(QMoveEvent *event); virtual void paintEvent(QPaintEvent *e); CFloatingDragPreview(QWidget* Content /TransferThis/, QWidget* parent /TransferThis/); diff --git a/sip/ads.sip b/sip/ads.sip index fe92502..8da5d64 100644 --- a/sip/ads.sip +++ b/sip/ads.sip @@ -5,6 +5,7 @@ %Include ads_globals.sip %Include DockWidget.sip %Include DockAreaTabBar.sip +%Include DockAreaTitleBar_p.sip %Include DockAreaTitleBar.sip %Include DockAreaWidget.sip %Include DockComponentsFactory.sip diff --git a/sip/ads_globals.sip b/sip/ads_globals.sip index ea78457..ead6b0e 100644 --- a/sip/ads_globals.sip +++ b/sip/ads_globals.sip @@ -8,13 +8,6 @@ namespace ads #include %End - enum eStateFileVersion - { - InitialVersion, - Version1, - CurrentVersion - }; - enum DockWidgetArea { NoDockWidgetArea,