Compare commits

..

54 Commits

Author SHA1 Message Date
Uwe Kindler
8d4507e9d8 Fixed mouse pressed state for Linux (use memeber variable instead of static) 2023-06-30 11:28:11 +02:00
Uwe Kindler
5a00eece87 Added QQuickWidget to demo application for testing OpenGl QtQuick on Linux 2023-06-30 08:27:51 +02:00
Uwe Kindler
09e4e6fa5a Fixed nullptr access in DockWidgetTab 2023-06-27 10:18:38 +02:00
Uwe Kindler
34cc91a9af Fixed #527 - updateDockWidgetFocusStyle() function error 2023-06-23 21:06:52 +02:00
Uwe Kindler
36cdf4a252 Fixed warnings on MacOS: replaced QApplication::setActiveWindow(this); with QWidget::activateWindow 2023-06-23 10:28:55 +02:00
Uwe Kindler
85f65b3f1a Avoid multiple function calls of parentWidget() function in CAutoHideSideBar::visibleTabCount() and CAutoHideSideBar::hasVisibleTabs() 2023-06-23 10:21:08 +02:00
Ahmad Syarifuddin
92da2eb8bd Bug fix sidebar state during restore (#526)
* fix side bar state being incorrect during restore

* isVisible is invalid during restore state

* Make visibleTabCount function consistent with hasVisibleTabs. Add a bit of documentation.

---------

Co-authored-by: Syarif Fakhri <fakhri.s@duerr-ndt.com>
2023-06-23 09:15:24 +02:00
Uwe Kindler
27edfe63ee Fixed issue #524: Sometimes sidebar visibility state is incorrect 2023-06-22 14:45:29 +02:00
Uwe Kindler
5517822008 Updated README.md with information about filing PySide related issues 2023-06-19 10:25:32 +02:00
Uwe Kindler
702702cbfd Merge branch '7c0o-master' 2023-06-19 10:03:56 +02:00
Uwe Kindler
c552fef134 Added documentation for the queued _this->ensureWidgetVisible(TabWidget) call 2023-06-19 10:02:19 +02:00
Eric Wong
916df28fcd Update FloatingDockContainer.cpp
remove dock container
2023-06-16 17:37:31 +08:00
Eric Wong
c08d91687a Update FloatingDockContainer.cpp
saveState() may use the floatingDockContainer to be deleted
2023-06-14 12:07:45 +08:00
Eric Wong
ccbde05fb7 Update DockAreaWidget.cpp
memory leak
2023-06-14 09:42:47 +08:00
Eric Wong
1049576349 Update DockAreaTabBar.cpp
Sometimes the synchronous calculation of the rectangular area fails
2023-06-08 09:13:41 +08:00
Uwe Kindler
0bfee09b17 Merge branch 'master' of https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System 2023-06-06 15:26:21 +02:00
Uwe Kindler
87954e4459 Merged #518 - Add more options to determine the minimum size of a dock widget 2023-06-06 15:25:49 +02:00
githubuser0xFFFF
0301e345b4 Update linux-builds.yml 2023-05-12 19:32:39 +02:00
Uwe Kindler
f9b5ef8d89 Remove Ubuntu 18.04 from linux-builds 2023-05-09 13:36:42 +02:00
Uwe Kindler
0ed1f8f429 Fixed linux-builds.yml file 2023-05-08 10:32:58 +02:00
Uwe Kindler
659537916e Added documentation of new AutoHideCloseButtonCollapsesDock flag 2023-04-28 12:24:12 +02:00
Uwe Kindler
0cac9ac507 Merge branch 'close_button_collapse_dock' of https://github.com/duerr-ndt/Qt-Advanced-Docking-System into duerr-ndt-close_button_collapse_dock 2023-04-28 11:49:17 +02:00
Uwe Kindler
7a79ecab8a Fixed #511 - CDockWidget::toggleView now properly shows auto hide widgets 2023-04-28 11:47:01 +02:00
Uwe Kindler
1186d2b78c Fixed #509 - Implemented support for restoring maximized state of floating widgets on Windows 2023-04-28 11:12:22 +02:00
Syarif Fakhri
b46768537a Add config to make close button collapse auto hide dock 2023-04-28 15:27:22 +08:00
Uwe Kindler
44115d4bd9 Added support for printing events to diagnose window state ploblem 2023-04-28 08:33:45 +02:00
Uwe Kindler
f2d8e17981 Merge branch 'master' of https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System 2023-04-27 23:38:19 +02:00
Uwe Kindler
7890a408f4 Added KDE LabPlot to the showcase section 2023-04-27 23:38:05 +02:00
Murmele
a940fc29c6 Use code also for other unix systems like BSD (#507) 2023-04-18 19:17:10 +02:00
Murmele
c6595563af if QT_VERSION_MAJOR is defined, use this version instead of searching again. Labplot does not support Qt6 yet and therefore the version is set manually in the project. If Qt5 and Qt6 are installed, QAd overwrites the Qt5 requirement and then the configuration of the project does not work (#504) 2023-04-16 11:32:45 +02:00
Uwe Kindler
cb24317010 Merge branch 'master' of https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System 2023-04-11 08:31:26 +02:00
Uwe Kindler
fb1e427ab7 Added DREAM.3D NX to showcase section 2023-04-11 08:30:25 +02:00
Nicolas Elie
9d28a4d0d5 Fix typo in pyproject.toml (#501) 2023-04-08 09:08:01 +02:00
Uwe Kindler
df34b0eb2b An additional fix for #496 Nonfloatable hidden window disappears on drop in empty area 2023-03-22 18:22:34 +01:00
Uwe Kindler
db3dc80170 Fixed #496 Nonfloatable hidden window disappears on drop in empty area 2023-03-21 08:31:55 +01:00
Nicolas Elie
db16c5f1b5 Update python bindings to 4.0.2 (#495)
* start adaption of PyQt5 bindings to Qt-ADS 4.0

* Update PyQt bindings

* Fix Python bindings build on Linux

---------

Co-authored-by: Mira Weller <mweller@seemoo.tu-darmstadt.de>
2023-03-21 06:04:19 +01:00
Nicolas Elie
d28ca1e7a1 Add options to project.py to specify include and library directories (#493) 2023-03-11 08:34:23 +01:00
Nicolas Elie
e84b4a8146 Add namespace to default argument for python bindings (#492) 2023-03-06 14:53:43 +01:00
Nicolas Elie
46e0d832f8 Fix wrong include path in CMake install (#491) 2023-03-06 14:52:57 +01:00
Uwe Kindler
7e63919c08 Updated ads icons 2023-03-01 08:54:27 +01:00
Uwe Kindler
1873dde358 Added ADTF to showcase section and added video link for Resinsight to showcase section 2023-03-01 08:49:19 +01:00
Uwe Kindler
6362d14da6 Merge branch 'master' of https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System 2023-02-27 08:03:08 +01:00
Uwe Kindler
1f48f0f3ad Updated linux-builds.yml to fix broken Ubuntu 22.04 workflow 2023-02-27 07:51:39 +01:00
Nicolas Elie
82695d1b3d Remove setup.py and related files (#490) 2023-02-23 18:42:47 +01:00
Nicolas Elie
08b0f8ad54 Change targets name based on Qt version (#489) 2023-02-23 15:50:50 +01:00
githubuser0xFFFF
54c2bd0c30 Update linux-builds.yml 2023-02-10 14:55:18 +01:00
githubuser0xFFFF
d8784a22b7 Update linux-builds.yml 2023-02-10 14:09:02 +01:00
githubuser0xFFFF
bc9f136f20 Update linux-builds.yml 2023-02-10 13:58:03 +01:00
githubuser0xFFFF
7192a06eb8 Update linux-builds.yml 2023-02-10 13:42:31 +01:00
githubuser0xFFFF
a4c6f1d16c Update linux-builds.yml 2023-02-10 13:30:41 +01:00
githubuser0xFFFF
009af32e61 Update linux-builds.yml
added Ubuntu 22.04 build with Qt6
2023-02-10 13:25:58 +01:00
Uwe Kindler
fab41828ab Updated the build documentation for Ubuntu 22.04 2023-02-10 12:02:42 +01:00
Uwe Kindler
cae42939c8 Disable native windows on Linux if wayland is used 2023-02-10 11:36:40 +01:00
Uwe Kindler
7b30322946 Added ResInsight to showcase section 2023-01-24 16:07:00 +01:00
65 changed files with 820 additions and 2475 deletions

View File

@@ -6,7 +6,7 @@ jobs:
build:
strategy:
matrix:
os: [ubuntu-20.04, ubuntu-18.04]
os: [ubuntu-20.04]
runs-on: ${{ matrix.os }}
@@ -21,3 +21,39 @@ jobs:
run: qmake
- name: make
run: make -j4
build_ubuntu_2204:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- name: Cache Qt
id: cache-qt-6-4
uses: actions/cache@v1 # not v2!
with:
path: ../Qt/6.4.2
key: ${{ runner.os }}-QtCache-Qt6-4
- name: Install Qt
uses: jurplel/install-qt-action@v2
with:
version: '6.4.2'
host: 'linux'
target: 'desktop'
install-deps: true
cached: ${{ steps.cache-qt-6-4.outputs.cache-hit }}
setup-python: true
tools: ''
tools-only: false
- name: Install needed xkbcommon symlink
run: sudo apt-get install libxkbcommon-dev -y
- name: Ubuntu and Qt version
run: |
cat /etc/issue
echo number of processors: $(nproc)
qmake -v
- name: qmake
run: qmake
- name: make
run: make -j$(nproc)

View File

@@ -98,6 +98,9 @@ know it from Visual Studio.
- [macOS](#macos)
- [Linux](#linux)
- [Build](#build)
- [Qt5 on Ubuntu 18.04 or 20.04](#qt5-on-ubuntu-1804-or-2004)
- [Qt5 on Ubuntu 22.04](#qt5-on-ubuntu-2204)
- [Qt6 on Ubuntu 22.04](#qt6-on-ubuntu-2204)
- [Getting started / Example](#getting-started--example)
- [License information](#license-information)
- [Donation](#donation)
@@ -114,6 +117,10 @@ know it from Visual Studio.
- [MetGem](#metgem)
- [PRE Workbench](#pre-workbench)
- [RDE Robox Development Environment](#rde--robox-development-environment)
- [ResInsight](#resinsight)
- [ADTF 3](#adtf-3)
- [DREAM.3D NX](#dream3d-nx)
- [LabPlot](#labplot)
- [Alternative Docking System Implementations](#alternative-docking-system-implementations)
- [KDDockWidgets](#kddockwidgets)
- [QtitanDocking](#qtitandocking)
@@ -249,7 +256,7 @@ The PySide6 bindings were contributed by:
- [mborgerson](https://github.com/mborgerson)
For more information about the PySide6 bindings read [this](https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/issues/298) issue.
Please file PySide6-QtAds-specific issues on its [pyside6_qtads](https://github.com/mborgerson/pyside6_qtads) fork for tracking. For more information about the PySide6 bindings read [this](https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/issues/298) issue.
### PyQt5
@@ -291,10 +298,13 @@ The application can be compiled for macOS. A user reported, that the library wor
[![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)
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:
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 some Linux distributions. Depending on the used window manager or compositor, dock widgets
with native title bars are supported or not. If native title bars are not supported,
the library switches to `QWidget` based title bars.
- **Kubuntu 18.04 and 19.10**
- **Ubuntu 18.04, 19.10 and 20.04**
- **Kubuntu 18.04 and 19.10** - uses KWin - no native title bars
- **Ubuntu 18.04, 19.10 and 20.04** - native title bars are supported
- **Ubuntu 22.04** - uses Wayland -> no native title bars
There are some requirements for the Linux distribution that have to be met:
@@ -309,10 +319,25 @@ Screenshot Ubuntu:
## Build
The Linux build requires private header files. Make sure that they are installed:
The Linux build requires private header files. Make sure that they are installed.
The library uses SVG icons, so ensure that Qt SVG support is installed.
### Qt5 on Ubuntu 18.04 or 20.04
```bash
sudo apt install qtbase5-private-dev
sudo apt install qt5-default qtbase5-private-dev
```
### Qt5 on Ubuntu 22.04
```bash
sudo apt install qtbase5-dev qtbase5-private-dev qtbase5-dev-tools libqt5svg5
```
### Qt6 on Ubuntu 22.04
```bash
sudo apt install qt6-base-dev qt6-base-private-dev qt6-tools-dev libqt6svg6
```
Open the `ads.pro` file with QtCreator and start the build, that's it.
@@ -538,13 +563,65 @@ development experience.
![RDE](doc/showcase_robox_ide.png)
### [ResInsight](https://www.ceetronsolutions.com/projects/resinsight)
ResInsight as a software from Ceetron Solutions for visualization of oil and
gas reservoir simulation data. It allows reservoir models, simulation results,
and measurements to be visualized with very high performance. Optimized use of
graphics technology and simultaneous processing on multiple CPU cores have been
vital to enhance the performance and capacity of ResInsight for large data sets.
The Advanced Docking System has empowered Ceetron to build a much more intuitive
user interface for its ResInsight users.
[read more...](https://resinsight.org/)
[![ResInsight](doc/showcase_resinsight.png)](https://www.youtube.com/watch?v=HzLaQ1p6AUc)
### [ADTF 3](https://www.digitalwerk.net/adtf/)
The Automotive Data and Time-Triggered Framework was designed as a Rapid Prototyping Toolset, Simulation Framework and Test- and Measurement Tool. It is meant for:
- Developing and testing ADAS and HAD components
- Recording of vehicle data for visualisation
- Simulation of complex scenarios in SIL/HIL test environments
The software features time-based processing of multiple data streams and graphical editing of dynamic filter graphs. It also includes an SDK for custom plug-ins and reusable components, as well as components for data visualization in both 2D and 3D. This is was the
[manual](https://support.digitalwerk.net/adtf/v3/adtf_html/page_adtf_xsystem_plugin.html)
says about the switch to Qt Advanced Docking:
> After several minor improvements the Qt5 ADTF XSystem uses the Advanced Docking System for Qt since ADTF 3.10.0 for more convenience and usability regarding layouting, docking and embedding several widgets.
[read more...](https://support.digitalwerk.net/adtf/v3/adtf_html/index.html)
![ADTF](doc/showcase_adtf.png)
### [DREAM.3D NX](https://github.com/BlueQuartzSoftware/DREAM3D)
DREAM.3D *(Digital Representation Environment for Analysis of Materials in 3D)* is an open source, cross-platform and modular, software suite that allows users to prepare, reconstruct, quantify, instantiate, and mesh, multidimensional, multimodal microstructural data, as well as many other applications.
[BlueQuartz Software](http://www.bluequartz.net/) is currently completely rewriting the DREAM.3D application. For the upcoming version **[DREAM3D NX](http://www.dream3d.io/)** they improved the UI by using the Advanced Docking System. An [early version](http://www.dream3d.io/) of **DREAM3D NX** with ADS is already available to any user who would like to take the brand new version out for a spin.
![DREAM.3D NX](doc/showcase_dream3d_nx.png)
[read more...](http://dream3d.bluequartz.net/)
### [LabPlot](https://labplot.kde.org/)
KDE LabPlot is the ultimate free, open source and cross-platform tool for scientists, engineers, and students who need to analyze and visualize data. With its intuitive interface and powerful features, you can create stunning plots and diagrams with ease. Whether you're working with CSV, FITS, or HDF5 data, KDE LabPlot makes it simple to import and analyze your data.
The LabPlot project recently switched to the Qt Advanced Docking System for their user interface. This switch represents a significant improvement to the LabPlot software, allowing users to create and manage complex data visualization layouts with ease.
![LabPlot](doc/showcase_labplot.png)
[read more...](https://labplot.kde.org/)
## Alternative Docking System Implementations
If this Qt Advanced Docking System does not fit to your needs you may consider some of the alternative docking system solutions for Qt.
### KDDockWidgets
This is an advanced docking framework for Qt from [KDAB](https://www.kdab.com/). The interesting thing is, that they separated GUI code from logic, so they can easily provide a QtQuick backend in the future.
This is an advanced docking framework for Qt from [KDAB](https://www.kdab.com/). The interesting thing is, that they separated GUI code from logic, so they can easily provide a QtQuick backend in the future.
- [Blog post about KDDockWidgets](https://www.kdab.com/kddockwidgets/)
- [GitHub project](https://github.com/KDAB/KDDockWidgets)

View File

@@ -25,7 +25,7 @@ target_link_libraries(AdvancedDockingSystemDemo PUBLIC Qt${QT_VERSION_MAJOR}::Co
if(WIN32 AND QT_VERSION_MAJOR LESS 6)
target_link_libraries(AdvancedDockingSystemDemo PUBLIC Qt${QT_VERSION_MAJOR}::AxContainer)
endif()
target_link_libraries(AdvancedDockingSystemDemo PRIVATE qtadvanceddocking)
target_link_libraries(AdvancedDockingSystemDemo PRIVATE qt${QT_VERSION_MAJOR}advanceddocking)
set_target_properties(AdvancedDockingSystemDemo PROPERTIES
AUTOMOC ON
AUTORCC ON

View File

@@ -62,6 +62,7 @@
#include <QPointer>
#include <QMap>
#include <QElapsedTimer>
#include <QQuickWidget>
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
@@ -407,6 +408,17 @@ struct MainWindowPrivate
return DockWidget;
}
/**
* Create QQuickWidget for test for OpenGL and QQuick
*/
ads::CDockWidget *createQQuickWidget()
{
QQuickWidget *widget = new QQuickWidget();
ads::CDockWidget *dockWidget = new ads::CDockWidget("Quick");
dockWidget->setWidget(widget);
return dockWidget;
}
#ifdef Q_OS_WIN
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
@@ -424,7 +436,6 @@ struct MainWindowPrivate
}
#endif
#endif
};
//============================================================================
@@ -557,6 +568,11 @@ void MainWindowPrivate::createContent()
// Create image viewer
DockWidget = createImageViewer();
DockManager->addDockWidget(ads::LeftDockWidgetArea, DockWidget);
// Create quick widget
DockWidget = createQQuickWidget();
DockWidget->setFeature(ads::CDockWidget::DockWidgetClosable, true);
DockManager->addDockWidget(ads::LeftDockWidgetArea, DockWidget);
}
@@ -734,7 +750,7 @@ CMainWindow::CMainWindow(QWidget *parent) :
CDockManager::setConfigFlag(CDockManager::FocusHighlighting, true);
// uncomment if you would like to enable dock widget auto hiding
CDockManager::setAutoHideConfigFlags(CDockManager::DefaultAutoHideConfig);
CDockManager::setAutoHideConfigFlags({CDockManager::DefaultAutoHideConfig});
// uncomment if you would like to enable an equal distribution of the
// available size of a splitter to all contained dock widgets

View File

@@ -2,7 +2,7 @@ ADS_OUT_ROOT = $${OUT_PWD}/..
TARGET = AdvancedDockingSystemDemo
DESTDIR = $${ADS_OUT_ROOT}/lib
QT += core gui widgets
QT += core gui widgets quick quickwidgets
include(../ads.pri)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

BIN
doc/showcase_adtf.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 KiB

BIN
doc/showcase_dream3d_nx.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 364 KiB

BIN
doc/showcase_labplot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 KiB

BIN
doc/showcase_resinsight.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 461 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 311 KiB

After

Width:  |  Height:  |  Size: 363 KiB

View File

@@ -39,6 +39,7 @@
- [`AutoHideButtonCheckable`](#autohidebuttoncheckable)
- [`AutoHideSideBarsIconOnly`](#autohidesidebarsicononly)
- [`AutoHideShowOnMouseOver`](#autohideshowonmouseover)
- [`AutoHideCloseButtonCollapsesDock`](#autohideclosebuttoncollapsesdock)
- [DockWidget Feature Flags](#dockwidget-feature-flags)
- [`DockWidgetClosable`](#dockwidgetclosable)
- [`DockWidgetMovable`](#dockwidgetmovable)
@@ -589,6 +590,21 @@ is shown, if the user hovers over the Auto-Hide tab or if the users moves the
mouse outside of the Auto-Hide widget. Showing and hiding my mouse click still
works if this feature is enabled.
### `AutoHideCloseButtonCollapsesDock`
Some users don't understand the distinction between closing an auto hide dock and
collapsing an auto hide dock. This may lead to situations where they press the
close button (losing the side tab widget) instead of simply clicking outside
the auto hide dock (collapsing the dock).
![AutoHideCloseButtonCollapsesDock false](cfg_flag_AutoHideCloseButtonCollapsesDock_false.gif)
If `AutoHideCloseButtonCollapsesDock` option is active, the
close button in an auto hide widget collapses the auto hide widget instead of
closing it.
![AutoHideCloseButtonCollapsesDock true](cfg_flag_AutoHideCloseButtonCollapsesDock_true.gif)
## DockWidget Feature Flags
### `DockWidgetClosable`

View File

@@ -9,7 +9,7 @@ add_executable(AutoHideExample WIN32
mainwindow.ui
)
target_include_directories(AutoHideExample PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../src")
target_link_libraries(AutoHideExample PRIVATE qtadvanceddocking)
target_link_libraries(AutoHideExample PRIVATE qt${QT_VERSION_MAJOR}advanceddocking)
target_link_libraries(AutoHideExample PUBLIC Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::Gui
Qt${QT_VERSION_MAJOR}::Widgets)

View File

@@ -9,7 +9,7 @@ add_executable(CentralWidgetExample WIN32
mainwindow.ui
)
target_include_directories(CentralWidgetExample PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../src")
target_link_libraries(CentralWidgetExample PRIVATE qtadvanceddocking)
target_link_libraries(CentralWidgetExample PRIVATE qt${QT_VERSION_MAJOR}advanceddocking)
target_link_libraries(CentralWidgetExample PUBLIC Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::Gui
Qt${QT_VERSION_MAJOR}::Widgets)

View File

@@ -7,7 +7,7 @@ add_executable(DeleteOnCloseTest WIN32
main.cpp
)
target_include_directories(DeleteOnCloseTest PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../src")
target_link_libraries(DeleteOnCloseTest PRIVATE qtadvanceddocking)
target_link_libraries(DeleteOnCloseTest PRIVATE qt${QT_VERSION_MAJOR}advanceddocking)
target_link_libraries(DeleteOnCloseTest PUBLIC Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::Gui
Qt${QT_VERSION_MAJOR}::Widgets)

View File

@@ -12,7 +12,7 @@ add_executable(DockInDockExample WIN32
mainframe.cpp
)
target_include_directories(DockInDockExample PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../src")
target_link_libraries(DockInDockExample PRIVATE qtadvanceddocking)
target_link_libraries(DockInDockExample PRIVATE qt${QT_VERSION_MAJOR}advanceddocking)
target_link_libraries(DockInDockExample PUBLIC Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::Gui
Qt${QT_VERSION_MAJOR}::Widgets)

View File

@@ -9,7 +9,7 @@ add_executable(EmptyDockAreaExample WIN32
mainwindow.ui
)
target_include_directories(EmptyDockAreaExample PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../src")
target_link_libraries(EmptyDockAreaExample PRIVATE qtadvanceddocking)
target_link_libraries(EmptyDockAreaExample PRIVATE qt${QT_VERSION_MAJOR}advanceddocking)
target_link_libraries(EmptyDockAreaExample PUBLIC Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::Gui
Qt${QT_VERSION_MAJOR}::Widgets)

View File

@@ -9,7 +9,7 @@ add_executable(HideShowExample WIN32
MainWindow.ui
)
target_include_directories(HideShowExample PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../src")
target_link_libraries(HideShowExample PRIVATE qtadvanceddocking)
target_link_libraries(HideShowExample PRIVATE qt${QT_VERSION_MAJOR}advanceddocking)
target_link_libraries(HideShowExample PUBLIC Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::Gui
Qt${QT_VERSION_MAJOR}::Widgets)

View File

@@ -9,7 +9,7 @@ add_executable(SidebarExample WIN32
MainWindow.ui
)
target_include_directories(SidebarExample PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../src")
target_link_libraries(SidebarExample PRIVATE qtadvanceddocking)
target_link_libraries(SidebarExample PRIVATE qt${QT_VERSION_MAJOR}advanceddocking)
target_link_libraries(SidebarExample PUBLIC Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::Gui
Qt${QT_VERSION_MAJOR}::Widgets)

View File

@@ -9,7 +9,7 @@ add_executable(SimpleExample WIN32
MainWindow.ui
)
target_include_directories(SimpleExample PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../src")
target_link_libraries(SimpleExample PRIVATE qtadvanceddocking)
target_link_libraries(SimpleExample PRIVATE qt${QT_VERSION_MAJOR}advanceddocking)
target_link_libraries(SimpleExample PUBLIC Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::Gui
Qt${QT_VERSION_MAJOR}::Widgets)

View File

@@ -1,4 +1,5 @@
import os
import sys
from pyqtbuild import PyQtBindings, PyQtProject
from sipbuild import Option
@@ -16,12 +17,37 @@ class ads(PyQtBindings):
""" Initialise the bindings. """
super().__init__(project, 'ads')
def get_options(self):
"""Our custom options that a user can pass to sip-build."""
options = super().get_options()
options += [
Option('ads_incdir',
help='the directory containing the ads header file',
metavar='DIR'),
Option('ads_libdir',
help='the directory containing the ads library',
metavar='DIR'),
Option('ads_lib',
help='the ads library',
metavar='LIB'),
]
return options
def apply_user_defaults(self, tool):
""" Set default values for user options that haven't been set yet. """
resource_file = os.path.join(self.project.root_dir,'src','ads.qrc')
print("Adding resource file to qmake project: ", resource_file)
self.builder_settings.append('RESOURCES += '+resource_file)
if self.ads_lib is not None:
self.libraries.append(self.ads_lib)
if self.ads_incdir is not None:
self.include_dirs.append(self.ads_incdir)
if self.ads_libdir is not None:
self.library_dirs.append(self.ads_libdir)
super().apply_user_defaults(tool)

View File

@@ -1,12 +1,12 @@
# Specify the build system.
[build-system]
requires = ["sip >=6.0.2, <6.6", "PyQt-builder >=1.6, <2", "PyQt5>=5.15.4", "PyQt5-sip<13,>=12.8"]
requires = ["sip >=6.0.2, <6.3", "PyQt-builder >=1.6, <2", "PyQt5==5.15.4", "PyQt5-sip<13,>=12.8"]
build-backend = "sipbuild.api"
# Specify the PEP 566 metadata for the project.
[tool.sip.metadata]
name = "PyQtAds"
version = "3.8.2"
version = "4.0.2"
summary = "Python bindings for Qt Advanced Docking System"
home-page = "https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/"
license = "LGPL v2.1"
@@ -21,8 +21,11 @@ tag-prefix = "QtAds"
define-macros = ["ADS_SHARED_EXPORT"]
sip-file = "ads.sip"
include-dirs = ["src"]
qmake-QT = ["widgets"]
qmake-QT = ["widgets", "gui-private; platform_system == 'Linux'"]
headers = [
"src/AutoHideDockContainer.h",
"src/AutoHideSideBar.h",
"src/AutoHideTab.h",
"src/DockAreaTabBar.h",
"src/DockAreaTitleBar.h",
"src/DockAreaTitleBar_p.h",
@@ -40,10 +43,15 @@ headers = [
"src/FloatingDockContainer.h",
"src/FloatingDragPreview.h",
"src/IconProvider.h",
"src/PushButton.h",
"src/ResizeHandle.h",
"src/ads_globals.h",
# "src/linux/FloatingWidgetTitleBar.h",
"src/linux/FloatingWidgetTitleBar.h; platform_system == 'Linux'",
]
sources = [
"src/AutoHideTab.cpp",
"src/AutoHideDockContainer.cpp",
"src/AutoHideSideBar.cpp",
"src/DockAreaTabBar.cpp",
"src/DockAreaTitleBar.cpp",
"src/DockAreaWidget.cpp",
@@ -60,6 +68,8 @@ sources = [
"src/FloatingDockContainer.cpp",
"src/FloatingDragPreview.cpp",
"src/IconProvider.cpp",
"src/PushButton.cpp",
"src/ResizeHandle.cpp",
"src/ads_globals.cpp",
# "src/linux/FloatingWidgetTitleBar.cpp",
"src/linux/FloatingWidgetTitleBar.cpp; platform_system == 'Linux'",
]

View File

@@ -1,7 +0,0 @@
[versioneer]
VCS = git
style = pep440
versionfile_source = PyQtAds/_version.py
versionfile_build = PyQtAds/_version.py
tag_prefix =

396
setup.py
View File

@@ -1,396 +0,0 @@
import os
import sys
import shlex
import shutil
import subprocess
import glob
import versioneer
from setuptools import setup, find_packages
from setuptools.command.build_py import build_py
from setuptools.extension import Extension
from distutils import sysconfig, dir_util, spawn, log, cmd
from distutils.dep_util import newer
import sipdistutils
import sipconfig
from PyQt5.QtCore import PYQT_CONFIGURATION
from PyQt5.pyrcc_main import processResourceFile
MODULE_NAME = "ads"
SRC_PATH = "PyQtAds"
REQUIRE_PYQT = True
if "--conda-recipe" in sys.argv:
REQUIRE_PYQT = False
sys.argv.remove("--conda-recipe")
class HostPythonConfiguration(object):
def __init__(self):
self.platform = sys.platform
self.version = sys.hexversion>>8
self.inc_dir = sysconfig.get_python_inc()
self.venv_inc_dir = sysconfig.get_python_inc(prefix=sys.prefix)
self.module_dir = sysconfig.get_python_lib(plat_specific=1)
if sys.platform == 'win32':
self.data_dir = sys.prefix
self.lib_dir = sys.prefix +'\\libs'
else:
self.data_dir = sys.prefix + '/share'
self.lib_dir = sys.prefix + '/lib'
class TargetQtConfiguration(object):
def __init__(self, qmake):
pipe = os.popen(' '.join([qmake, '-query']))
for l in pipe:
l = l.strip()
tokens = l.split(':', 1)
if isinstance(tokens, list):
if len(tokens) != 2:
error("Unexpected output from qmake: '%s'\n" % l)
name, value = tokens
else:
name = tokens
value = None
name = name.replace('/', '_')
setattr(self, name, value)
pipe.close()
class build_ext(sipdistutils.build_ext):
description = "Builds the " + MODULE_NAME + " module."
user_options = sipdistutils.build_ext.user_options + [
('qmake-bin=', None, "Path to qmake binary"),
('sip-bin=', None, "Path to sip binary"),
('qt-include-dir=', None, "Path to Qt headers"),
('pyqt-sip-dir=', None, "Path to PyQt's SIP files"),
('pyqt-sip-flags=', None, "SIP flags used to generate PyQt bindings"),
('sip-dir=', None, "Path to module's SIP files"),
('inc-dir=', None, "Path to module's include files")
]
def initialize_options (self):
super().initialize_options()
self.qmake_bin = 'qmake'
self.sip_bin = None
self.qt_include_dir = None
self.qt_libinfix = ''
self.pyqt_sip_dir = None
self.pyqt_sip_flags = None
self.sip_files_dir = None
self.sip_inc_dir = None
self.inc_dir = None
self.pyconfig = HostPythonConfiguration()
self.qtconfig = TargetQtConfiguration(self.qmake_bin)
self.config = sipconfig.Configuration()
self.config.default_mod_dir = ("/usr/local/lib/python%i.%i/dist-packages" %
(sys.version_info.major, sys.version_info.minor))
def finalize_options (self):
super().finalize_options()
if not self.qt_include_dir:
self.qt_include_dir = self.qtconfig.QT_INSTALL_HEADERS
if not self.qt_libinfix:
try:
with open(os.path.join(self.qtconfig.QT_INSTALL_PREFIX, 'mkspecs', 'qconfig.pri'), 'r') as f:
for line in f.readlines():
if line.startswith('QT_LIBINFIX'):
self.qt_libinfix = line.split('=')[1].strip('\n').strip()
except (FileNotFoundError, IndexError):
pass
if not self.pyqt_sip_dir:
self.pyqt_sip_dir = os.path.join(self.pyconfig.data_dir, 'sip', 'PyQt5')
if not self.pyqt_sip_flags:
self.pyqt_sip_flags = PYQT_CONFIGURATION.get('sip_flags', '')
if not self.sip_files_dir:
self.sip_files_dir = os.path.abspath(os.path.join(".", "sip"))
if not self.sip_inc_dir:
self.sip_inc_dir = self.pyconfig.venv_inc_dir
if not self.inc_dir:
self.inc_dir = os.path.abspath(os.path.join(".", "src"))
if not self.qt_include_dir:
raise SystemExit('Could not find Qt5 headers. '
'Please specify via --qt-include-dir=')
if not self.pyqt_sip_dir:
raise SystemExit('Could not find PyQt SIP files. '
'Please specify containing directory via '
'--pyqt-sip-dir=')
if not self.pyqt_sip_flags:
raise SystemExit('Could not find PyQt SIP flags. '
'Please specify via --pyqt-sip-flags=')
def _find_sip(self):
"""override _find_sip to allow for manually speficied sip path."""
# 1. Manually specified sip_bin
if self.sip_bin:
return self.sip_bin
# 2. Path determined from sipconfig.Configuration()
# This may not exist, depending on conda build configuration.
sip_bin = super()._find_sip()
if os.path.exists(sip_bin):
return sip_bin
# 3. Finally, fall back to sip binary found in path
sip_bin = shutil.which('sip')
if sip_bin:
return sip_bin
raise SystemExit('Could not find PyQt SIP binary.')
def _sip_sipfiles_dir(self):
sip_dir = super()._sip_sipfiles_dir()
if os.path.exists(sip_dir):
return sip_dir
return os.path.join(sys.prefix, 'sip', 'PyQt5')
def _sip_compile(self, sip_bin, source, sbf):
target_dir = os.path.dirname(__file__) if self.inplace else self.build_lib
pyi = os.path.join(target_dir, "PyQtAds", "QtAds", "ads.pyi")
if not os.path.exists(os.path.dirname(pyi)):
os.makedirs(os.path.dirname(pyi))
cmd = [sip_bin]
if hasattr(self, 'sip_opts'):
cmd += self.sip_opts
if hasattr(self, '_sip_sipfiles_dir'):
cmd += ['-I', self._sip_sipfiles_dir()]
cmd += [
"-I", self.sip_files_dir,
"-I", self.pyqt_sip_dir,
"-I", self.sip_inc_dir,
"-I", self.inc_dir,
"-c", self._sip_output_dir(),
"-b", sbf,
"-y", pyi,
"-w", "-o"]
cmd += shlex.split(self.pyqt_sip_flags) # use same SIP flags as for PyQt5
cmd.append(source)
self.spawn(cmd)
if os.path.exists(pyi):
with open(pyi) as f:
content = f.readlines()
with open(pyi, "w") as f:
for line in content:
if not line.startswith("class ads"):
f.write(line)
def swig_sources (self, sources, extension=None):
if not self.extensions:
return
# Add the local include directory to the include path
if extension is not None:
extension.extra_compile_args += ['-D', 'QT_CORE_LIB',
'-D', 'QT_GUI_LIB',
'-D', 'QT_WIDGETS_LIB',
'-D', 'ADS_SHARED_EXPORT']
extension.include_dirs += [self.qt_include_dir, self.inc_dir,
os.path.join(self.qt_include_dir, 'QtCore'),
os.path.join(self.qt_include_dir, 'QtGui'),
os.path.join(self.qt_include_dir, 'QtWidgets')]
extension.libraries += ['Qt5Core' + self.qt_libinfix,
'Qt5Gui' + self.qt_libinfix,
'Qt5Widgets' + self.qt_libinfix]
if sys.platform == 'win32':
extension.library_dirs += [self.qtconfig.QT_INSTALL_LIBS,
self.inc_dir, self._sip_output_dir()]
elif sys.platform == 'darwin':
extension.extra_compile_args += ['-F' + self.qtconfig.QT_INSTALL_LIBS,
'-std=c++11', '-stdlib=libc++', '-mmacosx-version-min=10.9']
extension.extra_link_args += ['-F' + self.qtconfig.QT_INSTALL_LIBS,
'-mmacosx-version-min=10.9']
elif sys.platform == 'linux':
extension.extra_compile_args += ['-std=c++11']
return super().swig_sources(sources, extension)
def build_extension(self, ext):
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)
def get_moc_args(out_file, source):
if sys.platform.startswith('linux'):
return ["moc", "-D", "Q_OS_LINUX=1", "-o", out_file, source]
if sys.platform.startswith('darwin'):
return ["moc", "-D", "Q_OS_MACOS=1", "-o", out_file, source]
if sys.platform.startswith('win'):
return ["moc", "-D", "Q_OS_WIN=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:
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)
# 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()]
# Run rcc on all resource files
resources = [source for source in ext.sources if source.endswith(".qrc")]
for source in resources:
ext.sources.remove(source)
out_file = os.path.join(self.build_temp, "qrc_" + os.path.basename(source).replace(".qrc", ".cpp"))
if newer(header, out_file) or self.force:
spawn.spawn(["rcc", "-name", os.path.splitext(os.path.basename(source))[0], source, "-o", out_file], dry_run=self.dry_run)
if os.path.getsize(out_file) > 0:
ext.sources.append(out_file)
sipdistutils.build_ext.build_extension(self, ext)
import inspect
sys.path.append(os.path.join(self.build_lib, 'PyQtAds', 'QtAds'))
import ads
with open(os.path.join(self.build_lib, 'PyQtAds', 'QtAds', '__init__.py'), 'w') as f:
f.write('from .._version import *\n')
f.write('from .ads import ads\n')
for name, member in sorted(inspect.getmembers(ads.ads)):
if not name.startswith('_'):
f.write('{0} = ads.{0}\n'.format(name))
class ProcessResourceCommand(cmd.Command):
"""A custom command to compile the resource file into a Python file"""
description = "Compile the qrc file into a python file"
def initialize_options(self):
return
def finalize_options(self):
return
def run(self):
processResourceFile([os.path.join('src', 'ads.qrc')],
os.path.join(SRC_PATH, 'rc.py'), False)
class BuildPyCommand(build_py):
"""Custom build command to include ProcessResource command"""
def run(self):
self.run_command("process_resource")
build_py.run(self)
setup_requires = ["PyQt5"] if REQUIRE_PYQT else []
cpp_sources = glob.glob(os.path.join('src', '*.cpp'))
sip_sources = [os.path.join('sip', MODULE_NAME + '.sip')]
resources = [os.path.join('src', MODULE_NAME + '.qrc')]
if sys.platform == 'linux':
cpp_sources += glob.glob(os.path.join('src', 'linux', '*.cpp'))
ext_modules = [Extension('PyQtAds.QtAds.ads', cpp_sources + sip_sources + resources)]
install_requires = ["PyQt5"]
if sys.platform == 'win32':
install_requires.append("pywin32")
with open('README.md', 'r') as f:
LONG_DESCRIPTION = f.read()
setup(
name = SRC_PATH,
author = "Nicolas Elie",
author_email = "nicolas.elie@cnrs.fr",
url = "https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System",
version = versioneer.get_version(),
description = "Advanced Docking System for Qt",
long_description = LONG_DESCRIPTION,
keywords = ["qt"],
license = "LGPLv2+",
classifiers = ["Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)",
"Operating System :: OS Independent",
"Topic :: Software Development :: Libraries :: Python Modules",
"Environment :: Win32 (MS Windows)",
"Environment :: MacOS X",
"Environment :: X11 Applications :: Qt",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.2",
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7"],
ext_modules = ext_modules,
cmdclass = versioneer.get_cmdclass({'process_resource': ProcessResourceCommand,
'build_py': BuildPyCommand,
'build_ext': build_ext}),
packages = find_packages(),
setup_requires = setup_requires,
install_requires = install_requires,
zip_safe=False
)

View File

@@ -0,0 +1,46 @@
%Import QtWidgets/QtWidgetsmod.sip
%If (Qt_5_0_0 -)
namespace ads
{
class CAutoHideDockContainer : QFrame
{
%TypeHeaderCode
#include <AutoHideDockContainer.h>
%End
protected:
virtual bool eventFilter(QObject* watched, QEvent* event);
virtual void resizeEvent(QResizeEvent* event);
virtual void leaveEvent(QEvent *event);
virtual bool event(QEvent* event);
void updateSize();
void saveState(QXmlStreamWriter& Stream);
public:
CAutoHideDockContainer(ads::CDockWidget* DockWidget /Transfer/, ads::SideBarLocation area,
ads::CDockContainerWidget* parent /TransferThis/);
virtual ~CAutoHideDockContainer();
ads::CAutoHideSideBar* sideBar() const;
ads::CAutoHideTab* autoHideTab() const;
ads::CDockWidget* dockWidget() const;
void addDockWidget(ads::CDockWidget* DockWidget /Transfer/);
ads::SideBarLocation sideBarLocation() const;
void setSideBarLocation(ads::SideBarLocation SideBarLocation);
ads::CDockAreaWidget* dockAreaWidget() const;
ads::CDockContainerWidget* dockContainer() const;
void moveContentsToParent();
void cleanupAndDelete();
void toggleView(bool Enable);
void collapseView(bool Enable);
void toggleCollapseState();
void setSize(int Size);
};
};
%End

41
sip/AutoHideSideBar.sip Normal file
View File

@@ -0,0 +1,41 @@
%Import QtWidgets/QtWidgetsmod.sip
%If (Qt_5_0_0 -)
namespace ads
{
class CAutoHideSideBar : QScrollArea
{
%TypeHeaderCode
#include <AutoHideSideBar.h>
%End
protected:
virtual bool eventFilter(QObject *watched, QEvent *event);
void saveState(QXmlStreamWriter& Stream) const;
void insertTab(int Index, ads::CAutoHideTab* SideTab /Transfer/);
public:
CAutoHideSideBar(ads::CDockContainerWidget* parent /TransferThis/, SideBarLocation area);
virtual ~CAutoHideSideBar();
void removeTab(ads::CAutoHideTab* SideTab) /TransferBack/;
ads::CAutoHideDockContainer* insertDockWidget(int Index, ads::CDockWidget* DockWidget /Transfer/);
void removeAutoHideWidget(ads::CAutoHideDockContainer* AutoHideWidget) /TransferBack/;
void addAutoHideWidget(ads::CAutoHideDockContainer* AutoHideWidget);
Qt::Orientation orientation() const;
ads::CAutoHideTab* tabAt(int index) const;
int tabCount() const;
ads::SideBarLocation sideBarLocation() const;
virtual QSize minimumSizeHint() const;
virtual QSize sizeHint() const;
int spacing() const;
void setSpacing(int Spacing);
CDockContainerWidget* dockContainer() const;
};
};
%End

36
sip/AutoHideTab.sip Normal file
View File

@@ -0,0 +1,36 @@
%Import QtWidgets/QtWidgetsmod.sip
%If (Qt_5_0_0 -)
namespace ads
{
class CAutoHideTab : CPushButton
{
%TypeHeaderCode
#include <AutoHideTab.h>
%End
protected:
void setSideBar(ads::CAutoHideSideBar *SideTabBar);
void removeFromSideBar();
virtual bool event(QEvent* event);
public:
CAutoHideTab(QWidget* parent /TransferThis/ = 0);
virtual ~CAutoHideTab();
void updateStyle();
ads::SideBarLocation sideBarLocation() const;
void setOrientation(Qt::Orientation Orientation);
Qt::Orientation orientation() const;
bool isActiveTab() const;
ads::CDockWidget* dockWidget() const;
void setDockWidget(ads::CDockWidget* DockWidget);
bool iconOnly() const;
ads::CAutoHideSideBar* sideBar() const;
};
};
%End

View File

@@ -27,10 +27,12 @@ public:
virtual ~CDockAreaTitleBar();
ads::CDockAreaTabBar* tabBar() const;
QAbstractButton* button(ads::TitleBarButton which) const;
ads::CElidingLabel* autoHideTitleLabel() const;
void updateDockWidgetActionsButtons();
virtual void setVisible(bool Visible);
void insertWidget(int index, QWidget *widget /Transfer/ );
int indexOf(QWidget *widget) const;
QString titleBarButtonToolTip(ads::TitleBarButton Button) const;
signals:

View File

@@ -23,6 +23,7 @@ protected:
void updateTitleBarVisibility();
void internalSetCurrentDockWidget(ads::CDockWidget* DockWidget /Transfer/);
void markTitleBarMenuOutdated();
void updateTitleBarButtonVisibility(bool IsTopLevel) const;
protected slots:
void toggleView(bool Open);
@@ -52,6 +53,8 @@ public:
ads::CDockWidget* currentDockWidget() const;
void setCurrentDockWidget(ads::CDockWidget* DockWidget);
void saveState(QXmlStreamWriter& Stream) const;
static bool restoreState(ads::CDockingStateReader& Stream, ads::CDockAreaWidget*& CreatedWidget,
bool Testing, ads::CDockContainerWidget* ParentContainer);
ads::CDockWidget::DockWidgetFeatures features(ads::eBitwiseOperator Mode = ads::BitwiseAnd) const;
QAbstractButton* titleBarButton(ads::TitleBarButton which) const;
virtual void setVisible(bool Visible);
@@ -65,6 +68,8 @@ public:
void setDockAreaFlag(eDockAreaFlag Flag, bool On);
bool isCentralWidgetArea() const;
bool containsCentralWidget() const;
bool isTopLevelArea() const;
public slots:
void setCurrentIndex(int index);

View File

@@ -13,6 +13,7 @@ class CDockComponentsFactory
public:
virtual ~CDockComponentsFactory();
virtual CDockWidgetTab* createDockWidgetTab(CDockWidget* DockWidget /Transfer/ ) const;
virtual CAutoHideTab* createDockWidgetSideTab(CDockWidget* DockWidget /Transfer/) const;
virtual CDockAreaTabBar* createDockAreaTabBar(CDockAreaWidget* DockArea /Transfer/ ) const;
virtual CDockAreaTitleBar* createDockAreaTitleBar(CDockAreaWidget* DockArea /Transfer/ ) const;
static const CDockComponentsFactory* factory();

View File

@@ -21,6 +21,7 @@ class CDockContainerWidget : QFrame
protected:
virtual bool event(QEvent *e);
QSplitter* rootSplitter() const;
ads::CAutoHideDockContainer* createAndSetupAutoHideContainer(ads::SideBarLocation area, ads::CDockWidget* DockWidget /Transfer/);
void createRootSplitter();
void dropFloatingWidget(ads::CFloatingDockContainer* FloatingWidget, const QPoint& TargetPos);
void dropWidget(QWidget* Widget, DockWidgetArea DropArea, CDockAreaWidget* TargetAreaWidget);
@@ -33,124 +34,44 @@ protected:
ads::CDockAreaWidget* topLevelDockArea() const;
QList<ads::CDockWidget*> dockWidgets() const;
void updateSplitterHandles(QSplitter* splitter);
void registerAutoHideWidget(ads::CAutoHideDockContainer* AutoHideWidget /Transfer/);
void removeAutoHideWidget(ads::CAutoHideDockContainer* AutoHideWidget /TransferBack/);
void handleAutoHideWidgetEvent(QEvent* e, QWidget* w);
public:
/**
* Default Constructor
*/
CDockContainerWidget(ads::CDockManager* DockManager /TransferThis/, QWidget* parent /TransferThis/ = 0);
/**
* Virtual Destructor
*/
virtual ~CDockContainerWidget();
/**
* Adds dockwidget into the given area.
* If DockAreaWidget is not null, then the area parameter indicates the area
* into the DockAreaWidget. If DockAreaWidget is null, the Dockwidget will
* be dropped into the container.
* \return Returns the dock area widget that contains the new DockWidget
*/
ads::CDockAreaWidget* addDockWidget(ads::DockWidgetArea area, ads::CDockWidget* Dockwidget /Transfer/,
ads::CDockAreaWidget* DockAreaWidget /Transfer/ = 0);
/**
* Removes dockwidget
*/
ads::CDockAreaWidget* DockAreaWidget /Transfer/ = 0,
int Index = -1);
void removeDockWidget(ads::CDockWidget* Dockwidget) /TransferBack/;
/**
* Returns the current zOrderIndex
*/
virtual unsigned int zOrderIndex() const;
/**
* This function returns true if this container widgets z order index is
* higher than the index of the container widget given in Other parameter
*/
bool isInFrontOf(ads::CDockContainerWidget* Other) const;
/**
* Returns the dock area at teh given global position or 0 if there is no
* dock area at this position
*/
ads::CDockAreaWidget* dockAreaAt(const QPoint& GlobalPos) const;
/**
* Returns the dock area at the given Index or 0 if the index is out of
* range
*/
ads::CDockAreaWidget* dockArea(int Index) const;
/**
* Returns the list of dock areas that are not closed
* If all dock widgets in a dock area are closed, the dock area will be closed
*/
QList<ads::CDockAreaWidget*> openedDockAreas() const;
QList<ads::CDockWidget*> openedDockWidgets() const;
bool hasTopLevelDockWidget() const;
/**
* Returns the number of dock areas in this container
*/
int dockAreaCount() const;
/**
* Returns the number of visible dock areas
*/
int visibleDockAreaCount() const;
/**
* This function returns true, if this container is in a floating widget
*/
bool isFloating() const;
/**
* Dumps the layout for debugging purposes
*/
void dumpLayout();
/**
* This functions returns the dock widget features of all dock widget in
* this container.
* A bitwise and is used to combine the flags of all dock widgets. That
* means, if only dock widget does not support a certain flag, the whole
* dock are does not support the flag.
*/
ads::CDockWidget::DockWidgetFeatures features() const;
/**
* If this dock container is in a floating widget, this function returns
* the floating widget.
* Else, it returns a nullptr.
*/
ads::CFloatingDockContainer* floatingWidget() const;
/**
* Call this function to close all dock areas except the KeepOpenArea
*/
void closeOtherAreas(ads::CDockAreaWidget* KeepOpenArea);
ads::CAutoHideSideBar* sideTabBar(SideBarLocation area) const;
QList<ads::CAutoHideDockContainer*> autoHideWidgets() const;
QRect contentRect() const;
QRect contentRectGlobal() const;
ads::CDockManager* dockManager() const;
signals:
/**
* This signal is emitted if one or multiple dock areas has been added to
* the internal list of dock areas.
* If multiple dock areas are inserted, this signal is emitted only once
*/
void dockAreasAdded();
/**
* This signal is emitted if one or multiple dock areas has been removed
*/
void autoHideWidgetCreated(ads::CAutoHideDockContainer* AutoHideWidget);
void dockAreasRemoved();
/**
* This signal is emitted if a dock area is opened or closed via
* toggleView() function
*/
void dockAreaViewToggled(ads::CDockAreaWidget* DockArea, bool Open);
}; // class DockContainerWidget
};
// namespace ads
};
%End

View File

@@ -22,6 +22,7 @@ public:
void notifyFloatingWidgetDrop(ads::CFloatingDockContainer* FloatingWidget);
ads::CDockWidget* focusedDockWidget() const;
void setDockWidgetTabFocused(ads::CDockWidgetTab* Tab);
void clearDockWidgetFocus(ads::CDockWidget* dockWidget);
public slots:
void setDockWidgetFocused(ads::CDockWidget* focusedNow);

View File

@@ -156,7 +156,6 @@ public:
TabCloseButtonIsToolButton,
AllTabsHaveCloseButton,
RetainTabSizeWhenCloseButtonHidden,
OpaqueUndocking,
DragPreviewIsDynamic,
DragPreviewShowsContentPixmap,
DragPreviewHasWindowFrame,
@@ -180,6 +179,17 @@ public:
NonOpaqueWithWindowFrame,
};
typedef QFlags<ads::CDockManager::eConfigFlag> ConfigFlags;
enum eAutoHideFlag
{
AutoHideFeatureEnabled,
DockAreaHasAutoHideButton,
AutoHideButtonTogglesArea,
AutoHideButtonCheckable,
AutoHideSideBarsIconOnly,
AutoHideShowOnMouseOver,
DefaultAutoHideConfig,
};
typedef QFlags<ads::CDockManager::eAutoHideFlag> AutoHideFlags;
CDockManager(QWidget* parent /TransferThis/ = 0);
virtual ~CDockManager();
@@ -187,13 +197,24 @@ public:
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::CDockManager::AutoHideFlags autoHideConfigFlags();
static void setAutoHideConfigFlags(const ads::CDockManager::AutoHideFlags Flags);
static void setAutoHideConfigFlag(ads::CDockManager::eAutoHideFlag Flag, bool On = true);
static bool testAutoHideConfigFlag(eAutoHideFlag Flag);
static ads::CIconProvider& iconProvider();
ads::CDockAreaWidget* addDockWidget(ads::DockWidgetArea area, ads::CDockWidget* Dockwidget /Transfer/,
ads::CDockAreaWidget* DockAreaWidget /Transfer/ = 0);
ads::CDockAreaWidget* DockAreaWidget /Transfer/ = 0,
int Index = -1);
ads::CDockAreaWidget* addDockWidgetToContainer(ads::DockWidgetArea area, ads::CDockWidget* Dockwidget /Transfer/,
ads::CDockContainerWidget* DockContainerWidget /Transfer/ = 0);
ads::CAutoHideDockContainer* addAutoHideDockWidget(ads::SideBarLocation Location, ads::CDockWidget* Dockwidget /Transfer/);
ads::CAutoHideDockContainer* addAutoHideDockWidgetToContainer(SideBarLocation Location,
ads::CDockWidget* Dockwidget /Transfer/, ads::CDockContainerWidget* DockContainerWidget);
ads::CDockAreaWidget* addDockWidgetTab(ads::DockWidgetArea area,
ads::CDockWidget* Dockwidget /Transfer/);
ads::CDockAreaWidget* addDockWidgetTabToArea(ads::CDockWidget* Dockwidget /Transfer/,
ads::CDockAreaWidget* DockAreaWidget /Transfer/);
ads::CDockAreaWidget* DockAreaWidget /Transfer/,
int Index = -1);
ads::CFloatingDockContainer* addDockWidgetFloating(ads::CDockWidget* DockWidget /Transfer/);
ads::CDockWidget* findDockWidget(const QString& ObjectName) const;
void removeDockWidget(ads::CDockWidget* Dockwidget) /TransferBack/;
@@ -220,6 +241,8 @@ public:
ads::CDockWidget* focusedDockWidget() const;
QList<int> splitterSizes(ads::CDockAreaWidget *ContainedArea) const;
void setSplitterSizes(ads::CDockAreaWidget *ContainedArea, const QList<int>& sizes);
static void setFloatingContainersTitle(const QString& Title);
static QString floatingContainersTitle();
public slots:
void openPerspective(const QString& PerspectiveName);

View File

@@ -35,6 +35,7 @@ public:
DockWidgetForceCloseWithArea,
NoTab,
DeleteContentOnClose,
DockWidgetPinnable,
DefaultDockWidgetFeatures,
AllDockWidgetFeatures,
DockWidgetAlwaysCloseAndDelete,
@@ -81,7 +82,12 @@ public:
ads::CDockWidget::DockWidgetFeatures features() const;
ads::CDockManager* dockManager() const;
ads::CDockContainerWidget* dockContainer() const;
ads::CFloatingDockContainer* floatingDockContainer() const;
ads::CDockAreaWidget* dockAreaWidget() const;
ads::CAutoHideTab* sideTabWidget() const;
void setSideTabWidget(ads::CAutoHideTab* SideTab /Transfer/) const;
bool isAutoHide() const;
ads::CAutoHideDockContainer* autoHideDockContainer() const;
bool isFloating() const;
bool isInFloatingContainer() const;
bool isClosed() const;
@@ -118,6 +124,8 @@ public slots:
void closeDockWidget();
void showFullScreen();
void showNormal();
void setAutoHide(bool Enable, ads::SideBarLocation Location = ads::SideBarNone);
void toggleAutoHide(ads::SideBarLocation Location = ads::SideBarNone);
signals:
void viewToggled(bool Open);

View File

@@ -64,6 +64,7 @@ protected:
%If (WS_X11)
virtual void moveEvent(QMoveEvent *event);
virtual void resizeEvent(QResizeEvent *event);
virtual bool event(QEvent *e);
%End
%If (WS_WIN)

View File

@@ -27,10 +27,9 @@ public:
public: // implements IFloatingWidget
virtual void startFloating(const QPoint& DragStartMousePos, const QSize& Size,
ads::eDragState DragState, QWidget* MouseEventHandler);
virtual void moveFloating();
virtual void finishDragging();
void cleanupAutoHideContainerWidget();
signals:
void draggingCanceled();

31
sip/PushButton.sip Normal file
View File

@@ -0,0 +1,31 @@
%Import QtWidgets/QtWidgetsmod.sip
%If (Qt_5_0_0 -)
namespace ads
{
class CPushButton : QPushButton
{
%TypeHeaderCode
#include <PushButton.h>
%End
public:
enum Orientation {
Horizontal,
VerticalTopToBottom,
VerticalBottomToTop
};
virtual QSize sizeHint() const;
ads::CPushButton::Orientation buttonOrientation() const;
void setButtonOrientation(ads::CPushButton::Orientation orientation);
};
};
%End

36
sip/ResizeHandle.sip Normal file
View File

@@ -0,0 +1,36 @@
%Import QtWidgets/QtWidgetsmod.sip
%If (Qt_5_0_0 -)
namespace ads
{
class CResizeHandle : QFrame
{
%TypeHeaderCode
#include <ResizeHandle.h>
%End
protected:
void mouseMoveEvent(QMouseEvent *);
void mousePressEvent(QMouseEvent *);
void mouseReleaseEvent(QMouseEvent *);
public:
CResizeHandle(Qt::Edge HandlePosition, QWidget* parent /TransferThis/);
virtual ~CResizeHandle();
void setHandlePosition(Qt::Edge HandlePosition);
Qt::Edge handlePostion() const;
Qt::Orientation orientation() const;
QSize sizeHint() const;
bool isResizing() const;
void setMinResizeSize(int MinSize);
void setMaxResizeSize(int MaxSize);
void setOpaqueResize(bool opaque = true);
bool opaqueResize() const;
};
};
%End

View File

@@ -3,6 +3,9 @@
%DefaultSupertype sip.simplewrapper
%Include ads_globals.sip
%Include AutoHideDockContainer.sip
%Include AutoHideSideBar.sip
%Include AutoHideTab.sip
%Include DockWidget.sip
%Include DockAreaTabBar.sip
%Include DockAreaTitleBar_p.sip
@@ -20,6 +23,8 @@
%Include FloatingDockContainer.sip
%Include FloatingDragPreview.sip
%Include IconProvider.sip
%Include PushButton.sip
%Include ResizeHandle.sip
%If (WS_X11)
%Include linux/FloatingWidgetTitleBar.sip
%End

View File

@@ -50,7 +50,6 @@ namespace ads
TopDockWidgetArea,
BottomDockWidgetArea,
CenterDockWidgetArea,
InvalidDockWidgetArea,
OuterDockAreas,
AllDockAreas
@@ -62,7 +61,8 @@ namespace ads
{
TitleBarButtonTabsMenu,
TitleBarButtonUndock,
TitleBarButtonClose
TitleBarButtonClose,
TitleBarButtonAutoHide
};
enum eDragState
@@ -76,10 +76,10 @@ namespace ads
enum eIcon
{
TabCloseIcon,
AutoHideIcon,
DockAreaMenuIcon,
DockAreaUndockIcon,
DockAreaCloseIcon,
IconCount,
};
@@ -89,6 +89,15 @@ namespace ads
BitwiseOr
};
enum SideBarLocation
{
SideBarTop,
SideBarLeft,
SideBarRight,
SideBarBottom,
SideBarNone
};
namespace internal
{
void replaceSplitterWidget(QSplitter* Splitter, QWidget* From, QWidget* To);
@@ -131,6 +140,7 @@ namespace ads
};
void repolishStyle(QWidget* w, ads::internal::eRepolishChildOptions Options = ads::internal::RepolishIgnoreChildren);
QRect globalGeometry(QWidget* w);
};
};

View File

@@ -127,27 +127,6 @@ void AutoHideSideBarPrivate::handleViewportEvent(QEvent* e)
}
break;
case QEvent::Resize:
if (_this->tabCount())
{
auto ev = static_cast<QResizeEvent*>(e);
auto Tab = _this->tabAt(0);
int Size = isHorizontal() ? ev->size().height() : ev->size().width();
int TabSize = isHorizontal() ? Tab->size().height() : Tab->size().width();
// If the size of the side bar is less than the size of the first tab
// then there are no visible tabs in this side bar. This check will
// fail if someone will force a very big border via CSS!!
if (Size < TabSize)
{
_this->hide();
}
}
else
{
_this->hide();
}
break;
default:
break;
}
@@ -288,20 +267,33 @@ void CAutoHideSideBar::removeTab(CAutoHideTab* SideTab)
//============================================================================
bool CAutoHideSideBar::eventFilter(QObject *watched, QEvent *event)
{
if (event->type() != QEvent::ShowToParent)
auto Tab = qobject_cast<CAutoHideTab*>(watched);
if (!Tab)
{
return false;
}
// As soon as on tab is shown, we need to show the side tab bar
auto Tab = qobject_cast<CAutoHideTab*>(watched);
if (Tab)
switch (event->type())
{
show();
case QEvent::ShowToParent:
show();
break;
case QEvent::HideToParent:
if (!hasVisibleTabs())
{
hide();
}
break;
default:
break;
}
return false;
}
//============================================================================
Qt::Orientation CAutoHideSideBar::orientation() const
{
@@ -323,6 +315,39 @@ int CAutoHideSideBar::tabCount() const
}
//============================================================================
int CAutoHideSideBar::visibleTabCount() const
{
int count = 0;
auto ParentWidget = parentWidget();
for (auto i = 0; i < tabCount(); i++)
{
if (tabAt(i)->isVisibleTo(ParentWidget))
{
count++;
}
}
return count;
}
//============================================================================
bool CAutoHideSideBar::hasVisibleTabs() const
{
auto ParentWidget = parentWidget();
for (auto i = 0; i < tabCount(); i++)
{
if (tabAt(i)->isVisibleTo(ParentWidget))
{
return true;
}
}
return false;
}
//============================================================================
SideBarLocation CAutoHideSideBar::sideBarLocation() const
{

View File

@@ -134,6 +134,19 @@ public:
*/
int tabCount() const;
/**
* Returns the number of visible tabs to its parent widget.
*/
int visibleTabCount() const;
/**
* Returns true, if the sidebar contains visible tabs to its parent widget.
* The function returns as soon as it finds the first visible tab.
* That means, if you just want to find out if there are visible tabs
* then this function is quicker than visibleTabCount()
*/
bool hasVisibleTabs() const;
/**
* Getter for side tab bar area property
*/

View File

@@ -1,6 +1,11 @@
cmake_minimum_required(VERSION 3.5)
project(QtAdvancedDockingSystem LANGUAGES CXX VERSION ${VERSION_SHORT})
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED)
if (${QT_VERSION_MAJOR})
message(STATUS "Forced to use Qt version ${QT_VERSION_MAJOR}")
find_package(QT NAMES Qt${QT_VERSION_MAJOR} COMPONENTS Core REQUIRED)
else()
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED)
endif()
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Gui Widgets REQUIRED)
if (UNIX AND NOT APPLE)
include_directories(${Qt${QT_VERSION_MAJOR}Gui_PRIVATE_INCLUDE_DIRS})
@@ -64,50 +69,52 @@ if (UNIX AND NOT APPLE)
set(ads_SRCS linux/FloatingWidgetTitleBar.cpp ${ads_SRCS})
set(ads_HEADERS linux/FloatingWidgetTitleBar.h ${ads_HEADERS})
endif()
set(library_name "qt${QT_VERSION_MAJOR}advanceddocking")
if(BUILD_STATIC)
add_library(qtadvanceddocking STATIC ${ads_SRCS} ${ads_HEADERS})
target_compile_definitions(qtadvanceddocking PUBLIC ADS_STATIC)
add_library(${library_name} STATIC ${ads_SRCS} ${ads_HEADERS})
target_compile_definitions( ${library_name} PUBLIC ADS_STATIC)
else()
add_library(qtadvanceddocking SHARED ${ads_SRCS} ${ads_HEADERS})
target_compile_definitions(qtadvanceddocking PRIVATE ADS_SHARED_EXPORT)
add_library( ${library_name} SHARED ${ads_SRCS} ${ads_HEADERS})
target_compile_definitions( ${library_name} PRIVATE ADS_SHARED_EXPORT)
endif()
add_library(ads::qtadvanceddocking ALIAS qtadvanceddocking)
add_library(ads::${library_name} ALIAS ${library_name})
target_link_libraries(qtadvanceddocking PUBLIC Qt${QT_VERSION_MAJOR}::Core
target_link_libraries(${library_name} PUBLIC Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::Gui
Qt${QT_VERSION_MAJOR}::Widgets)
if (UNIX AND NOT APPLE)
target_link_libraries(qtadvanceddocking PUBLIC xcb)
target_link_libraries(${library_name} PUBLIC xcb)
endif()
set_target_properties(qtadvanceddocking PROPERTIES
set_target_properties(${library_name} PROPERTIES
AUTOMOC ON
AUTORCC ON
CXX_EXTENSIONS OFF
VERSION ${VERSION_SHORT}
EXPORT_NAME "qtadvanceddocking"
EXPORT_NAME ${library_name}
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/bin"
)
if(QT_VERSION_MAJOR STREQUAL "5")
set_target_properties(qtadvanceddocking PROPERTIES
set_target_properties(${library_name} PROPERTIES
CXX_STANDARD 14
CXX_STANDARD_REQUIRED ON)
elseif(QT_VERSION_MAJOR STREQUAL "6")
set_target_properties(qtadvanceddocking PROPERTIES
set_target_properties(${library_name} PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON)
endif()
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
"qtadvanceddockingConfigVersion.cmake"
"${library_name}ConfigVersion.cmake"
VERSION ${VERSION_SHORT}
COMPATIBILITY SameMajorVersion
)
install(FILES ${ads_HEADERS}
DESTINATION include
DESTINATION include/${library_name}
COMPONENT headers
)
install(FILES
@@ -116,24 +123,27 @@ install(FILES
DESTINATION license/ads
COMPONENT license
)
install(TARGETS qtadvanceddocking
install(TARGETS ${library_name}
EXPORT adsTargets
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
INCLUDES DESTINATION include
INCLUDES DESTINATION include/${library_name}
)
install(EXPORT adsTargets
FILE adsTargets.cmake
NAMESPACE ads::
DESTINATION lib/cmake/qtadvanceddocking
DESTINATION lib/cmake/${library_name}
)
install(FILES qtadvanceddockingConfig.cmake "${CMAKE_CURRENT_BINARY_DIR}/qtadvanceddockingConfigVersion.cmake"
DESTINATION lib/cmake/qtadvanceddocking
install(FILES qtadvanceddockingConfig.cmake RENAME ${library_name}Config.cmake
DESTINATION lib/cmake/${library_name}
)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${library_name}ConfigVersion.cmake"
DESTINATION lib/cmake/${library_name}
)
target_include_directories(qtadvanceddocking PUBLIC
target_include_directories(${library_name} PUBLIC
$<INSTALL_INTERFACE:include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
)

View File

@@ -36,6 +36,7 @@
#include <QBoxLayout>
#include <QApplication>
#include <QtGlobal>
#include <QTimer>
#include "FloatingDockContainer.h"
#include "DockAreaWidget.h"
@@ -107,7 +108,12 @@ void DockAreaTabBarPrivate::updateTabs()
{
TabWidget->show();
TabWidget->setActiveTab(true);
_this->ensureWidgetVisible(TabWidget);
// Sometimes the synchronous calculation of the rectangular area fails
// Therefore we use QTimer::singleShot here to execute the call
// within the event loop - see #520
QTimer::singleShot(0, [&, TabWidget]{
_this->ensureWidgetVisible(TabWidget);
});
}
else
{

View File

@@ -415,7 +415,12 @@ void CDockAreaTitleBar::onTabsMenuAboutToShow()
void CDockAreaTitleBar::onCloseButtonClicked()
{
ADS_PRINT("CDockAreaTitleBar::onCloseButtonClicked");
if (d->testConfigFlag(CDockManager::DockAreaCloseButtonClosesTab))
if (CDockManager::testAutoHideConfigFlag(CDockManager::AutoHideCloseButtonCollapsesDock) &&
d->DockArea->autoHideDockContainer())
{
d->DockArea->autoHideDockContainer()->collapseView(true);
}
else if (d->testConfigFlag(CDockManager::DockAreaCloseButtonClosesTab))
{
d->TabBar->closeTab(d->TabBar->currentIndex());
}

View File

@@ -140,6 +140,7 @@ public:
{
LayoutItem->widget()->setParent(nullptr);
}
delete LayoutItem;
m_CurrentWidget = nullptr;
m_CurrentIndex = -1;
}

View File

@@ -130,7 +130,7 @@ protected:
/**
* Adds the given dock area to this container widget
*/
void addDockArea(CDockAreaWidget* DockAreaWidget, DockWidgetArea area = CenterDockWidgetArea);
void addDockArea(CDockAreaWidget* DockAreaWidget, DockWidgetArea area = ads::CenterDockWidgetArea);
/**
* Removes the given dock area from this container

View File

@@ -27,7 +27,7 @@
#include "DockManager.h"
#include "DockAreaTitleBar.h"
#ifdef Q_OS_LINUX
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
#include "linux/FloatingWidgetTitleBar.h"
#endif
@@ -44,11 +44,12 @@ struct DockFocusControllerPrivate
QPointer<CDockWidget> FocusedDockWidget = nullptr;
QPointer<CDockAreaWidget> FocusedArea = nullptr;
QPointer<CDockWidget> OldFocusedDockWidget = nullptr;
#ifdef Q_OS_LINUX
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
QPointer<CFloatingDockContainer> FloatingWidget = nullptr;
#endif
CDockManager* DockManager;
bool ForceFocusChangedSignal = false;
bool TabPressed = false;
/**
* Private data constructor
@@ -84,7 +85,7 @@ static void updateDockAreaFocusStyle(CDockAreaWidget* DockArea, bool Focused)
//===========================================================================
#ifdef Q_OS_LINUX
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
static void updateFloatingWidgetFocusStyle(CFloatingDockContainer* FloatingWidget, bool Focused)
{
if (FloatingWidget->hasNativeTitleBar())
@@ -168,7 +169,7 @@ void DockFocusControllerPrivate::updateDockWidgetFocus(CDockWidget* DockWidget)
}
#ifdef Q_OS_LINUX
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
// This code is required for styling the floating widget titlebar for linux
// depending on the current focus state
if (FloatingWidget != NewFloatingWidget)
@@ -267,7 +268,9 @@ void CDockFocusController::onApplicationFocusChanged(QWidget* focusedOld, QWidge
{
Q_UNUSED(focusedOld);
if (d->DockManager->isRestoringState())
// Ignore focus changes if we are restoring state, or if user clicked
// a tab wich in turn caused the focus change
if (d->DockManager->isRestoringState() || d->TabPressed)
{
return;
}
@@ -285,7 +288,7 @@ void CDockFocusController::onApplicationFocusChanged(QWidget* focusedOld, QWidge
DockWidget = internal::findParent<CDockWidget*>(focusedNow);
}
#ifdef Q_OS_LINUX
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
if (!DockWidget)
{
return;
@@ -418,6 +421,12 @@ CDockWidget* CDockFocusController::focusedDockWidget() const
return d->FocusedDockWidget.data();
}
//==========================================================================
void CDockFocusController::setDockWidgetTabPressed(bool Value)
{
d->TabPressed = Value;
}
} // namespace ads
//---------------------------------------------------------------------------

View File

@@ -80,6 +80,12 @@ public:
*/
void clearDockWidgetFocus(CDockWidget* dockWidget);
/**
* Notifies the dock focus controller, that a the mouse is pressed or
* released
*/
void setDockWidgetTabPressed(bool Value);
public Q_SLOTS:
/**
* Request a focus change to the given dock widget

View File

@@ -47,6 +47,7 @@
#include <QMenu>
#include <QApplication>
#include <QWindow>
#include <QWindowStateChangeEvent>
#include "FloatingDockContainer.h"
#include "DockOverlay.h"
@@ -59,7 +60,7 @@
#include "DockFocusController.h"
#include "DockSplitter.h"
#ifdef Q_OS_LINUX
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
#include "linux/FloatingWidgetTitleBar.h"
#endif
@@ -116,6 +117,7 @@ struct DockManagerPrivate
QVector<CFloatingDockContainer*> UninitializedFloatingWidgets;
CDockFocusController* FocusController = nullptr;
CDockWidget* CentralWidget = nullptr;
bool IsLeavingMinimized = false;
/**
* Private data constructor
@@ -192,7 +194,7 @@ void DockManagerPrivate::loadStylesheet()
QString FileName = ":ads/stylesheets/";
FileName += CDockManager::testConfigFlag(CDockManager::FocusHighlighting)
? "focus_highlighting" : "default";
#ifdef Q_OS_LINUX
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
FileName += "_linux";
#endif
FileName += ".css";
@@ -510,9 +512,10 @@ CDockManager::CDockManager(QWidget *parent) :
d->FocusController = new CDockFocusController(this);
}
#ifdef Q_OS_LINUX
window()->installEventFilter(this);
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
connect(qApp, &QApplication::focusWindowChanged, [](QWindow* focusWindow)
{
// bring modal dialogs to foreground to ensure that they are in front of any
@@ -552,7 +555,7 @@ CDockManager::~CDockManager()
}
//============================================================================
#ifdef Q_OS_LINUX
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
bool CDockManager::eventFilter(QObject *obj, QEvent *e)
{
// Emulate Qt:Tool behaviour.
@@ -629,8 +632,39 @@ bool CDockManager::eventFilter(QObject *obj, QEvent *e)
}
return Super::eventFilter(obj, e);
}
#else
//============================================================================
bool CDockManager::eventFilter(QObject *obj, QEvent *e)
{
if (e->type() == QEvent::WindowStateChange)
{
QWindowStateChangeEvent* ev = static_cast<QWindowStateChangeEvent*>(e);
if (ev->oldState().testFlag(Qt::WindowMinimized))
{
d->IsLeavingMinimized = true;
QMetaObject::invokeMethod(this, "endLeavingMinimizedState", Qt::QueuedConnection);
}
}
return Super::eventFilter(obj, e);
}
#endif
//============================================================================
void CDockManager::endLeavingMinimizedState()
{
d->IsLeavingMinimized = false;
this->activateWindow();
}
//============================================================================
bool CDockManager::isLeavingMinimizedState() const
{
return d->IsLeavingMinimized;
}
//============================================================================
void CDockManager::registerFloatingWidget(CFloatingDockContainer* FloatingWidget)
{

View File

@@ -88,6 +88,12 @@ private:
friend class CAutoHideDockContainer;
friend CAutoHideSideBar;
public Q_SLOTS:
/**
* Ends the isRestoringFromMinimizedState
*/
void endLeavingMinimizedState();
protected:
/**
@@ -239,6 +245,7 @@ public:
AutoHideButtonCheckable = 0x08, //!< If the flag is set, the auto hide button will be checked and unchecked depending on the auto hide state. Mainly for styling purposes.
AutoHideSideBarsIconOnly = 0x10,///< show only icons in auto hide side tab - if a tab has no icon, then the text will be shown
AutoHideShowOnMouseOver = 0x20, ///< show the auto hide window on mouse over tab and hide it if mouse leaves auto hide container
AutoHideCloseButtonCollapsesDock = 0x40, ///< Close button of an auto hide container collapses the dock instead of hiding it completely
DefaultAutoHideConfig = AutoHideFeatureEnabled
| DockAreaHasAutoHideButton ///< the default configuration for left and right side bars
@@ -539,6 +546,15 @@ public:
*/
bool isRestoringState() const;
/**
* This function returns true, if the DockManager window is restoring from
* minimized state.
* The DockManager is in this state starting from the QWindowStateChangeEvent
* that signals the state change from minimized to normal until
* endLeavingMinimizedState() function is called.
*/
bool isLeavingMinimizedState() const;
/**
* The distance the user needs to move the mouse with the left button
* hold down before a dock widget start floating
@@ -560,9 +576,7 @@ public:
widget->setFocus(Qt::OtherFocusReason);
}
#ifdef Q_OS_LINUX
bool eventFilter(QObject *obj, QEvent *e) override;
#endif
/**
* Returns the dock widget that has focus style in the ui or a nullptr if

View File

@@ -139,7 +139,7 @@ struct DockOverlayCrossPrivate
*/
qreal dropIndicatiorWidth(QLabel* l) const
{
#ifdef Q_OS_LINUX
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
Q_UNUSED(l)
return 40;
#else
@@ -333,7 +333,7 @@ CDockOverlay::CDockOverlay(QWidget* parent, eMode Mode) :
{
d->Mode = Mode;
d->Cross = new CDockOverlayCross(this);
#ifdef Q_OS_LINUX
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
setWindowFlags(Qt::Tool | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | Qt::X11BypassWindowManagerHint);
#else
setWindowFlags(Qt::Tool | Qt::FramelessWindowHint);
@@ -595,7 +595,7 @@ CDockOverlayCross::CDockOverlayCross(CDockOverlay* overlay) :
d(new DockOverlayCrossPrivate(this))
{
d->DockOverlay = overlay;
#ifdef Q_OS_LINUX
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
setWindowFlags(Qt::Tool | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | Qt::X11BypassWindowManagerHint);
#else
setWindowFlags(Qt::Tool | Qt::FramelessWindowHint);

View File

@@ -622,6 +622,13 @@ void CDockWidget::setMinimumSizeHintMode(eMinimumSizeHintMode Mode)
}
//============================================================================
CDockWidget::eMinimumSizeHintMode CDockWidget::minimumSizeHintMode() const
{
return d->MinimumSizeHintMode;
}
//============================================================================
bool CDockWidget::isCentralWidget() const
{
@@ -643,14 +650,20 @@ void CDockWidget::toggleView(bool Open)
// If the dock widget state is different, then we really need to toggle
// the state. If we are in the right state, then we simply make this
// dock widget the current dock widget
auto AutoHideContainer = autoHideDockContainer();
if (d->Closed != !Open)
{
toggleViewInternal(Open);
}
else if (Open && d->DockArea)
else if (Open && d->DockArea && !AutoHideContainer)
{
raise();
}
if (Open && AutoHideContainer)
{
AutoHideContainer->collapseView(false);
}
}
@@ -984,14 +997,20 @@ void CDockWidget::setClosedState(bool Closed)
//============================================================================
QSize CDockWidget::minimumSizeHint() const
{
if (d->MinimumSizeHintMode == CDockWidget::MinimumSizeHintFromDockWidget || !d->Widget)
if (!d->Widget)
{
return QSize(60, 40);
}
else
switch (d->MinimumSizeHintMode)
{
return d->Widget->minimumSizeHint();
case MinimumSizeHintFromDockWidget: return QSize(60, 40);
case MinimumSizeHintFromContent: return d->Widget->minimumSizeHint();
case MinimumSizeHintFromDockWidgetMinimumSize: return minimumSize();
case MinimumSizeHintFromContentMinimumSize: return d->Widget->minimumSize();
}
return d->Widget->minimumSizeHint();
}

View File

@@ -208,12 +208,17 @@ public:
* reimplements minimumSizeHint() function to return a very small minimum
* size hint. If you would like to adhere the minimumSizeHint() from the
* content widget, then set the minimumSizeHintMode() to
* MinimumSizeHintFromContent.
* MinimumSizeHintFromContent. If you would like to use the minimumSize()
* value of the content widget or the dock widget, then you can use the
* MinimumSizeHintFromDockWidgetMinimumSize or
* MinimumSizeHintFromContentMinimumSize modes.
*/
enum eMinimumSizeHintMode
{
MinimumSizeHintFromDockWidget,
MinimumSizeHintFromContent
MinimumSizeHintFromContent,
MinimumSizeHintFromDockWidgetMinimumSize,
MinimumSizeHintFromContentMinimumSize,
};
@@ -411,6 +416,11 @@ public:
*/
void setMinimumSizeHintMode(eMinimumSizeHintMode Mode);
/**
* Get the minimum size hint mode configured by setMinimumSizeHintMode
*/
eMinimumSizeHintMode minimumSizeHintMode() const;
/**
* Returns true if the dock widget is set as central widget of it's dock manager
*/

View File

@@ -79,6 +79,7 @@ struct DockWidgetTabPrivate
QSpacerItem* IconTextSpacer;
QPoint TabDragStartPosition;
QSize IconSize;
bool MousePressed = false;
/**
* Private data constructor
@@ -372,10 +373,12 @@ void CDockWidgetTab::mousePressEvent(QMouseEvent* ev)
if (ev->button() == Qt::LeftButton)
{
ev->accept();
d->MousePressed = true;
d->saveDragStartMousePosition(internal::globalPositionOf(ev));
d->DragState = DraggingMousePressed;
if (CDockManager::testConfigFlag(CDockManager::FocusHighlighting))
{
d->focusController()->setDockWidgetTabPressed(true);
d->focusController()->setDockWidgetTabFocused(this);
}
Q_EMIT clicked();
@@ -391,6 +394,7 @@ void CDockWidgetTab::mouseReleaseEvent(QMouseEvent* ev)
{
if (ev->button() == Qt::LeftButton)
{
d->MousePressed = false;
auto CurrentDragState = d->DragState;
d->GlobalDragStartMousePosition = QPoint();
d->DragStartMousePosition = QPoint();
@@ -412,7 +416,12 @@ void CDockWidgetTab::mouseReleaseEvent(QMouseEvent* ev)
d->FloatingWidget->finishDragging();
break;
default:; // do nothing
default:
if (CDockManager::testConfigFlag(CDockManager::FocusHighlighting))
{
d->focusController()->setDockWidgetTabPressed(false);
}
break; // do nothing
}
}
else if (ev->button() == Qt::MiddleButton)
@@ -802,6 +811,7 @@ void CDockWidgetTab::setIconSize(const QSize& Size)
d->IconSize = Size;
d->updateIcon();
}
} // namespace ads
//---------------------------------------------------------------------------
// EOF DockWidgetTab.cpp

View File

@@ -178,6 +178,12 @@ public:
*/
void setIconSize(const QSize& Size);
/**
* Returns true, if the tab has been clicked and the mouse is currently
* pressed.
*/
bool mousePressed() const;
public Q_SLOTS:
virtual void setVisible(bool visible) override;

View File

@@ -52,7 +52,7 @@
#pragma comment(lib, "User32.lib")
#endif
#endif
#ifdef Q_OS_LINUX
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
#include "linux/FloatingWidgetTitleBar.h"
#include <xcb/xcb.h>
#endif
@@ -374,10 +374,11 @@ struct FloatingDockContainerPrivate
QPoint DragStartPos;
bool Hiding = false;
bool AutoHideChildren = true;
#ifdef Q_OS_LINUX
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
QWidget* MouseEventHandler = nullptr;
CFloatingWidgetTitleBar* TitleBar = nullptr;
bool IsResizing = false;
bool MousePressed = false;
#endif
/**
@@ -424,7 +425,7 @@ struct FloatingDockContainerPrivate
void setWindowTitle(const QString &Text)
{
#ifdef Q_OS_LINUX
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
if (TitleBar)
{
TitleBar->setTitle(Text);
@@ -540,7 +541,7 @@ void FloatingDockContainerPrivate::updateDropOverlays(const QPoint &GlobalPos)
return;
}
#ifdef Q_OS_LINUX
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
// Prevent display of drop overlays and docking as long as a model dialog
// is active
if (qApp->activeModalWidget())
@@ -641,7 +642,7 @@ CFloatingDockContainer::CFloatingDockContainer(CDockManager *DockManager) :
connect(d->DockContainer, SIGNAL(dockAreasRemoved()), this,
SLOT(onDockAreasAddedOrRemoved()));
#ifdef Q_OS_LINUX
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
QDockWidget::setWidget(d->DockContainer);
QDockWidget::setFloating(true);
QDockWidget::setFeatures(QDockWidget::DockWidgetClosable
@@ -674,6 +675,17 @@ CFloatingDockContainer::CFloatingDockContainer(CDockManager *DockManager) :
native_window = window_manager != "KWIN";
}
if (native_window)
{
// Native windows do not work if wayland is used. Ubuntu 22.04 uses wayland by default. To use
// native windows, switch to Xorg
QString XdgSessionType = qgetenv("XDG_SESSION_TYPE").toLower();
if ("wayland" == XdgSessionType)
{
native_window = false;
}
}
if (native_window)
{
setTitleBarWidget(new QWidget());
@@ -752,18 +764,43 @@ CDockContainerWidget* CFloatingDockContainer::dockContainer() const
void CFloatingDockContainer::changeEvent(QEvent *event)
{
Super::changeEvent(event);
if ((event->type() == QEvent::ActivationChange) && isActiveWindow())
switch (event->type())
{
ADS_PRINT("FloatingWidget::changeEvent QEvent::ActivationChange ");
d->zOrderIndex = ++zOrderCounter;
#ifdef Q_OS_LINUX
if (d->DraggingState == DraggingFloatingWidget)
case QEvent::ActivationChange:
if (isActiveWindow())
{
d->titleMouseReleaseEvent();
d->DraggingState = DraggingInactive;
}
ADS_PRINT("FloatingWidget::changeEvent QEvent::ActivationChange ");
d->zOrderIndex = ++zOrderCounter;
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
if (d->DraggingState == DraggingFloatingWidget)
{
d->titleMouseReleaseEvent();
d->DraggingState = DraggingInactive;
}
#endif
}
break;
case QEvent::WindowStateChange:
// If the DockManager window is restored from minimized on Windows
// then the FloatingWidgets are not properly restored to maximized but
// to normal state.
// We simply check here, if the FloatingWidget was maximized before
// and if the DockManager is just leaving the minimized state. In this
// case, we restore the maximized state of this floating widget
if (d->DockManager->isLeavingMinimizedState())
{
QWindowStateChangeEvent* ev = static_cast<QWindowStateChangeEvent*>(event);
if (ev->oldState().testFlag(Qt::WindowMaximized))
{
this->showMaximized();
}
}
break;
default:
break; // do nothing
}
}
@@ -909,7 +946,7 @@ void CFloatingDockContainer::hideEvent(QHideEvent *event)
void CFloatingDockContainer::showEvent(QShowEvent *event)
{
Super::showEvent(event);
#ifdef Q_OS_LINUX
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
if (CDockManager::testConfigFlag(CDockManager::FocusHighlighting))
{
this->window()->activateWindow();
@@ -922,7 +959,7 @@ void CFloatingDockContainer::showEvent(QShowEvent *event)
void CFloatingDockContainer::startFloating(const QPoint &DragStartMousePos,
const QSize &Size, eDragState DragState, QWidget *MouseEventHandler)
{
#ifdef Q_OS_LINUX
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
if (!isMaximized())
{
resize(Size);
@@ -974,7 +1011,7 @@ void CFloatingDockContainer::moveFloating()
// the main window as the active window for some reason. This fixes
// that by resetting the active window to the floating widget after
// updating the overlays.
QApplication::setActiveWindow(this);
activateWindow();
#endif
break;
default:
@@ -1059,7 +1096,7 @@ bool CFloatingDockContainer::restoreState(CDockingStateReader &Stream,
return false;
}
onDockAreasAddedOrRemoved();
#ifdef Q_OS_LINUX
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
if(d->TitleBar)
{
d->TitleBar->setMaximizedIcon(windowState() == Qt::WindowMaximized);
@@ -1097,13 +1134,18 @@ void CFloatingDockContainer::hideAndDeleteLater()
d->AutoHideChildren = false;
hide();
deleteLater();
if (d->DockManager)
{
d->DockManager->removeFloatingWidget(this);
d->DockManager->removeDockContainer(this->dockContainer());
}
}
//============================================================================
void CFloatingDockContainer::finishDragging()
{
ADS_PRINT("CFloatingDockContainer::finishDragging");
#ifdef Q_OS_LINUX
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
setWindowOpacity(1);
activateWindow();
if (d->MouseEventHandler)
@@ -1207,7 +1249,7 @@ void CFloatingDockContainer::moveEvent(QMoveEvent *event)
// the main window as the active window for some reason. This fixes
// that by resetting the active window to the floating widget after
// updating the overlays.
QApplication::setActiveWindow(this);
activateWindow();
break;
default:
break;
@@ -1218,7 +1260,7 @@ void CFloatingDockContainer::moveEvent(QMoveEvent *event)
#endif
#ifdef Q_OS_LINUX
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
//============================================================================
void CFloatingDockContainer::onMaximizeRequest()
{
@@ -1287,12 +1329,12 @@ void CFloatingDockContainer::resizeEvent(QResizeEvent *event)
Super::resizeEvent(event);
}
static bool s_mousePressed = false;
//============================================================================
void CFloatingDockContainer::moveEvent(QMoveEvent *event)
{
Super::moveEvent(event);
if (!d->IsResizing && event->spontaneous() && s_mousePressed)
if (!d->IsResizing && event->spontaneous() && d->MousePressed)
{
d->setState(DraggingFloatingWidget);
d->updateDropOverlays(QCursor::pos());
@@ -1308,10 +1350,10 @@ bool CFloatingDockContainer::event(QEvent *e)
switch (e->type())
{
case QEvent::WindowActivate:
s_mousePressed = false;
d->MousePressed = false;
break;
case QEvent::WindowDeactivate:
s_mousePressed = true;
d->MousePressed = true;
break;
default:
break;

View File

@@ -33,7 +33,7 @@
#include <QRubberBand>
#ifdef Q_OS_LINUX
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
#include <QDockWidget>
#define tFloatingWidgetBase QDockWidget
#else
@@ -182,10 +182,8 @@ protected: // reimplements QWidget
#ifdef Q_OS_MACOS
virtual bool event(QEvent *e) override;
virtual void moveEvent(QMoveEvent *event) override;
#endif
#ifdef Q_OS_LINUX
virtual void moveEvent(QMoveEvent *event) override;
#elif defined(Q_OS_UNIX)
virtual void moveEvent(QMoveEvent *event) override;
virtual void resizeEvent(QResizeEvent *event) override;
virtual bool event(QEvent *e) override;
@@ -264,7 +262,7 @@ public:
*/
void hideAndDeleteLater();
#ifdef Q_OS_LINUX
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
/**
* This is a function that responds to FloatingWidgetTitleBar::maximizeRequest()
* Maximize or normalize the container size.
@@ -300,7 +298,6 @@ public:
*/
bool hasNativeTitleBar();
#endif
}; // class FloatingDockContainer
}
// namespace ads

View File

@@ -72,6 +72,26 @@ struct FloatingDragPreviewPrivate
* outside of any drop area
*/
void createFloatingWidget();
/**
* Returns true, if the content is floatable
*/
bool isContentFloatable() const
{
CDockWidget* DockWidget = qobject_cast<CDockWidget*>(Content);
if (DockWidget && DockWidget->features().testFlag(CDockWidget::DockWidgetFloatable))
{
return true;
}
CDockAreaWidget* DockArea = qobject_cast<CDockAreaWidget*>(Content);
if (DockArea && DockArea->features().testFlag(CDockWidget::DockWidgetFloatable))
{
return true;
}
return false;
}
};
// struct LedArrayPanelPrivate
@@ -242,7 +262,7 @@ CFloatingDragPreview::CFloatingDragPreview(QWidget* Content, QWidget* parent) :
setAttribute(Qt::WA_TranslucentBackground);
}
#ifdef Q_OS_LINUX
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
auto Flags = windowFlags();
Flags |= Qt::WindowStaysOnTopHint | Qt::X11BypassWindowManagerHint;
setWindowFlags(Flags);
@@ -328,10 +348,17 @@ void CFloatingDragPreview::finishDragging()
{
ADS_PRINT("CFloatingDragPreview::finishDragging");
cleanupAutoHideContainerWidget();
auto DockDropArea = d->DockManager->dockAreaOverlay()->visibleDropAreaUnderCursor();
auto ContainerDropArea = d->DockManager->containerOverlay()->visibleDropAreaUnderCursor();
bool ValidDropArea = (DockDropArea != InvalidDockWidgetArea) || (ContainerDropArea != InvalidDockWidgetArea);
// Non floatable auto hide widgets should stay in its current auto hide
// state if they are dragged into a floating window
if (ValidDropArea || d->isContentFloatable())
{
cleanupAutoHideContainerWidget();
}
if (!d->DropContainer)
{
d->createFloatingWidget();

View File

@@ -38,7 +38,7 @@
#include "IconProvider.h"
#include "ads_globals.h"
#ifdef Q_OS_LINUX
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
#include <QSettings>
#include <QFile>
#include <QApplication>
@@ -52,7 +52,7 @@ namespace internal
{
const int FloatingWidgetDragStartEvent = QEvent::registerEventType();
const int DockedWidgetDragStartEvent = QEvent::registerEventType();
#ifdef Q_OS_LINUX
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
static QString _window_manager;
static QHash<QString, xcb_atom_t> _xcb_atom_cache;
@@ -371,7 +371,7 @@ void setButtonIcon(QAbstractButton* Button, QStyle::StandardPixmap StandarPixmap
return;
}
#ifdef Q_OS_LINUX
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
Button->setIcon(Button->style()->standardIcon(StandarPixmap));
#else
// The standard icons does not look good on high DPI screens so we create

View File

@@ -40,7 +40,7 @@
#include <iostream>
#ifdef Q_OS_LINUX
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
#include <xcb/xcb.h>
#endif
@@ -156,7 +156,7 @@ static const char* const DirtyProperty = "dirty";
extern const int FloatingWidgetDragStartEvent;
extern const int DockedWidgetDragStartEvent;
#ifdef Q_OS_LINUX
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
// Utils to directly communicate with the X server
/**
* Get atom from cache or request it from the XServer.

File diff suppressed because it is too large Load Diff