mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2025-04-19 03:44:45 +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
66
setup.py
66
setup.py
@ -18,7 +18,7 @@ from PyQt5.pyrcc_main import processResourceFile
|
|||||||
|
|
||||||
MODULE_NAME = "ads"
|
MODULE_NAME = "ads"
|
||||||
SRC_PATH = "PyQtAds"
|
SRC_PATH = "PyQtAds"
|
||||||
|
|
||||||
REQUIRE_PYQT = True
|
REQUIRE_PYQT = True
|
||||||
if "--conda-recipe" in sys.argv:
|
if "--conda-recipe" in sys.argv:
|
||||||
REQUIRE_PYQT = False
|
REQUIRE_PYQT = False
|
||||||
@ -40,7 +40,7 @@ class HostPythonConfiguration(object):
|
|||||||
else:
|
else:
|
||||||
self.data_dir = sys.prefix + '/share'
|
self.data_dir = sys.prefix + '/share'
|
||||||
self.lib_dir = sys.prefix + '/lib'
|
self.lib_dir = sys.prefix + '/lib'
|
||||||
|
|
||||||
|
|
||||||
class TargetQtConfiguration(object):
|
class TargetQtConfiguration(object):
|
||||||
def __init__(self, qmake):
|
def __init__(self, qmake):
|
||||||
@ -63,12 +63,12 @@ class TargetQtConfiguration(object):
|
|||||||
setattr(self, name, value)
|
setattr(self, name, value)
|
||||||
|
|
||||||
pipe.close()
|
pipe.close()
|
||||||
|
|
||||||
|
|
||||||
class build_ext(sipdistutils.build_ext):
|
class build_ext(sipdistutils.build_ext):
|
||||||
|
|
||||||
description = "Builds the " + MODULE_NAME + " module."
|
description = "Builds the " + MODULE_NAME + " module."
|
||||||
|
|
||||||
user_options = sipdistutils.build_ext.user_options + [
|
user_options = sipdistutils.build_ext.user_options + [
|
||||||
('qmake-bin=', None, "Path to qmake binary"),
|
('qmake-bin=', None, "Path to qmake binary"),
|
||||||
('sip-bin=', None, "Path to sip binary"),
|
('sip-bin=', None, "Path to sip binary"),
|
||||||
@ -78,7 +78,7 @@ class build_ext(sipdistutils.build_ext):
|
|||||||
('sip-dir=', None, "Path to module's SIP files"),
|
('sip-dir=', None, "Path to module's SIP files"),
|
||||||
('inc-dir=', None, "Path to module's include files")
|
('inc-dir=', None, "Path to module's include files")
|
||||||
]
|
]
|
||||||
|
|
||||||
def initialize_options (self):
|
def initialize_options (self):
|
||||||
super().initialize_options()
|
super().initialize_options()
|
||||||
self.qmake_bin = 'qmake'
|
self.qmake_bin = 'qmake'
|
||||||
@ -92,16 +92,16 @@ class build_ext(sipdistutils.build_ext):
|
|||||||
self.inc_dir = None
|
self.inc_dir = None
|
||||||
self.pyconfig = HostPythonConfiguration()
|
self.pyconfig = HostPythonConfiguration()
|
||||||
self.qtconfig = TargetQtConfiguration(self.qmake_bin)
|
self.qtconfig = TargetQtConfiguration(self.qmake_bin)
|
||||||
self.config = sipconfig.Configuration()
|
self.config = sipconfig.Configuration()
|
||||||
self.config.default_mod_dir = ("/usr/local/lib/python%i.%i/dist-packages" %
|
self.config.default_mod_dir = ("/usr/local/lib/python%i.%i/dist-packages" %
|
||||||
(sys.version_info.major, sys.version_info.minor))
|
(sys.version_info.major, sys.version_info.minor))
|
||||||
|
|
||||||
def finalize_options (self):
|
def finalize_options (self):
|
||||||
super().finalize_options()
|
super().finalize_options()
|
||||||
|
|
||||||
if not self.qt_include_dir:
|
if not self.qt_include_dir:
|
||||||
self.qt_include_dir = self.qtconfig.QT_INSTALL_HEADERS
|
self.qt_include_dir = self.qtconfig.QT_INSTALL_HEADERS
|
||||||
|
|
||||||
if not self.qt_libinfix:
|
if not self.qt_libinfix:
|
||||||
try:
|
try:
|
||||||
with open(os.path.join(self.qtconfig.QT_INSTALL_PREFIX, 'mkspecs', 'qconfig.pri'), 'r') as f:
|
with open(os.path.join(self.qtconfig.QT_INSTALL_PREFIX, 'mkspecs', 'qconfig.pri'), 'r') as f:
|
||||||
@ -113,16 +113,16 @@ class build_ext(sipdistutils.build_ext):
|
|||||||
|
|
||||||
if not self.pyqt_sip_dir:
|
if not self.pyqt_sip_dir:
|
||||||
self.pyqt_sip_dir = os.path.join(self.pyconfig.data_dir, 'sip', 'PyQt5')
|
self.pyqt_sip_dir = os.path.join(self.pyconfig.data_dir, 'sip', 'PyQt5')
|
||||||
|
|
||||||
if not self.pyqt_sip_flags:
|
if not self.pyqt_sip_flags:
|
||||||
self.pyqt_sip_flags = PYQT_CONFIGURATION.get('sip_flags', '')
|
self.pyqt_sip_flags = PYQT_CONFIGURATION.get('sip_flags', '')
|
||||||
|
|
||||||
if not self.sip_files_dir:
|
if not self.sip_files_dir:
|
||||||
self.sip_files_dir = os.path.abspath(os.path.join(".", "sip"))
|
self.sip_files_dir = os.path.abspath(os.path.join(".", "sip"))
|
||||||
|
|
||||||
if not self.sip_inc_dir:
|
if not self.sip_inc_dir:
|
||||||
self.sip_inc_dir = self.pyconfig.venv_inc_dir
|
self.sip_inc_dir = self.pyconfig.venv_inc_dir
|
||||||
|
|
||||||
if not self.inc_dir:
|
if not self.inc_dir:
|
||||||
self.inc_dir = os.path.abspath(os.path.join(".", "src"))
|
self.inc_dir = os.path.abspath(os.path.join(".", "src"))
|
||||||
|
|
||||||
@ -138,12 +138,12 @@ class build_ext(sipdistutils.build_ext):
|
|||||||
if not self.pyqt_sip_flags:
|
if not self.pyqt_sip_flags:
|
||||||
raise SystemExit('Could not find PyQt SIP flags. '
|
raise SystemExit('Could not find PyQt SIP flags. '
|
||||||
'Please specify via --pyqt-sip-flags=')
|
'Please specify via --pyqt-sip-flags=')
|
||||||
|
|
||||||
def _find_sip(self):
|
def _find_sip(self):
|
||||||
"""override _find_sip to allow for manually speficied sip path."""
|
"""override _find_sip to allow for manually speficied sip path."""
|
||||||
return self.sip_bin or super()._find_sip()
|
return self.sip_bin or super()._find_sip()
|
||||||
|
|
||||||
def _sip_compile(self, sip_bin, source, sbf):
|
def _sip_compile(self, sip_bin, source, sbf):
|
||||||
cmd = [sip_bin]
|
cmd = [sip_bin]
|
||||||
if hasattr(self, 'sip_opts'):
|
if hasattr(self, 'sip_opts'):
|
||||||
cmd += self.sip_opts
|
cmd += self.sip_opts
|
||||||
@ -157,11 +157,11 @@ class build_ext(sipdistutils.build_ext):
|
|||||||
"-c", self._sip_output_dir(),
|
"-c", self._sip_output_dir(),
|
||||||
"-b", sbf,
|
"-b", sbf,
|
||||||
"-w", "-o"]
|
"-w", "-o"]
|
||||||
|
|
||||||
cmd += shlex.split(self.pyqt_sip_flags) # use same SIP flags as for PyQt5
|
cmd += shlex.split(self.pyqt_sip_flags) # use same SIP flags as for PyQt5
|
||||||
cmd.append(source)
|
cmd.append(source)
|
||||||
self.spawn(cmd)
|
self.spawn(cmd)
|
||||||
|
|
||||||
def swig_sources (self, sources, extension=None):
|
def swig_sources (self, sources, extension=None):
|
||||||
if not self.extensions:
|
if not self.extensions:
|
||||||
return
|
return
|
||||||
@ -179,7 +179,7 @@ class build_ext(sipdistutils.build_ext):
|
|||||||
extension.libraries += ['Qt5Core' + self.qt_libinfix,
|
extension.libraries += ['Qt5Core' + self.qt_libinfix,
|
||||||
'Qt5Gui' + self.qt_libinfix,
|
'Qt5Gui' + self.qt_libinfix,
|
||||||
'Qt5Widgets' + self.qt_libinfix]
|
'Qt5Widgets' + self.qt_libinfix]
|
||||||
|
|
||||||
if sys.platform == 'win32':
|
if sys.platform == 'win32':
|
||||||
extension.library_dirs += [self.qtconfig.QT_INSTALL_LIBS,
|
extension.library_dirs += [self.qtconfig.QT_INSTALL_LIBS,
|
||||||
self.inc_dir, self._sip_output_dir()]
|
self.inc_dir, self._sip_output_dir()]
|
||||||
@ -192,30 +192,42 @@ class build_ext(sipdistutils.build_ext):
|
|||||||
extension.extra_compile_args += ['-std=c++11']
|
extension.extra_compile_args += ['-std=c++11']
|
||||||
|
|
||||||
return super().swig_sources(sources, extension)
|
return super().swig_sources(sources, extension)
|
||||||
|
|
||||||
def build_extension(self, ext):
|
def build_extension(self, ext):
|
||||||
cppsources = [source for source in ext.sources if source.endswith(".cpp")]
|
cppsources = [source for source in ext.sources if source.endswith(".cpp")]
|
||||||
|
|
||||||
dir_util.mkpath(self.build_temp, dry_run=self.dry_run)
|
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.
|
# Run moc on all header files.
|
||||||
for source in cppsources:
|
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")
|
header = source.replace(".cpp", ".h")
|
||||||
if os.path.exists(header):
|
if os.path.exists(header):
|
||||||
|
# *.h -> moc_*.cpp
|
||||||
moc_file = "moc_" + os.path.basename(header).replace(".h", ".cpp")
|
moc_file = "moc_" + os.path.basename(header).replace(".h", ".cpp")
|
||||||
out_file = os.path.join(self.build_temp, moc_file)
|
out_file = os.path.join(self.build_temp, moc_file)
|
||||||
|
|
||||||
if newer(header, out_file) or self.force:
|
if newer(header, out_file) or self.force:
|
||||||
call_arg = ["moc", "-o", out_file, header]
|
spawn.spawn(get_moc_args(out_file, header), dry_run=self.dry_run)
|
||||||
spawn.spawn(call_arg, dry_run=self.dry_run)
|
|
||||||
|
|
||||||
if os.path.getsize(out_file) > 0:
|
if os.path.getsize(out_file) > 0:
|
||||||
ext.sources.append(out_file)
|
ext.sources.append(out_file)
|
||||||
|
|
||||||
# Add the temp build directory to include path, for compiler to find
|
# Add the temp build directory to include path, for compiler to find
|
||||||
# the created .moc files
|
# the created .moc files
|
||||||
ext.include_dirs += [self._sip_output_dir()]
|
ext.include_dirs += [self._sip_output_dir()]
|
||||||
|
|
||||||
sipdistutils.build_ext.build_extension(self, ext)
|
sipdistutils.build_ext.build_extension(self, ext)
|
||||||
|
|
||||||
|
|
||||||
@ -253,7 +265,7 @@ ext_modules = [Extension('PyQtAds.QtAds.ads', cpp_sources + sip_sources)]
|
|||||||
install_requires = ["PyQt5"]
|
install_requires = ["PyQt5"]
|
||||||
if sys.platform == 'win32':
|
if sys.platform == 'win32':
|
||||||
install_requires.append("pywin32")
|
install_requires.append("pywin32")
|
||||||
|
|
||||||
|
|
||||||
with open('README.md', 'r') as f:
|
with open('README.md', 'r') as f:
|
||||||
LONG_DESCRIPTION = f.read()
|
LONG_DESCRIPTION = f.read()
|
||||||
|
@ -13,14 +13,6 @@ class CDockAreaTabBar : QScrollArea
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void wheelEvent(QWheelEvent* Event);
|
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:
|
public:
|
||||||
CDockAreaTabBar(ads::CDockAreaWidget* parent /TransferThis/);
|
CDockAreaTabBar(ads::CDockAreaWidget* parent /TransferThis/);
|
||||||
@ -35,6 +27,7 @@ public:
|
|||||||
bool isTabOpen(int Index) const;
|
bool isTabOpen(int Index) const;
|
||||||
virtual QSize minimumSizeHint() const;
|
virtual QSize minimumSizeHint() const;
|
||||||
virtual QSize sizeHint() const;
|
virtual QSize sizeHint() const;
|
||||||
|
void elidedChanged(bool elided);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setCurrentIndex(int Index);
|
void setCurrentIndex(int Index);
|
||||||
@ -54,4 +47,4 @@ signals:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
%End
|
%End
|
||||||
|
@ -11,6 +11,13 @@ class CDockAreaTitleBar : QFrame
|
|||||||
#include <DockAreaTitleBar.h>
|
#include <DockAreaTitleBar.h>
|
||||||
%End
|
%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:
|
public slots:
|
||||||
void markTabsMenuOutdated();
|
void markTabsMenuOutdated();
|
||||||
|
|
||||||
@ -20,7 +27,10 @@ public:
|
|||||||
virtual ~CDockAreaTitleBar();
|
virtual ~CDockAreaTitleBar();
|
||||||
ads::CDockAreaTabBar* tabBar() const;
|
ads::CDockAreaTabBar* tabBar() const;
|
||||||
QAbstractButton* button(ads::TitleBarButton which) const;
|
QAbstractButton* button(ads::TitleBarButton which) const;
|
||||||
|
void updateDockWidgetActionsButtons();
|
||||||
virtual void setVisible(bool Visible);
|
virtual void setVisible(bool Visible);
|
||||||
|
void insertWidget(int index, QWidget *widget /Transfer/ );
|
||||||
|
int indexOf(QWidget *widget) const;
|
||||||
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
@ -42,12 +42,16 @@ public:
|
|||||||
int currentIndex() const;
|
int currentIndex() const;
|
||||||
int indexOfFirstOpenDockWidget() const;
|
int indexOfFirstOpenDockWidget() const;
|
||||||
ads::CDockWidget* currentDockWidget() const;
|
ads::CDockWidget* currentDockWidget() const;
|
||||||
void setCurrentDockWidget(ads::CDockWidget* DockWidget /Transfer/);
|
void setCurrentDockWidget(ads::CDockWidget* DockWidget);
|
||||||
void saveState(QXmlStreamWriter& Stream) const;
|
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;
|
QAbstractButton* titleBarButton(ads::TitleBarButton which) const;
|
||||||
virtual void setVisible(bool Visible);
|
virtual void setVisible(bool Visible);
|
||||||
|
|
||||||
|
void setAllowedAreas(DockWidgetAreas areas);
|
||||||
|
DockWidgetAreas allowedAreas() const;
|
||||||
|
CDockAreaTitleBar* titleBar() const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setCurrentIndex(int index);
|
void setCurrentIndex(int index);
|
||||||
void closeArea();
|
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 dropFloatingWidget(ads::CFloatingDockContainer* FloatingWidget, const QPoint& TargetPos);
|
||||||
void dropWidget(QWidget* widget, const QPoint& TargetPos);
|
void dropWidget(QWidget* widget, const QPoint& TargetPos);
|
||||||
void addDockArea(ads::CDockAreaWidget* DockAreaWidget /Transfer/, ads::DockWidgetArea area = ads::CenterDockWidgetArea);
|
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;
|
void saveState(QXmlStreamWriter& Stream) const;
|
||||||
bool restoreState(CDockingStateReader& Stream, bool Testing);
|
bool restoreState(CDockingStateReader& Stream, bool Testing);
|
||||||
ads::CDockAreaWidget* lastAddedDockAreaWidget(ads::DockWidgetArea area) const;
|
ads::CDockAreaWidget* lastAddedDockAreaWidget(ads::DockWidgetArea area) const;
|
||||||
bool hasTopLevelDockWidget() const;
|
|
||||||
ads::CDockWidget* topLevelDockWidget() const;
|
ads::CDockWidget* topLevelDockWidget() const;
|
||||||
ads::CDockAreaWidget* topLevelDockArea() const;
|
ads::CDockAreaWidget* topLevelDockArea() const;
|
||||||
QList<ads::CDockWidget*> dockWidgets() 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
|
* If all dock widgets in a dock area are closed, the dock area will be closed
|
||||||
*/
|
*/
|
||||||
QList<ads::CDockAreaWidget*> openedDockAreas() const;
|
QList<ads::CDockAreaWidget*> openedDockAreas() const;
|
||||||
|
bool hasTopLevelDockWidget() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the number of dock areas in this container
|
* Returns the number of dock areas in this container
|
||||||
|
@ -143,7 +143,7 @@ public:
|
|||||||
|
|
||||||
enum eConfigFlag
|
enum eConfigFlag
|
||||||
{
|
{
|
||||||
ActiveTabHasCloseButton,
|
ActiveTabHasCloseButton,
|
||||||
DockAreaHasCloseButton,
|
DockAreaHasCloseButton,
|
||||||
DockAreaCloseButtonClosesTab,
|
DockAreaCloseButtonClosesTab,
|
||||||
OpaqueSplitterResize,
|
OpaqueSplitterResize,
|
||||||
@ -152,13 +152,22 @@ public:
|
|||||||
TabCloseButtonIsToolButton,
|
TabCloseButtonIsToolButton,
|
||||||
AllTabsHaveCloseButton,
|
AllTabsHaveCloseButton,
|
||||||
RetainTabSizeWhenCloseButtonHidden,
|
RetainTabSizeWhenCloseButtonHidden,
|
||||||
OpaqueUndocking,
|
OpaqueUndocking,
|
||||||
DragPreviewIsDynamic,
|
DragPreviewIsDynamic,
|
||||||
DragPreviewShowsContentPixmap,
|
DragPreviewShowsContentPixmap,
|
||||||
DragPreviewHasWindowFrame,
|
DragPreviewHasWindowFrame,
|
||||||
DefaultConfig,
|
AlwaysShowTabs,
|
||||||
DefaultNonOpaqueConfig,
|
DockAreaHasUndockButton,
|
||||||
NonOpaqueWithWindowFrame,
|
DockAreaHasTabsMenuButton,
|
||||||
|
DockAreaHideDisabledButtons,
|
||||||
|
DockAreaDynamicTabsMenuButtonVisibility,
|
||||||
|
FloatingContainerHasWidgetTitle,
|
||||||
|
FloatingContainerHasWidgetIcon,
|
||||||
|
DefaultDockAreaButtons,
|
||||||
|
DefaultBaseConfig,
|
||||||
|
DefaultOpaqueConfig,
|
||||||
|
DefaultNonOpaqueConfig,
|
||||||
|
NonOpaqueWithWindowFrame,
|
||||||
};
|
};
|
||||||
typedef QFlags<ads::CDockManager::eConfigFlag> ConfigFlags;
|
typedef QFlags<ads::CDockManager::eConfigFlag> ConfigFlags;
|
||||||
|
|
||||||
@ -167,6 +176,7 @@ public:
|
|||||||
static ads::CDockManager::ConfigFlags configFlags();
|
static ads::CDockManager::ConfigFlags configFlags();
|
||||||
static void setConfigFlags(const ads::CDockManager::ConfigFlags Flags);
|
static void setConfigFlags(const ads::CDockManager::ConfigFlags Flags);
|
||||||
static void setConfigFlag(ads::CDockManager::eConfigFlag Flag, bool On = true);
|
static void setConfigFlag(ads::CDockManager::eConfigFlag Flag, bool On = true);
|
||||||
|
static bool testConfigFlag(eConfigFlag Flag);
|
||||||
static ads::CIconProvider& iconProvider();
|
static ads::CIconProvider& iconProvider();
|
||||||
ads::CDockAreaWidget* addDockWidget(ads::DockWidgetArea area, ads::CDockWidget* Dockwidget /Transfer/,
|
ads::CDockAreaWidget* addDockWidget(ads::DockWidgetArea area, ads::CDockWidget* Dockwidget /Transfer/,
|
||||||
ads::CDockAreaWidget* DockAreaWidget /Transfer/ = 0);
|
ads::CDockAreaWidget* DockAreaWidget /Transfer/ = 0);
|
||||||
@ -180,7 +190,7 @@ public:
|
|||||||
QMap<QString, ads::CDockWidget*> dockWidgetsMap() const;
|
QMap<QString, ads::CDockWidget*> dockWidgetsMap() const;
|
||||||
const QList<ads::CDockContainerWidget*> dockContainers() const;
|
const QList<ads::CDockContainerWidget*> dockContainers() const;
|
||||||
const QList<ads::CFloatingDockContainer*> floatingWidgets() const;
|
const QList<ads::CFloatingDockContainer*> floatingWidgets() const;
|
||||||
virtual unsigned int zOrderIndex() const;
|
unsigned int zOrderIndex() const;
|
||||||
QByteArray saveState(int version = 1) const;
|
QByteArray saveState(int version = 1) const;
|
||||||
bool restoreState(const QByteArray &state, int version = 1);
|
bool restoreState(const QByteArray &state, int version = 1);
|
||||||
void addPerspective(const QString& UniquePrespectiveName);
|
void addPerspective(const QString& UniquePrespectiveName);
|
||||||
@ -206,6 +216,7 @@ signals:
|
|||||||
void stateRestored();
|
void stateRestored();
|
||||||
void openingPerspective(const QString& PerspectiveName);
|
void openingPerspective(const QString& PerspectiveName);
|
||||||
void perspectiveOpened(const QString& PerspectiveName);
|
void perspectiveOpened(const QString& PerspectiveName);
|
||||||
|
void floatingWidgetCreated(CFloatingDockContainer* FloatingWidget);
|
||||||
void dockAreaCreated(ads::CDockAreaWidget* DockArea);
|
void dockAreaCreated(ads::CDockAreaWidget* DockArea);
|
||||||
void dockWidgetAboutToBeRemoved(ads::CDockWidget* DockWidget);
|
void dockWidgetAboutToBeRemoved(ads::CDockWidget* DockWidget);
|
||||||
void dockWidgetRemoved(ads::CDockWidget* DockWidget);
|
void dockWidgetRemoved(ads::CDockWidget* DockWidget);
|
||||||
|
@ -12,15 +12,16 @@ class CDockWidget : QFrame
|
|||||||
%End
|
%End
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void setDockManager(ads::CDockManager* DockManager /Transfer/);
|
void setDockManager(ads::CDockManager* DockManager /Transfer/ );
|
||||||
void setDockArea(ads::CDockAreaWidget* DockArea /Transfer/);
|
void setDockArea(ads::CDockAreaWidget* DockArea /Transfer/ );
|
||||||
void setToggleViewActionChecked(bool Checked);
|
void setToggleViewActionChecked(bool Checked);
|
||||||
void saveState(QXmlStreamWriter& Stream) const;
|
void saveState(QXmlStreamWriter& Stream) const;
|
||||||
void flagAsUnassigned();
|
void flagAsUnassigned();
|
||||||
static void emitTopLevelEventForWidget(ads::CDockWidget* TopLevelDockWidget, bool Floating);
|
static void emitTopLevelEventForWidget(ads::CDockWidget* TopLevelDockWidget, bool Floating);
|
||||||
void emitTopLevelChanged(bool Floating);
|
void emitTopLevelChanged(bool Floating);
|
||||||
void setClosedState(bool Closed);
|
void setClosedState(bool Closed);
|
||||||
void toggleViewInternal(bool Open);
|
void toggleViewInternal(bool Open);
|
||||||
|
bool closeDockWidgetInternal(bool ForceClose = false);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum DockWidgetFeature
|
enum DockWidgetFeature
|
||||||
@ -77,7 +78,7 @@ public:
|
|||||||
QIcon icon() const;
|
QIcon icon() const;
|
||||||
QToolBar* toolBar() const;
|
QToolBar* toolBar() const;
|
||||||
QToolBar* createDefaultToolBar();
|
QToolBar* createDefaultToolBar();
|
||||||
void setToolBar(QToolBar* ToolBar);
|
void setToolBar(QToolBar* ToolBar /Transfer/ );
|
||||||
void setToolBarStyle(Qt::ToolButtonStyle Style, ads::CDockWidget::eState State);
|
void setToolBarStyle(Qt::ToolButtonStyle Style, ads::CDockWidget::eState State);
|
||||||
Qt::ToolButtonStyle toolBarStyle(ads::CDockWidget::eState State) const;
|
Qt::ToolButtonStyle toolBarStyle(ads::CDockWidget::eState State) const;
|
||||||
void setToolBarIconSize(const QSize& IconSize, ads::CDockWidget::eState State);
|
void setToolBarIconSize(const QSize& IconSize, ads::CDockWidget::eState State);
|
||||||
|
@ -30,6 +30,7 @@ public:
|
|||||||
const QIcon& icon() const;
|
const QIcon& icon() const;
|
||||||
QString text() const;
|
QString text() const;
|
||||||
void setText(const QString& title);
|
void setText(const QString& title);
|
||||||
|
bool isTitleElided() const;
|
||||||
bool isClosable() const;
|
bool isClosable() const;
|
||||||
virtual bool event(QEvent *e);
|
virtual bool event(QEvent *e);
|
||||||
|
|
||||||
@ -43,6 +44,7 @@ signals:
|
|||||||
void closeRequested();
|
void closeRequested();
|
||||||
void closeOtherTabsRequested();
|
void closeOtherTabsRequested();
|
||||||
void moved(const QPoint& GlobalPos);
|
void moved(const QPoint& GlobalPos);
|
||||||
|
void elidedChanged(bool elided);
|
||||||
}; // class DockWidgetTab
|
}; // class DockWidgetTab
|
||||||
};
|
};
|
||||||
// namespace ads
|
// namespace ads
|
||||||
|
@ -22,7 +22,7 @@ public:
|
|||||||
virtual ~CElidingLabel();
|
virtual ~CElidingLabel();
|
||||||
Qt::TextElideMode elideMode() const;
|
Qt::TextElideMode elideMode() const;
|
||||||
void setElideMode(Qt::TextElideMode mode);
|
void setElideMode(Qt::TextElideMode mode);
|
||||||
|
bool isElided() const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual QSize minimumSizeHint() const;
|
virtual QSize minimumSizeHint() const;
|
||||||
@ -33,6 +33,7 @@ public:
|
|||||||
signals:
|
signals:
|
||||||
void clicked();
|
void clicked();
|
||||||
void doubleClicked();
|
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
|
%Import QtWidgets/QtWidgetsmod.sip
|
||||||
|
|
||||||
%If (Qt_5_0_0 -)
|
%If (Qt_5_0_0 -)
|
||||||
@ -46,7 +49,6 @@ protected:
|
|||||||
virtual void closeEvent(QCloseEvent *event);
|
virtual void closeEvent(QCloseEvent *event);
|
||||||
virtual void hideEvent(QHideEvent *event);
|
virtual void hideEvent(QHideEvent *event);
|
||||||
virtual void showEvent(QShowEvent *event);
|
virtual void showEvent(QShowEvent *event);
|
||||||
virtual bool eventFilter(QObject *watched, QEvent *event);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CFloatingDockContainer(ads::CDockManager* DockManager /TransferThis/);
|
CFloatingDockContainer(ads::CDockManager* DockManager /TransferThis/);
|
||||||
|
@ -12,6 +12,10 @@ class CFloatingDragPreview : QWidget, ads::IFloatingWidget
|
|||||||
#include <FloatingDragPreview.h>
|
#include <FloatingDragPreview.h>
|
||||||
%End
|
%End
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void moveEvent(QMoveEvent *event);
|
||||||
|
virtual void paintEvent(QPaintEvent *e);
|
||||||
|
CFloatingDragPreview(QWidget* Content /TransferThis/, QWidget* parent /TransferThis/);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CFloatingDragPreview(ads::CDockWidget* Content /TransferThis/ );
|
CFloatingDragPreview(ads::CDockWidget* Content /TransferThis/ );
|
||||||
@ -21,6 +25,7 @@ public:
|
|||||||
|
|
||||||
virtual bool eventFilter(QObject* watched, QEvent* event);
|
virtual bool eventFilter(QObject* watched, QEvent* event);
|
||||||
|
|
||||||
|
public: // implements IFloatingWidget
|
||||||
virtual void startFloating(const QPoint& DragStartMousePos, const QSize& Size,
|
virtual void startFloating(const QPoint& DragStartMousePos, const QSize& Size,
|
||||||
ads::eDragState DragState, QWidget* MouseEventHandler);
|
ads::eDragState DragState, QWidget* MouseEventHandler);
|
||||||
|
|
||||||
@ -35,4 +40,4 @@ signals:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
%End
|
%End
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
%Include DockAreaTabBar.sip
|
%Include DockAreaTabBar.sip
|
||||||
%Include DockAreaTitleBar.sip
|
%Include DockAreaTitleBar.sip
|
||||||
%Include DockAreaWidget.sip
|
%Include DockAreaWidget.sip
|
||||||
|
%Include DockComponentsFactory.sip
|
||||||
%Include DockContainerWidget.sip
|
%Include DockContainerWidget.sip
|
||||||
%Include DockingStateReader.sip
|
%Include DockingStateReader.sip
|
||||||
%Include DockManager.sip
|
%Include DockManager.sip
|
||||||
@ -15,9 +16,12 @@
|
|||||||
%Include DockSplitter.sip
|
%Include DockSplitter.sip
|
||||||
%Include DockWidgetTab.sip
|
%Include DockWidgetTab.sip
|
||||||
%Include ElidingLabel.sip
|
%Include ElidingLabel.sip
|
||||||
%Include FloatingDockContainer.sip
|
|
||||||
%Include FloatingDragPreview.sip
|
%Include FloatingDragPreview.sip
|
||||||
%Include IconProvider.sip
|
%Include IconProvider.sip
|
||||||
%If (Linux)
|
%If (Linux)
|
||||||
|
%Include linux/FloatingDockContainer.sip
|
||||||
%Include linux/FloatingWidgetTitleBar.sip
|
%Include linux/FloatingWidgetTitleBar.sip
|
||||||
%End
|
%End
|
||||||
|
%If (!Linux)
|
||||||
|
%Include FloatingDockContainer.sip
|
||||||
|
%End
|
||||||
|
@ -49,6 +49,12 @@ namespace ads
|
|||||||
IconCount,
|
IconCount,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum eBitwiseOperator
|
||||||
|
{
|
||||||
|
BitwiseAnd,
|
||||||
|
BitwiseOr
|
||||||
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
%End
|
%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