mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-12-24 23:31:32 +08:00
Merge branch 'master' of https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System
This commit is contained in:
commit
2a6bd306cb
42
README.md
42
README.md
@ -15,6 +15,9 @@ integrated development environments (IDEs) such as Visual Studio.
|
||||
|
||||
## New and Noteworthy
|
||||
|
||||
The [release 3.7.0](https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/releases/tag/3.7.0)
|
||||
adds support for Qt6.
|
||||
|
||||
The [release 3.6.0](https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/releases/tag/3.6.0)
|
||||
adds some nice new features:
|
||||
|
||||
@ -56,6 +59,7 @@ know it from Visual Studio.
|
||||
- [Supports deletion of dynamically created dock widgets](#supports-deletion-of-dynamically-created-dock-widgets)
|
||||
- [Python PyQt5 Bindings](#python-pyqt5-bindings)
|
||||
- [Tested Compatible Environments](#tested-compatible-environments)
|
||||
- [Supported Qt Versions](#supported-qt-versions)
|
||||
- [Windows](#windows)
|
||||
- [macOS](#macos)
|
||||
- [Linux](#linux)
|
||||
@ -81,8 +85,8 @@ There is no central widget like in the Qt docking system. You can dock on every
|
||||
border of the main window or you can dock into each dock area - so you are
|
||||
free to dock almost everywhere.
|
||||
|
||||
![Dropping widgets](doc/preview-dragndrop.png)\
|
||||
\
|
||||
![Dropping widgets](doc/preview-dragndrop.png)
|
||||
|
||||
![Dropping widgets](doc/preview-dragndrop_dark.png)
|
||||
|
||||
### Docking inside floating windows
|
||||
@ -90,8 +94,8 @@ free to dock almost everywhere.
|
||||
There is no difference between the main window and a floating window. Docking
|
||||
into floating windows is supported.
|
||||
|
||||
![Docking inside floating windows](doc/floating-widget-dragndrop.png)\
|
||||
\
|
||||
![Docking inside floating windows](doc/floating-widget-dragndrop.png)
|
||||
|
||||
![Docking inside floating windows](doc/floating-widget-dragndrop_dark.png)
|
||||
|
||||
### Grouped dragging
|
||||
@ -100,8 +104,8 @@ When dragging the titlebar of a dock, all the tabs that are tabbed with it are
|
||||
going to be dragged. So you can move complete groups of tabbed widgets into
|
||||
a floating widget or from one dock area to another one.
|
||||
|
||||
![Grouped dragging](doc/grouped-dragging.gif)\
|
||||
\
|
||||
![Grouped dragging](doc/grouped-dragging.gif)
|
||||
|
||||
![Grouped dragging](doc/grouped-dragging_dark.png)
|
||||
|
||||
### Perspectives for fast switching of the complete main window layout
|
||||
@ -112,13 +116,13 @@ perspective to make your own custom perspective. Later you can simply
|
||||
select a perspective from the perspective list to quickly switch the complete
|
||||
main window layout.
|
||||
|
||||
![Perspective](doc/perspectives.gif)\
|
||||
\
|
||||
![Perspective](doc/perspectives.gif)
|
||||
|
||||
![Perspective](doc/perspectives_dark.png)
|
||||
|
||||
### Opaque and non-opaque splitter resizing
|
||||
|
||||
The advanced docking system uses standard QSplitters as resize separators and thus supports opaque and non-opaque resizing functionality of QSplitter. In some rare cases, for very complex widgets or on slow machines resizing via separator on the fly may cause flicking and glaring of rendered content inside a widget. The global dock manager flag `OpaqueSplitterResize` configures the resizing behaviour of the splitters. If this flag is set, then widgets are resized dynamically (opaquely) while interactively moving the splitters.
|
||||
The advanced docking system uses standard QSplitters as resize separators and thus supports opaque and non-opaque resizing functionality of QSplitter. In some rare cases, for very complex widgets or on slow machines resizing via separator on the fly may cause flicking and glaring of rendered content inside a widget. The global dock manager flag `OpaqueSplitterResize` configures the resizing behaviour of the splitters. If this flag is set, then widgets are resized dynamically (opaquely) while interactively moving the splitters.
|
||||
|
||||
![Opaque resizing](doc/opaque_resizing.gif)
|
||||
|
||||
@ -171,6 +175,10 @@ Latest working version: [3.5.2](https://github.com/githubuser0xFFFF/Qt-Advanced-
|
||||
|
||||
## Tested Compatible Environments
|
||||
|
||||
### Supported Qt Versions
|
||||
|
||||
The library supports **Qt5** and **Qt6**.
|
||||
|
||||
### Windows
|
||||
|
||||
Windows 10 [![Build status](https://ci.appveyor.com/api/projects/status/qcfb3cy932jw9mpy/branch/master?svg=true)](https://ci.appveyor.com/project/githubuser0xFFFF/qt-advanced-docking-system/branch/master)
|
||||
@ -187,15 +195,23 @@ The application can be compiled for macOS. A user reported, that the library wor
|
||||
|
||||
### Linux
|
||||
|
||||
Ubuntu [![Build Status](https://travis-ci.org/githubuser0xFFFF/Qt-Advanced-Docking-System.svg?branch=master)](https://travis-ci.org/githubuser0xFFFF/Qt-Advanced-Docking-System)
|
||||
[![Build Status](https://travis-ci.org/githubuser0xFFFF/Qt-Advanced-Docking-System.svg?branch=master)](https://travis-ci.org/githubuser0xFFFF/Qt-Advanced-Docking-System)
|
||||
[![Build status](https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/workflows/linux-builds/badge.svg)](https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/actions?query=workflow%3Alinux-builds)
|
||||
|
||||
The application can be compiled for Linux and has been developed and tested with **Kubuntu 18.04** and **Kubuntu 19.10**.
|
||||
Unfortunately, there is no such thing as a Linux operating system. Linux is a heterogeneous environment with a variety of different distributions. So it is not possible to support "Linux" like this is possible for Windows. It is only possible to support and test a small subset of Linux distributions. The library can be compiled for and has been developed and tested with the following Linux distributions:
|
||||
|
||||
- **Kubuntu 18.04 and 19.10**
|
||||
- **Ubuntu 18.04, 19.10 and 20.04**
|
||||
|
||||
There are some requirements for the Linux distribution that have to be met:
|
||||
|
||||
- an X server that supports ARGB visuals and a compositing window manager. This is required to display the translucent dock overlays ([https://doc.qt.io/qt-5/qwidget.html#creating-translucent-windows](https://doc.qt.io/qt-5/qwidget.html#creating-translucent-windows)). If your Linux distribution does not support this, or if you disable this feature, you will very likely see issue [#95](https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/issues/95).
|
||||
- Wayland is not properly supported by Qt yet. If you use Wayland, then you should set the session type to x11: `XDG_SESSION_TYPE=x11 ./AdvancedDockingSystemDemo`. You will find more details about this in issue [#288](https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/issues/288).
|
||||
|
||||
Screenshot Kubuntu:
|
||||
![Advanced Docking on Kubuntu Linux](doc/linux_kubuntu_1804.png)
|
||||
|
||||
and with **Ubuntu 19.10**
|
||||
|
||||
Screenshot Ubuntu:
|
||||
![Advanced Docking on Ubuntu Linux](doc/linux_ubuntu_1910.png)
|
||||
|
||||
## Build
|
||||
|
28
ads.pri
Normal file
28
ads.pri
Normal file
@ -0,0 +1,28 @@
|
||||
|
||||
lessThan(QT_MAJOR_VERSION, 6) {
|
||||
CONFIG(debug, debug|release){
|
||||
win32 {
|
||||
LIBS += -lqtadvanceddockingd
|
||||
}
|
||||
else:mac {
|
||||
LIBS += -lqtadvanceddocking_debug
|
||||
}
|
||||
else {
|
||||
LIBS += -lqtadvanceddocking
|
||||
}
|
||||
}
|
||||
else{
|
||||
LIBS += -lqtadvanceddocking
|
||||
}
|
||||
}
|
||||
else {
|
||||
# qt$$qtLibraryTarget(qtadvanceddocking) does not produce an advanceddockingd.dll file on Windows
|
||||
# for Qt6 - I don't know if this is a bug and I have to investigate
|
||||
LIBS += -lqtadvanceddocking
|
||||
}
|
||||
|
||||
|
||||
unix:!macx {
|
||||
LIBS += -lxcb
|
||||
QT += x11extras
|
||||
}
|
@ -58,12 +58,15 @@
|
||||
#include <QMessageBox>
|
||||
#include <QMenu>
|
||||
#include <QToolButton>
|
||||
#include <QToolBar>
|
||||
#include <QPointer>
|
||||
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
#include <QAxWidget>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <QMap>
|
||||
#include <QElapsedTimer>
|
||||
@ -355,6 +358,7 @@ struct MainWindowPrivate
|
||||
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
/**
|
||||
* Creates an ActiveX widget on windows
|
||||
*/
|
||||
@ -368,6 +372,7 @@ struct MainWindowPrivate
|
||||
return DockWidget;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
@ -446,10 +451,12 @@ void MainWindowPrivate::createContent()
|
||||
DockWidget->connect(Action, SIGNAL(triggered()), SLOT(raise()));
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
if (!ads::CDockManager::testConfigFlag(ads::CDockManager::OpaqueUndocking))
|
||||
{
|
||||
DockManager->addDockWidget(ads::CenterDockWidgetArea, createActiveXWidget(), RighDockArea);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
for (auto DockWidget : DockManager->dockWidgetsMap())
|
||||
@ -610,8 +617,13 @@ CMainWindow::CMainWindow(QWidget *parent) :
|
||||
// Now create the dock manager and its content
|
||||
d->DockManager = new CDockManager(this);
|
||||
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
connect(d->PerspectiveComboBox, SIGNAL(activated(const QString&)),
|
||||
d->DockManager, SLOT(openPerspective(const QString&)));
|
||||
#else
|
||||
connect(d->PerspectiveComboBox, SIGNAL(textActivated(const QString&)),
|
||||
d->DockManager, SLOT(openPerspective(const QString&)));
|
||||
#endif
|
||||
|
||||
d->createContent();
|
||||
// Default window geometry - center on screen
|
||||
|
@ -4,8 +4,12 @@ TARGET = AdvancedDockingSystemDemo
|
||||
DESTDIR = $${ADS_OUT_ROOT}/lib
|
||||
QT += core gui widgets
|
||||
|
||||
win32 {
|
||||
QT += axcontainer
|
||||
include(../ads.pri)
|
||||
|
||||
lessThan(QT_MAJOR_VERSION, 6) {
|
||||
win32 {
|
||||
QT += axcontainer
|
||||
}
|
||||
}
|
||||
|
||||
CONFIG += c++14
|
||||
@ -35,26 +39,5 @@ RESOURCES += demo.qrc
|
||||
LIBS += -L$${ADS_OUT_ROOT}/lib
|
||||
|
||||
|
||||
# Dependency: AdvancedDockingSystem (shared)
|
||||
CONFIG(debug, debug|release){
|
||||
win32 {
|
||||
LIBS += -lqtadvanceddockingd
|
||||
}
|
||||
else:mac {
|
||||
LIBS += -lqtadvanceddocking_debug
|
||||
}
|
||||
else {
|
||||
LIBS += -lqtadvanceddocking
|
||||
}
|
||||
}
|
||||
else{
|
||||
LIBS += -lqtadvanceddocking
|
||||
}
|
||||
|
||||
unix:!macx {
|
||||
LIBS += -lxcb
|
||||
QT += x11extras
|
||||
}
|
||||
|
||||
INCLUDEPATH += ../src
|
||||
DEPENDPATH += ../src
|
||||
|
@ -359,6 +359,7 @@ class MainWindow(MainWindowUI, MainWindowBase):
|
||||
floating = sender.property("Floating")
|
||||
dock_widget = self.create_editor_widget()
|
||||
dock_widget.setFeature(QtAds.CDockWidget.DockWidgetDeleteOnClose, True)
|
||||
dock_widget.setFeature(QtAds.CDockWidget.DockWidgetForceCloseWithArea, True)
|
||||
dock_widget.closeRequested.connect(self.on_editor_close_requested)
|
||||
|
||||
if floating:
|
||||
|
@ -35,9 +35,11 @@ void myMessageOutput(QtMsgType type, const QMessageLogContext &context, const QS
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||
#if QT_VERSION >= 0x050600
|
||||
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
#endif
|
||||
#endif
|
||||
std::shared_ptr<int> b;
|
||||
QApplication a(argc, argv);
|
||||
|
@ -106,6 +106,11 @@ class MainWindow(MainWindowUI, MainWindowBase):
|
||||
self.perspective_combobox.clear()
|
||||
self.perspective_combobox.addItems(self.dock_manager.perspectiveNames())
|
||||
self.perspective_combobox.setCurrentText(perspective_name)
|
||||
|
||||
def closeEvent(self, event: QCloseEvent):
|
||||
self.dock_manager.deleteLater()
|
||||
super().closeEvent(event)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app = QApplication(sys.argv)
|
||||
|
@ -28,28 +28,7 @@ FORMS += \
|
||||
mainwindow.ui
|
||||
|
||||
LIBS += -L$${ADS_OUT_ROOT}/lib
|
||||
|
||||
# Dependency: AdvancedDockingSystem (shared)
|
||||
CONFIG(debug, debug|release){
|
||||
win32 {
|
||||
LIBS += -lqtadvanceddockingd
|
||||
}
|
||||
else:mac {
|
||||
LIBS += -lqtadvanceddocking_debug
|
||||
}
|
||||
else {
|
||||
LIBS += -lqtadvanceddocking
|
||||
}
|
||||
}
|
||||
else{
|
||||
LIBS += -lqtadvanceddocking
|
||||
}
|
||||
|
||||
unix:!macx {
|
||||
LIBS += -lxcb
|
||||
QT += x11extras
|
||||
}
|
||||
|
||||
include(../../ads.pri)
|
||||
INCLUDEPATH += ../../src
|
||||
DEPENDPATH += ../../src
|
||||
|
||||
|
@ -26,17 +26,6 @@
|
||||
|
||||
using namespace ads;
|
||||
|
||||
/**
|
||||
* Helper function to create an SVG icon
|
||||
*/
|
||||
static QIcon svgIcon(const QString& File)
|
||||
{
|
||||
// This is a workaround, because in item views SVG icons are not
|
||||
// properly scaled and look blurry or pixelate
|
||||
QIcon SvgIcon(File);
|
||||
SvgIcon.addPixmap(SvgIcon.pixmap(92));
|
||||
return SvgIcon;
|
||||
}
|
||||
|
||||
CMainWindow::CMainWindow(QWidget *parent)
|
||||
: QMainWindow(parent)
|
||||
@ -104,7 +93,6 @@ CMainWindow::~CMainWindow()
|
||||
void CMainWindow::createPerspectiveUi()
|
||||
{
|
||||
SavePerspectiveAction = new QAction("Create Perspective", this);
|
||||
SavePerspectiveAction->setIcon(svgIcon(":/adsdemo/images/picture_in_picture.svg"));
|
||||
connect(SavePerspectiveAction, SIGNAL(triggered()), SLOT(savePerspective()));
|
||||
PerspectiveListAction = new QWidgetAction(this);
|
||||
PerspectiveComboBox = new QComboBox(this);
|
||||
|
@ -17,28 +17,7 @@ SOURCES += main.cpp
|
||||
|
||||
|
||||
LIBS += -L$${ADS_OUT_ROOT}/lib
|
||||
|
||||
# Dependency: AdvancedDockingSystem (shared)
|
||||
CONFIG(debug, debug|release){
|
||||
win32 {
|
||||
LIBS += -lqtadvanceddockingd
|
||||
}
|
||||
else:mac {
|
||||
LIBS += -lqtadvanceddocking_debug
|
||||
}
|
||||
else {
|
||||
LIBS += -lqtadvanceddocking
|
||||
}
|
||||
}
|
||||
else{
|
||||
LIBS += -lqtadvanceddocking
|
||||
}
|
||||
|
||||
unix:!macx {
|
||||
LIBS += -lxcb
|
||||
QT += x11extras
|
||||
}
|
||||
|
||||
include(../../ads.pri)
|
||||
INCLUDEPATH += ../../src
|
||||
DEPENDPATH += ../../src
|
||||
|
||||
|
@ -25,28 +25,7 @@ FORMS += \
|
||||
|
||||
|
||||
LIBS += -L$${ADS_OUT_ROOT}/lib
|
||||
|
||||
# Dependency: AdvancedDockingSystem (shared)
|
||||
CONFIG(debug, debug|release){
|
||||
win32 {
|
||||
LIBS += -lqtadvanceddockingd
|
||||
}
|
||||
else:mac {
|
||||
LIBS += -lqtadvanceddocking_debug
|
||||
}
|
||||
else {
|
||||
LIBS += -lqtadvanceddocking
|
||||
}
|
||||
}
|
||||
else{
|
||||
LIBS += -lqtadvanceddocking
|
||||
}
|
||||
|
||||
unix:!macx {
|
||||
LIBS += -lxcb
|
||||
QT += x11extras
|
||||
}
|
||||
|
||||
include(../../ads.pri)
|
||||
INCLUDEPATH += ../../src
|
||||
DEPENDPATH += ../../src
|
||||
|
||||
|
@ -25,28 +25,7 @@ FORMS += \
|
||||
|
||||
|
||||
LIBS += -L$${ADS_OUT_ROOT}/lib
|
||||
|
||||
# Dependency: AdvancedDockingSystem (shared)
|
||||
CONFIG(debug, debug|release){
|
||||
win32 {
|
||||
LIBS += -lqtadvanceddockingd
|
||||
}
|
||||
else:mac {
|
||||
LIBS += -lqtadvanceddocking_debug
|
||||
}
|
||||
else {
|
||||
LIBS += -lqtadvanceddocking
|
||||
}
|
||||
}
|
||||
else{
|
||||
LIBS += -lqtadvanceddocking
|
||||
}
|
||||
|
||||
unix:!macx {
|
||||
LIBS += -lxcb
|
||||
QT += x11extras
|
||||
}
|
||||
|
||||
include(../../ads.pri)
|
||||
INCLUDEPATH += ../../src
|
||||
DEPENDPATH += ../../src
|
||||
|
||||
|
@ -135,7 +135,6 @@ protected:
|
||||
ads::CDockOverlay* dockAreaOverlay() const;
|
||||
void notifyWidgetOrAreaRelocation(QWidget* RelocatedWidget);
|
||||
void notifyFloatingWidgetDrop(ads::CFloatingDockContainer* FloatingWidget);
|
||||
ads::CDockWidget* focusedDockWidget() const;
|
||||
|
||||
virtual void showEvent(QShowEvent *event);
|
||||
|
||||
@ -217,6 +216,9 @@ public:
|
||||
void setViewMenuInsertionOrder(ads::CDockManager::eViewMenuInsertionOrder Order);
|
||||
bool isRestoringState() const;
|
||||
static int startDragDistance();
|
||||
ads::CDockWidget* focusedDockWidget() const;
|
||||
QList<int> splitterSizes(ads::CDockAreaWidget *ContainedArea) const;
|
||||
void setSplitterSizes(ads::CDockAreaWidget *ContainedArea, const QList<int>& sizes);
|
||||
|
||||
public slots:
|
||||
void openPerspective(const QString& PerspectiveName);
|
||||
|
@ -35,6 +35,8 @@ public:
|
||||
virtual bool event(QEvent *e);
|
||||
void setElideMode(Qt::TextElideMode mode);
|
||||
void updateStyle();
|
||||
QSize iconSize() const;
|
||||
void setIconSize(const QSize& Size);
|
||||
|
||||
public slots:
|
||||
virtual void setVisible(bool visible);
|
||||
|
@ -917,15 +917,15 @@ bool DockContainerWidgetPrivate::restoreSplitter(CDockingStateReader& s,
|
||||
{
|
||||
QWidget* ChildNode = nullptr;
|
||||
bool Result = true;
|
||||
if (s.name() == "Splitter")
|
||||
if (s.name() == QLatin1String("Splitter"))
|
||||
{
|
||||
Result = restoreSplitter(s, ChildNode, Testing);
|
||||
}
|
||||
else if (s.name() == "Area")
|
||||
else if (s.name() == QLatin1String("Area"))
|
||||
{
|
||||
Result = restoreDockArea(s, ChildNode, Testing);
|
||||
}
|
||||
else if (s.name() == "Sizes")
|
||||
else if (s.name() == QLatin1String("Sizes"))
|
||||
{
|
||||
QString sSizes = s.readElementText().trimmed();
|
||||
ADS_PRINT("Sizes: " << sSizes);
|
||||
@ -1026,7 +1026,7 @@ bool DockContainerWidgetPrivate::restoreDockArea(CDockingStateReader& s,
|
||||
|
||||
while (s.readNextStartElement())
|
||||
{
|
||||
if (s.name() != "Widget")
|
||||
if (s.name() != QLatin1String("Widget"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -1089,12 +1089,12 @@ bool DockContainerWidgetPrivate::restoreChildNodes(CDockingStateReader& s,
|
||||
bool Result = true;
|
||||
while (s.readNextStartElement())
|
||||
{
|
||||
if (s.name() == "Splitter")
|
||||
if (s.name() == QLatin1String("Splitter"))
|
||||
{
|
||||
Result = restoreSplitter(s, CreatedWidget, Testing);
|
||||
ADS_PRINT("Splitter");
|
||||
}
|
||||
else if (s.name() == "Area")
|
||||
else if (s.name() == QLatin1String("Area"))
|
||||
{
|
||||
Result = restoreDockArea(s, CreatedWidget, Testing);
|
||||
ADS_PRINT("DockAreaWidget");
|
||||
@ -1664,7 +1664,7 @@ bool CDockContainerWidget::restoreState(CDockingStateReader& s, bool Testing)
|
||||
if (IsFloating)
|
||||
{
|
||||
ADS_PRINT("Restore floating widget");
|
||||
if (!s.readNextStartElement() || s.name() != "Geometry")
|
||||
if (!s.readNextStartElement() || s.name() != QLatin1String("Geometry"))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -250,7 +250,7 @@ bool DockManagerPrivate::restoreStateFromXml(const QByteArray &state, int versi
|
||||
}
|
||||
CDockingStateReader s(state);
|
||||
s.readNextStartElement();
|
||||
if (s.name() != "QtAdvancedDockingSystem")
|
||||
if (s.name() != QLatin1String("QtAdvancedDockingSystem"))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -304,7 +304,7 @@ bool DockManagerPrivate::restoreStateFromXml(const QByteArray &state, int versi
|
||||
int DockContainerCount = 0;
|
||||
while (s.readNextStartElement())
|
||||
{
|
||||
if (s.name() == "Container")
|
||||
if (s.name() == QLatin1String("Container"))
|
||||
{
|
||||
Result = restoreContainer(DockContainerCount, s, Testing);
|
||||
if (!Result)
|
||||
|
@ -806,10 +806,15 @@ void CDockOverlayCross::setIconColors(const QString& Colors)
|
||||
{"Arrow", CDockOverlayCross::ArrowColor},
|
||||
{"Shadow", CDockOverlayCross::ShadowColor}};
|
||||
|
||||
auto ColorList = Colors.split(' ', QString::SkipEmptyParts);
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
auto SkipEmptyParts = QString::SkipEmptyParts;
|
||||
#else
|
||||
auto SkipEmptyParts = Qt::SkipEmptyParts;
|
||||
#endif
|
||||
auto ColorList = Colors.split(' ', SkipEmptyParts);
|
||||
for (const auto& ColorListEntry : ColorList)
|
||||
{
|
||||
auto ComponentColor = ColorListEntry.split('=', QString::SkipEmptyParts);
|
||||
auto ComponentColor = ColorListEntry.split('=', SkipEmptyParts);
|
||||
int Component = ColorCompenentStringMap.value(ComponentColor[0], -1);
|
||||
if (Component < 0)
|
||||
{
|
||||
|
@ -31,7 +31,7 @@
|
||||
|
||||
#include <QDebug>
|
||||
#include <QChildEvent>
|
||||
|
||||
#include <QVariant>
|
||||
#include "DockAreaWidget.h"
|
||||
|
||||
namespace ads
|
||||
@ -52,7 +52,7 @@ CDockSplitter::CDockSplitter(QWidget *parent)
|
||||
: QSplitter(parent),
|
||||
d(new DockSplitterPrivate(this))
|
||||
{
|
||||
setProperty("ads-splitter", true);
|
||||
setProperty("ads-splitter", QVariant(true));
|
||||
setChildrenCollapsible(false);
|
||||
}
|
||||
|
||||
|
@ -259,7 +259,7 @@ void DockWidgetTabPrivate::createLayout()
|
||||
void DockWidgetTabPrivate::moveTab(QMouseEvent* ev)
|
||||
{
|
||||
ev->accept();
|
||||
QPoint Distance = ev->globalPos() - GlobalDragStartMousePosition;
|
||||
QPoint Distance = internal::globalPositionOf(ev) - GlobalDragStartMousePosition;
|
||||
Distance.setY(0);
|
||||
auto TargetPos = Distance + TabDragStartPosition;
|
||||
TargetPos.rx() = qMax(TargetPos.x(), 0);
|
||||
@ -351,7 +351,7 @@ void CDockWidgetTab::mousePressEvent(QMouseEvent* ev)
|
||||
if (ev->button() == Qt::LeftButton)
|
||||
{
|
||||
ev->accept();
|
||||
d->saveDragStartMousePosition(ev->globalPos());
|
||||
d->saveDragStartMousePosition(internal::globalPositionOf(ev));
|
||||
d->DragState = DraggingMousePressed;
|
||||
emit clicked();
|
||||
return;
|
||||
@ -377,7 +377,7 @@ void CDockWidgetTab::mouseReleaseEvent(QMouseEvent* ev)
|
||||
// End of tab moving, emit signal
|
||||
if (d->DockArea)
|
||||
{
|
||||
emit moved(ev->globalPos());
|
||||
emit moved(internal::globalPositionOf(ev));
|
||||
}
|
||||
break;
|
||||
|
||||
@ -422,7 +422,7 @@ void CDockWidgetTab::mouseMoveEvent(QMouseEvent* ev)
|
||||
auto MappedPos = mapToParent(ev->pos());
|
||||
bool MouseOutsideBar = (MappedPos.x() < 0) || (MappedPos.x() > parentWidget()->rect().right());
|
||||
// Maybe a fixed drag distance is better here ?
|
||||
int DragDistanceY = qAbs(d->GlobalDragStartMousePosition.y() - ev->globalPos().y());
|
||||
int DragDistanceY = qAbs(d->GlobalDragStartMousePosition.y() - internal::globalPositionOf(ev).y());
|
||||
if (DragDistanceY >= CDockManager::startDragDistance() || MouseOutsideBar)
|
||||
{
|
||||
// If this is the last dock area in a dock container with only
|
||||
@ -454,7 +454,7 @@ void CDockWidgetTab::mouseMoveEvent(QMouseEvent* ev)
|
||||
return;
|
||||
}
|
||||
else if (d->DockArea->openDockWidgetsCount() > 1
|
||||
&& (ev->globalPos() - d->GlobalDragStartMousePosition).manhattanLength() >= QApplication::startDragDistance()) // Wait a few pixels before start moving
|
||||
&& (internal::globalPositionOf(ev) - d->GlobalDragStartMousePosition).manhattanLength() >= QApplication::startDragDistance()) // Wait a few pixels before start moving
|
||||
{
|
||||
// If we start dragging the tab, we save its inital position to
|
||||
// restore it later
|
||||
@ -618,7 +618,7 @@ void CDockWidgetTab::mouseDoubleClickEvent(QMouseEvent *event)
|
||||
if ((!d->DockArea->dockContainer()->isFloating() || d->DockArea->dockWidgetsCount() > 1)
|
||||
&& d->DockWidget->features().testFlag(CDockWidget::DockWidgetFloatable))
|
||||
{
|
||||
d->saveDragStartMousePosition(event->globalPos());
|
||||
d->saveDragStartMousePosition(internal::globalPositionOf(event));
|
||||
d->startFloating(DraggingInactive);
|
||||
}
|
||||
|
||||
|
@ -163,7 +163,12 @@ void CElidingLabel::resizeEvent(QResizeEvent *event)
|
||||
//============================================================================
|
||||
QSize CElidingLabel::minimumSizeHint() const
|
||||
{
|
||||
if (pixmap() != nullptr || d->isModeElideNone())
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
bool HasPixmap = !pixmap().isNull();
|
||||
#else
|
||||
bool HasPixmap = (pixmap() != nullptr);
|
||||
#endif
|
||||
if (HasPixmap || d->isModeElideNone())
|
||||
{
|
||||
return QLabel::minimumSizeHint();
|
||||
}
|
||||
@ -180,7 +185,12 @@ QSize CElidingLabel::minimumSizeHint() const
|
||||
//============================================================================
|
||||
QSize CElidingLabel::sizeHint() const
|
||||
{
|
||||
if (pixmap() != nullptr || d->isModeElideNone())
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
bool HasPixmap = !pixmap().isNull();
|
||||
#else
|
||||
bool HasPixmap = (pixmap() != nullptr);
|
||||
#endif
|
||||
if (HasPixmap || d->isModeElideNone())
|
||||
{
|
||||
return QLabel::sizeHint();
|
||||
}
|
||||
|
@ -58,8 +58,8 @@ protected:
|
||||
public:
|
||||
using Super = QLabel;
|
||||
|
||||
CElidingLabel(QWidget* parent = 0, Qt::WindowFlags f = 0);
|
||||
CElidingLabel(const QString& text, QWidget* parent = 0, Qt::WindowFlags f = 0);
|
||||
CElidingLabel(QWidget* parent = 0, Qt::WindowFlags f = Qt::WindowFlags ());
|
||||
CElidingLabel(const QString& text, QWidget* parent = 0, Qt::WindowFlags f = Qt::WindowFlags ());
|
||||
virtual ~CElidingLabel();
|
||||
|
||||
/**
|
||||
|
@ -733,8 +733,11 @@ void CFloatingDockContainer::changeEvent(QEvent *event)
|
||||
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
//============================================================================
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
bool CFloatingDockContainer::nativeEvent(const QByteArray &eventType, void *message, long *result)
|
||||
#else
|
||||
bool CFloatingDockContainer::nativeEvent(const QByteArray &eventType, void *message, qintptr *result)
|
||||
#endif
|
||||
{
|
||||
QWidget::nativeEvent(eventType, message, result);
|
||||
MSG *msg = static_cast<MSG*>(message);
|
||||
|
@ -194,7 +194,11 @@ protected: // reimplements QWidget
|
||||
/**
|
||||
* Native event filter for handling WM_MOVING messages on Windows
|
||||
*/
|
||||
virtual bool nativeEvent(const QByteArray &eventType, void *message, long *result) override;
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
virtual bool nativeEvent(const QByteArray &eventType, void *message, long *result) override;
|
||||
#else
|
||||
virtual bool nativeEvent(const QByteArray &eventType, void *message, qintptr *result) override;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include <QWidget>
|
||||
#include <QDebug>
|
||||
#include <QStyle>
|
||||
#include <QMouseEvent>
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
#include <xcb/xcb.h>
|
||||
@ -179,7 +180,7 @@ void hideEmptyParentSplitters(CDockSplitter* FirstParentSplitter);
|
||||
class CDockInsertParam : public QPair<Qt::Orientation, bool>
|
||||
{
|
||||
public:
|
||||
using QPair::QPair;
|
||||
using QPair<Qt::Orientation, bool>::QPair;
|
||||
Qt::Orientation orientation() const {return this->first;}
|
||||
bool append() const {return this->second;}
|
||||
int insertOffset() const {return append() ? 1 : 0;}
|
||||
@ -260,6 +261,19 @@ void setToolTip(QObjectPtr obj, const QString &tip)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Helper function for access to mouse event global position in Qt5 and
|
||||
*/
|
||||
inline QPoint globalPositionOf(QMouseEvent* ev)
|
||||
{
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
return ev->globalPosition().toPoint();
|
||||
#else
|
||||
return ev->globalPos();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Helper function to set the icon of a certain button.
|
||||
* Use this function to set the icons for the dock area and dock widget buttons.
|
||||
|
Loading…
Reference in New Issue
Block a user