mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-11-15 13:15:43 +08:00
FIX: Update Python SIP bindings 3.2.1 & Linux Crash (#126)
* (Python) WIP: attempt to update to 3.2.0 * (Python) MAINT: move demo.py to demo/ to avoid PyQtAds import issue * (Python) STY: remove trailing whitespace * (Python) Missing/incorrect /Transfer/ annotations * (Python) n-elie's fix for setup.py moc generation * (Python) FIX: Q_OS_LINUX is not defined by default with moc * (Python) FIX: split FloatingDockContainer.sip to be platform-specific %If (Platform) blocks around the class definition in FloatingDockContainer.sip did not seem to work. Co-authored-by: K Lauer <klauer@users.noreply.github.com>
This commit is contained in:
parent
dec170ed24
commit
c90fb9413c
16
setup.py
16
setup.py
@ -198,16 +198,28 @@ class build_ext(sipdistutils.build_ext):
|
||||
|
||||
dir_util.mkpath(self.build_temp, dry_run=self.dry_run)
|
||||
|
||||
def get_moc_args(out_file, source):
|
||||
if sys.platform.startswith('linux'):
|
||||
return ["moc", "-D", "Q_OS_LINUX=1", "-o", out_file, source]
|
||||
return ["moc", "-o", out_file, source]
|
||||
|
||||
# Run moc on all header files.
|
||||
for source in cppsources:
|
||||
# *.cpp -> *.moc
|
||||
moc_file = os.path.basename(source).replace(".cpp", ".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.replace(".cpp", ".h")
|
||||
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:
|
||||
call_arg = ["moc", "-o", out_file, header]
|
||||
spawn.spawn(call_arg, dry_run=self.dry_run)
|
||||
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)
|
||||
|
@ -13,14 +13,6 @@ class CDockAreaTabBar : QScrollArea
|
||||
|
||||
protected:
|
||||
virtual void wheelEvent(QWheelEvent* Event);
|
||||
virtual void mousePressEvent(QMouseEvent* ev);
|
||||
virtual void mouseReleaseEvent(QMouseEvent* ev);
|
||||
virtual void mouseMoveEvent(QMouseEvent* ev);
|
||||
virtual void mouseDoubleClickEvent(QMouseEvent *event);
|
||||
void startFloating(const QPoint& Offset);
|
||||
ads::IFloatingWidget* makeAreaFloating(const QPoint& Offset,
|
||||
ads::eDragState DragState);
|
||||
ads::eDragState dragState() const;
|
||||
|
||||
public:
|
||||
CDockAreaTabBar(ads::CDockAreaWidget* parent /TransferThis/);
|
||||
@ -35,6 +27,7 @@ public:
|
||||
bool isTabOpen(int Index) const;
|
||||
virtual QSize minimumSizeHint() const;
|
||||
virtual QSize sizeHint() const;
|
||||
void elidedChanged(bool elided);
|
||||
|
||||
public slots:
|
||||
void setCurrentIndex(int Index);
|
||||
|
@ -11,6 +11,13 @@ class CDockAreaTitleBar : QFrame
|
||||
#include <DockAreaTitleBar.h>
|
||||
%End
|
||||
|
||||
protected:
|
||||
virtual void mousePressEvent(QMouseEvent* ev);
|
||||
virtual void mouseReleaseEvent(QMouseEvent* ev);
|
||||
virtual void mouseMoveEvent(QMouseEvent* ev);
|
||||
virtual void mouseDoubleClickEvent(QMouseEvent *event);
|
||||
virtual void contextMenuEvent(QContextMenuEvent *event);
|
||||
|
||||
public slots:
|
||||
void markTabsMenuOutdated();
|
||||
|
||||
@ -20,7 +27,10 @@ public:
|
||||
virtual ~CDockAreaTitleBar();
|
||||
ads::CDockAreaTabBar* tabBar() const;
|
||||
QAbstractButton* button(ads::TitleBarButton which) const;
|
||||
void updateDockWidgetActionsButtons();
|
||||
virtual void setVisible(bool Visible);
|
||||
void insertWidget(int index, QWidget *widget /Transfer/ );
|
||||
int indexOf(QWidget *widget) const;
|
||||
|
||||
|
||||
signals:
|
||||
|
@ -42,12 +42,16 @@ public:
|
||||
int currentIndex() const;
|
||||
int indexOfFirstOpenDockWidget() const;
|
||||
ads::CDockWidget* currentDockWidget() const;
|
||||
void setCurrentDockWidget(ads::CDockWidget* DockWidget /Transfer/);
|
||||
void setCurrentDockWidget(ads::CDockWidget* DockWidget);
|
||||
void saveState(QXmlStreamWriter& Stream) const;
|
||||
ads::CDockWidget::DockWidgetFeatures features() const;
|
||||
ads::CDockWidget::DockWidgetFeatures features(ads::eBitwiseOperator Mode = ads::BitwiseAnd) const;
|
||||
QAbstractButton* titleBarButton(ads::TitleBarButton which) const;
|
||||
virtual void setVisible(bool Visible);
|
||||
|
||||
void setAllowedAreas(DockWidgetAreas areas);
|
||||
DockWidgetAreas allowedAreas() const;
|
||||
CDockAreaTitleBar* titleBar() const;
|
||||
|
||||
public slots:
|
||||
void setCurrentIndex(int index);
|
||||
void closeArea();
|
||||
|
26
sip/DockComponentsFactory.sip
Normal file
26
sip/DockComponentsFactory.sip
Normal file
@ -0,0 +1,26 @@
|
||||
%If (Qt_5_0_0 -)
|
||||
|
||||
namespace ads
|
||||
{
|
||||
|
||||
class CDockComponentsFactory
|
||||
{
|
||||
|
||||
%TypeHeaderCode
|
||||
#include <DockComponentsFactory.h>
|
||||
%End
|
||||
|
||||
public:
|
||||
virtual ~CDockComponentsFactory();
|
||||
virtual CDockWidgetTab* createDockWidgetTab(CDockWidget* DockWidget /Transfer/ ) const;
|
||||
virtual CDockAreaTabBar* createDockAreaTabBar(CDockAreaWidget* DockArea /Transfer/ ) const;
|
||||
virtual CDockAreaTitleBar* createDockAreaTitleBar(CDockAreaWidget* DockArea /Transfer/ ) const;
|
||||
static const CDockComponentsFactory* factory();
|
||||
static void setFactory(CDockComponentsFactory* Factory);
|
||||
static void resetDefaultFactory();
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
%End
|
@ -25,11 +25,10 @@ protected:
|
||||
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 removeDockArea(ads::CDockAreaWidget* area /TransferBack/);
|
||||
void saveState(QXmlStreamWriter& Stream) const;
|
||||
bool restoreState(CDockingStateReader& Stream, bool Testing);
|
||||
ads::CDockAreaWidget* lastAddedDockAreaWidget(ads::DockWidgetArea area) const;
|
||||
bool hasTopLevelDockWidget() const;
|
||||
ads::CDockWidget* topLevelDockWidget() const;
|
||||
ads::CDockAreaWidget* topLevelDockArea() const;
|
||||
QList<ads::CDockWidget*> dockWidgets() const;
|
||||
@ -88,6 +87,7 @@ public:
|
||||
* If all dock widgets in a dock area are closed, the dock area will be closed
|
||||
*/
|
||||
QList<ads::CDockAreaWidget*> openedDockAreas() const;
|
||||
bool hasTopLevelDockWidget() const;
|
||||
|
||||
/**
|
||||
* Returns the number of dock areas in this container
|
||||
|
@ -156,7 +156,16 @@ public:
|
||||
DragPreviewIsDynamic,
|
||||
DragPreviewShowsContentPixmap,
|
||||
DragPreviewHasWindowFrame,
|
||||
DefaultConfig,
|
||||
AlwaysShowTabs,
|
||||
DockAreaHasUndockButton,
|
||||
DockAreaHasTabsMenuButton,
|
||||
DockAreaHideDisabledButtons,
|
||||
DockAreaDynamicTabsMenuButtonVisibility,
|
||||
FloatingContainerHasWidgetTitle,
|
||||
FloatingContainerHasWidgetIcon,
|
||||
DefaultDockAreaButtons,
|
||||
DefaultBaseConfig,
|
||||
DefaultOpaqueConfig,
|
||||
DefaultNonOpaqueConfig,
|
||||
NonOpaqueWithWindowFrame,
|
||||
};
|
||||
@ -167,6 +176,7 @@ 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 bool testConfigFlag(eConfigFlag Flag);
|
||||
static ads::CIconProvider& iconProvider();
|
||||
ads::CDockAreaWidget* addDockWidget(ads::DockWidgetArea area, ads::CDockWidget* Dockwidget /Transfer/,
|
||||
ads::CDockAreaWidget* DockAreaWidget /Transfer/ = 0);
|
||||
@ -180,7 +190,7 @@ public:
|
||||
QMap<QString, ads::CDockWidget*> dockWidgetsMap() const;
|
||||
const QList<ads::CDockContainerWidget*> dockContainers() const;
|
||||
const QList<ads::CFloatingDockContainer*> floatingWidgets() const;
|
||||
virtual unsigned int zOrderIndex() const;
|
||||
unsigned int zOrderIndex() const;
|
||||
QByteArray saveState(int version = 1) const;
|
||||
bool restoreState(const QByteArray &state, int version = 1);
|
||||
void addPerspective(const QString& UniquePrespectiveName);
|
||||
@ -206,6 +216,7 @@ signals:
|
||||
void stateRestored();
|
||||
void openingPerspective(const QString& PerspectiveName);
|
||||
void perspectiveOpened(const QString& PerspectiveName);
|
||||
void floatingWidgetCreated(CFloatingDockContainer* FloatingWidget);
|
||||
void dockAreaCreated(ads::CDockAreaWidget* DockArea);
|
||||
void dockWidgetAboutToBeRemoved(ads::CDockWidget* DockWidget);
|
||||
void dockWidgetRemoved(ads::CDockWidget* DockWidget);
|
||||
|
@ -12,8 +12,8 @@ class CDockWidget : QFrame
|
||||
%End
|
||||
|
||||
protected:
|
||||
void setDockManager(ads::CDockManager* DockManager /Transfer/);
|
||||
void setDockArea(ads::CDockAreaWidget* DockArea /Transfer/);
|
||||
void setDockManager(ads::CDockManager* DockManager /Transfer/ );
|
||||
void setDockArea(ads::CDockAreaWidget* DockArea /Transfer/ );
|
||||
void setToggleViewActionChecked(bool Checked);
|
||||
void saveState(QXmlStreamWriter& Stream) const;
|
||||
void flagAsUnassigned();
|
||||
@ -21,6 +21,7 @@ protected:
|
||||
void emitTopLevelChanged(bool Floating);
|
||||
void setClosedState(bool Closed);
|
||||
void toggleViewInternal(bool Open);
|
||||
bool closeDockWidgetInternal(bool ForceClose = false);
|
||||
|
||||
public:
|
||||
enum DockWidgetFeature
|
||||
@ -77,7 +78,7 @@ public:
|
||||
QIcon icon() const;
|
||||
QToolBar* toolBar() const;
|
||||
QToolBar* createDefaultToolBar();
|
||||
void setToolBar(QToolBar* ToolBar);
|
||||
void setToolBar(QToolBar* ToolBar /Transfer/ );
|
||||
void setToolBarStyle(Qt::ToolButtonStyle Style, ads::CDockWidget::eState State);
|
||||
Qt::ToolButtonStyle toolBarStyle(ads::CDockWidget::eState State) const;
|
||||
void setToolBarIconSize(const QSize& IconSize, ads::CDockWidget::eState State);
|
||||
|
@ -30,6 +30,7 @@ public:
|
||||
const QIcon& icon() const;
|
||||
QString text() const;
|
||||
void setText(const QString& title);
|
||||
bool isTitleElided() const;
|
||||
bool isClosable() const;
|
||||
virtual bool event(QEvent *e);
|
||||
|
||||
@ -43,6 +44,7 @@ signals:
|
||||
void closeRequested();
|
||||
void closeOtherTabsRequested();
|
||||
void moved(const QPoint& GlobalPos);
|
||||
void elidedChanged(bool elided);
|
||||
}; // class DockWidgetTab
|
||||
};
|
||||
// namespace ads
|
||||
|
@ -22,7 +22,7 @@ public:
|
||||
virtual ~CElidingLabel();
|
||||
Qt::TextElideMode elideMode() const;
|
||||
void setElideMode(Qt::TextElideMode mode);
|
||||
|
||||
bool isElided() const;
|
||||
|
||||
public:
|
||||
virtual QSize minimumSizeHint() const;
|
||||
@ -33,6 +33,7 @@ public:
|
||||
signals:
|
||||
void clicked();
|
||||
void doubleClicked();
|
||||
void elidedChanged(bool elided);
|
||||
};
|
||||
|
||||
};
|
||||
|
@ -1,3 +1,6 @@
|
||||
// NOTE: there is a separate sip/linux/FloatingDockContainer.sip as the base
|
||||
// class for CFloatingDockContainer changes for Linux.
|
||||
|
||||
%Import QtWidgets/QtWidgetsmod.sip
|
||||
|
||||
%If (Qt_5_0_0 -)
|
||||
@ -46,7 +49,6 @@ protected:
|
||||
virtual void closeEvent(QCloseEvent *event);
|
||||
virtual void hideEvent(QHideEvent *event);
|
||||
virtual void showEvent(QShowEvent *event);
|
||||
virtual bool eventFilter(QObject *watched, QEvent *event);
|
||||
|
||||
public:
|
||||
CFloatingDockContainer(ads::CDockManager* DockManager /TransferThis/);
|
||||
|
@ -12,6 +12,10 @@ class CFloatingDragPreview : QWidget, ads::IFloatingWidget
|
||||
#include <FloatingDragPreview.h>
|
||||
%End
|
||||
|
||||
protected:
|
||||
virtual void moveEvent(QMoveEvent *event);
|
||||
virtual void paintEvent(QPaintEvent *e);
|
||||
CFloatingDragPreview(QWidget* Content /TransferThis/, QWidget* parent /TransferThis/);
|
||||
|
||||
public:
|
||||
CFloatingDragPreview(ads::CDockWidget* Content /TransferThis/ );
|
||||
@ -21,6 +25,7 @@ public:
|
||||
|
||||
virtual bool eventFilter(QObject* watched, QEvent* event);
|
||||
|
||||
public: // implements IFloatingWidget
|
||||
virtual void startFloating(const QPoint& DragStartMousePos, const QSize& Size,
|
||||
ads::eDragState DragState, QWidget* MouseEventHandler);
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
%Include DockAreaTabBar.sip
|
||||
%Include DockAreaTitleBar.sip
|
||||
%Include DockAreaWidget.sip
|
||||
%Include DockComponentsFactory.sip
|
||||
%Include DockContainerWidget.sip
|
||||
%Include DockingStateReader.sip
|
||||
%Include DockManager.sip
|
||||
@ -15,9 +16,12 @@
|
||||
%Include DockSplitter.sip
|
||||
%Include DockWidgetTab.sip
|
||||
%Include ElidingLabel.sip
|
||||
%Include FloatingDockContainer.sip
|
||||
%Include FloatingDragPreview.sip
|
||||
%Include IconProvider.sip
|
||||
%If (Linux)
|
||||
%Include linux/FloatingDockContainer.sip
|
||||
%Include linux/FloatingWidgetTitleBar.sip
|
||||
%End
|
||||
%If (!Linux)
|
||||
%Include FloatingDockContainer.sip
|
||||
%End
|
||||
|
@ -49,6 +49,12 @@ namespace ads
|
||||
IconCount,
|
||||
};
|
||||
|
||||
enum eBitwiseOperator
|
||||
{
|
||||
BitwiseAnd,
|
||||
BitwiseOr
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
%End
|
67
sip/linux/FloatingDockContainer.sip
Normal file
67
sip/linux/FloatingDockContainer.sip
Normal file
@ -0,0 +1,67 @@
|
||||
// NOTE: this is the Linux version, with QDockWidget as the
|
||||
// CFloatingDockContainer base class.
|
||||
|
||||
%Import QtWidgets/QtWidgetsmod.sip
|
||||
|
||||
%If (Qt_5_0_0 -)
|
||||
|
||||
namespace ads
|
||||
{
|
||||
|
||||
class IFloatingWidget
|
||||
{
|
||||
%TypeHeaderCode
|
||||
#include <FloatingDockContainer.h>
|
||||
%End
|
||||
|
||||
public:
|
||||
virtual void startFloating(const QPoint& DragStartMousePos, const QSize& Size,
|
||||
ads::eDragState DragState, QWidget* MouseEventHandler) = 0;
|
||||
|
||||
virtual void moveFloating() = 0;
|
||||
virtual void finishDragging() = 0;
|
||||
};
|
||||
|
||||
|
||||
class CFloatingDockContainer : QDockWidget, ads::IFloatingWidget
|
||||
{
|
||||
|
||||
%TypeHeaderCode
|
||||
#include <FloatingDockContainer.h>
|
||||
%End
|
||||
|
||||
protected:
|
||||
virtual void startFloating(const QPoint& DragStartMousePos, const QSize& Size,
|
||||
ads::eDragState DragState, QWidget* MouseEventHandler);
|
||||
void startDragging(const QPoint& DragStartMousePos, const QSize& Size,
|
||||
QWidget* MouseEventHandler);
|
||||
virtual void finishDragging();
|
||||
void initFloatingGeometry(const QPoint& DragStartMousePos, const QSize& Size);
|
||||
void moveFloating();
|
||||
bool restoreState(ads::CDockingStateReader& Stream, bool Testing);
|
||||
void updateWindowTitle();
|
||||
|
||||
|
||||
protected:
|
||||
virtual void changeEvent(QEvent *event);
|
||||
virtual void moveEvent(QMoveEvent *event);
|
||||
virtual bool event(QEvent *e);
|
||||
virtual void closeEvent(QCloseEvent *event);
|
||||
virtual void hideEvent(QHideEvent *event);
|
||||
virtual void showEvent(QShowEvent *event);
|
||||
|
||||
public:
|
||||
CFloatingDockContainer(ads::CDockManager* DockManager /TransferThis/);
|
||||
CFloatingDockContainer(ads::CDockAreaWidget* DockArea /TransferThis/);
|
||||
CFloatingDockContainer(ads::CDockWidget* DockWidget /TransferThis/);
|
||||
virtual ~CFloatingDockContainer();
|
||||
ads::CDockContainerWidget* dockContainer() const;
|
||||
bool isClosable() const;
|
||||
bool hasTopLevelDockWidget() const;
|
||||
ads::CDockWidget* topLevelDockWidget() const;
|
||||
QList<ads::CDockWidget*> dockWidgets() const;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
%End
|
Loading…
Reference in New Issue
Block a user