Compare commits
175 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a16d17a8bf | ||
|
|
faf24cd531 | ||
|
|
979d76aa47 | ||
|
|
0a55bcd586 | ||
|
|
f41a6f06fe | ||
|
|
349d584228 | ||
|
|
fcad7763ff | ||
|
|
1bec4234c3 | ||
|
|
0be5ba8cf6 | ||
|
|
7245dced84 | ||
|
|
e2f611ea9a | ||
|
|
1f21eb0200 | ||
|
|
f2378636e2 | ||
|
|
509b2356d1 | ||
|
|
30b802bd10 | ||
|
|
e857421fdf | ||
|
|
8dcdc8fad2 | ||
|
|
f964ce2c68 | ||
|
|
eb9b439d11 | ||
|
|
a13ed7e4d6 | ||
|
|
8cfa5c8e0e | ||
|
|
2878559ee6 | ||
|
|
6ff39bccf8 | ||
|
|
952131a1e9 | ||
|
|
5edbcc1970 | ||
|
|
04f6d9168e | ||
|
|
cea1327dac | ||
|
|
1c41cbff82 | ||
|
|
06e8451fc0 | ||
|
|
3ff6918b1f | ||
|
|
ac3af4c6cd | ||
|
|
41bb861417 | ||
|
|
6e63418798 | ||
|
|
65781b7cac | ||
|
|
d7e6c613c6 | ||
|
|
8da0713bf0 | ||
|
|
08da925fde | ||
|
|
fb58c435ef | ||
|
|
6bf593ef4b | ||
|
|
6b3b7750cb | ||
|
|
541db8e214 | ||
|
|
644c828f00 | ||
|
|
ed6636ae26 | ||
|
|
1a543e946d | ||
|
|
9bdefd6055 | ||
|
|
8fd691968c | ||
|
|
7abc698d09 | ||
|
|
5b23248fb8 | ||
|
|
46a5cee9c9 | ||
|
|
6c2c9888be | ||
|
|
44ff9e9956 | ||
|
|
f848df74c3 | ||
|
|
6c98c29855 | ||
|
|
c34d479d5c | ||
|
|
a7a97e6978 | ||
|
|
ec018a4c70 | ||
|
|
0fabebb0fe | ||
|
|
521e1fbe39 | ||
|
|
5f2aeaef00 | ||
|
|
818e568f4a | ||
|
|
5d6831d179 | ||
|
|
a2c94c16b5 | ||
|
|
68f1084bf0 | ||
|
|
761bfc50d6 | ||
|
|
59b4dfb89c | ||
|
|
bfa5124999 | ||
|
|
234cf9ac58 | ||
|
|
8f77f4b42a | ||
|
|
fa94da00d4 | ||
|
|
40beef964b | ||
|
|
420baeedfe | ||
|
|
0f8096e314 | ||
|
|
9ec97a8867 | ||
|
|
55ef6ef863 | ||
|
|
c0985f6497 | ||
|
|
2f1ef61f82 | ||
|
|
62d2dd213d | ||
|
|
3c941a2312 | ||
|
|
4634b5617c | ||
|
|
2178b52621 | ||
|
|
61573cba16 | ||
|
|
2d2de53dcd | ||
|
|
0d10c6e2d9 | ||
|
|
767933d0cb | ||
|
|
7a362b7ee3 | ||
|
|
77ed9b0661 | ||
|
|
65600a4dcd | ||
|
|
ac1879d5cb | ||
|
|
f00ef60fb3 | ||
|
|
1a1352e456 | ||
|
|
65ae86a46d | ||
|
|
e239cdb354 | ||
|
|
7140e5e32a | ||
|
|
f5cfe9e05a | ||
|
|
be727c5890 | ||
|
|
f4fc0dab29 | ||
|
|
39bc7f1780 | ||
|
|
364ee33f9c | ||
|
|
cb5e9f60a1 | ||
|
|
2760fb1fe9 | ||
|
|
8a82e4cf57 | ||
|
|
0627b3183f | ||
|
|
df1bc94d9e | ||
|
|
6924e69b6b | ||
|
|
0a6c58fd66 | ||
|
|
bf22e54fc3 | ||
|
|
4307f48d99 | ||
|
|
4bdc04e9d8 | ||
|
|
1c6d86e70f | ||
|
|
6e642ec423 | ||
|
|
0b3c3f0123 | ||
|
|
957afe3a07 | ||
|
|
4ab726fee3 | ||
|
|
8d4507e9d8 | ||
|
|
5a00eece87 | ||
|
|
e2929ade14 | ||
|
|
b801f0655d | ||
|
|
f6ccaba6aa | ||
|
|
21189759dd | ||
|
|
047ea3c494 | ||
|
|
f71c8ffe5d | ||
|
|
381acb2449 | ||
|
|
09e4e6fa5a | ||
|
|
b9479dbd3d | ||
|
|
34cc91a9af | ||
|
|
36cdf4a252 | ||
|
|
85f65b3f1a | ||
|
|
92da2eb8bd | ||
|
|
27edfe63ee | ||
|
|
5517822008 | ||
|
|
702702cbfd | ||
|
|
c552fef134 | ||
|
|
916df28fcd | ||
|
|
c08d91687a | ||
|
|
ccbde05fb7 | ||
|
|
1049576349 | ||
|
|
0bfee09b17 | ||
|
|
87954e4459 | ||
|
|
0301e345b4 | ||
|
|
f9b5ef8d89 | ||
|
|
0ed1f8f429 | ||
|
|
659537916e | ||
|
|
0cac9ac507 | ||
|
|
7a79ecab8a | ||
|
|
1186d2b78c | ||
|
|
b46768537a | ||
|
|
44115d4bd9 | ||
|
|
f2d8e17981 | ||
|
|
7890a408f4 | ||
|
|
a940fc29c6 | ||
|
|
c6595563af | ||
|
|
cb24317010 | ||
|
|
fb1e427ab7 | ||
|
|
9d28a4d0d5 | ||
|
|
df34b0eb2b | ||
|
|
db3dc80170 | ||
|
|
db16c5f1b5 | ||
|
|
d28ca1e7a1 | ||
|
|
e84b4a8146 | ||
|
|
46e0d832f8 | ||
|
|
7e63919c08 | ||
|
|
1873dde358 | ||
|
|
6362d14da6 | ||
|
|
1f48f0f3ad | ||
|
|
82695d1b3d | ||
|
|
08b0f8ad54 | ||
|
|
54c2bd0c30 | ||
|
|
d8784a22b7 | ||
|
|
bc9f136f20 | ||
|
|
7192a06eb8 | ||
|
|
a4c6f1d16c | ||
|
|
009af32e61 | ||
|
|
fab41828ab | ||
|
|
cae42939c8 | ||
|
|
7b30322946 |
146
.clang-format
Normal file
@@ -0,0 +1,146 @@
|
||||
---
|
||||
AccessModifierOffset: -4
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignConsecutiveMacros: None
|
||||
AlignConsecutiveAssignments: None
|
||||
AlignConsecutiveDeclarations: None
|
||||
AlignEscapedNewlines: Right
|
||||
AlignOperands: Align
|
||||
AlignTrailingComments: true
|
||||
|
||||
AllowAllArgumentsOnNextLine: true
|
||||
AllowAllParametersOfDeclarationOnNextLine: true
|
||||
AllowShortBlocksOnASingleLine: Never
|
||||
AllowShortCaseLabelsOnASingleLine: true
|
||||
AllowShortFunctionsOnASingleLine: InlineOnly
|
||||
AllowShortIfStatementsOnASingleLine: Never
|
||||
AllowShortLambdasOnASingleLine: Inline
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: false
|
||||
AlwaysBreakTemplateDeclarations: Yes
|
||||
|
||||
BinPackArguments: true
|
||||
BinPackParameters: true
|
||||
|
||||
BraceWrapping:
|
||||
AfterCaseLabel: true
|
||||
AfterClass: true
|
||||
AfterControlStatement: Always
|
||||
AfterEnum: true
|
||||
AfterFunction: true
|
||||
AfterNamespace: true
|
||||
AfterStruct: true
|
||||
AfterUnion: true
|
||||
AfterExternBlock: true
|
||||
BeforeCatch: true
|
||||
BeforeElse: true
|
||||
BeforeLambdaBody: false
|
||||
IndentBraces: false
|
||||
SplitEmptyFunction: false
|
||||
SplitEmptyRecord: false
|
||||
SplitEmptyNamespace: false
|
||||
|
||||
BreakBeforeBinaryOperators: NonAssignment
|
||||
BreakBeforeBraces: Custom
|
||||
BreakBeforeTernaryOperators: false
|
||||
BreakConstructorInitializers: BeforeColon
|
||||
BreakInheritanceList: AfterColon
|
||||
BreakStringLiterals: true
|
||||
|
||||
ColumnLimit: 82
|
||||
CommentPragmas: '^(!.*|@c)'
|
||||
|
||||
CompactNamespaces: false
|
||||
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
||||
ContinuationIndentWidth: 4
|
||||
Cpp11BracedListStyle: true
|
||||
|
||||
FixNamespaceComments: true
|
||||
|
||||
IncludeBlocks: Regroup
|
||||
IncludeCategories:
|
||||
- Regex: '^<windows(\.h)?>' # windows headers
|
||||
Priority: -1
|
||||
- Regex: '^<labbcan[[:alnum:]._/]+' # labbcan headers
|
||||
Priority: 1
|
||||
- Regex: '^<diag[[:alnum:]._/]+' # usl headers
|
||||
Priority: 1
|
||||
- Regex: '^<usl[[:alnum:]._/]+' # usl headers
|
||||
Priority: 1
|
||||
- Regex: '^<qt5compat[[:alnum:]._/]+' # qtlabb headers
|
||||
Priority: 2
|
||||
- Regex: '^<qtcoreaddons[[:alnum:]._/]+' # qtlabb headers
|
||||
Priority: 2
|
||||
- Regex: '^<qtlabb[[:alnum:]._/]+' # qtlabb headers
|
||||
Priority: 2
|
||||
- Regex: '<Q[[:alnum:].]+>' # Qt headers
|
||||
Priority: 3
|
||||
- Regex: '^<sila_cpp[[:alnum:]._/]+' # sila_cpp headers
|
||||
Priority: 4
|
||||
- Regex: '<[[:alnum:]._/]+\.h>' # other headers
|
||||
Priority: 5
|
||||
- Regex: '<[[:alnum:]._/]+>' # system headers
|
||||
Priority: 6
|
||||
- Regex: '.*'
|
||||
Priority: 7
|
||||
|
||||
IncludeIsMainRegex: '(_p)?$'
|
||||
|
||||
IndentCaseBlocks: false
|
||||
IndentCaseLabels: false
|
||||
IndentPPDirectives: AfterHash
|
||||
IndentWidth: 4
|
||||
IndentWrappedFunctionNames: false
|
||||
|
||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||
MaxEmptyLinesToKeep: 1
|
||||
|
||||
NamespaceIndentation: None
|
||||
|
||||
PenaltyBreakAssignment: 20
|
||||
PenaltyBreakBeforeFirstCallParameter: 15
|
||||
PenaltyBreakComment: 10
|
||||
PenaltyBreakFirstLessLess: 5
|
||||
# PenaltyBreakOpenParenthesis: 30
|
||||
PenaltyBreakString: 150
|
||||
PenaltyBreakTemplateDeclaration: 10
|
||||
PenaltyExcessCharacter: 100
|
||||
PenaltyIndentedWhitespace: 0
|
||||
PenaltyReturnTypeOnItsOwnLine: 150
|
||||
|
||||
PointerAlignment: Left
|
||||
ReflowComments: true
|
||||
|
||||
SortIncludes: CaseSensitive
|
||||
SortUsingDeclarations: true
|
||||
|
||||
SpaceAfterCStyleCast: false
|
||||
SpaceAfterLogicalNot: false
|
||||
SpaceAfterTemplateKeyword: false
|
||||
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeCpp11BracedList: false
|
||||
SpaceBeforeCtorInitializerColon: true
|
||||
SpaceBeforeInheritanceColon: true
|
||||
SpaceBeforeParens: ControlStatements
|
||||
SpaceBeforeRangeBasedForLoopColon: true
|
||||
SpaceBeforeSquareBrackets: false
|
||||
SpaceInEmptyBlock: false
|
||||
SpaceInEmptyParentheses: false
|
||||
|
||||
SpacesBeforeTrailingComments: 2
|
||||
SpacesInAngles: Never
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInConditionalStatement: false
|
||||
SpacesInParentheses: false
|
||||
SpacesInSquareBrackets: false
|
||||
|
||||
Standard: c++17
|
||||
|
||||
StatementMacros: [ 'Q_UNUSED', 'PIMPL_D', 'PIMPL_Q', 'OD_ENTRY', 'OD_ENTRY_PROCIMG' ]
|
||||
|
||||
TabWidth: 4
|
||||
UseTab: Never
|
||||
40
.github/workflows/linux-builds.yml
vendored
@@ -6,7 +6,7 @@ jobs:
|
||||
build:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-20.04, ubuntu-18.04]
|
||||
os: [ubuntu-20.04]
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
@@ -16,8 +16,44 @@ jobs:
|
||||
run: |
|
||||
sudo apt-get update --fix-missing
|
||||
sudo apt-get install qt5-default
|
||||
sudo apt-get install qtbase5-private-dev
|
||||
sudo apt-get install qtbase5-private-dev qtdeclarative5-dev
|
||||
- name: qmake
|
||||
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)
|
||||
|
||||
5
.gitignore
vendored
@@ -1,4 +1,4 @@
|
||||
*.pro.user
|
||||
*.pro.user*
|
||||
/build
|
||||
*.o
|
||||
*.dylib
|
||||
@@ -7,6 +7,9 @@ qrc_*
|
||||
moc_*
|
||||
ui_*
|
||||
Makefile
|
||||
*.dll
|
||||
*.a
|
||||
build*
|
||||
|
||||
# IDEs
|
||||
.idea
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
if (POLICY CMP0091)
|
||||
cmake_policy(SET CMP0091 NEW)
|
||||
endif (POLICY CMP0091)
|
||||
|
||||
# By default, the version information is extracted from the git index. However,
|
||||
# we can override this behavior by explicitly setting ADS_VERSION and
|
||||
|
||||
171
README.md
@@ -22,6 +22,70 @@ integrated development environments (IDEs) such as Visual Studio.
|
||||
|
||||
## New and Noteworthy
|
||||
|
||||
Release [4.1](https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/releases/latest) significantly improves the Auto-Hide functionality and also brings improvements
|
||||
for Drag and Drop of dock widgets into dock area tabs. These are the highlights of the new version:
|
||||
|
||||
#### Drag & Drop to Auto-Hide
|
||||
|
||||
Now you can easily drag any dock widget or any floating widget to the
|
||||
borders of a window to pin it as a auto-hide tab in one of the 4 sidebars.
|
||||
If you drag a dock widget close the one of the four window borders, special
|
||||
drop overlays will be shown to indicate the drop area for auto-hide widgets:
|
||||
|
||||

|
||||
|
||||
Of course, this also works with dock areas:
|
||||
|
||||

|
||||
|
||||
If you drag a dock widget or dock area into a sidebar, then you even have
|
||||
control over where tabs are inserted. Simply drag your mouse over a specific
|
||||
auto-hide tab, and your dragged dock widget will be inserted before this tab.
|
||||
Drag to the sidebar area behind the last tab, and the dragged widget will be
|
||||
appended as last tab. In the following screen capture, the **Image Viewer 1** will
|
||||
be inserted before the **Table 0** Auto-Hide tab and the **Image Viewer 2**
|
||||
is appende behind the last tab:
|
||||
|
||||

|
||||
|
||||
#### Auto-Hide Tab Insertion Order
|
||||
|
||||
It is also possible to drag Auto-Hide tabs to a new auto-hide position.
|
||||
That means, you can drag them to a different border or sidebar:
|
||||
|
||||

|
||||
|
||||
#### Auto-Hide Tab Sorting
|
||||
|
||||
You can drag Auto-Hide tabs to a new position in the current sidebar
|
||||
to sort them:
|
||||
|
||||

|
||||
|
||||
#### Auto-Hide Drag to Float / Dock
|
||||
|
||||
But that is not all. You can also simply move Auto-Hide tabs to another
|
||||
floating widget or dock them via drag and drop:
|
||||
|
||||

|
||||
|
||||
#### Auto-Hide Context Menu
|
||||
|
||||
All Auto-Hide tabs now have a context menu, that provides all the functionality
|
||||
that you know from Dock widget tabs. With the **Pin To...** item from the
|
||||
context menu it is very easy to move an Auto-Hide tab to a different Auto-Hide
|
||||
sidebar:
|
||||
|
||||

|
||||
|
||||
#### Dock Area Tab Insert Order
|
||||
|
||||
And last but not least the new version also improves the docking of widgets
|
||||
into the tabs of a Dock area. Just as with Auto-Hide tabs, you can now determine the position at which a tab is inserted by moving the mouse over an already existing tab (insertion before the tab) or behind the last tab
|
||||
(appending):
|
||||
|
||||

|
||||
|
||||
The [release 4.0](https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/releases/latest)
|
||||
adds the following features:
|
||||
|
||||
@@ -77,6 +141,12 @@ know it from Visual Studio.
|
||||
### Overview
|
||||
|
||||
- [New and Noteworthy](#new-and-noteworthy)
|
||||
- [Drag \& Drop to Auto-Hide](#drag--drop-to-auto-hide)
|
||||
- [Auto-Hide Tab Insertion Order](#auto-hide-tab-insertion-order)
|
||||
- [Auto-Hide Tab Sorting](#auto-hide-tab-sorting)
|
||||
- [Auto-Hide Drag to Float / Dock](#auto-hide-drag-to-float--dock)
|
||||
- [Auto-Hide Context Menu](#auto-hide-context-menu)
|
||||
- [Dock Area Tab Insert Order](#dock-area-tab-insert-order)
|
||||
- [Features](#features)
|
||||
- [Overview](#overview)
|
||||
- [Docking everywhere - no central widget](#docking-everywhere---no-central-widget)
|
||||
@@ -98,6 +168,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 +187,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 +326,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 +368,13 @@ The application can be compiled for macOS. A user reported, that the library wor
|
||||
[](https://travis-ci.org/githubuser0xFFFF/Qt-Advanced-Docking-System)
|
||||
[](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 it 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 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 +389,27 @@ 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. The demo
|
||||
application creates a `QQuickWidget` for testing, so ensure that the required
|
||||
libraries are 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 libqt5qml5 qtdeclarative5-dev
|
||||
```
|
||||
|
||||
### Qt6 on Ubuntu 22.04
|
||||
|
||||
```bash
|
||||
sudo apt install qt6-default qt6-base-dev qt6-base-private-dev qt6-tools-dev libqt6svg6 qt6-qtdeclarative
|
||||
```
|
||||
|
||||
Open the `ads.pro` file with QtCreator and start the build, that's it.
|
||||
@@ -365,7 +462,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
// Create the dock manager after the ui is setup. Because the
|
||||
// parent parameter is a QMainWindow the dock manager registers
|
||||
// itself as the central widget as such the ui must be set up first.
|
||||
m_DockManager = new ads::CDockManager(this);
|
||||
DockManager = new ads::CDockManager(this);
|
||||
|
||||
// Create example content label - this can be any application specific
|
||||
// widget
|
||||
@@ -376,7 +473,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
|
||||
// Create a dock widget with the title Label 1 and set the created label
|
||||
// as the dock widget content
|
||||
ads::CDockWidget* DockWidget = new ads::CDockWidget("Label 1");
|
||||
ads::CDockWidget* DockWidget = DockManager->createDockWidget("Label 1");
|
||||
DockWidget->setWidget(l);
|
||||
|
||||
// Add the toggleViewAction of the dock widget to the menu to give
|
||||
@@ -384,7 +481,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
ui->menuView->addAction(DockWidget->toggleViewAction());
|
||||
|
||||
// Add the dock widget to the top dock widget area
|
||||
m_DockManager->addDockWidget(ads::TopDockWidgetArea, DockWidget);
|
||||
DockManager->addDockWidget(ads::TopDockWidgetArea, DockWidget);
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
@@ -485,7 +582,7 @@ highlights are:
|
||||
- Simple Drag & Drop user interface.
|
||||
- Load data from file.
|
||||
- Connect to live streaming of data.
|
||||
- Save the visualization layout and configurations to re-use them later.
|
||||
- Save the visualization layout and configurations to reuse them later.
|
||||
- Fast OpenGL visualization.
|
||||
- Can handle thousands of timeseries and millions of data points.
|
||||
- Transform your data using a simple editor: derivative, moving average, integral, etc…
|
||||
@@ -538,13 +635,65 @@ development experience.
|
||||
|
||||

|
||||
|
||||
### [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/)
|
||||
|
||||
[](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)
|
||||
|
||||

|
||||
|
||||
### [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.
|
||||
|
||||

|
||||
|
||||
[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.
|
||||
|
||||

|
||||
|
||||
[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)
|
||||
|
||||
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.5)
|
||||
project(ads_demo VERSION ${VERSION_SHORT})
|
||||
|
||||
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED)
|
||||
find_package(Qt${QT_VERSION_MAJOR} 5.5 COMPONENTS Core Gui Widgets REQUIRED)
|
||||
find_package(Qt${QT_VERSION_MAJOR} 5.5 COMPONENTS Core Gui Widgets Quick QuickWidgets REQUIRED)
|
||||
if(WIN32 AND QT_VERSION_MAJOR LESS 6)
|
||||
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS AxContainer REQUIRED)
|
||||
endif()
|
||||
@@ -21,11 +21,13 @@ add_executable(AdvancedDockingSystemDemo WIN32 ${ads_demo_SRCS})
|
||||
target_include_directories(AdvancedDockingSystemDemo PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../src")
|
||||
target_link_libraries(AdvancedDockingSystemDemo PUBLIC Qt${QT_VERSION_MAJOR}::Core
|
||||
Qt${QT_VERSION_MAJOR}::Gui
|
||||
Qt${QT_VERSION_MAJOR}::Widgets)
|
||||
Qt${QT_VERSION_MAJOR}::Widgets
|
||||
Qt${QT_VERSION_MAJOR}::Quick
|
||||
Qt${QT_VERSION_MAJOR}::QuickWidgets)
|
||||
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 qtadvanceddocking-qt${QT_VERSION_MAJOR})
|
||||
set_target_properties(AdvancedDockingSystemDemo PROPERTIES
|
||||
AUTOMOC ON
|
||||
AUTORCC ON
|
||||
|
||||
@@ -62,6 +62,7 @@
|
||||
#include <QPointer>
|
||||
#include <QMap>
|
||||
#include <QElapsedTimer>
|
||||
#include <QQuickWidget>
|
||||
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
@@ -74,18 +75,17 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "DockManager.h"
|
||||
#include "DockWidget.h"
|
||||
#include "DockAreaWidget.h"
|
||||
#include "DockAreaTitleBar.h"
|
||||
#include "DockAreaTabBar.h"
|
||||
#include "FloatingDockContainer.h"
|
||||
#include "DockAreaTitleBar.h"
|
||||
#include "DockAreaWidget.h"
|
||||
#include "DockComponentsFactory.h"
|
||||
#include "StatusDialog.h"
|
||||
#include "DockManager.h"
|
||||
#include "DockSplitter.h"
|
||||
#include "DockWidget.h"
|
||||
#include "FloatingDockContainer.h"
|
||||
#include "ImageViewer.h"
|
||||
|
||||
|
||||
#include "MyDockAreaTitleBar.h"
|
||||
#include "StatusDialog.h"
|
||||
|
||||
/**
|
||||
* Returns a random number from 0 to highest - 1
|
||||
@@ -146,7 +146,7 @@ public:
|
||||
using Super = ads::CDockComponentsFactory;
|
||||
ads::CDockAreaTitleBar* createDockAreaTitleBar(ads::CDockAreaWidget* DockArea) const override
|
||||
{
|
||||
auto TitleBar = new ads::CDockAreaTitleBar(DockArea);
|
||||
auto TitleBar = new MyDockAreaTitleBar(DockArea);
|
||||
auto CustomButton = new QToolButton(DockArea);
|
||||
CustomButton->setToolTip(QObject::tr("Help"));
|
||||
CustomButton->setIcon(svgIcon(":/adsdemo/images/help_outline.svg"));
|
||||
@@ -236,7 +236,7 @@ struct MainWindowPrivate
|
||||
m->setRootPath(QDir::currentPath());
|
||||
w->setModel(m);
|
||||
w->setRootIndex(m->index(QDir::currentPath()));
|
||||
ads::CDockWidget* DockWidget = new ads::CDockWidget(QString("Filesystem %1")
|
||||
ads::CDockWidget* DockWidget = DockManager->createDockWidget(QString("Filesystem %1")
|
||||
.arg(FileSystemCount++));
|
||||
DockWidget->setWidget(w);
|
||||
DockWidget->setIcon(svgIcon(":/adsdemo/images/folder_open.svg"));
|
||||
@@ -257,7 +257,7 @@ struct MainWindowPrivate
|
||||
{
|
||||
static int CalendarCount = 0;
|
||||
QCalendarWidget* w = new QCalendarWidget();
|
||||
ads::CDockWidget* DockWidget = new ads::CDockWidget(QString("Calendar %1").arg(CalendarCount++));
|
||||
ads::CDockWidget* DockWidget = DockManager->createDockWidget(QString("Calendar %1").arg(CalendarCount++));
|
||||
// The following lines are for testing the setWidget() and takeWidget()
|
||||
// functionality
|
||||
DockWidget->setWidget(w);
|
||||
@@ -270,6 +270,10 @@ struct MainWindowPrivate
|
||||
auto ToolBar = DockWidget->createDefaultToolBar();
|
||||
ToolBar->addAction(ui.actionSaveState);
|
||||
ToolBar->addAction(ui.actionRestoreState);
|
||||
// For testing all calendar dock widgets have a the tool button style
|
||||
// Qt::ToolButtonTextUnderIcon
|
||||
DockWidget->setToolBarStyleSource(ads::CDockWidget::ToolBarStyleFromDockWidget);
|
||||
DockWidget->setToolBarStyle(Qt::ToolButtonTextUnderIcon, ads::CDockWidget::StateFloating);
|
||||
return DockWidget;
|
||||
}
|
||||
|
||||
@@ -298,7 +302,7 @@ struct MainWindowPrivate
|
||||
.arg(LabelCount)
|
||||
.arg(QTime::currentTime().toString("hh:mm:ss:zzz")));
|
||||
|
||||
ads::CDockWidget* DockWidget = new ads::CDockWidget(QString("Label %1").arg(LabelCount++));
|
||||
ads::CDockWidget* DockWidget = DockManager->createDockWidget(QString("Label %1").arg(LabelCount++));
|
||||
DockWidget->setWidget(l);
|
||||
DockWidget->setIcon(svgIcon(":/adsdemo/images/font_download.svg"));
|
||||
ui.menuView->addAction(DockWidget->toggleViewAction());
|
||||
@@ -316,7 +320,7 @@ struct MainWindowPrivate
|
||||
w->setPlaceholderText("This is an editor. If you close the editor, it will be "
|
||||
"deleted. Enter your text here.");
|
||||
w->setStyleSheet("border: none");
|
||||
ads::CDockWidget* DockWidget = new ads::CDockWidget(QString("Editor %1").arg(EditorCount++));
|
||||
ads::CDockWidget* DockWidget = DockManager->createDockWidget(QString("Editor %1").arg(EditorCount++));
|
||||
DockWidget->setWidget(w);
|
||||
DockWidget->setIcon(svgIcon(":/adsdemo/images/edit.svg"));
|
||||
DockWidget->setFeature(ads::CDockWidget::CustomCloseHandling, true);
|
||||
@@ -359,7 +363,7 @@ struct MainWindowPrivate
|
||||
|
||||
auto Result = w->loadFile(FileName);
|
||||
qDebug() << "loadFile result: " << Result;
|
||||
ads::CDockWidget* DockWidget = new ads::CDockWidget(QString("Image Viewer %1").arg(ImageViewerCount++));
|
||||
ads::CDockWidget* DockWidget = DockManager->createDockWidget(QString("Image Viewer %1").arg(ImageViewerCount++));
|
||||
DockWidget->setIcon(svgIcon(":/adsdemo/images/photo.svg"));
|
||||
DockWidget->setWidget(w,ads:: CDockWidget::ForceNoScrollArea);
|
||||
auto ToolBar = DockWidget->createDefaultToolBar();
|
||||
@@ -374,7 +378,7 @@ struct MainWindowPrivate
|
||||
{
|
||||
static int TableCount = 0;
|
||||
auto w = new CMinSizeTableWidget();
|
||||
ads::CDockWidget* DockWidget = new ads::CDockWidget(QString("Table %1").arg(TableCount++));
|
||||
ads::CDockWidget* DockWidget = DockManager->createDockWidget(QString("Table %1").arg(TableCount++));
|
||||
static int colCount = 5;
|
||||
static int rowCount = 30;
|
||||
w->setColumnCount(colCount);
|
||||
@@ -407,6 +411,17 @@ struct MainWindowPrivate
|
||||
return DockWidget;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create QQuickWidget for test for OpenGL and QQuick
|
||||
*/
|
||||
ads::CDockWidget *createQQuickWidget()
|
||||
{
|
||||
QQuickWidget *widget = new QQuickWidget();
|
||||
ads::CDockWidget *dockWidget = DockManager->createDockWidget("Quick");
|
||||
dockWidget->setWidget(widget);
|
||||
return dockWidget;
|
||||
}
|
||||
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
@@ -417,14 +432,13 @@ struct MainWindowPrivate
|
||||
{
|
||||
static int ActiveXCount = 0;
|
||||
QAxWidget* w = new QAxWidget("{6bf52a52-394a-11d3-b153-00c04f79faa6}", parent);
|
||||
ads::CDockWidget* DockWidget = new ads::CDockWidget(QString("Active X %1").arg(ActiveXCount++));
|
||||
ads::CDockWidget* DockWidget = DockManager->createDockWidget(QString("Active X %1").arg(ActiveXCount++));
|
||||
DockWidget->setWidget(w);
|
||||
ui.menuView->addAction(DockWidget->toggleViewAction());
|
||||
return DockWidget;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
//============================================================================
|
||||
@@ -437,8 +451,8 @@ void MainWindowPrivate::createContent()
|
||||
|
||||
// For this Special Dock Area we want to avoid dropping on the center of it (i.e. we don't want this widget to be ever tabbified):
|
||||
{
|
||||
SpecialDockArea->setAllowedAreas(ads::OuterDockAreas);
|
||||
//SpecialDockArea->setAllowedAreas({ads::LeftDockWidgetArea, ads::RightDockWidgetArea}); // just for testing
|
||||
//SpecialDockArea->setAllowedAreas(ads::OuterDockAreas);
|
||||
SpecialDockArea->setAllowedAreas({ads::LeftDockWidgetArea, ads::RightDockWidgetArea, ads::TopDockWidgetArea}); // just for testing
|
||||
}
|
||||
|
||||
DockWidget = createLongTextLabelDockWidget();
|
||||
@@ -456,12 +470,12 @@ void MainWindowPrivate::createContent()
|
||||
appendFeaturStringToWindowTitle(FileSystemWidget);
|
||||
|
||||
// Test custom factory - we inject a help button into the title bar
|
||||
ads::CDockComponentsFactory::setFactory(new CCustomComponentsFactory());
|
||||
DockManager->setComponentsFactory(new CCustomComponentsFactory());
|
||||
auto TopDockArea = DockManager->addDockWidget(ads::TopDockWidgetArea, FileSystemWidget);
|
||||
// Uncomment the next line if you would like to test the
|
||||
// HideSingleWidgetTitleBar functionality
|
||||
// TopDockArea->setDockAreaFlag(ads::CDockAreaWidget::HideSingleWidgetTitleBar, true);
|
||||
ads::CDockComponentsFactory::resetDefaultFactory();
|
||||
DockManager->setComponentsFactory(ads::CDockComponentsFactory::factory());
|
||||
|
||||
// We create a calendar widget and clear all flags to prevent the dock area
|
||||
// from closing
|
||||
@@ -506,7 +520,9 @@ void MainWindowPrivate::createContent()
|
||||
|
||||
// Test dock area docking
|
||||
auto RighDockArea = DockManager->addDockWidget(ads::RightDockWidgetArea, createLongTextLabelDockWidget(), TopDockArea);
|
||||
DockManager->addDockWidget(ads::TopDockWidgetArea, createLongTextLabelDockWidget(), RighDockArea);
|
||||
DockWidget = createLongTextLabelDockWidget();
|
||||
DockWidget->setFeature(ads::CDockWidget::DockWidgetPinnable, false);
|
||||
DockManager->addDockWidget(ads::TopDockWidgetArea, DockWidget, RighDockArea);
|
||||
auto BottomDockArea = DockManager->addDockWidget(ads::BottomDockWidgetArea, createLongTextLabelDockWidget(), RighDockArea);
|
||||
DockManager->addDockWidget(ads::CenterDockWidgetArea, createLongTextLabelDockWidget(), RighDockArea);
|
||||
auto LabelDockWidget = createLongTextLabelDockWidget();
|
||||
@@ -514,6 +530,7 @@ void MainWindowPrivate::createContent()
|
||||
|
||||
// Tests CustomCloseHandling without DeleteOnClose
|
||||
LabelDockWidget->setFeature(ads::CDockWidget::CustomCloseHandling, true);
|
||||
LabelDockWidget->setWindowTitle(LabelDockWidget->windowTitle() + " [Custom Close]");
|
||||
QObject::connect(LabelDockWidget, &ads::CDockWidget::closeRequested, [LabelDockWidget, this]()
|
||||
{
|
||||
int Result = QMessageBox::question(_this, "Custom Close Request",
|
||||
@@ -557,6 +574,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);
|
||||
}
|
||||
|
||||
|
||||
@@ -569,19 +591,29 @@ void MainWindowPrivate::createActions()
|
||||
ui.toolBar->addAction(ui.actionRestoreState);
|
||||
ui.actionRestoreState->setIcon(svgIcon(":/adsdemo/images/restore.svg"));
|
||||
|
||||
SavePerspectiveAction = new QAction("Create Perspective", _this);
|
||||
SavePerspectiveAction->setIcon(svgIcon(":/adsdemo/images/picture_in_picture.svg"));
|
||||
_this->connect(SavePerspectiveAction, SIGNAL(triggered()), SLOT(savePerspective()));
|
||||
ui.toolBar->addSeparator();
|
||||
|
||||
QAction* a = ui.toolBar->addAction("Lock Workspace");
|
||||
a->setIcon(svgIcon(":/adsdemo/images/lock_outline.svg"));
|
||||
a->setCheckable(true);
|
||||
a->setChecked(false);
|
||||
QObject::connect(a, &QAction::triggered, _this, &CMainWindow::lockWorkspace);
|
||||
|
||||
PerspectiveListAction = new QWidgetAction(_this);
|
||||
PerspectiveComboBox = new QComboBox(_this);
|
||||
PerspectiveComboBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||
PerspectiveComboBox->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
|
||||
PerspectiveComboBox->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
||||
PerspectiveListAction->setDefaultWidget(PerspectiveComboBox);
|
||||
ui.toolBar->addSeparator();
|
||||
ui.toolBar->addAction(PerspectiveListAction);
|
||||
|
||||
a = SavePerspectiveAction = ui.toolBar->addAction("Create Perspective");
|
||||
a->setIcon(svgIcon(":/adsdemo/images/picture_in_picture.svg"));
|
||||
QObject::connect(a, &QAction::triggered, _this, &CMainWindow::savePerspective);
|
||||
ui.toolBar->addAction(SavePerspectiveAction);
|
||||
|
||||
QAction* a = ui.toolBar->addAction("Create Floating Editor");
|
||||
ui.toolBar->addSeparator();
|
||||
|
||||
a = ui.toolBar->addAction("Create Floating Editor");
|
||||
a->setProperty("Floating", true);
|
||||
a->setToolTip("Creates floating dynamic dockable editor windows that are deleted on close");
|
||||
a->setIcon(svgIcon(":/adsdemo/images/note_add.svg"));
|
||||
@@ -603,6 +635,7 @@ void MainWindowPrivate::createActions()
|
||||
_this->connect(a, SIGNAL(triggered()), SLOT(createEditor()));
|
||||
ui.menuTests->addAction(a);
|
||||
|
||||
ui.toolBar->addSeparator();
|
||||
a = ui.toolBar->addAction("Create Floating Table");
|
||||
a->setToolTip("Creates floating dynamic dockable table with millions of entries");
|
||||
a->setIcon(svgIcon(":/adsdemo/images/grid_on.svg"));
|
||||
@@ -734,7 +767,10 @@ 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 disable closing auto hide widget with mouse click outside of auto hide container
|
||||
//CDockManager::setAutoHideConfigFlag(CDockManager::AutoHideCloseOnOutsideMouseClick, false);
|
||||
|
||||
// uncomment if you would like to enable an equal distribution of the
|
||||
// available size of a splitter to all contained dock widgets
|
||||
@@ -745,6 +781,7 @@ CMainWindow::CMainWindow(QWidget *parent) :
|
||||
|
||||
// Now create the dock manager and its content
|
||||
d->DockManager = new CDockManager(this);
|
||||
d->DockManager->setDockWidgetToolBarStyle(Qt::ToolButtonIconOnly, ads::CDockWidget::StateFloating);
|
||||
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
connect(d->PerspectiveComboBox, SIGNAL(activated(QString)),
|
||||
@@ -1006,3 +1043,17 @@ void CMainWindow::createImageViewer()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
void CMainWindow::lockWorkspace(bool Value)
|
||||
{
|
||||
if (Value)
|
||||
{
|
||||
d->DockManager->lockDockWidgetFeaturesGlobally();
|
||||
}
|
||||
else
|
||||
{
|
||||
d->DockManager->lockDockWidgetFeaturesGlobally(ads::CDockWidget::NoDockWidgetFeatures);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -68,6 +68,7 @@ private slots:
|
||||
void toggleDockWidgetWindowTitle();
|
||||
void applyVsStyle();
|
||||
void createImageViewer();
|
||||
void lockWorkspace(bool Value);
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
||||
|
||||
58
demo/MyDockAreaTitleBar.h
Normal file
@@ -0,0 +1,58 @@
|
||||
#ifndef QTADS_MYDOCKAREATITLEBAR_H
|
||||
#define QTADS_MYDOCKAREATITLEBAR_H
|
||||
/*******************************************************************************
|
||||
** Qt Advanced Docking System
|
||||
** Copyright (C) 2017 Uwe Kindler
|
||||
**
|
||||
** This library is free software; you can redistribute it and/or
|
||||
** modify it under the terms of the GNU Lesser General Public
|
||||
** License as published by the Free Software Foundation; either
|
||||
** version 2.1 of the License, or (at your option) any later version.
|
||||
**
|
||||
** This library is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
** Lesser General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU Lesser General Public
|
||||
** License along with this library; If not, see <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
//============================================================================
|
||||
// INCLUDES
|
||||
//============================================================================
|
||||
#include <DockAreaTitleBar.h>
|
||||
|
||||
|
||||
/**
|
||||
* Custom DockAreaTitleBar that adds a custom context menu
|
||||
*/
|
||||
class MyDockAreaTitleBar : public ads::CDockAreaTitleBar
|
||||
{
|
||||
public:
|
||||
explicit MyDockAreaTitleBar(ads::CDockAreaWidget *parent) :
|
||||
CDockAreaTitleBar(parent)
|
||||
{
|
||||
}
|
||||
|
||||
QMenu* buildContextMenu(QMenu*) override
|
||||
{
|
||||
auto menu = ads::CDockAreaTitleBar::buildContextMenu(nullptr);
|
||||
menu->addSeparator();
|
||||
auto action = menu->addAction(tr("Format HardDrive"));
|
||||
|
||||
connect(action, &QAction::triggered, this, [this]()
|
||||
{
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText("No, just kidding");
|
||||
msgBox.setStandardButtons(QMessageBox::Abort);
|
||||
msgBox.setDefaultButton(QMessageBox::Abort);
|
||||
msgBox.exec();
|
||||
});
|
||||
|
||||
return menu;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // QTADS_MYDOCKAREATITLEBAR_H
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -36,5 +36,8 @@
|
||||
<file>images/panorama.svg</file>
|
||||
<file>images/ads_icon2.svg</file>
|
||||
<file>images/font_download.svg</file>
|
||||
<file>images/lock_outline.svg</file>
|
||||
<file>images/lock.svg</file>
|
||||
<file>images/lock_open.svg</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
6
demo/images/lock.svg
Normal file
@@ -0,0 +1,6 @@
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0,0,1024,1024">
|
||||
<desc>lock icon - Licensed under Apache License v2.0 (http://www.apache.org/licenses/LICENSE-2.0) - Created with Iconfu.com - Derivative work of Material icons (Copyright Google Inc.)</desc>
|
||||
<g fill="#03b8e5" fill-rule="nonzero" style="mix-blend-mode: normal">
|
||||
<path d="M853.33,426.67v426.66c0,46.93 -38.4,85.34 -85.33,85.34h-512c-46.93,0 -85.33,-38.41 -85.33,-85.34v-426.66c0,-46.93 38.4,-85.34 85.33,-85.34h42.67v-85.33c0,-117.76 95.57,-213.33 213.33,-213.33c117.76,0 213.33,95.57 213.33,213.33v85.33h42.67c46.93,0 85.33,38.41 85.33,85.34zM644.27,256c0,-72.96 -59.31,-132.27 -132.27,-132.27c-72.96,0 -132.27,59.31 -132.27,132.27v85.33h264.54zM597.33,640c0,-46.93 -38.4,-85.33 -85.33,-85.33c-46.93,0 -85.33,38.4 -85.33,85.33c0,46.93 38.4,85.33 85.33,85.33c46.93,0 85.33,-38.4 85.33,-85.33z"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 932 B |
6
demo/images/lock_open.svg
Normal file
@@ -0,0 +1,6 @@
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0,0,1024,1024">
|
||||
<desc>lock_open icon - Licensed under Apache License v2.0 (http://www.apache.org/licenses/LICENSE-2.0) - Created with Iconfu.com - Derivative work of Material icons (Copyright Google Inc.)</desc>
|
||||
<g fill="#03b8e5" fill-rule="nonzero" style="mix-blend-mode: normal">
|
||||
<path d="M853.33,426.67v426.66c0,46.93 -38.4,85.34 -85.33,85.34h-512c-46.93,0 -85.33,-38.41 -85.33,-85.34v-426.66c0,-46.93 38.4,-85.34 85.33,-85.34h388.27v-85.33c0,-72.96 -59.31,-132.27 -132.27,-132.27c-72.96,0 -132.27,59.31 -132.27,132.27h-81.06c0,-117.76 95.57,-213.33 213.33,-213.33c117.76,0 213.33,95.57 213.33,213.33v85.33h42.67c46.93,0 85.33,38.41 85.33,85.34zM768,426.67h-512v426.66h512zM426.67,640c0,-46.93 38.4,-85.33 85.33,-85.33c46.93,0 85.33,38.4 85.33,85.33c0,46.93 -38.4,85.33 -85.33,85.33c-46.93,0 -85.33,-38.4 -85.33,-85.33z"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 948 B |
6
demo/images/lock_outline.svg
Normal file
@@ -0,0 +1,6 @@
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0,0,1024,1024">
|
||||
<desc>lock_outline icon - Licensed under Apache License v2.0 (http://www.apache.org/licenses/LICENSE-2.0) - Created with Iconfu.com - Derivative work of Material icons (Copyright Google Inc.)</desc>
|
||||
<g fill="#03b8e5" fill-rule="nonzero" style="mix-blend-mode: normal">
|
||||
<path d="M853.33,426.67v426.66c0,46.93 -38.4,85.34 -85.33,85.34h-512c-46.93,0 -85.33,-38.41 -85.33,-85.34v-426.66c0,-46.93 38.4,-85.34 85.33,-85.34h42.67v-85.33c0,-117.76 95.57,-213.33 213.33,-213.33c117.76,0 213.33,95.57 213.33,213.33v85.33h42.67c46.93,0 85.33,38.41 85.33,85.34zM768,426.67h-512v426.66h512zM379.73,341.33h264.54v-85.33c0,-72.96 -59.31,-132.27 -132.27,-132.27c-72.96,0 -132.27,59.31 -132.27,132.27zM426.67,640c0,-46.93 38.4,-85.33 85.33,-85.33c46.93,0 85.33,38.4 85.33,85.33c0,46.93 -38.4,85.33 -85.33,85.33c-46.93,0 -85.33,-38.4 -85.33,-85.33z"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 972 B |
@@ -2,7 +2,7 @@ import os
|
||||
import sys
|
||||
|
||||
from PyQt5 import uic
|
||||
from PyQtAds import QtAds
|
||||
import PyQtAds as QtAds
|
||||
|
||||
UI_FILE = os.path.join(os.path.dirname(__file__), 'StatusDialog.ui')
|
||||
StatusDialogUI, StatusDialogBase = uic.loadUiType(UI_FILE)
|
||||
|
||||
BIN
doc/AutoHide_Change_Sidebar.gif
Normal file
|
After Width: | Height: | Size: 312 KiB |
BIN
doc/AutoHide_Context_Menu.png
Normal file
|
After Width: | Height: | Size: 34 KiB |
BIN
doc/AutoHide_Drag_DockArea.gif
Normal file
|
After Width: | Height: | Size: 330 KiB |
BIN
doc/AutoHide_Drag_to_Float_or_Dock.gif
Normal file
|
After Width: | Height: | Size: 642 KiB |
BIN
doc/AutoHide_Drag_to_Sidebar.gif
Normal file
|
After Width: | Height: | Size: 559 KiB |
BIN
doc/AutoHide_Sort_Tabs.gif
Normal file
|
After Width: | Height: | Size: 299 KiB |
BIN
doc/AutoHide_Tab_Insert_Order.gif
Normal file
|
After Width: | Height: | Size: 303 KiB |
BIN
doc/DockArea_Tab_Insertion_Order.gif
Normal file
|
After Width: | Height: | Size: 376 KiB |
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 8.0 KiB |
@@ -12,10 +12,10 @@ styles as much as possible.
|
||||
|
||||
## Features
|
||||
|
||||
### Docking everywhere - no central widget
|
||||
### Docking everywhere - with or without a central widget
|
||||
|
||||
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
|
||||
The Advanced Docking System works with or without a central widget.
|
||||
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.
|
||||
|
||||

|
||||
@@ -65,7 +65,7 @@ If this flag is cleared, the widget resizing is deferred until the mouse button
|
||||
|
||||
### Opaque and non-opaque undocking
|
||||
|
||||
By default, opaque undocking is active. That means, as soon as you drag a dock widget or a dock area with a number of dock widgets it will be undocked and moved into a floating widget and then the floating widget will be dragged around. That means undocking will take place immediatelly. You can compare this with opaque splitter resizing. If the flag `OpaqueUndocking` is cleared, then non-opaque undocking is active. In this mode, undocking is more like a standard drag and drop operation. That means, the dragged dock widget or dock area is not undocked immediatelly. Instead, a drag preview widget is created and dragged around to indicate the future position of the dock widget or dock area. The actual dock operation is only executed when the mouse button is released. That makes it possible, to cancel an active drag operation with the escape key.
|
||||
By default, opaque undocking is active. That means, as soon as you drag a dock widget or a dock area with a number of dock widgets it will be undocked and moved into a floating widget and then the floating widget will be dragged around. That means undocking will take place immediately. You can compare this with opaque splitter resizing. If the flag `OpaqueUndocking` is cleared, then non-opaque undocking is active. In this mode, undocking is more like a standard drag and drop operation. That means, the dragged dock widget or dock area is not undocked immediately. Instead, a drag preview widget is created and dragged around to indicate the future position of the dock widget or dock area. The actual dock operation is only executed when the mouse button is released. That makes it possible, to cancel an active drag operation with the escape key.
|
||||
|
||||
The drag preview widget can be configured by a number of global dock manager flags:
|
||||
|
||||
|
||||
BIN
doc/cfg_flag_AutoHideCloseButtonCollapsesDock_false.gif
Normal file
|
After Width: | Height: | Size: 90 KiB |
BIN
doc/cfg_flag_AutoHideCloseButtonCollapsesDock_true.gif
Normal file
|
After Width: | Height: | Size: 52 KiB |
BIN
doc/cfg_flag_AutoHideHasCloseButton.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
doc/cfg_flag_AutoHideHasMinimizeButton.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
doc/cfg_flag_AutoHideOpenOnDragHover.gif
Normal file
|
After Width: | Height: | Size: 269 KiB |
BIN
doc/cfg_flag_DisableTabTextEliding_false.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
doc/cfg_flag_DisableTabTextEliding_true.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
doc/cfg_flag_ShowTabTextOnlyForActiveTab_true.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
doc/showcase_adtf.png
Normal file
|
After Width: | Height: | Size: 112 KiB |
BIN
doc/showcase_dream3d_nx.png
Normal file
|
After Width: | Height: | Size: 364 KiB |
BIN
doc/showcase_labplot.png
Normal file
|
After Width: | Height: | Size: 256 KiB |
BIN
doc/showcase_resinsight.png
Normal file
|
After Width: | Height: | Size: 461 KiB |
|
Before Width: | Height: | Size: 311 KiB After Width: | Height: | Size: 363 KiB |
@@ -27,11 +27,19 @@
|
||||
- [`FloatingContainerForceNativeTitleBar` (Linux only)](#floatingcontainerforcenativetitlebar-linux-only)
|
||||
- [`FloatingContainerForceQWidgetTitleBar` (Linux only)](#floatingcontainerforceqwidgettitlebar-linux-only)
|
||||
- [`MiddleMouseButtonClosesTab`](#middlemousebuttonclosestab)
|
||||
- [Auto-Hide Configuration Flags](#auto-hide-configuration-flags)
|
||||
- [Auto Hide Dock Widgets](#auto-hide-dock-widgets)
|
||||
- [`DisableTabTextEliding`](#disabletabtexteliding)
|
||||
- [`ShowTabTextOnlyForActiveTab`](#showtabtextonlyforactivetab)
|
||||
- [`DoubleClickUndocksWidget`](#doubleclickundockswidget)
|
||||
- [Auto Hide Dock Widgets](#auto-hide-dock-widgets)
|
||||
- [Pinning Auto-Hide Widgets to a certain border](#pinning-auto-hide-widgets-to-a-certain-border)
|
||||
- [Show / Hide Auto-Hide Widgets via Mouse Over](#show--hide-auto-hide-widgets-via-mouse-over)
|
||||
- [Drag \& Drop to Auto-Hide](#drag--drop-to-auto-hide)
|
||||
- [Auto-Hide Tab Insertion Order](#auto-hide-tab-insertion-order)
|
||||
- [Auto-Hide Tab Sorting](#auto-hide-tab-sorting)
|
||||
- [Auto-Hide Drag to Float / Dock](#auto-hide-drag-to-float--dock)
|
||||
- [Auto-Hide Context Menu](#auto-hide-context-menu)
|
||||
- [Adding Auto Hide Widgets](#adding-auto-hide-widgets)
|
||||
- [Auto-Hide Configuration Flags](#auto-hide-configuration-flags)
|
||||
- [Setting Auto-Hide Flags](#setting-auto-hide-flags)
|
||||
- [`AutoHideFeatureEnabled`](#autohidefeatureenabled)
|
||||
- [`DockAreaHasAutoHideButton`](#dockareahasautohidebutton)
|
||||
@@ -39,6 +47,11 @@
|
||||
- [`AutoHideButtonCheckable`](#autohidebuttoncheckable)
|
||||
- [`AutoHideSideBarsIconOnly`](#autohidesidebarsicononly)
|
||||
- [`AutoHideShowOnMouseOver`](#autohideshowonmouseover)
|
||||
- [`AutoHideCloseButtonCollapsesDock`](#autohideclosebuttoncollapsesdock)
|
||||
- [`AutoHideHasCloseButton`](#autohidehasclosebutton)
|
||||
- [`AutoHideHasMinimizeButton`](#autohidehasminimizebutton)
|
||||
- [`AutoHideOpenOnDragHover`](#autohideopenondraghover)
|
||||
- [`AutoHideCloseOnOutsideMouseClick`](#autohidecloseonoutsidemouseclick)
|
||||
- [DockWidget Feature Flags](#dockwidget-feature-flags)
|
||||
- [`DockWidgetClosable`](#dockwidgetclosable)
|
||||
- [`DockWidgetMovable`](#dockwidgetmovable)
|
||||
@@ -52,6 +65,8 @@
|
||||
- [Central Widget](#central-widget)
|
||||
- [Empty Dock Area](#empty-dock-area)
|
||||
- [Custom Close Handling](#custom-close-handling)
|
||||
- [Globally Lock Docking Features](#globally-lock-docking-features)
|
||||
- [Dock Widget Size / Minimum Size Handling](#dock-widget-size--minimum-size-handling)
|
||||
- [Styling](#styling)
|
||||
- [Disabling the Internal Style Sheet](#disabling-the-internal-style-sheet)
|
||||
|
||||
@@ -140,7 +155,7 @@ This ie enabled by default to minimize the size of the saved data.
|
||||
|
||||
### `TabCloseButtonIsToolButton`
|
||||
|
||||
If enabled the tab close buttons will be `QToolButtons` instead of `QPushButtons` -
|
||||
If enabled the tab close buttons will be `QToolButtons` instead of `QPushButtons` -
|
||||
disabled by default. Normally the default configuration should be ok but if your
|
||||
application requires `QToolButtons` instead of `QPushButtons` for styling reasons
|
||||
or for any other reasons, then you can enable this flag.
|
||||
@@ -171,7 +186,7 @@ constant, that means, if enabled, the tabs need more space.
|
||||
|
||||
### `DragPreviewIsDynamic`
|
||||
|
||||
If non-opaque undocking is enabled, this flag defines the behavior of the drag
|
||||
If non-opaque undocking is enabled, this flag defines the behavior of the drag
|
||||
preview window. If this flag is enabled, then it will give the user the
|
||||
impression, that the floating drag preview is dynamically adjusted to the drop
|
||||
area. In order to give the perfect impression, you should disable the flags
|
||||
@@ -187,7 +202,7 @@ CDockManager::setConfigFlag(CDockManager::DragPreviewHasWindowFrame, false);
|
||||
|
||||
### `DragPreviewShowsContentPixmap`
|
||||
|
||||
If non-opaque undocking is enabled, the created drag preview window shows a
|
||||
If non-opaque undocking is enabled, the created drag preview window shows a
|
||||
copy of the content of the dock widget / dock are that is dragged, if this
|
||||
flag is enabled (default).
|
||||
|
||||
@@ -200,7 +215,7 @@ like window without any content.
|
||||
|
||||
### `DragPreviewHasWindowFrame`
|
||||
|
||||
If non-opaque undocking is enabled, then this flag configures if the drag
|
||||
If non-opaque undocking is enabled, then this flag configures if the drag
|
||||
preview is frameless (default) or looks like a real window. If it is enabled,
|
||||
then the drag preview is a transparent window with a system window frame.
|
||||
|
||||
@@ -293,8 +308,9 @@ or to close it via the close button.
|
||||
|
||||

|
||||
|
||||
The Advanced Docking System is meant for applications without a static central
|
||||
widget and normally does not know anything about a central static widget.
|
||||
Unless a central widget explicitly has been set with setCentralWidget, the
|
||||
Advanced Docking System is without a static central widget and it wouldn't know
|
||||
about a central static widget.
|
||||
Therefore this flag is disabled by default and a central single dock widget
|
||||
still has a titlebar to drag it out of the main window.
|
||||
|
||||
@@ -367,7 +383,7 @@ ads--CDockAreaWidget[focused="true"] ads--CDockAreaTitleBar
|
||||
|
||||
If you have a content widget that does not support focussing for some reason
|
||||
(like `QVTKOpenGLStereoWidget` from the [VTK library](https://github.com/Kitware/VTK)),
|
||||
then you can manually switch the focus by reacting on mouse events. The
|
||||
then you can manually switch the focus by reacting on mouse events. The
|
||||
following code shows, how to install en event filter on the `QVTKOpenGLStereoWidget`
|
||||
to properly switch the focus on `QEvent::MouseButtonPress`:
|
||||
|
||||
@@ -411,7 +427,7 @@ bool CMainWindow::eventFilter(QObject *watched, QEvent *event)
|
||||
### `EqualSplitOnInsertion`
|
||||
|
||||
This flag configures how the space is distributed if a new dock widget is
|
||||
inserted into an existing dock area. The flag is disabled by default. If 3
|
||||
inserted into an existing dock area. The flag is disabled by default. If 3
|
||||
dock widgets are inserted with the following code
|
||||
|
||||
```c++
|
||||
@@ -422,7 +438,7 @@ then this is the result, if the flag is disabled:
|
||||
|
||||

|
||||
|
||||
If the flag is enabled, then the space is equally distributed to all widgets
|
||||
If the flag is enabled, then the space is equally distributed to all widgets
|
||||
in a splitter:
|
||||
|
||||

|
||||
@@ -466,13 +482,34 @@ possible in various web browsers.
|
||||
|
||||

|
||||
|
||||
## Auto-Hide Configuration Flags
|
||||
### `DisableTabTextEliding`
|
||||
|
||||
### Auto Hide Dock Widgets
|
||||
Set this flag to disable eliding of tab texts in dock area tabs:
|
||||
|
||||

|
||||
|
||||
The flag is disabled by default and the text in all tabs is elided to show as
|
||||
many tabs as possible even if there is not much space:
|
||||
|
||||

|
||||
|
||||
### `ShowTabTextOnlyForActiveTab`
|
||||
|
||||
Set this flag (default = false) to show label texts in dock area tabs only
|
||||
for active tabs. Inactive tabs only show their icon:
|
||||
|
||||

|
||||
|
||||
### `DoubleClickUndocksWidget`
|
||||
|
||||
If the flag is set (default), a double click on a tab undocks the dock widget.
|
||||
If you would like to disable undocking, just clear this flag.
|
||||
|
||||
## Auto Hide Dock Widgets
|
||||
|
||||
The Advanced Docking System supports "Auto-Hide" functionality for **all**
|
||||
dock containers. The "Auto Hide" feature allows to display more information
|
||||
using less screen space by hiding or showing windows pinned to one of the
|
||||
using less screen space by hiding or showing windows pinned to one of the
|
||||
four dock container borders.
|
||||
|
||||
Enabling this feature adds a button with a pin icon to each dock area.
|
||||
@@ -480,7 +517,7 @@ Enabling this feature adds a button with a pin icon to each dock area.
|
||||

|
||||
|
||||
By clicking this button, the current dock widget (or the complete area - depending on the
|
||||
configuration flags) will be pinned to a certain border. The border is choosen
|
||||
configuration flags) will be pinned to a certain border. The border is chosen
|
||||
depending on the location of the dock area. If you click the pin button while
|
||||
holding down the **Ctrl** key, the whole dock area will be pinned to a certain
|
||||
border.
|
||||
@@ -502,6 +539,59 @@ the Auto-Hide widget is shown, if the user hovers over the Auto-Hide tab and is
|
||||
collapsed if the mouse cursor leaves the Auto-Hide widget. Showing and hiding
|
||||
by mouse click still works if this feature is enabled.
|
||||
|
||||
### Drag & Drop to Auto-Hide
|
||||
|
||||
You can easily drag any dock widget or any floating widget to the
|
||||
borders of a window to pin it as a auto-hide tab in one of the 4 sidebars.
|
||||
If you drag a dock widget close the one of the four window borders, special
|
||||
drop overlays will be shown to indicate the drop area for auto-hide widgets:
|
||||
|
||||

|
||||
|
||||
Of course, this also works with dock areas:
|
||||
|
||||

|
||||
|
||||
If you drag a dock widget or dock area into a sidebar, then you even have
|
||||
control over where tabs are inserted. Simply drag your mouse over a specific
|
||||
auto-hide tab, and your dragged dock widget will be inserted before this tab.
|
||||
Drag to the sidebar area behind the last tab, and the dragged widget will be
|
||||
appended as last tab. In the following screen capture, the **Image Viewer 1** will
|
||||
be inserted before the **Table 0** Auto-Hide tab and the **Image Viewer 2**
|
||||
is appended behind the last tab:
|
||||
|
||||

|
||||
|
||||
### Auto-Hide Tab Insertion Order
|
||||
|
||||
It is also possible to drag Auto-Hide tabs to a new auto-hide position.
|
||||
That means, you can drag them to a different border or sidebar:
|
||||
|
||||

|
||||
|
||||
### Auto-Hide Tab Sorting
|
||||
|
||||
You can drag Auto-Hide tabs to a new position in the current sidebar
|
||||
to sort them:
|
||||
|
||||

|
||||
|
||||
### Auto-Hide Drag to Float / Dock
|
||||
|
||||
But that is not all. You can also simply move Auto-Hide tabs to another
|
||||
floating widget or dock them via drag and drop:
|
||||
|
||||

|
||||
|
||||
### Auto-Hide Context Menu
|
||||
|
||||
All Auto-Hide tabs now have a context menu, that provides all the functionality
|
||||
that you know from Dock widget tabs. With the **Pin To...** item from the
|
||||
context menu it is very easy to move an Auto-Hide tab to a different Auto-Hide
|
||||
sidebar:
|
||||
|
||||

|
||||
|
||||
### Adding Auto Hide Widgets
|
||||
|
||||
Adding an auto hide widget is similar to adding a dock widget, simply call
|
||||
@@ -516,6 +606,8 @@ DockManager->addAutoHideDockWidget(SideBarLeft, TableDockWidget);
|
||||
|
||||
See `autohide` example or the demo application to learn how it works.
|
||||
|
||||
## Auto-Hide Configuration Flags
|
||||
|
||||
### Setting Auto-Hide Flags
|
||||
|
||||
The Advanced Docking System has a number of global configuration flags to
|
||||
@@ -550,7 +642,7 @@ the other Auto-Hide flags will be evaluated.
|
||||
|
||||
### `DockAreaHasAutoHideButton`
|
||||
|
||||
If this flag is set (default), then each dock area has a pin button in the title
|
||||
If this flag is set (default), then each dock area has a pin button in the title
|
||||
bar to toggle Auto-Hide state.
|
||||
|
||||

|
||||
@@ -589,6 +681,53 @@ 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).
|
||||
|
||||

|
||||
|
||||
If `AutoHideCloseButtonCollapsesDock` option is active, the
|
||||
close button in an auto hide widget collapses the auto hide widget instead of
|
||||
closing it.
|
||||
|
||||

|
||||
|
||||
If you enable the `AutoHideHasMinimizeButton` flag, you should disable this
|
||||
flag our you will have two buttons with minimize functionality.
|
||||
|
||||
### `AutoHideHasCloseButton`
|
||||
|
||||
If this flag is set (default), then each auto hide widget has a close button:
|
||||
|
||||

|
||||
|
||||
The functionality of the close button (close or minimize) is configured by the
|
||||
`AutoHideCloseButtonCollapsesDock` flag.
|
||||
|
||||
### `AutoHideHasMinimizeButton`
|
||||
|
||||
If this flag is set (disabled by default), then each auto hide widget has a minimize button.
|
||||
|
||||

|
||||
|
||||
### `AutoHideOpenOnDragHover`
|
||||
|
||||
If this flag is set (disabled by default), then holding a dragging cursor hover an auto-hide collapsed dock's tab will open said dock:
|
||||
|
||||

|
||||
|
||||
Said dock must be set to accept drops to hide when cursor leaves its scope. See `AutoHideDragNDropExample` for more details.
|
||||
|
||||
### `AutoHideCloseOnOutsideMouseClick`
|
||||
|
||||
If this flag is set (default), the auto hide dock container will collapse if the
|
||||
user clicks outside of the container. If not set, the auto hide container can be
|
||||
closed only via click on auto hide sidebar tab.
|
||||
|
||||
## DockWidget Feature Flags
|
||||
|
||||
### `DockWidgetClosable`
|
||||
@@ -710,6 +849,93 @@ Normally clicking the close button of a dock widget will just hide the widget an
|
||||
|
||||
When an entire area is closed, the default behavior is to hide the dock widgets it contains regardless of the `DockWidgetDeleteOnClose` flag except if there is only one dock widget. In this special case, the `DockWidgetDeleteOnClose` flag is followed. This behavior can be changed by setting the `DockWidgetForceCloseWithArea` flag to all the dock widgets that needs to be closed with their area.
|
||||
|
||||
## Globally Lock Docking Features
|
||||
|
||||
It is possible to globally lock features of all dock widgets to "freeze" the
|
||||
current workspace layout. That means, you can now lock your workspace
|
||||
to avoid accidentally dragging a docked view. When locking wasn't possible,
|
||||
users had to manually dock it back to the desired place after each accidental
|
||||
undock.
|
||||
|
||||
You can use a combination of the following feature flags to define which features
|
||||
shall get locked:
|
||||
|
||||
- CDockWidget::DockWidgetClosable
|
||||
- CDockWidget::DockWidgetMovable
|
||||
- CDockWidget::DockWidgetFloatable
|
||||
- CDockWidget::DockWidgetPinable
|
||||
|
||||
To clear the locked features, you can use CDockWidget::NoDockWidgetFeatures
|
||||
The following code shows how to lock and unlock all dock widget features
|
||||
globally.
|
||||
|
||||
```c++
|
||||
DockManager->lockDockWidgetFeaturesGlobally();
|
||||
DockManager->lockDockWidgetFeaturesGlobally(CDockWidget::NoDockWidgetFeatures);
|
||||
```
|
||||
|
||||
## Dock Widget Size / Minimum Size Handling
|
||||
|
||||
There are several `CDockWidget` mode enums to control how a `CDockWidget` is
|
||||
resized and how the docking system handles the minimum size of a dockwidget.
|
||||
|
||||
The first one is the `eInsertMode` enum:
|
||||
|
||||
```c++
|
||||
enum eInsertMode
|
||||
{
|
||||
AutoScrollArea,
|
||||
ForceScrollArea,
|
||||
ForceNoScrollArea
|
||||
};
|
||||
```
|
||||
|
||||
The InsertMode defines how the widget is inserted into the dock widget, when you
|
||||
call the `CDockWidget::setWidget` method:
|
||||
|
||||
```c++
|
||||
DockWidget->setWidget(widget, CDockWidget::AutoScrollArea);
|
||||
```
|
||||
|
||||
The content of a dock widget should be resizable do a very small size to
|
||||
prevent the dock widget from blocking the resizing. To ensure, that a
|
||||
dock widget can be resized very well, it is better to insert the content
|
||||
widget into a scroll area or to provide a widget that is already a scroll
|
||||
area or that contains a scroll area (such as an `QAbstractItemView`)
|
||||
If the InsertMode is `AutoScrollArea`, the DockWidget tries to automatically
|
||||
detect how to insert the given widget. If the widget is derived from
|
||||
`QScrollArea` (i.e. an `QAbstractItemView`), then the widget is inserted
|
||||
directly. If the given widget is not a scroll area, the widget will be
|
||||
inserted into a scroll area.
|
||||
|
||||
To force insertion into a scroll area, you can also provide the InsertMode
|
||||
`ForceScrollArea`. In this case a scroll area will also be created for content
|
||||
widgets that are derived from `QScrollArea` To prevent insertion into a scroll
|
||||
area, you can provide the InsertMode `ForceNoScrollArea`. In this case, the
|
||||
content widget is always inserted directly.
|
||||
|
||||
A second enum, the `eMinimumSizeHintMode` defines, which value will be returned
|
||||
from the `CDockWidget::minimumSizeHint()` function:
|
||||
|
||||
```c++
|
||||
enum eMinimumSizeHintMode
|
||||
{
|
||||
MinimumSizeHintFromDockWidget,
|
||||
MinimumSizeHintFromContent,
|
||||
MinimumSizeHintFromDockWidgetMinimumSize,
|
||||
MinimumSizeHintFromContentMinimumSize,
|
||||
};
|
||||
```
|
||||
|
||||
To ensure, that a dock widget does not block resizing, the dock widget
|
||||
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`. 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.
|
||||
|
||||
## Styling
|
||||
|
||||
The Advanced Docking System supports styling via [Qt Style Sheets](https://doc.qt.io/qt-5/stylesheet.html). All components like splitters, tabs, buttons, titlebar and
|
||||
|
||||
@@ -6,5 +6,6 @@ add_subdirectory(sidebar)
|
||||
add_subdirectory(deleteonclose)
|
||||
add_subdirectory(centralwidget)
|
||||
add_subdirectory(autohide)
|
||||
add_subdirectory(autohidedragndrop)
|
||||
add_subdirectory(emptydockarea)
|
||||
add_subdirectory(dockindock)
|
||||
add_subdirectory(dockindock)
|
||||
|
||||
@@ -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 qtadvanceddocking-qt${QT_VERSION_MAJOR})
|
||||
target_link_libraries(AutoHideExample PUBLIC Qt${QT_VERSION_MAJOR}::Core
|
||||
Qt${QT_VERSION_MAJOR}::Gui
|
||||
Qt${QT_VERSION_MAJOR}::Widgets)
|
||||
|
||||
@@ -8,7 +8,7 @@ from PyQt5.QtWidgets import (QApplication, QLabel, QCalendarWidget, QFrame, QTre
|
||||
QTableWidget, QFileSystemModel, QPlainTextEdit, QToolBar,
|
||||
QWidgetAction, QComboBox, QAction, QSizePolicy, QInputDialog)
|
||||
|
||||
from PyQtAds import QtAds
|
||||
import PyQtAds as QtAds
|
||||
|
||||
UI_FILE = os.path.join(os.path.dirname(__file__), 'mainwindow.ui')
|
||||
MainWindowUI, MainWindowBase = uic.loadUiType(UI_FILE)
|
||||
|
||||
29
examples/autohidedragndrop/CMakeLists.txt
Normal file
@@ -0,0 +1,29 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
project(ads_example_autohide_dragndrop VERSION ${VERSION_SHORT})
|
||||
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED)
|
||||
find_package(Qt${QT_VERSION_MAJOR} 5.5 COMPONENTS Core Gui Widgets REQUIRED)
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
add_executable(AutoHideDragNDropExample WIN32
|
||||
main.cpp
|
||||
mainwindow.cpp
|
||||
mainwindow.ui
|
||||
droppableitem.cpp
|
||||
)
|
||||
target_include_directories(AutoHideDragNDropExample PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../src")
|
||||
target_link_libraries(AutoHideDragNDropExample PRIVATE qtadvanceddocking-qt${QT_VERSION_MAJOR})
|
||||
target_link_libraries(AutoHideDragNDropExample PUBLIC Qt${QT_VERSION_MAJOR}::Core
|
||||
Qt${QT_VERSION_MAJOR}::Gui
|
||||
Qt${QT_VERSION_MAJOR}::Widgets)
|
||||
set_target_properties(AutoHideDragNDropExample PROPERTIES
|
||||
AUTOMOC ON
|
||||
AUTORCC ON
|
||||
AUTOUIC ON
|
||||
CXX_STANDARD 14
|
||||
CXX_STANDARD_REQUIRED ON
|
||||
CXX_EXTENSIONS OFF
|
||||
VERSION ${VERSION_SHORT}
|
||||
EXPORT_NAME "Qt Advanced Docking System Auto Hide With Drag N Drop Example"
|
||||
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"
|
||||
)
|
||||
36
examples/autohidedragndrop/autohidedragndrop.pro
Normal file
@@ -0,0 +1,36 @@
|
||||
ADS_OUT_ROOT = $${OUT_PWD}/../..
|
||||
|
||||
QT += core gui widgets
|
||||
|
||||
TARGET = AutoHideDragNDropExample
|
||||
DESTDIR = $${ADS_OUT_ROOT}/lib
|
||||
TEMPLATE = app
|
||||
CONFIG += c++14
|
||||
CONFIG += debug_and_release
|
||||
adsBuildStatic {
|
||||
DEFINES += ADS_STATIC
|
||||
}
|
||||
|
||||
# The following define makes your compiler emit warnings if you use
|
||||
# any Qt feature that has been marked deprecated (the exact warnings
|
||||
# depend on your compiler). Please consult the documentation of the
|
||||
# deprecated API in order to know how to port your code away from it.
|
||||
DEFINES += QT_DEPRECATED_WARNINGS
|
||||
|
||||
SOURCES += \
|
||||
main.cpp \
|
||||
mainwindow.cpp \
|
||||
droppableitem.cpp
|
||||
|
||||
HEADERS += \
|
||||
mainwindow.h \
|
||||
droppableitem.h
|
||||
|
||||
FORMS += \
|
||||
mainwindow.ui
|
||||
|
||||
LIBS += -L$${ADS_OUT_ROOT}/lib
|
||||
include(../../ads.pri)
|
||||
INCLUDEPATH += ../../src
|
||||
DEPENDPATH += ../../src
|
||||
|
||||
38
examples/autohidedragndrop/droppableitem.cpp
Normal file
@@ -0,0 +1,38 @@
|
||||
#include "droppableitem.h"
|
||||
|
||||
#include <QDragEnterEvent>
|
||||
#include <QDragLeaveEvent>
|
||||
#include <QDropEvent>
|
||||
#include <QMimeData>
|
||||
#include <qsizepolicy.h>
|
||||
|
||||
DroppableItem::DroppableItem(const QString& text, QWidget* parent)
|
||||
: QPushButton(text, parent)
|
||||
{
|
||||
setAcceptDrops(true);
|
||||
setSizePolicy(QSizePolicy::Policy::Expanding, QSizePolicy::Policy::Expanding);
|
||||
}
|
||||
|
||||
void DroppableItem::dragEnterEvent(QDragEnterEvent* event)
|
||||
{
|
||||
if (event->mimeData()->hasText())
|
||||
{
|
||||
event->acceptProposedAction();
|
||||
setCursor(Qt::DragMoveCursor);
|
||||
}
|
||||
}
|
||||
|
||||
void DroppableItem::dragLeaveEvent(QDragLeaveEvent* event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
unsetCursor();
|
||||
}
|
||||
|
||||
void DroppableItem::dropEvent(QDropEvent* event)
|
||||
{
|
||||
if (event->mimeData()->hasText())
|
||||
{
|
||||
event->acceptProposedAction();
|
||||
setText(event->mimeData()->text());
|
||||
}
|
||||
}
|
||||
19
examples/autohidedragndrop/droppableitem.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#include <QObject>
|
||||
#include <QPushButton>
|
||||
|
||||
class QDragEnterEvent;
|
||||
class QDragLeaveEvent;
|
||||
class QDropEvent;
|
||||
|
||||
class DroppableItem : public QPushButton
|
||||
{
|
||||
Q_OBJECT;
|
||||
|
||||
public:
|
||||
DroppableItem(const QString& text = QString(), QWidget* parent = nullptr);
|
||||
|
||||
protected:
|
||||
void dragEnterEvent(QDragEnterEvent* event) override;
|
||||
void dragLeaveEvent(QDragLeaveEvent* event) override;
|
||||
void dropEvent(QDropEvent* event) override;
|
||||
};
|
||||
10
examples/autohidedragndrop/main.cpp
Normal file
@@ -0,0 +1,10 @@
|
||||
#include <mainwindow.h>
|
||||
#include <QApplication>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
CMainWindow w;
|
||||
w.show();
|
||||
return a.exec();
|
||||
}
|
||||
84
examples/autohidedragndrop/main.py
Normal file
@@ -0,0 +1,84 @@
|
||||
import os
|
||||
import sys
|
||||
|
||||
from PyQt5 import uic
|
||||
from PyQt5.QtCore import Qt, QTimer, QDir, QSignalBlocker
|
||||
from PyQt5.QtGui import QCloseEvent, QIcon
|
||||
from PyQt5.QtWidgets import (QApplication, QLabel, QCalendarWidget, QFrame, QTreeView,
|
||||
QTableWidget, QFileSystemModel, QPlainTextEdit, QToolBar,
|
||||
QWidgetAction, QComboBox, QAction, QSizePolicy, QInputDialog)
|
||||
|
||||
import PyQtAds as QtAds
|
||||
|
||||
UI_FILE = os.path.join(os.path.dirname(__file__), 'mainwindow.ui')
|
||||
MainWindowUI, MainWindowBase = uic.loadUiType(UI_FILE)
|
||||
|
||||
class MainWindow(MainWindowUI, MainWindowBase):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
|
||||
self.setupUi(self)
|
||||
|
||||
QtAds.CDockManager.setConfigFlag(QtAds.CDockManager.OpaqueSplitterResize, True)
|
||||
QtAds.CDockManager.setConfigFlag(QtAds.CDockManager.XmlCompressionEnabled, False)
|
||||
QtAds.CDockManager.setConfigFlag(QtAds.CDockManager.FocusHighlighting, True)
|
||||
QtAds.CDockManager.setAutoHideConfigFlag(QtAds.CDockManager.AutoHideOpenOnDragHover, True);
|
||||
self.dock_manager = QtAds.CDockManager(self)
|
||||
|
||||
# Set central widget
|
||||
text_edit = QPlainTextEdit()
|
||||
text_edit.setPlaceholderText("This is the central editor. Enter your text here.")
|
||||
central_dock_widget = QtAds.CDockWidget("CentralWidget")
|
||||
central_dock_widget.setWidget(text_edit)
|
||||
central_dock_area = self.dock_manager.setCentralWidget(central_dock_widget)
|
||||
central_dock_area.setAllowedAreas(QtAds.DockWidgetArea.OuterDockAreas)
|
||||
|
||||
|
||||
droppable_item = DroppableItem("Drop text here.")
|
||||
drop_dock_widget = QtAds.CDockWidget("Tab")
|
||||
drop_dock_widget.setWidget(droppable_item)
|
||||
drop_dock_widget.setMinimumSizeHintMode(QtAds.CDockWidget.MinimumSizeHintFromDockWidget)
|
||||
drop_dock_widget.setMinimumSize(200, 150)
|
||||
drop_dock_widget.setAcceptDrops(True)
|
||||
drop_area = self.dock_manager.addDockWidget(QtAds.DockWidgetArea.LeftDockWidgetArea, drop_dock_widget)
|
||||
drop_area.setAcceptDrops(True)
|
||||
self.menuView.addAction(drop_dock_widget.toggleViewAction())
|
||||
|
||||
self.create_perspective_ui()
|
||||
|
||||
def create_perspective_ui(self):
|
||||
save_perspective_action = QAction("Create Perspective", self)
|
||||
save_perspective_action.triggered.connect(self.save_perspective)
|
||||
perspective_list_action = QWidgetAction(self)
|
||||
self.perspective_combobox = QComboBox(self)
|
||||
self.perspective_combobox.setSizeAdjustPolicy(QComboBox.AdjustToContents)
|
||||
self.perspective_combobox.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
|
||||
self.perspective_combobox.activated[str].connect(self.dock_manager.openPerspective)
|
||||
perspective_list_action.setDefaultWidget(self.perspective_combobox)
|
||||
self.toolBar.addSeparator()
|
||||
self.toolBar.addAction(perspective_list_action)
|
||||
self.toolBar.addAction(save_perspective_action)
|
||||
|
||||
def save_perspective(self):
|
||||
perspective_name, ok = QInputDialog.getText(self, "Save Perspective", "Enter Unique name:")
|
||||
if not ok or not perspective_name:
|
||||
return
|
||||
|
||||
self.dock_manager.addPerspective(perspective_name)
|
||||
blocker = QSignalBlocker(self.perspective_combobox)
|
||||
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)
|
||||
|
||||
w = MainWindow()
|
||||
w.show()
|
||||
app.exec_()
|
||||
131
examples/autohidedragndrop/mainwindow.cpp
Normal file
@@ -0,0 +1,131 @@
|
||||
#include "mainwindow.h"
|
||||
#include "droppableitem.h"
|
||||
|
||||
#include "ui_mainwindow.h"
|
||||
|
||||
#include <QWidgetAction>
|
||||
#include <QFileSystemModel>
|
||||
#include <QTableWidget>
|
||||
#include <QHBoxLayout>
|
||||
#include <QInputDialog>
|
||||
#include <QFileDialog>
|
||||
#include <QSettings>
|
||||
#include <QPlainTextEdit>
|
||||
#include <QToolBar>
|
||||
|
||||
#include "AutoHideDockContainer.h"
|
||||
#include "DockAreaWidget.h"
|
||||
#include "DockAreaTitleBar.h"
|
||||
|
||||
using namespace ads;
|
||||
|
||||
CMainWindow::CMainWindow(QWidget *parent)
|
||||
: QMainWindow(parent)
|
||||
, ui(new Ui::CMainWindow)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
CDockManager::setConfigFlag(CDockManager::OpaqueSplitterResize, true);
|
||||
CDockManager::setConfigFlag(CDockManager::XmlCompressionEnabled, false);
|
||||
CDockManager::setConfigFlag(CDockManager::FocusHighlighting, true);
|
||||
CDockManager::setAutoHideConfigFlags(CDockManager::DefaultAutoHideConfig);
|
||||
CDockManager::setAutoHideConfigFlag(CDockManager::AutoHideOpenOnDragHover, true);
|
||||
CDockManager::setConfigParam(CDockManager::AutoHideOpenOnDragHoverDelay_ms, 500);
|
||||
DockManager = new CDockManager(this);
|
||||
|
||||
// Set central widget
|
||||
QPlainTextEdit* w = new QPlainTextEdit();
|
||||
w->setPlaceholderText("This is the central editor. Enter your text here.");
|
||||
CDockWidget* CentralDockWidget = new CDockWidget("CentralWidget");
|
||||
CentralDockWidget->setWidget(w);
|
||||
auto* CentralDockArea = DockManager->setCentralWidget(CentralDockWidget);
|
||||
CentralDockArea->setAllowedAreas(DockWidgetArea::OuterDockAreas);
|
||||
|
||||
{
|
||||
DroppableItem* droppableItem = new DroppableItem("Drop text here.");
|
||||
CDockWidget* dropDockWidget = new CDockWidget("Tab 1");
|
||||
dropDockWidget->setWidget(droppableItem);
|
||||
dropDockWidget->setMinimumSizeHintMode(CDockWidget::MinimumSizeHintFromDockWidget);
|
||||
dropDockWidget->setMinimumSize(200,150);
|
||||
dropDockWidget->setAcceptDrops(true);
|
||||
const auto autoHideContainer = DockManager->addAutoHideDockWidget(SideBarLocation::SideBarLeft, dropDockWidget);
|
||||
autoHideContainer->setSize(480);
|
||||
autoHideContainer->setAcceptDrops(true);
|
||||
ui->menuView->addAction(dropDockWidget->toggleViewAction());
|
||||
}
|
||||
{
|
||||
DroppableItem* droppableItem = new DroppableItem("Drop text here.");
|
||||
CDockWidget* dropDockWidget = new CDockWidget("Tab 2");
|
||||
dropDockWidget->setWidget(droppableItem);
|
||||
dropDockWidget->setMinimumSizeHintMode(CDockWidget::MinimumSizeHintFromDockWidget);
|
||||
dropDockWidget->setMinimumSize(200,150);
|
||||
dropDockWidget->setAcceptDrops(true);
|
||||
const auto autoHideContainer = DockManager->addAutoHideDockWidget(SideBarLocation::SideBarRight, dropDockWidget);
|
||||
autoHideContainer->setSize(480);
|
||||
autoHideContainer->setAcceptDrops(true);
|
||||
ui->menuView->addAction(dropDockWidget->toggleViewAction());
|
||||
}
|
||||
|
||||
QTableWidget* propertiesTable = new QTableWidget();
|
||||
propertiesTable->setColumnCount(3);
|
||||
propertiesTable->setRowCount(10);
|
||||
CDockWidget* PropertiesDockWidget = new CDockWidget("Properties");
|
||||
PropertiesDockWidget->setWidget(propertiesTable);
|
||||
PropertiesDockWidget->setMinimumSizeHintMode(CDockWidget::MinimumSizeHintFromDockWidget);
|
||||
PropertiesDockWidget->resize(250, 150);
|
||||
PropertiesDockWidget->setMinimumSize(200,150);
|
||||
DockManager->addDockWidget(DockWidgetArea::RightDockWidgetArea, PropertiesDockWidget, CentralDockArea);
|
||||
ui->menuView->addAction(PropertiesDockWidget->toggleViewAction());
|
||||
|
||||
createPerspectiveUi();
|
||||
}
|
||||
|
||||
CMainWindow::~CMainWindow()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
||||
void CMainWindow::createPerspectiveUi()
|
||||
{
|
||||
SavePerspectiveAction = new QAction("Create Perspective", this);
|
||||
connect(SavePerspectiveAction, SIGNAL(triggered()), SLOT(savePerspective()));
|
||||
PerspectiveListAction = new QWidgetAction(this);
|
||||
PerspectiveComboBox = new QComboBox(this);
|
||||
PerspectiveComboBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||
PerspectiveComboBox->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
|
||||
connect(PerspectiveComboBox, SIGNAL(currentTextChanged(const QString&)),
|
||||
DockManager, SLOT(openPerspective(const QString&)));
|
||||
PerspectiveListAction->setDefaultWidget(PerspectiveComboBox);
|
||||
ui->toolBar->addSeparator();
|
||||
ui->toolBar->addAction(PerspectiveListAction);
|
||||
ui->toolBar->addAction(SavePerspectiveAction);
|
||||
}
|
||||
|
||||
|
||||
void CMainWindow::savePerspective()
|
||||
{
|
||||
QString PerspectiveName = QInputDialog::getText(this, "Save Perspective", "Enter unique name:");
|
||||
if (PerspectiveName.isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
DockManager->addPerspective(PerspectiveName);
|
||||
QSignalBlocker Blocker(PerspectiveComboBox);
|
||||
PerspectiveComboBox->clear();
|
||||
PerspectiveComboBox->addItems(DockManager->perspectiveNames());
|
||||
PerspectiveComboBox->setCurrentText(PerspectiveName);
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
void CMainWindow::closeEvent(QCloseEvent* event)
|
||||
{
|
||||
// Delete dock manager here to delete all floating widgets. This ensures
|
||||
// that all top level windows of the dock manager are properly closed
|
||||
DockManager->deleteLater();
|
||||
QMainWindow::closeEvent(event);
|
||||
}
|
||||
|
||||
|
||||
|
||||
43
examples/autohidedragndrop/mainwindow.h
Normal file
@@ -0,0 +1,43 @@
|
||||
#ifndef MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QComboBox>
|
||||
#include <QWidgetAction>
|
||||
|
||||
#include "DockManager.h"
|
||||
#include "DockAreaWidget.h"
|
||||
#include "DockWidget.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
namespace Ui { class CMainWindow; }
|
||||
QT_END_NAMESPACE
|
||||
|
||||
class CMainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CMainWindow(QWidget *parent = nullptr);
|
||||
~CMainWindow();
|
||||
|
||||
protected:
|
||||
virtual void closeEvent(QCloseEvent* event) override;
|
||||
|
||||
private:
|
||||
QAction* SavePerspectiveAction = nullptr;
|
||||
QWidgetAction* PerspectiveListAction = nullptr;
|
||||
QComboBox* PerspectiveComboBox = nullptr;
|
||||
|
||||
Ui::CMainWindow *ui;
|
||||
|
||||
ads::CDockManager* DockManager;
|
||||
ads::CDockAreaWidget* StatusDockArea;
|
||||
ads::CDockWidget* TimelineDockWidget;
|
||||
|
||||
void createPerspectiveUi();
|
||||
|
||||
private slots:
|
||||
void savePerspective();
|
||||
};
|
||||
#endif // MAINWINDOW_H
|
||||
47
examples/autohidedragndrop/mainwindow.ui
Normal file
@@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CMainWindow</class>
|
||||
<widget class="QMainWindow" name="CMainWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1284</width>
|
||||
<height>757</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>MainWindow</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget"/>
|
||||
<widget class="QMenuBar" name="menubar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1284</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuView">
|
||||
<property name="title">
|
||||
<string>View</string>
|
||||
</property>
|
||||
</widget>
|
||||
<addaction name="menuView"/>
|
||||
</widget>
|
||||
<widget class="QToolBar" name="toolBar">
|
||||
<property name="windowTitle">
|
||||
<string>toolBar</string>
|
||||
</property>
|
||||
<attribute name="toolBarArea">
|
||||
<enum>TopToolBarArea</enum>
|
||||
</attribute>
|
||||
<attribute name="toolBarBreak">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -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 qtadvanceddocking-qt${QT_VERSION_MAJOR})
|
||||
target_link_libraries(CentralWidgetExample PUBLIC Qt${QT_VERSION_MAJOR}::Core
|
||||
Qt${QT_VERSION_MAJOR}::Gui
|
||||
Qt${QT_VERSION_MAJOR}::Widgets)
|
||||
|
||||
@@ -8,7 +8,7 @@ from PyQt5.QtWidgets import (QApplication, QLabel, QCalendarWidget, QFrame, QTre
|
||||
QTableWidget, QFileSystemModel, QPlainTextEdit, QToolBar,
|
||||
QWidgetAction, QComboBox, QAction, QSizePolicy, QInputDialog)
|
||||
|
||||
from PyQtAds import QtAds
|
||||
import PyQtAds as QtAds
|
||||
|
||||
UI_FILE = os.path.join(os.path.dirname(__file__), 'mainwindow.ui')
|
||||
MainWindowUI, MainWindowBase = uic.loadUiType(UI_FILE)
|
||||
|
||||
28
examples/configflags/CMakeLists.txt
Normal file
@@ -0,0 +1,28 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
project(ads_example_centralwidget VERSION ${VERSION_SHORT})
|
||||
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED)
|
||||
find_package(Qt${QT_VERSION_MAJOR} 5.5 COMPONENTS Core Gui Widgets REQUIRED)
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
add_executable(configFlagsExample WIN32
|
||||
main.cpp
|
||||
mainwindow.cpp
|
||||
mainwindow.ui
|
||||
)
|
||||
target_include_directories(CentralWidgetExample PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../src")
|
||||
target_link_libraries(CentralWidgetExample PRIVATE qtadvanceddocking-qt${QT_VERSION_MAJOR})
|
||||
target_link_libraries(CentralWidgetExample PUBLIC Qt${QT_VERSION_MAJOR}::Core
|
||||
Qt${QT_VERSION_MAJOR}::Gui
|
||||
Qt${QT_VERSION_MAJOR}::Widgets)
|
||||
set_target_properties(CentralWidgetExample PROPERTIES
|
||||
AUTOMOC ON
|
||||
AUTORCC ON
|
||||
AUTOUIC ON
|
||||
CXX_STANDARD 14
|
||||
CXX_STANDARD_REQUIRED ON
|
||||
CXX_EXTENSIONS OFF
|
||||
VERSION ${VERSION_SHORT}
|
||||
EXPORT_NAME "Qt Advanced Docking System Central Widget Example"
|
||||
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"
|
||||
)
|
||||
34
examples/configflags/configflags.pro
Normal file
@@ -0,0 +1,34 @@
|
||||
ADS_OUT_ROOT = $${OUT_PWD}/../..
|
||||
|
||||
QT += core gui widgets
|
||||
|
||||
TARGET = ConfigFlagsExample
|
||||
DESTDIR = $${ADS_OUT_ROOT}/lib
|
||||
TEMPLATE = app
|
||||
CONFIG += c++14
|
||||
CONFIG += debug_and_release
|
||||
adsBuildStatic {
|
||||
DEFINES += ADS_STATIC
|
||||
}
|
||||
|
||||
# The following define makes your compiler emit warnings if you use
|
||||
# any Qt feature that has been marked deprecated (the exact warnings
|
||||
# depend on your compiler). Please consult the documentation of the
|
||||
# deprecated API in order to know how to port your code away from it.
|
||||
DEFINES += QT_DEPRECATED_WARNINGS
|
||||
|
||||
SOURCES += \
|
||||
main.cpp \
|
||||
mainwindow.cpp
|
||||
|
||||
HEADERS += \
|
||||
mainwindow.h
|
||||
|
||||
FORMS += \
|
||||
mainwindow.ui
|
||||
|
||||
LIBS += -L$${ADS_OUT_ROOT}/lib
|
||||
include(../../ads.pri)
|
||||
INCLUDEPATH += ../../src
|
||||
DEPENDPATH += ../../src
|
||||
|
||||
10
examples/configflags/main.cpp
Normal file
@@ -0,0 +1,10 @@
|
||||
#include <mainwindow.h>
|
||||
#include <QApplication>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
CMainWindow w;
|
||||
w.show();
|
||||
return a.exec();
|
||||
}
|
||||
65
examples/configflags/mainwindow.cpp
Normal file
@@ -0,0 +1,65 @@
|
||||
#include "mainwindow.h"
|
||||
|
||||
#include "ui_mainwindow.h"
|
||||
|
||||
#include <QLabel>
|
||||
#include <QToolBar>
|
||||
|
||||
#include "DockAreaWidget.h"
|
||||
#include "DockAreaTitleBar.h"
|
||||
|
||||
|
||||
using namespace ads;
|
||||
|
||||
|
||||
CMainWindow::CMainWindow(QWidget *parent) :
|
||||
QMainWindow(parent),
|
||||
ui(new Ui::CMainWindow)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
// Add the toolbar
|
||||
auto toolbar_ = addToolBar("Top Toolbar");
|
||||
|
||||
// Create the dock manager
|
||||
ads::CDockManager::setConfigFlags(ads::CDockManager::DefaultOpaqueConfig);
|
||||
ads::CDockManager::setConfigFlag(ads::CDockManager::DockAreaHasCloseButton,
|
||||
false);
|
||||
ads::CDockManager::setConfigFlag(ads::CDockManager::DockAreaHasUndockButton,
|
||||
false);
|
||||
ads::CDockManager::setConfigFlag(
|
||||
ads::CDockManager::DockAreaHasTabsMenuButton, false);
|
||||
auto DockManager = new ads::CDockManager(this);
|
||||
|
||||
// Create a dockable widget
|
||||
QLabel *l1 = new QLabel();
|
||||
l1->setWordWrap(true);
|
||||
l1->setAlignment(Qt::AlignTop | Qt::AlignLeft);
|
||||
l1->setText("Docking widget 1");
|
||||
ads::CDockWidget *dockWidget1 = new ads::CDockWidget("Dock 1");
|
||||
dockWidget1->setWidget(l1);
|
||||
DockManager->addDockWidget(ads::LeftDockWidgetArea, dockWidget1);
|
||||
|
||||
QLabel *l2 = new QLabel();
|
||||
l2->setWordWrap(true);
|
||||
l2->setAlignment(Qt::AlignTop | Qt::AlignLeft);
|
||||
l2->setText("Docking widget 2");
|
||||
ads::CDockWidget *dockWidget2 = new ads::CDockWidget("Dock 2");
|
||||
dockWidget2->setWidget(l2);
|
||||
DockManager->addDockWidget(ads::RightDockWidgetArea, dockWidget2);
|
||||
|
||||
// Add menu actions
|
||||
ui->menuView->addAction(dockWidget1->toggleViewAction());
|
||||
ui->menuView->addAction(dockWidget2->toggleViewAction());
|
||||
toolbar_->addAction(dockWidget1->toggleViewAction());
|
||||
toolbar_->addAction(dockWidget2->toggleViewAction());
|
||||
}
|
||||
|
||||
|
||||
CMainWindow::~CMainWindow()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
||||
|
||||
27
examples/configflags/mainwindow.h
Normal file
@@ -0,0 +1,27 @@
|
||||
#ifndef MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QComboBox>
|
||||
#include <QWidgetAction>
|
||||
|
||||
#include "DockManager.h"
|
||||
#include "DockAreaWidget.h"
|
||||
#include "DockWidget.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
namespace Ui { class CMainWindow; }
|
||||
QT_END_NAMESPACE
|
||||
|
||||
class CMainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CMainWindow(QWidget *parent = nullptr);
|
||||
~CMainWindow();
|
||||
|
||||
private:
|
||||
Ui::CMainWindow *ui;
|
||||
};
|
||||
#endif // MAINWINDOW_H
|
||||
47
examples/configflags/mainwindow.ui
Normal file
@@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CMainWindow</class>
|
||||
<widget class="QMainWindow" name="CMainWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1284</width>
|
||||
<height>757</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>MainWindow</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget"/>
|
||||
<widget class="QMenuBar" name="menubar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1284</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuView">
|
||||
<property name="title">
|
||||
<string>View</string>
|
||||
</property>
|
||||
</widget>
|
||||
<addaction name="menuView"/>
|
||||
</widget>
|
||||
<widget class="QToolBar" name="toolBar">
|
||||
<property name="windowTitle">
|
||||
<string>toolBar</string>
|
||||
</property>
|
||||
<attribute name="toolBarArea">
|
||||
<enum>TopToolBarArea</enum>
|
||||
</attribute>
|
||||
<attribute name="toolBarBreak">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -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 qtadvanceddocking-qt${QT_VERSION_MAJOR})
|
||||
target_link_libraries(DeleteOnCloseTest PUBLIC Qt${QT_VERSION_MAJOR}::Core
|
||||
Qt${QT_VERSION_MAJOR}::Gui
|
||||
Qt${QT_VERSION_MAJOR}::Widgets)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import sys
|
||||
|
||||
from PyQtAds import QtAds
|
||||
import PyQtAds as QtAds
|
||||
from PyQt5.QtGui import QCloseEvent
|
||||
from PyQt5.QtCore import (qDebug, pyqtSlot, QObject, pyqtSignal)
|
||||
from PyQt5.QtWidgets import (QMainWindow, QAction, QTextEdit, QApplication,
|
||||
@@ -70,4 +70,4 @@ if __name__ == '__main__':
|
||||
action.triggered.connect(on_action2_triggered)
|
||||
|
||||
w.show()
|
||||
app.exec_()
|
||||
app.exec_()
|
||||
|
||||
@@ -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 qtadvanceddocking-qt${QT_VERSION_MAJOR})
|
||||
target_link_libraries(DockInDockExample PUBLIC Qt${QT_VERSION_MAJOR}::Core
|
||||
Qt${QT_VERSION_MAJOR}::Gui
|
||||
Qt${QT_VERSION_MAJOR}::Widgets)
|
||||
|
||||
@@ -3,7 +3,7 @@ import sys
|
||||
from PyQt5.QtWidgets import (QApplication, QWidget, QVBoxLayout, QMessageBox,
|
||||
QInputDialog, QMenu, QLineEdit)
|
||||
from PyQt5.QtGui import QIcon
|
||||
from PyQtAds import QtAds
|
||||
import PyQtAds as QtAds
|
||||
|
||||
from dockindockmanager import DockInDockManager
|
||||
from perspectiveactions import LoadPerspectiveAction, RemovePerspectiveAction
|
||||
@@ -200,4 +200,4 @@ class DockInDockWidget(QWidget):
|
||||
|
||||
for closed in self.getManager().dockWidgetsMap().values():
|
||||
if not closed in visible_widgets:
|
||||
self.dumpStatus(widget=closed, tab=tab, suffix=" (closed)")
|
||||
self.dumpStatus(widget=closed, tab=tab, suffix=" (closed)")
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from PyQt5.QtWidgets import QAction, QMenu, QInputDialog, QLineEdit
|
||||
from PyQt5.QtCore import QSettings
|
||||
|
||||
from PyQtAds import QtAds
|
||||
import PyQtAds as QtAds
|
||||
|
||||
CHILD_PREFIX = "Child-"
|
||||
|
||||
@@ -211,4 +211,4 @@ class MoveDockWidgetAction(QAction):
|
||||
widget.dockManager().removeDockWidget(widget)
|
||||
move_to.addDockWidget(QtAds.CenterDockWidgetArea, widget, move_to.getInsertDefaultPos())
|
||||
else:
|
||||
assert False
|
||||
assert False
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <QApplication>
|
||||
#include "../../examples/simple/MainWindow.h"
|
||||
#include "mainframe.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@ import atexit
|
||||
|
||||
from PyQt5.QtWidgets import QApplication, QMainWindow, QLabel
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQtAds import QtAds
|
||||
import PyQtAds as QtAds
|
||||
|
||||
from perspectives import PerspectivesManager
|
||||
from dockindock import DockInDockWidget
|
||||
@@ -69,4 +69,4 @@ if __name__ == '__main__':
|
||||
|
||||
w = MainWindow()
|
||||
w.show()
|
||||
app.exec_()
|
||||
app.exec_()
|
||||
|
||||
@@ -4,7 +4,7 @@ import shutil
|
||||
import atexit
|
||||
|
||||
from PyQt5.QtCore import pyqtSignal, QSettings, QObject
|
||||
from PyQtAds import QtAds
|
||||
import PyQtAds as QtAds
|
||||
|
||||
from dockindockmanager import DockInDockManager
|
||||
from dockindock import DockInDockWidget
|
||||
@@ -200,4 +200,4 @@ class PerspectivesManager(QObject):
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
if not shutil.copy(settings.fileName(), to_save):
|
||||
assert False
|
||||
assert False
|
||||
|
||||
@@ -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 qtadvanceddocking-qt${QT_VERSION_MAJOR})
|
||||
target_link_libraries(EmptyDockAreaExample PUBLIC Qt${QT_VERSION_MAJOR}::Core
|
||||
Qt${QT_VERSION_MAJOR}::Gui
|
||||
Qt${QT_VERSION_MAJOR}::Widgets)
|
||||
|
||||
@@ -6,7 +6,7 @@ from PyQt5.QtCore import Qt, QSignalBlocker
|
||||
from PyQt5.QtWidgets import (QApplication, QMainWindow, QLabel, QComboBox, QTableWidget,
|
||||
QAction, QWidgetAction, QSizePolicy, QInputDialog)
|
||||
from PyQt5.QtGui import QCloseEvent
|
||||
from PyQtAds import QtAds
|
||||
import PyQtAds as QtAds
|
||||
|
||||
|
||||
UI_FILE = os.path.join(os.path.dirname(__file__), 'mainwindow.ui')
|
||||
@@ -105,4 +105,4 @@ if __name__ == '__main__':
|
||||
|
||||
w = CMainWindow()
|
||||
w.show()
|
||||
app.exec_()
|
||||
app.exec_()
|
||||
|
||||
@@ -32,9 +32,12 @@ CMainWindow::CMainWindow(QWidget *parent)
|
||||
, ui(new Ui::CMainWindow)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
CDockManager::setConfigFlag(CDockManager::OpaqueSplitterResize, true);
|
||||
CDockManager::setConfigFlag(CDockManager::XmlCompressionEnabled, false);
|
||||
CDockManager::setConfigFlag(CDockManager::FocusHighlighting, true);
|
||||
ads::CDockManager::setConfigFlag( ads::CDockManager::DockAreaHasCloseButton, false );
|
||||
ads::CDockManager::setConfigFlag( ads::CDockManager::AllTabsHaveCloseButton, true );
|
||||
ads::CDockManager::setConfigFlag( ads::CDockManager::DockAreaHasUndockButton, false );
|
||||
ads::CDockManager::setConfigFlag( ads::CDockManager::DockAreaDynamicTabsMenuButtonVisibility, true );
|
||||
ads::CDockManager::setConfigFlag( ads::CDockManager::DisableTabTextEliding, true );
|
||||
ads::CDockManager::setConfigFlag( ads::CDockManager::DoubleClickUndocksWidget, false );
|
||||
DockManager = new CDockManager(this);
|
||||
|
||||
// Set central widget
|
||||
@@ -98,8 +101,13 @@ void CMainWindow::createPerspectiveUi()
|
||||
PerspectiveComboBox = new QComboBox(this);
|
||||
PerspectiveComboBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||
PerspectiveComboBox->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
connect(PerspectiveComboBox, &QComboBox::textActivated,
|
||||
DockManager, &CDockManager::openPerspective);
|
||||
#else
|
||||
connect(PerspectiveComboBox, SIGNAL(activated(const QString&)),
|
||||
DockManager, SLOT(openPerspective(const QString&)));
|
||||
#endif
|
||||
PerspectiveListAction->setDefaultWidget(PerspectiveComboBox);
|
||||
ui->toolBar->addSeparator();
|
||||
ui->toolBar->addAction(PerspectiveListAction);
|
||||
|
||||
@@ -2,10 +2,12 @@ TEMPLATE = subdirs
|
||||
|
||||
SUBDIRS = \
|
||||
autohide \
|
||||
autohidedragndrop \
|
||||
centralwidget \
|
||||
simple \
|
||||
hideshow \
|
||||
sidebar \
|
||||
deleteonclose \
|
||||
emptydockarea \
|
||||
dockindock
|
||||
dockindock \
|
||||
configflags
|
||||
|
||||
@@ -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 qtadvanceddocking-qt${QT_VERSION_MAJOR})
|
||||
target_link_libraries(HideShowExample PUBLIC Qt${QT_VERSION_MAJOR}::Core
|
||||
Qt${QT_VERSION_MAJOR}::Gui
|
||||
Qt${QT_VERSION_MAJOR}::Widgets)
|
||||
|
||||
@@ -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 qtadvanceddocking-qt${QT_VERSION_MAJOR})
|
||||
target_link_libraries(SidebarExample PUBLIC Qt${QT_VERSION_MAJOR}::Core
|
||||
Qt${QT_VERSION_MAJOR}::Gui
|
||||
Qt${QT_VERSION_MAJOR}::Widgets)
|
||||
|
||||
@@ -5,7 +5,7 @@ from PyQt5 import uic
|
||||
from PyQt5.QtCore import Qt, QMargins
|
||||
from PyQt5.QtWidgets import QApplication, QLabel, QVBoxLayout, QPlainTextEdit
|
||||
|
||||
from PyQtAds import QtAds
|
||||
import PyQtAds as QtAds
|
||||
|
||||
UI_FILE = os.path.join(os.path.dirname(__file__), 'MainWindow.ui')
|
||||
MainWindowUI, MainWindowBase = uic.loadUiType(UI_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 qtadvanceddocking-qt${QT_VERSION_MAJOR})
|
||||
target_link_libraries(SimpleExample PUBLIC Qt${QT_VERSION_MAJOR}::Core
|
||||
Qt${QT_VERSION_MAJOR}::Gui
|
||||
Qt${QT_VERSION_MAJOR}::Widgets)
|
||||
|
||||
@@ -6,7 +6,7 @@ from PyQt5.QtCore import Qt, QTimer
|
||||
from PyQt5.QtGui import QCloseEvent
|
||||
from PyQt5.QtWidgets import QApplication, QLabel
|
||||
|
||||
from PyQtAds import QtAds
|
||||
import PyQtAds as QtAds
|
||||
|
||||
UI_FILE = os.path.join(os.path.dirname(__file__), 'MainWindow.ui')
|
||||
MainWindowUI, MainWindowBase = uic.loadUiType(UI_FILE)
|
||||
|
||||
28
project.py
@@ -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)
|
||||
|
||||
@@ -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", "PyQt-builder >=1.6", "PyQt5>=5.15", "PyQt5-sip>=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.4.1"
|
||||
summary = "Python bindings for Qt Advanced Docking System"
|
||||
home-page = "https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/"
|
||||
license = "LGPL v2.1"
|
||||
@@ -16,13 +16,18 @@ description-content-type = "text/markdown"
|
||||
|
||||
[tool.sip.project]
|
||||
tag-prefix = "QtAds"
|
||||
dunder-init = true
|
||||
|
||||
[tool.sip.bindings.ads]
|
||||
pep484-pyi = true
|
||||
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 +45,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 +70,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'",
|
||||
]
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
[versioneer]
|
||||
VCS = git
|
||||
style = pep440
|
||||
versionfile_source = PyQtAds/_version.py
|
||||
versionfile_build = PyQtAds/_version.py
|
||||
tag_prefix =
|
||||
|
||||
396
setup.py
@@ -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
|
||||
)
|
||||
49
sip/AutoHideDockContainer.sip
Normal file
@@ -0,0 +1,49 @@
|
||||
%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* autoHideSideBar() const;
|
||||
ads::CAutoHideTab* autoHideTab() const;
|
||||
ads::CDockWidget* dockWidget() const;
|
||||
int tabIndex() 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);
|
||||
void resetToInitialDockWidgetSize();
|
||||
Qt::Orientation orientation() const;
|
||||
void moveToNewSideBarLocation(ads::SideBarLocation);
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
%End
|
||||
46
sip/AutoHideSideBar.sip
Normal file
@@ -0,0 +1,46 @@
|
||||
%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, int Index);
|
||||
Qt::Orientation orientation() const;
|
||||
ads::CAutoHideTab* tab(int index) const;
|
||||
int tabAt(const QPoint& Pos) const;
|
||||
int tabInsertIndexAt(const QPoint& Pos) const;
|
||||
int indexOfTab(const CAutoHideTab& Tab) const;
|
||||
int count() const;
|
||||
int visibleTabCount() const;
|
||||
bool hasVisibleTabs() const;
|
||||
ads::SideBarLocation sideBarLocation() const;
|
||||
virtual QSize minimumSizeHint() const;
|
||||
virtual QSize sizeHint() const;
|
||||
int spacing() const;
|
||||
void setSpacing(int Spacing);
|
||||
CDockContainerWidget* dockContainer() const;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
%End
|
||||
44
sip/AutoHideTab.sip
Normal file
@@ -0,0 +1,44 @@
|
||||
%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);
|
||||
virtual void contextMenuEvent(QContextMenuEvent* ev);
|
||||
virtual void mousePressEvent(QMouseEvent* ev);
|
||||
virtual void mouseReleaseEvent(QMouseEvent* ev);
|
||||
virtual void mouseMoveEvent(QMouseEvent* ev);
|
||||
|
||||
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;
|
||||
int tabIndex() const;
|
||||
void setDockWidgetFloating();
|
||||
void unpinDockWidget();
|
||||
void requestCloseDockWidget();
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
%End
|
||||
@@ -23,6 +23,8 @@ public:
|
||||
int currentIndex() const;
|
||||
ads::CDockWidgetTab* currentTab() const;
|
||||
ads::CDockWidgetTab* tab(int Index) const;
|
||||
int tabAt(const QPoint& Pos) const;
|
||||
int tabInsertIndexAt(const QPoint& Pos) const;
|
||||
virtual bool eventFilter(QObject *watched, QEvent *event);
|
||||
bool isTabOpen(int Index) const;
|
||||
virtual QSize minimumSizeHint() const;
|
||||
|
||||
@@ -5,6 +5,26 @@
|
||||
namespace ads
|
||||
{
|
||||
|
||||
class CTitleBarButton : QToolButton
|
||||
{
|
||||
%TypeHeaderCode
|
||||
#include <DockAreaTitleBar.h>
|
||||
%End
|
||||
|
||||
public:
|
||||
CTitleBarButton(bool ShowInTitleBar, bool HideWhenDisabled, TitleBarButton ButtonId,
|
||||
QWidget* /TransferThis/ = Q_NULLPTR );
|
||||
virtual void setVisible(bool);
|
||||
void setShowInTitleBar(bool);
|
||||
|
||||
TitleBarButton buttonId() const;
|
||||
ads::CDockAreaTitleBar* titleBar() const;
|
||||
bool isInAutoHideArea() const;
|
||||
|
||||
protected:
|
||||
bool event(QEvent *ev);
|
||||
};
|
||||
|
||||
class CDockAreaTitleBar : QFrame
|
||||
{
|
||||
%TypeHeaderCode
|
||||
@@ -26,12 +46,17 @@ public:
|
||||
CDockAreaTitleBar(ads::CDockAreaWidget* parent /TransferThis/);
|
||||
virtual ~CDockAreaTitleBar();
|
||||
ads::CDockAreaTabBar* tabBar() const;
|
||||
QAbstractButton* button(ads::TitleBarButton which) const;
|
||||
ads::CTitleBarButton* button(ads::TitleBarButton which) const;
|
||||
ads::CElidingLabel* autoHideTitleLabel() const;
|
||||
ads::CDockAreaWidget* dockAreaWidget() 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;
|
||||
void setAreaFloating();
|
||||
void showAutoHideControls(bool Show);
|
||||
bool isAutoHide() const;
|
||||
|
||||
signals:
|
||||
void tabBarClicked(int index);
|
||||
|
||||
@@ -5,21 +5,6 @@
|
||||
namespace ads
|
||||
{
|
||||
|
||||
class CTitleBarButton : QToolButton
|
||||
{
|
||||
%TypeHeaderCode
|
||||
#include <DockAreaTitleBar_p.h>
|
||||
%End
|
||||
|
||||
protected:
|
||||
bool event(QEvent *ev);
|
||||
|
||||
public:
|
||||
CTitleBarButton(bool visible = true, QWidget* parent /TransferThis/ = Q_NULLPTR );
|
||||
virtual void setVisible(bool visible);
|
||||
};
|
||||
|
||||
|
||||
class CSpacerWidget : QWidget
|
||||
{
|
||||
%TypeHeaderCode
|
||||
|
||||
@@ -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);
|
||||
@@ -39,6 +40,10 @@ public:
|
||||
virtual ~CDockAreaWidget();
|
||||
ads::CDockManager* dockManager() const;
|
||||
ads::CDockContainerWidget* dockContainer() const;
|
||||
ads::CAutoHideDockContainer* autoHideDockContainer() const;
|
||||
ads::CDockSplitter* parentSplitter() const;
|
||||
bool isAutoHide() const;
|
||||
void setAutoHideDockContainer(CAutoHideDockContainer*);
|
||||
virtual QSize minimumSizeHint() const;
|
||||
QRect titleBarGeometry() const;
|
||||
QRect contentAreaGeometry() const;
|
||||
@@ -52,6 +57,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,11 +72,16 @@ public:
|
||||
void setDockAreaFlag(eDockAreaFlag Flag, bool On);
|
||||
|
||||
bool isCentralWidgetArea() const;
|
||||
bool containsCentralWidget() const;
|
||||
bool isTopLevelArea() const;
|
||||
|
||||
public slots:
|
||||
void setCurrentIndex(int index);
|
||||
void closeArea();
|
||||
void setAutoHide(bool Enable, SideBarLocation Location = ads::SideBarNone, int TabIndex = -1);
|
||||
void toggleAutoHide(SideBarLocation Location = ads::SideBarNone);
|
||||
void closeOtherAreas();
|
||||
void setFloating();
|
||||
|
||||
signals:
|
||||
void tabBarClicked(int index);
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -9,8 +9,8 @@ namespace ads
|
||||
* Container that manages a number of dock areas with single dock widgets
|
||||
* or tabyfied dock widgets in each area.
|
||||
* Each window that support docking has a DockContainerWidget. That means
|
||||
* the main application window and all floating windows are ore contain
|
||||
* an DockContainerWidget.
|
||||
* the main application window and all floating windows contain a
|
||||
* DockContainerWidget.
|
||||
*/
|
||||
class CDockContainerWidget : QFrame
|
||||
{
|
||||
@@ -20,12 +20,14 @@ class CDockContainerWidget : QFrame
|
||||
|
||||
protected:
|
||||
virtual bool event(QEvent *e);
|
||||
QSplitter* rootSplitter() const;
|
||||
ads::CDockSplitter* rootSplitter() const;
|
||||
ads::CAutoHideDockContainer* createAndSetupAutoHideContainer(ads::SideBarLocation area, ads::CDockWidget* DockWidget /Transfer/, int TabIndex = -1);
|
||||
void createRootSplitter();
|
||||
void dropFloatingWidget(ads::CFloatingDockContainer* FloatingWidget, const QPoint& TargetPos);
|
||||
void dropWidget(QWidget* Widget, DockWidgetArea DropArea, CDockAreaWidget* TargetAreaWidget);
|
||||
void dropWidget(QWidget* Widget, DockWidgetArea DropArea, CDockAreaWidget* TargetAreaWidget, int TabIndex = -1);
|
||||
void addDockArea(ads::CDockAreaWidget* DockAreaWidget /Transfer/, ads::DockWidgetArea area = ads::CenterDockWidgetArea);
|
||||
void removeDockArea(ads::CDockAreaWidget* area /TransferBack/);
|
||||
/*QList<QPointer<ads::CDockAreaWidget>> removeAllDockAreas();*/
|
||||
void saveState(QXmlStreamWriter& Stream) const;
|
||||
bool restoreState(CDockingStateReader& Stream, bool Testing);
|
||||
ads::CDockAreaWidget* lastAddedDockAreaWidget(ads::DockWidgetArea area) const;
|
||||
@@ -33,124 +35,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* autoHideSideBar(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
|
||||
|
||||
@@ -22,6 +22,8 @@ public:
|
||||
void notifyFloatingWidgetDrop(ads::CFloatingDockContainer* FloatingWidget);
|
||||
ads::CDockWidget* focusedDockWidget() const;
|
||||
void setDockWidgetTabFocused(ads::CDockWidgetTab* Tab);
|
||||
void clearDockWidgetFocus(ads::CDockWidget* dockWidget);
|
||||
void setDockWidgetTabPressed(bool Value);
|
||||
|
||||
public slots:
|
||||
void setDockWidgetFocused(ads::CDockWidget* focusedNow);
|
||||
|
||||
@@ -156,7 +156,6 @@ public:
|
||||
TabCloseButtonIsToolButton,
|
||||
AllTabsHaveCloseButton,
|
||||
RetainTabSizeWhenCloseButtonHidden,
|
||||
OpaqueUndocking,
|
||||
DragPreviewIsDynamic,
|
||||
DragPreviewShowsContentPixmap,
|
||||
DragPreviewHasWindowFrame,
|
||||
@@ -173,6 +172,8 @@ public:
|
||||
FloatingContainerForceNativeTitleBar,
|
||||
FloatingContainerForceQWidgetTitleBar,
|
||||
MiddleMouseButtonClosesTab,
|
||||
DisableTabTextEliding,
|
||||
ShowTabTextOnlyForActiveTab,
|
||||
DefaultDockAreaButtons,
|
||||
DefaultBaseConfig,
|
||||
DefaultOpaqueConfig,
|
||||
@@ -180,6 +181,20 @@ public:
|
||||
NonOpaqueWithWindowFrame,
|
||||
};
|
||||
typedef QFlags<ads::CDockManager::eConfigFlag> ConfigFlags;
|
||||
enum eAutoHideFlag
|
||||
{
|
||||
AutoHideFeatureEnabled,
|
||||
DockAreaHasAutoHideButton,
|
||||
AutoHideButtonTogglesArea,
|
||||
AutoHideButtonCheckable,
|
||||
AutoHideSideBarsIconOnly,
|
||||
AutoHideShowOnMouseOver,
|
||||
AutoHideCloseButtonCollapsesDock,
|
||||
AutoHideHasCloseButton,
|
||||
AutoHideHasMinimizeButton,
|
||||
DefaultAutoHideConfig,
|
||||
};
|
||||
typedef QFlags<ads::CDockManager::eAutoHideFlag> AutoHideFlags;
|
||||
|
||||
CDockManager(QWidget* parent /TransferThis/ = 0);
|
||||
virtual ~CDockManager();
|
||||
@@ -187,13 +202,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/;
|
||||
@@ -216,12 +242,22 @@ public:
|
||||
QMenu* viewMenu() const;
|
||||
void setViewMenuInsertionOrder(ads::CDockManager::eViewMenuInsertionOrder Order);
|
||||
bool isRestoringState() const;
|
||||
bool isLeavingMinimizedState() const;
|
||||
static int startDragDistance();
|
||||
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();
|
||||
void setDockWidgetToolBarStyle(Qt::ToolButtonStyle Style, ads::CDockWidget::eState State);
|
||||
Qt::ToolButtonStyle dockWidgetToolBarStyle(ads::CDockWidget::eState State) const;
|
||||
void setDockWidgetToolBarIconSize(const QSize& IconSize, ads::CDockWidget::eState State);
|
||||
QSize dockWidgetToolBarIconSize(ads::CDockWidget::eState State) const;
|
||||
ads::CDockWidget::DockWidgetFeatures globallyLockedDockWidgetFeatures() const;
|
||||
void lockDockWidgetFeaturesGlobally(ads::CDockWidget::DockWidgetFeatures Features = ads::CDockWidget::GloballyLockableFeatures);
|
||||
|
||||
public slots:
|
||||
void endLeavingMinimizedState();
|
||||
void openPerspective(const QString& PerspectiveName);
|
||||
void setDockWidgetFocused(ads::CDockWidget* DockWidget);
|
||||
|
||||
|
||||
@@ -22,8 +22,10 @@ public:
|
||||
CDockOverlay(QWidget* parent /TransferThis/, eMode Mode = ads::CDockOverlay::ModeDockAreaOverlay);
|
||||
virtual ~CDockOverlay();
|
||||
void setAllowedAreas(ads::DockWidgetAreas areas);
|
||||
void setAllowedArea(ads::DockWidgetArea area, bool Enable);
|
||||
ads::DockWidgetAreas allowedAreas() const;
|
||||
ads::DockWidgetArea dropAreaUnderCursor() const;
|
||||
int tabIndexUnderCursor() const;
|
||||
ads::DockWidgetArea visibleDropAreaUnderCursor() const;
|
||||
ads::DockWidgetArea showOverlay(QWidget* target);
|
||||
void hideOverlay();
|
||||
|
||||
@@ -35,9 +35,11 @@ public:
|
||||
DockWidgetForceCloseWithArea,
|
||||
NoTab,
|
||||
DeleteContentOnClose,
|
||||
DockWidgetPinnable,
|
||||
DefaultDockWidgetFeatures,
|
||||
AllDockWidgetFeatures,
|
||||
DockWidgetAlwaysCloseAndDelete,
|
||||
GloballyLockableFeatures,
|
||||
NoDockWidgetFeatures
|
||||
};
|
||||
typedef QFlags<ads::CDockWidget::DockWidgetFeature> DockWidgetFeatures;
|
||||
@@ -48,6 +50,12 @@ public:
|
||||
StateDocked,
|
||||
StateFloating
|
||||
};
|
||||
|
||||
enum eToolBarStyleSource
|
||||
{
|
||||
ToolBarStyleFromDockManager,
|
||||
ToolBarStyleFromDockWidget
|
||||
};
|
||||
|
||||
enum eInsertMode
|
||||
{
|
||||
@@ -59,7 +67,9 @@ public:
|
||||
enum eMinimumSizeHintMode
|
||||
{
|
||||
MinimumSizeHintFromDockWidget,
|
||||
MinimumSizeHintFromContent
|
||||
MinimumSizeHintFromContent,
|
||||
MinimumSizeHintFromDockWidgetMinimumSize,
|
||||
MinimumSizeHintFromContentMinimumSize,
|
||||
};
|
||||
|
||||
enum eToggleViewActionMode
|
||||
@@ -69,7 +79,7 @@ public:
|
||||
};
|
||||
|
||||
|
||||
CDockWidget(const QString &title, QWidget* parent /TransferThis/ = 0);
|
||||
CDockWidget(const QString &title, QWidget* parent /TransferThis/ = Q_NULLPTR);
|
||||
virtual ~CDockWidget();
|
||||
virtual QSize minimumSizeHint() const;
|
||||
void setWidget(QWidget* widget /Transfer/, ads::CDockWidget::eInsertMode InsertMode = AutoScrollArea);
|
||||
@@ -79,21 +89,32 @@ public:
|
||||
void setFeatures(ads::CDockWidget::DockWidgetFeatures features);
|
||||
void setFeature(ads::CDockWidget::DockWidgetFeature flag, bool on);
|
||||
ads::CDockWidget::DockWidgetFeatures features() const;
|
||||
void notifyFeaturesChanged();
|
||||
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;
|
||||
ads::SideBarLocation autoHideLocation() const;
|
||||
bool isFloating() const;
|
||||
bool isInFloatingContainer() const;
|
||||
bool isClosed() const;
|
||||
QAction* toggleViewAction() const;
|
||||
void setToggleViewAction(QAction* action);
|
||||
void setToggleViewActionMode(ads::CDockWidget::eToggleViewActionMode Mode);
|
||||
void setMinimumSizeHintMode(ads::CDockWidget::eMinimumSizeHintMode Mode);
|
||||
ads::CDockWidget::eMinimumSizeHintMode minimumSizeHintMode() const;
|
||||
bool isCentralWidget() const;
|
||||
void setIcon(const QIcon& Icon);
|
||||
QIcon icon() const;
|
||||
QToolBar* toolBar() const;
|
||||
QToolBar* createDefaultToolBar();
|
||||
void setToolBar(QToolBar* ToolBar /Transfer/ );
|
||||
void setToolBarStyleSource(ads::CDockWidget::eToolBarStyleSource Source);
|
||||
ads::CDockWidget::eToolBarStyleSource toolBarStyleSource() const;
|
||||
void setToolBarStyle(Qt::ToolButtonStyle Style, ads::CDockWidget::eState State);
|
||||
Qt::ToolButtonStyle toolBarStyle(ads::CDockWidget::eState State) const;
|
||||
void setToolBarIconSize(const QSize& IconSize, ads::CDockWidget::eState State);
|
||||
@@ -116,8 +137,11 @@ public slots:
|
||||
void setFloating();
|
||||
void deleteDockWidget();
|
||||
void closeDockWidget();
|
||||
void requestCloseDockWidget();
|
||||
void showFullScreen();
|
||||
void showNormal();
|
||||
void setAutoHide(bool Enable, ads::SideBarLocation Location = ads::SideBarNone, int TabIndex = -1);
|
||||
void toggleAutoHide(ads::SideBarLocation Location = ads::SideBarNone);
|
||||
|
||||
signals:
|
||||
void viewToggled(bool Open);
|
||||
|
||||
@@ -17,8 +17,8 @@ protected:
|
||||
virtual void mouseDoubleClickEvent( QMouseEvent *ev );
|
||||
|
||||
public:
|
||||
CElidingLabel(QWidget* parent /TransferThis/ = 0, Qt::WindowFlags f = 0);
|
||||
CElidingLabel(const QString& text, QWidget* parent /TransferThis/ = 0, Qt::WindowFlags f = 0);
|
||||
CElidingLabel(QWidget* parent /TransferThis/ = Q_NULLPTR, Qt::WindowFlags f = Qt::WindowFlags ());
|
||||
CElidingLabel(const QString& text, QWidget* parent /TransferThis/ = Q_NULLPTR, Qt::WindowFlags f = Qt::WindowFlags ());
|
||||
virtual ~CElidingLabel();
|
||||
Qt::TextElideMode elideMode() const;
|
||||
void setElideMode(Qt::TextElideMode mode);
|
||||
|
||||
@@ -44,6 +44,7 @@ protected:
|
||||
void startDragging(const QPoint& DragStartMousePos, const QSize& Size,
|
||||
QWidget* MouseEventHandler);
|
||||
virtual void finishDragging();
|
||||
void deleteContent();
|
||||
void initFloatingGeometry(const QPoint& DragStartMousePos, const QSize& Size);
|
||||
void moveFloating();
|
||||
bool restoreState(ads::CDockingStateReader& Stream, bool Testing);
|
||||
@@ -64,6 +65,7 @@ protected:
|
||||
%If (WS_X11)
|
||||
virtual void moveEvent(QMoveEvent *event);
|
||||
virtual void resizeEvent(QResizeEvent *event);
|
||||
virtual bool event(QEvent *e);
|
||||
%End
|
||||
|
||||
%If (WS_WIN)
|
||||
@@ -81,6 +83,7 @@ public:
|
||||
bool hasTopLevelDockWidget() const;
|
||||
ads::CDockWidget* topLevelDockWidget() const;
|
||||
QList<ads::CDockWidget*> dockWidgets() const;
|
||||
void finishDropOperation();
|
||||
|
||||
%If (WS_X11)
|
||||
void onMaximizeRequest();
|
||||
|
||||
@@ -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(ads::DockWidgetArea ContainerDropArea);
|
||||
|
||||
signals:
|
||||
void draggingCanceled();
|
||||
|
||||
31
sip/PushButton.sip
Normal 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
@@ -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
|
||||
@@ -1,8 +1,13 @@
|
||||
%Module(name=PyQtAds, call_super_init=True, keyword_arguments="Optional", use_limited_api=True)
|
||||
%HideNamespace(name=ads)
|
||||
|
||||
%Import QtCore/QtCoremod.sip
|
||||
%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 +25,8 @@
|
||||
%Include FloatingDockContainer.sip
|
||||
%Include FloatingDragPreview.sip
|
||||
%Include IconProvider.sip
|
||||
%Include PushButton.sip
|
||||
%Include ResizeHandle.sip
|
||||
%If (WS_X11)
|
||||
%Include linux/FloatingWidgetTitleBar.sip
|
||||
%End
|
||||
|
||||