Compare commits
144 Commits
4.0.2
...
openglwidg
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e38212eade | ||
|
|
8eb200b9a9 | ||
|
|
5af55c1258 | ||
|
|
ae7d6cc655 | ||
|
|
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:
|
build:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-20.04, ubuntu-18.04]
|
os: [ubuntu-20.04]
|
||||||
|
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
@@ -16,8 +16,44 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
sudo apt-get update --fix-missing
|
sudo apt-get update --fix-missing
|
||||||
sudo apt-get install qt5-default
|
sudo apt-get install qt5-default
|
||||||
sudo apt-get install qtbase5-private-dev
|
sudo apt-get install qtbase5-private-dev qtdeclarative5-dev
|
||||||
- name: qmake
|
- name: qmake
|
||||||
run: qmake
|
run: qmake
|
||||||
- name: make
|
- name: make
|
||||||
run: make -j4
|
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)
|
||||||
|
|||||||
6
.gitignore
vendored
@@ -1,4 +1,4 @@
|
|||||||
*.pro.user
|
*.pro.user*
|
||||||
/build
|
/build
|
||||||
*.o
|
*.o
|
||||||
*.dylib
|
*.dylib
|
||||||
@@ -7,6 +7,10 @@ qrc_*
|
|||||||
moc_*
|
moc_*
|
||||||
ui_*
|
ui_*
|
||||||
Makefile
|
Makefile
|
||||||
|
*.dll
|
||||||
|
*.a
|
||||||
|
build-*
|
||||||
|
build_*
|
||||||
|
|
||||||
# IDEs
|
# IDEs
|
||||||
.idea
|
.idea
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
cmake_minimum_required(VERSION 3.5)
|
cmake_minimum_required(VERSION 3.5)
|
||||||
|
|
||||||
|
if (POLICY CMP0091)
|
||||||
|
cmake_policy(SET CMP0091 NEW)
|
||||||
|
endif (POLICY CMP0091)
|
||||||
|
|
||||||
# By default, the version information is extracted from the git index. However,
|
# By default, the version information is extracted from the git index. However,
|
||||||
# we can override this behavior by explicitly setting ADS_VERSION and
|
# we can override this behavior by explicitly setting ADS_VERSION and
|
||||||
# skipping the git checks. This is useful for cases where this project is being
|
# skipping the git checks. This is useful for cases where this project is being
|
||||||
|
|||||||
163
README.md
@@ -22,6 +22,70 @@ integrated development environments (IDEs) such as Visual Studio.
|
|||||||
|
|
||||||
## New and Noteworthy
|
## 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)
|
The [release 4.0](https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/releases/latest)
|
||||||
adds the following features:
|
adds the following features:
|
||||||
|
|
||||||
@@ -77,6 +141,12 @@ know it from Visual Studio.
|
|||||||
### Overview
|
### Overview
|
||||||
|
|
||||||
- [New and Noteworthy](#new-and-noteworthy)
|
- [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)
|
- [Features](#features)
|
||||||
- [Overview](#overview)
|
- [Overview](#overview)
|
||||||
- [Docking everywhere - no central widget](#docking-everywhere---no-central-widget)
|
- [Docking everywhere - no central widget](#docking-everywhere---no-central-widget)
|
||||||
@@ -98,6 +168,9 @@ know it from Visual Studio.
|
|||||||
- [macOS](#macos)
|
- [macOS](#macos)
|
||||||
- [Linux](#linux)
|
- [Linux](#linux)
|
||||||
- [Build](#build)
|
- [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)
|
- [Getting started / Example](#getting-started--example)
|
||||||
- [License information](#license-information)
|
- [License information](#license-information)
|
||||||
- [Donation](#donation)
|
- [Donation](#donation)
|
||||||
@@ -114,6 +187,10 @@ know it from Visual Studio.
|
|||||||
- [MetGem](#metgem)
|
- [MetGem](#metgem)
|
||||||
- [PRE Workbench](#pre-workbench)
|
- [PRE Workbench](#pre-workbench)
|
||||||
- [RDE – Robox Development Environment](#rde--robox-development-environment)
|
- [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)
|
- [Alternative Docking System Implementations](#alternative-docking-system-implementations)
|
||||||
- [KDDockWidgets](#kddockwidgets)
|
- [KDDockWidgets](#kddockwidgets)
|
||||||
- [QtitanDocking](#qtitandocking)
|
- [QtitanDocking](#qtitandocking)
|
||||||
@@ -249,7 +326,7 @@ The PySide6 bindings were contributed by:
|
|||||||
|
|
||||||
- [mborgerson](https://github.com/mborgerson)
|
- [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
|
### 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://travis-ci.org/githubuser0xFFFF/Qt-Advanced-Docking-System)
|
||||||
[](https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/actions?query=workflow%3Alinux-builds)
|
[](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**
|
- **Kubuntu 18.04 and 19.10** - uses KWin - no native title bars
|
||||||
- **Ubuntu 18.04, 19.10 and 20.04**
|
- **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:
|
There are some requirements for the Linux distribution that have to be met:
|
||||||
|
|
||||||
@@ -309,10 +389,27 @@ Screenshot Ubuntu:
|
|||||||
|
|
||||||
## Build
|
## 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
|
```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.
|
Open the `ads.pro` file with QtCreator and start the build, that's it.
|
||||||
@@ -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
|
## 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.
|
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
|
### 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/)
|
- [Blog post about KDDockWidgets](https://www.kdab.com/kddockwidgets/)
|
||||||
- [GitHub project](https://github.com/KDAB/KDDockWidgets)
|
- [GitHub project](https://github.com/KDAB/KDDockWidgets)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.5)
|
|||||||
project(ads_demo VERSION ${VERSION_SHORT})
|
project(ads_demo VERSION ${VERSION_SHORT})
|
||||||
|
|
||||||
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED)
|
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)
|
if(WIN32 AND QT_VERSION_MAJOR LESS 6)
|
||||||
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS AxContainer REQUIRED)
|
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS AxContainer REQUIRED)
|
||||||
endif()
|
endif()
|
||||||
@@ -21,11 +21,13 @@ add_executable(AdvancedDockingSystemDemo WIN32 ${ads_demo_SRCS})
|
|||||||
target_include_directories(AdvancedDockingSystemDemo PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../src")
|
target_include_directories(AdvancedDockingSystemDemo PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../src")
|
||||||
target_link_libraries(AdvancedDockingSystemDemo PUBLIC Qt${QT_VERSION_MAJOR}::Core
|
target_link_libraries(AdvancedDockingSystemDemo PUBLIC Qt${QT_VERSION_MAJOR}::Core
|
||||||
Qt${QT_VERSION_MAJOR}::Gui
|
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)
|
if(WIN32 AND QT_VERSION_MAJOR LESS 6)
|
||||||
target_link_libraries(AdvancedDockingSystemDemo PUBLIC Qt${QT_VERSION_MAJOR}::AxContainer)
|
target_link_libraries(AdvancedDockingSystemDemo PUBLIC Qt${QT_VERSION_MAJOR}::AxContainer)
|
||||||
endif()
|
endif()
|
||||||
target_link_libraries(AdvancedDockingSystemDemo PRIVATE qtadvanceddocking)
|
target_link_libraries(AdvancedDockingSystemDemo PRIVATE qt${QT_VERSION_MAJOR}advanceddocking)
|
||||||
set_target_properties(AdvancedDockingSystemDemo PROPERTIES
|
set_target_properties(AdvancedDockingSystemDemo PROPERTIES
|
||||||
AUTOMOC ON
|
AUTOMOC ON
|
||||||
AUTORCC ON
|
AUTORCC ON
|
||||||
|
|||||||
@@ -62,7 +62,17 @@
|
|||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QElapsedTimer>
|
#include <QElapsedTimer>
|
||||||
|
#include <QQuickWidget>
|
||||||
|
|
||||||
|
#include <Inventor/Qt/SoQt.h>
|
||||||
|
#include <Inventor/Qt/viewers/SoQtExaminerViewer.h>
|
||||||
|
#include <Inventor/nodes/SoSeparator.h>
|
||||||
|
#include <Inventor/nodes/SoCone.h>
|
||||||
|
#include <Inventor/nodes/SoBaseColor.h>
|
||||||
|
|
||||||
|
#include <Quarter/QuarterWidget.h>
|
||||||
|
#include <Quarter/Quarter.h>
|
||||||
|
#include <Quarter/eventhandlers/DragDropHandler.h>
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||||
#include <QRandomGenerator>
|
#include <QRandomGenerator>
|
||||||
@@ -84,6 +94,7 @@
|
|||||||
#include "StatusDialog.h"
|
#include "StatusDialog.h"
|
||||||
#include "DockSplitter.h"
|
#include "DockSplitter.h"
|
||||||
#include "ImageViewer.h"
|
#include "ImageViewer.h"
|
||||||
|
#include "glwidget.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -270,6 +281,10 @@ struct MainWindowPrivate
|
|||||||
auto ToolBar = DockWidget->createDefaultToolBar();
|
auto ToolBar = DockWidget->createDefaultToolBar();
|
||||||
ToolBar->addAction(ui.actionSaveState);
|
ToolBar->addAction(ui.actionSaveState);
|
||||||
ToolBar->addAction(ui.actionRestoreState);
|
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;
|
return DockWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -407,6 +422,17 @@ struct MainWindowPrivate
|
|||||||
return DockWidget;
|
return DockWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create QQuickWidget for test for OpenGL and QQuick
|
||||||
|
*/
|
||||||
|
ads::CDockWidget *createQQuickWidget()
|
||||||
|
{
|
||||||
|
QQuickWidget *widget = new QQuickWidget();
|
||||||
|
ads::CDockWidget *dockWidget = new ads::CDockWidget("Quick");
|
||||||
|
dockWidget->setWidget(widget);
|
||||||
|
return dockWidget;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||||
@@ -424,7 +450,6 @@ struct MainWindowPrivate
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
@@ -437,8 +462,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):
|
// 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::OuterDockAreas);
|
||||||
//SpecialDockArea->setAllowedAreas({ads::LeftDockWidgetArea, ads::RightDockWidgetArea}); // just for testing
|
SpecialDockArea->setAllowedAreas({ads::LeftDockWidgetArea, ads::RightDockWidgetArea, ads::TopDockWidgetArea}); // just for testing
|
||||||
}
|
}
|
||||||
|
|
||||||
DockWidget = createLongTextLabelDockWidget();
|
DockWidget = createLongTextLabelDockWidget();
|
||||||
@@ -506,7 +531,9 @@ void MainWindowPrivate::createContent()
|
|||||||
|
|
||||||
// Test dock area docking
|
// Test dock area docking
|
||||||
auto RighDockArea = DockManager->addDockWidget(ads::RightDockWidgetArea, createLongTextLabelDockWidget(), TopDockArea);
|
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);
|
auto BottomDockArea = DockManager->addDockWidget(ads::BottomDockWidgetArea, createLongTextLabelDockWidget(), RighDockArea);
|
||||||
DockManager->addDockWidget(ads::CenterDockWidgetArea, createLongTextLabelDockWidget(), RighDockArea);
|
DockManager->addDockWidget(ads::CenterDockWidgetArea, createLongTextLabelDockWidget(), RighDockArea);
|
||||||
auto LabelDockWidget = createLongTextLabelDockWidget();
|
auto LabelDockWidget = createLongTextLabelDockWidget();
|
||||||
@@ -514,6 +541,7 @@ void MainWindowPrivate::createContent()
|
|||||||
|
|
||||||
// Tests CustomCloseHandling without DeleteOnClose
|
// Tests CustomCloseHandling without DeleteOnClose
|
||||||
LabelDockWidget->setFeature(ads::CDockWidget::CustomCloseHandling, true);
|
LabelDockWidget->setFeature(ads::CDockWidget::CustomCloseHandling, true);
|
||||||
|
LabelDockWidget->setWindowTitle(LabelDockWidget->windowTitle() + " [Custom Close]");
|
||||||
QObject::connect(LabelDockWidget, &ads::CDockWidget::closeRequested, [LabelDockWidget, this]()
|
QObject::connect(LabelDockWidget, &ads::CDockWidget::closeRequested, [LabelDockWidget, this]()
|
||||||
{
|
{
|
||||||
int Result = QMessageBox::question(_this, "Custom Close Request",
|
int Result = QMessageBox::question(_this, "Custom Close Request",
|
||||||
@@ -557,6 +585,11 @@ void MainWindowPrivate::createContent()
|
|||||||
// Create image viewer
|
// Create image viewer
|
||||||
DockWidget = createImageViewer();
|
DockWidget = createImageViewer();
|
||||||
DockManager->addDockWidget(ads::LeftDockWidgetArea, DockWidget);
|
DockManager->addDockWidget(ads::LeftDockWidgetArea, DockWidget);
|
||||||
|
|
||||||
|
// Create quick widget
|
||||||
|
DockWidget = createQQuickWidget();
|
||||||
|
DockWidget->setFeature(ads::CDockWidget::DockWidgetClosable, true);
|
||||||
|
DockManager->addDockWidget(ads::LeftDockWidgetArea, DockWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -569,19 +602,29 @@ void MainWindowPrivate::createActions()
|
|||||||
ui.toolBar->addAction(ui.actionRestoreState);
|
ui.toolBar->addAction(ui.actionRestoreState);
|
||||||
ui.actionRestoreState->setIcon(svgIcon(":/adsdemo/images/restore.svg"));
|
ui.actionRestoreState->setIcon(svgIcon(":/adsdemo/images/restore.svg"));
|
||||||
|
|
||||||
SavePerspectiveAction = new QAction("Create Perspective", _this);
|
ui.toolBar->addSeparator();
|
||||||
SavePerspectiveAction->setIcon(svgIcon(":/adsdemo/images/picture_in_picture.svg"));
|
|
||||||
_this->connect(SavePerspectiveAction, SIGNAL(triggered()), SLOT(savePerspective()));
|
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);
|
PerspectiveListAction = new QWidgetAction(_this);
|
||||||
PerspectiveComboBox = new QComboBox(_this);
|
PerspectiveComboBox = new QComboBox(_this);
|
||||||
PerspectiveComboBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
PerspectiveComboBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||||
PerspectiveComboBox->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
|
PerspectiveComboBox->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
||||||
PerspectiveListAction->setDefaultWidget(PerspectiveComboBox);
|
PerspectiveListAction->setDefaultWidget(PerspectiveComboBox);
|
||||||
ui.toolBar->addSeparator();
|
|
||||||
ui.toolBar->addAction(PerspectiveListAction);
|
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);
|
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->setProperty("Floating", true);
|
||||||
a->setToolTip("Creates floating dynamic dockable editor windows that are deleted on close");
|
a->setToolTip("Creates floating dynamic dockable editor windows that are deleted on close");
|
||||||
a->setIcon(svgIcon(":/adsdemo/images/note_add.svg"));
|
a->setIcon(svgIcon(":/adsdemo/images/note_add.svg"));
|
||||||
@@ -603,6 +646,7 @@ void MainWindowPrivate::createActions()
|
|||||||
_this->connect(a, SIGNAL(triggered()), SLOT(createEditor()));
|
_this->connect(a, SIGNAL(triggered()), SLOT(createEditor()));
|
||||||
ui.menuTests->addAction(a);
|
ui.menuTests->addAction(a);
|
||||||
|
|
||||||
|
ui.toolBar->addSeparator();
|
||||||
a = ui.toolBar->addAction("Create Floating Table");
|
a = ui.toolBar->addAction("Create Floating Table");
|
||||||
a->setToolTip("Creates floating dynamic dockable table with millions of entries");
|
a->setToolTip("Creates floating dynamic dockable table with millions of entries");
|
||||||
a->setIcon(svgIcon(":/adsdemo/images/grid_on.svg"));
|
a->setIcon(svgIcon(":/adsdemo/images/grid_on.svg"));
|
||||||
@@ -624,6 +668,30 @@ void MainWindowPrivate::createActions()
|
|||||||
a = Menu->addAction("Pinned Image Viewer");
|
a = Menu->addAction("Pinned Image Viewer");
|
||||||
_this->connect(a, SIGNAL(triggered()), SLOT(createImageViewer()));
|
_this->connect(a, SIGNAL(triggered()), SLOT(createImageViewer()));
|
||||||
|
|
||||||
|
a = ui.toolBar->addAction("Create OpenGL Viewer");
|
||||||
|
a->setToolTip("Creates a opengl widget for testing." );
|
||||||
|
a->setIcon(svgIcon(":/adsdemo/images/deployed_code.svg"));
|
||||||
|
QObject::connect(a, &QAction::triggered, _this, &CMainWindow::createOpenGlWidget);
|
||||||
|
ui.menuTests->addAction(a);
|
||||||
|
|
||||||
|
a = ui.toolBar->addAction("Create Coin3D Viewer");
|
||||||
|
a->setToolTip("Creates a Coin3D SoQt examine viewer for testing." );
|
||||||
|
a->setIcon(svgIcon(":/adsdemo/images/category.svg"));
|
||||||
|
QObject::connect(a, &QAction::triggered, _this, &CMainWindow::createCoin3DViewer);
|
||||||
|
ui.menuTests->addAction(a);
|
||||||
|
|
||||||
|
a = ui.toolBar->addAction("Create Quarter Viewer");
|
||||||
|
a->setToolTip("Creates a Coin3D Quarter examine viewer for testing." );
|
||||||
|
a->setIcon(svgIcon(":/adsdemo/images/category.svg"));
|
||||||
|
QObject::connect(a, &QAction::triggered, _this, &CMainWindow::createQuarterViewer);
|
||||||
|
ui.menuTests->addAction(a);
|
||||||
|
|
||||||
|
a = ui.toolBar->addAction("Apply VS Style");
|
||||||
|
a->setToolTip("Applies a Visual Studio light style (visual_studio_light.css)." );
|
||||||
|
a->setIcon(svgIcon(":/adsdemo/images/color_lens.svg"));
|
||||||
|
QObject::connect(a, &QAction::triggered, _this, &CMainWindow::applyVsStyle);
|
||||||
|
ui.menuTests->addAction(a);
|
||||||
|
|
||||||
|
|
||||||
ui.menuTests->addSeparator();
|
ui.menuTests->addSeparator();
|
||||||
a = ui.menuTests->addAction("Show Status Dialog");
|
a = ui.menuTests->addAction("Show Status Dialog");
|
||||||
@@ -632,12 +700,6 @@ void MainWindowPrivate::createActions()
|
|||||||
a = ui.menuTests->addAction("Toggle Label 0 Window Title");
|
a = ui.menuTests->addAction("Toggle Label 0 Window Title");
|
||||||
_this->connect(a, SIGNAL(triggered()), SLOT(toggleDockWidgetWindowTitle()));
|
_this->connect(a, SIGNAL(triggered()), SLOT(toggleDockWidgetWindowTitle()));
|
||||||
ui.menuTests->addSeparator();
|
ui.menuTests->addSeparator();
|
||||||
|
|
||||||
a = ui.toolBar->addAction("Apply VS Style");
|
|
||||||
a->setToolTip("Applies a Visual Studio light style (visual_studio_light.css)." );
|
|
||||||
a->setIcon(svgIcon(":/adsdemo/images/color_lens.svg"));
|
|
||||||
QObject::connect(a, &QAction::triggered, _this, &CMainWindow::applyVsStyle);
|
|
||||||
ui.menuTests->addAction(a);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -690,6 +752,9 @@ CMainWindow::CMainWindow(QWidget *parent) :
|
|||||||
d->ui.setupUi(this);
|
d->ui.setupUi(this);
|
||||||
setWindowTitle(QApplication::instance()->applicationName());
|
setWindowTitle(QApplication::instance()->applicationName());
|
||||||
d->createActions();
|
d->createActions();
|
||||||
|
SoQt::init(this);
|
||||||
|
SoDB::init();
|
||||||
|
SIM::Coin3D::Quarter::Quarter::init();
|
||||||
|
|
||||||
// uncomment the following line if the tab close button should be
|
// uncomment the following line if the tab close button should be
|
||||||
// a QToolButton instead of a QPushButton
|
// a QToolButton instead of a QPushButton
|
||||||
@@ -734,7 +799,7 @@ CMainWindow::CMainWindow(QWidget *parent) :
|
|||||||
CDockManager::setConfigFlag(CDockManager::FocusHighlighting, true);
|
CDockManager::setConfigFlag(CDockManager::FocusHighlighting, true);
|
||||||
|
|
||||||
// uncomment if you would like to enable dock widget auto hiding
|
// uncomment if you would like to enable dock widget auto hiding
|
||||||
CDockManager::setAutoHideConfigFlags(CDockManager::DefaultAutoHideConfig);
|
CDockManager::setAutoHideConfigFlags({CDockManager::DefaultAutoHideConfig});
|
||||||
|
|
||||||
// uncomment if you would like to enable an equal distribution of the
|
// uncomment if you would like to enable an equal distribution of the
|
||||||
// available size of a splitter to all contained dock widgets
|
// available size of a splitter to all contained dock widgets
|
||||||
@@ -745,6 +810,7 @@ CMainWindow::CMainWindow(QWidget *parent) :
|
|||||||
|
|
||||||
// Now create the dock manager and its content
|
// Now create the dock manager and its content
|
||||||
d->DockManager = new CDockManager(this);
|
d->DockManager = new CDockManager(this);
|
||||||
|
d->DockManager->setDockWidgetToolBarStyle(Qt::ToolButtonIconOnly, ads::CDockWidget::StateFloating);
|
||||||
|
|
||||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||||
connect(d->PerspectiveComboBox, SIGNAL(activated(QString)),
|
connect(d->PerspectiveComboBox, SIGNAL(activated(QString)),
|
||||||
@@ -1006,3 +1072,88 @@ void CMainWindow::createImageViewer()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
void CMainWindow::lockWorkspace(bool Value)
|
||||||
|
{
|
||||||
|
if (Value)
|
||||||
|
{
|
||||||
|
d->DockManager->lockDockWidgetFeaturesGlobally();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
d->DockManager->lockDockWidgetFeaturesGlobally(ads::CDockWidget::NoDockWidgetFeatures);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
void CMainWindow::createOpenGlWidget()
|
||||||
|
{
|
||||||
|
qDebug() << ":createOpenGlWidget ";
|
||||||
|
static int OpenGlWidgetCount = 0;
|
||||||
|
|
||||||
|
auto w = new GLWidget();
|
||||||
|
auto DockWidget = new ads::CDockWidget(QString("OpenGL Viewer %1").arg(OpenGlWidgetCount++));
|
||||||
|
DockWidget->setIcon(svgIcon(":/adsdemo/images/deployed_code.svg"));
|
||||||
|
DockWidget->setWidget(w, ads:: CDockWidget::ForceNoScrollArea);
|
||||||
|
d->DockManager->addDockWidget(ads::RightDockWidgetArea, DockWidget);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
void CMainWindow::createCoin3DViewer()
|
||||||
|
{
|
||||||
|
qDebug() << ":createCoin3DViewer ";
|
||||||
|
static int Coin3DWidgetCount = 0;
|
||||||
|
static SoSeparator* Root;
|
||||||
|
if (!Coin3DWidgetCount)
|
||||||
|
{
|
||||||
|
Root = new SoSeparator();
|
||||||
|
Root->ref();
|
||||||
|
auto Cone = new SoCone();
|
||||||
|
Root->addChild(Cone);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto Viewer = new SoQtExaminerViewer(this, nullptr, true, SoQtFullViewer::BUILD_ALL);
|
||||||
|
Viewer->setTransparencyType(SoGLRenderAction::SORTED_OBJECT_BLEND);
|
||||||
|
Viewer->setAnimationEnabled(false);
|
||||||
|
Viewer->setFeedbackVisibility(true);
|
||||||
|
Viewer->setSampleBuffers(4);
|
||||||
|
Viewer->setSceneGraph(Root);
|
||||||
|
//d->Viewer->setBackgroundColor(toSbColor(QColor(38, 38, 38)));
|
||||||
|
auto DockWidget = new ads::CDockWidget(QString("Coin3D Viewer %1").arg(Coin3DWidgetCount++));
|
||||||
|
DockWidget->setIcon(svgIcon(":/adsdemo/images/category.svg"));
|
||||||
|
DockWidget->setWidget(Viewer->getWidget(), ads:: CDockWidget::ForceNoScrollArea);
|
||||||
|
d->DockManager->addDockWidget(ads::LeftDockWidgetArea, DockWidget);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
void CMainWindow::createQuarterViewer()
|
||||||
|
{
|
||||||
|
qDebug() << ":createQuarterViewer ";
|
||||||
|
static int QuarterWidgetCount = 0;
|
||||||
|
static SoSeparator* Root;
|
||||||
|
if (!QuarterWidgetCount)
|
||||||
|
{
|
||||||
|
Root = new SoSeparator();
|
||||||
|
Root->ref();
|
||||||
|
SoBaseColor * col = new SoBaseColor;
|
||||||
|
col->rgb = SbColor(1, 1, 0);
|
||||||
|
Root->addChild(col);
|
||||||
|
Root->addChild(new SoCone);
|
||||||
|
}
|
||||||
|
|
||||||
|
using namespace SIM::Coin3D::Quarter;
|
||||||
|
auto Viewer = new QuarterWidget();
|
||||||
|
Viewer->setTransparencyType(QuarterWidget::SORTED_OBJECT_BLEND);
|
||||||
|
Viewer->setNavigationModeFile();
|
||||||
|
Viewer->setSceneGraph(Root);
|
||||||
|
//d->Viewer->setBackgroundColor(toSbColor(QColor(38, 38, 38)));
|
||||||
|
auto DockWidget = new ads::CDockWidget(QString("Quarter Viewer %1").arg(QuarterWidgetCount++));
|
||||||
|
DockWidget->setIcon(svgIcon(":/adsdemo/images/category.svg"));
|
||||||
|
DockWidget->setWidget(Viewer, ads:: CDockWidget::ForceNoScrollArea);
|
||||||
|
d->DockManager->addDockWidget(ads::LeftDockWidgetArea, DockWidget);
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -68,6 +68,10 @@ private slots:
|
|||||||
void toggleDockWidgetWindowTitle();
|
void toggleDockWidgetWindowTitle();
|
||||||
void applyVsStyle();
|
void applyVsStyle();
|
||||||
void createImageViewer();
|
void createImageViewer();
|
||||||
|
void lockWorkspace(bool Value);
|
||||||
|
void createOpenGlWidget();
|
||||||
|
void createCoin3DViewer();
|
||||||
|
void createQuarterViewer();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MAINWINDOW_H
|
#endif // MAINWINDOW_H
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
ADS_OUT_ROOT = $${OUT_PWD}/..
|
ADS_OUT_ROOT = $${OUT_PWD}/..
|
||||||
|
|
||||||
|
|
||||||
TARGET = AdvancedDockingSystemDemo
|
TARGET = AdvancedDockingSystemDemo
|
||||||
DESTDIR = $${ADS_OUT_ROOT}/lib
|
DESTDIR = $${ADS_OUT_ROOT}/lib
|
||||||
QT += core gui widgets
|
QT += core gui widgets quick quickwidgets opengl
|
||||||
|
|
||||||
include(../ads.pri)
|
include(../ads.pri)
|
||||||
|
|
||||||
@@ -10,6 +11,8 @@ lessThan(QT_MAJOR_VERSION, 6) {
|
|||||||
win32 {
|
win32 {
|
||||||
QT += axcontainer
|
QT += axcontainer
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
QT += openglwidgets
|
||||||
}
|
}
|
||||||
|
|
||||||
CONFIG += c++14
|
CONFIG += c++14
|
||||||
@@ -26,14 +29,19 @@ HEADERS += \
|
|||||||
MainWindow.h \
|
MainWindow.h \
|
||||||
StatusDialog.h \
|
StatusDialog.h \
|
||||||
ImageViewer.h \
|
ImageViewer.h \
|
||||||
RenderWidget.h
|
RenderWidget.h \
|
||||||
|
glwidget.h \
|
||||||
|
logo.h
|
||||||
|
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
main.cpp \
|
main.cpp \
|
||||||
MainWindow.cpp \
|
MainWindow.cpp \
|
||||||
StatusDialog.cpp \
|
StatusDialog.cpp \
|
||||||
ImageViewer.cpp \
|
ImageViewer.cpp \
|
||||||
RenderWidget.cpp
|
RenderWidget.cpp \
|
||||||
|
glwidget.cpp \
|
||||||
|
logo.cpp
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
mainwindow.ui \
|
mainwindow.ui \
|
||||||
@@ -47,3 +55,24 @@ LIBS += -L$${ADS_OUT_ROOT}/lib
|
|||||||
|
|
||||||
INCLUDEPATH += ../src
|
INCLUDEPATH += ../src
|
||||||
DEPENDPATH += ../src
|
DEPENDPATH += ../src
|
||||||
|
|
||||||
|
|
||||||
|
DEFINES += COIN_NOT_DLL \
|
||||||
|
SOQT_NOT_DLL \
|
||||||
|
QUARTER_NOT_DLL
|
||||||
|
|
||||||
|
LIBS *= -lopengl32
|
||||||
|
|
||||||
|
CONFIG(debug, debug|release){
|
||||||
|
LIBS *= -llibSoQtd \
|
||||||
|
-llibCoin-80d \
|
||||||
|
-lquarterd
|
||||||
|
}else{
|
||||||
|
LIBS *= -llibSoQt \
|
||||||
|
-llibCoin-80 \
|
||||||
|
-lquarter
|
||||||
|
}
|
||||||
|
|
||||||
|
# Add your library search path for external libraries here that contain the
|
||||||
|
# coin3d libraries
|
||||||
|
#LIBS *= -LC:/CodingXP/mingw1120_64_qt6/usr/bin
|
||||||
|
|||||||
@@ -36,5 +36,10 @@
|
|||||||
<file>images/panorama.svg</file>
|
<file>images/panorama.svg</file>
|
||||||
<file>images/ads_icon2.svg</file>
|
<file>images/ads_icon2.svg</file>
|
||||||
<file>images/font_download.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>
|
||||||
|
<file>images/deployed_code.svg</file>
|
||||||
|
<file>images/category.svg</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|||||||
280
demo/glwidget.cpp
Normal file
@@ -0,0 +1,280 @@
|
|||||||
|
// Copyright (C) 2016 The Qt Company Ltd.
|
||||||
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
||||||
|
|
||||||
|
#include "glwidget.h"
|
||||||
|
#include <QMouseEvent>
|
||||||
|
#include <QOpenGLShaderProgram>
|
||||||
|
#include <QCoreApplication>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
bool GLWidget::m_transparent = false;
|
||||||
|
|
||||||
|
GLWidget::GLWidget(QWidget *parent)
|
||||||
|
: QOpenGLWidget(parent)
|
||||||
|
{
|
||||||
|
m_core = QSurfaceFormat::defaultFormat().profile() == QSurfaceFormat::CoreProfile;
|
||||||
|
// --transparent causes the clear color to be transparent. Therefore, on systems that
|
||||||
|
// support it, the widget will become transparent apart from the logo.
|
||||||
|
if (m_transparent) {
|
||||||
|
QSurfaceFormat fmt = format();
|
||||||
|
fmt.setAlphaBufferSize(8);
|
||||||
|
setFormat(fmt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GLWidget::~GLWidget()
|
||||||
|
{
|
||||||
|
cleanup();
|
||||||
|
}
|
||||||
|
|
||||||
|
QSize GLWidget::minimumSizeHint() const
|
||||||
|
{
|
||||||
|
return QSize(50, 50);
|
||||||
|
}
|
||||||
|
|
||||||
|
QSize GLWidget::sizeHint() const
|
||||||
|
{
|
||||||
|
return QSize(400, 400);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void qNormalizeAngle(int &angle)
|
||||||
|
{
|
||||||
|
while (angle < 0)
|
||||||
|
angle += 360 * 16;
|
||||||
|
while (angle > 360 * 16)
|
||||||
|
angle -= 360 * 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GLWidget::setXRotation(int angle)
|
||||||
|
{
|
||||||
|
qNormalizeAngle(angle);
|
||||||
|
if (angle != m_xRot) {
|
||||||
|
m_xRot = angle;
|
||||||
|
emit xRotationChanged(angle);
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GLWidget::setYRotation(int angle)
|
||||||
|
{
|
||||||
|
qNormalizeAngle(angle);
|
||||||
|
if (angle != m_yRot) {
|
||||||
|
m_yRot = angle;
|
||||||
|
emit yRotationChanged(angle);
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GLWidget::setZRotation(int angle)
|
||||||
|
{
|
||||||
|
qNormalizeAngle(angle);
|
||||||
|
if (angle != m_zRot) {
|
||||||
|
m_zRot = angle;
|
||||||
|
emit zRotationChanged(angle);
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GLWidget::cleanup()
|
||||||
|
{
|
||||||
|
if (m_program == nullptr)
|
||||||
|
return;
|
||||||
|
makeCurrent();
|
||||||
|
m_logoVbo.destroy();
|
||||||
|
delete m_program;
|
||||||
|
m_program = nullptr;
|
||||||
|
doneCurrent();
|
||||||
|
QObject::disconnect(context(), &QOpenGLContext::aboutToBeDestroyed, this, &GLWidget::cleanup);
|
||||||
|
m_HiddenOnCleanup = isHidden();
|
||||||
|
// Hiding here prevents the base class implementation to recreate
|
||||||
|
// the QOpenGlContext immediatelly allowing us to set the surface format again
|
||||||
|
hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
static const char *vertexShaderSourceCore =
|
||||||
|
"#version 150\n"
|
||||||
|
"in vec4 vertex;\n"
|
||||||
|
"in vec3 normal;\n"
|
||||||
|
"out vec3 vert;\n"
|
||||||
|
"out vec3 vertNormal;\n"
|
||||||
|
"uniform mat4 projMatrix;\n"
|
||||||
|
"uniform mat4 mvMatrix;\n"
|
||||||
|
"uniform mat3 normalMatrix;\n"
|
||||||
|
"void main() {\n"
|
||||||
|
" vert = vertex.xyz;\n"
|
||||||
|
" vertNormal = normalMatrix * normal;\n"
|
||||||
|
" gl_Position = projMatrix * mvMatrix * vertex;\n"
|
||||||
|
"}\n";
|
||||||
|
|
||||||
|
static const char *fragmentShaderSourceCore =
|
||||||
|
"#version 150\n"
|
||||||
|
"in highp vec3 vert;\n"
|
||||||
|
"in highp vec3 vertNormal;\n"
|
||||||
|
"out highp vec4 fragColor;\n"
|
||||||
|
"uniform highp vec3 lightPos;\n"
|
||||||
|
"void main() {\n"
|
||||||
|
" highp vec3 L = normalize(lightPos - vert);\n"
|
||||||
|
" highp float NL = max(dot(normalize(vertNormal), L), 0.0);\n"
|
||||||
|
" highp vec3 color = vec3(0.39, 1.0, 0.0);\n"
|
||||||
|
" highp vec3 col = clamp(color * 0.2 + color * 0.8 * NL, 0.0, 1.0);\n"
|
||||||
|
" fragColor = vec4(col, 1.0);\n"
|
||||||
|
"}\n";
|
||||||
|
|
||||||
|
static const char *vertexShaderSource =
|
||||||
|
"attribute vec4 vertex;\n"
|
||||||
|
"attribute vec3 normal;\n"
|
||||||
|
"varying vec3 vert;\n"
|
||||||
|
"varying vec3 vertNormal;\n"
|
||||||
|
"uniform mat4 projMatrix;\n"
|
||||||
|
"uniform mat4 mvMatrix;\n"
|
||||||
|
"uniform mat3 normalMatrix;\n"
|
||||||
|
"void main() {\n"
|
||||||
|
" vert = vertex.xyz;\n"
|
||||||
|
" vertNormal = normalMatrix * normal;\n"
|
||||||
|
" gl_Position = projMatrix * mvMatrix * vertex;\n"
|
||||||
|
"}\n";
|
||||||
|
|
||||||
|
static const char *fragmentShaderSource =
|
||||||
|
"varying highp vec3 vert;\n"
|
||||||
|
"varying highp vec3 vertNormal;\n"
|
||||||
|
"uniform highp vec3 lightPos;\n"
|
||||||
|
"void main() {\n"
|
||||||
|
" highp vec3 L = normalize(lightPos - vert);\n"
|
||||||
|
" highp float NL = max(dot(normalize(vertNormal), L), 0.0);\n"
|
||||||
|
" highp vec3 color = vec3(0.39, 1.0, 0.0);\n"
|
||||||
|
" highp vec3 col = clamp(color * 0.2 + color * 0.8 * NL, 0.0, 1.0);\n"
|
||||||
|
" gl_FragColor = vec4(col, 1.0);\n"
|
||||||
|
"}\n";
|
||||||
|
|
||||||
|
void GLWidget::initializeGL()
|
||||||
|
{
|
||||||
|
// In this example the widget's corresponding top-level window can change
|
||||||
|
// several times during the widget's lifetime. Whenever this happens, the
|
||||||
|
// QOpenGLWidget's associated context is destroyed and a new one is created.
|
||||||
|
// Therefore we have to be prepared to clean up the resources on the
|
||||||
|
// aboutToBeDestroyed() signal, instead of the destructor. The emission of
|
||||||
|
// the signal will be followed by an invocation of initializeGL() where we
|
||||||
|
// can recreate all resources.
|
||||||
|
connect(context(), &QOpenGLContext::aboutToBeDestroyed, this, &GLWidget::cleanup);
|
||||||
|
|
||||||
|
initializeOpenGLFunctions();
|
||||||
|
glClearColor(0, 0, 0, m_transparent ? 0 : 1);
|
||||||
|
|
||||||
|
m_program = new QOpenGLShaderProgram;
|
||||||
|
m_program->addShaderFromSourceCode(QOpenGLShader::Vertex, m_core ? vertexShaderSourceCore : vertexShaderSource);
|
||||||
|
m_program->addShaderFromSourceCode(QOpenGLShader::Fragment, m_core ? fragmentShaderSourceCore : fragmentShaderSource);
|
||||||
|
m_program->bindAttributeLocation("vertex", 0);
|
||||||
|
m_program->bindAttributeLocation("normal", 1);
|
||||||
|
m_program->link();
|
||||||
|
|
||||||
|
m_program->bind();
|
||||||
|
m_projMatrixLoc = m_program->uniformLocation("projMatrix");
|
||||||
|
m_mvMatrixLoc = m_program->uniformLocation("mvMatrix");
|
||||||
|
m_normalMatrixLoc = m_program->uniformLocation("normalMatrix");
|
||||||
|
m_lightPosLoc = m_program->uniformLocation("lightPos");
|
||||||
|
|
||||||
|
// Create a vertex array object. In OpenGL ES 2.0 and OpenGL 2.x
|
||||||
|
// implementations this is optional and support may not be present
|
||||||
|
// at all. Nonetheless the below code works in all cases and makes
|
||||||
|
// sure there is a VAO when one is needed.
|
||||||
|
m_vao.create();
|
||||||
|
QOpenGLVertexArrayObject::Binder vaoBinder(&m_vao);
|
||||||
|
|
||||||
|
// Setup our vertex buffer object.
|
||||||
|
m_logoVbo.create();
|
||||||
|
m_logoVbo.bind();
|
||||||
|
m_logoVbo.allocate(m_logo.constData(), m_logo.count() * sizeof(GLfloat));
|
||||||
|
|
||||||
|
// Store the vertex attribute bindings for the program.
|
||||||
|
setupVertexAttribs();
|
||||||
|
|
||||||
|
// Our camera never changes in this example.
|
||||||
|
m_camera.setToIdentity();
|
||||||
|
m_camera.translate(0, 0, -1);
|
||||||
|
|
||||||
|
// Light position is fixed.
|
||||||
|
m_program->setUniformValue(m_lightPosLoc, QVector3D(0, 0, 70));
|
||||||
|
|
||||||
|
m_program->release();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GLWidget::setupVertexAttribs()
|
||||||
|
{
|
||||||
|
m_logoVbo.bind();
|
||||||
|
QOpenGLFunctions *f = QOpenGLContext::currentContext()->functions();
|
||||||
|
f->glEnableVertexAttribArray(0);
|
||||||
|
f->glEnableVertexAttribArray(1);
|
||||||
|
f->glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(GLfloat),
|
||||||
|
nullptr);
|
||||||
|
f->glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(GLfloat),
|
||||||
|
reinterpret_cast<void *>(3 * sizeof(GLfloat)));
|
||||||
|
m_logoVbo.release();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GLWidget::paintGL()
|
||||||
|
{
|
||||||
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
|
glEnable(GL_DEPTH_TEST);
|
||||||
|
glEnable(GL_CULL_FACE);
|
||||||
|
|
||||||
|
m_world.setToIdentity();
|
||||||
|
m_world.rotate(180.0f - (m_xRot / 16.0f), 1, 0, 0);
|
||||||
|
m_world.rotate(m_yRot / 16.0f, 0, 1, 0);
|
||||||
|
m_world.rotate(m_zRot / 16.0f, 0, 0, 1);
|
||||||
|
|
||||||
|
QOpenGLVertexArrayObject::Binder vaoBinder(&m_vao);
|
||||||
|
m_program->bind();
|
||||||
|
m_program->setUniformValue(m_projMatrixLoc, m_proj);
|
||||||
|
m_program->setUniformValue(m_mvMatrixLoc, m_camera * m_world);
|
||||||
|
QMatrix3x3 normalMatrix = m_world.normalMatrix();
|
||||||
|
m_program->setUniformValue(m_normalMatrixLoc, normalMatrix);
|
||||||
|
|
||||||
|
glDrawArrays(GL_TRIANGLES, 0, m_logo.vertexCount());
|
||||||
|
|
||||||
|
m_program->release();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GLWidget::resizeGL(int w, int h)
|
||||||
|
{
|
||||||
|
m_proj.setToIdentity();
|
||||||
|
m_proj.perspective(45.0f, GLfloat(w) / h, 0.01f, 100.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GLWidget::mousePressEvent(QMouseEvent *event)
|
||||||
|
{
|
||||||
|
m_lastPos = event->position().toPoint();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GLWidget::mouseMoveEvent(QMouseEvent *event)
|
||||||
|
{
|
||||||
|
int dx = event->position().toPoint().x() - m_lastPos.x();
|
||||||
|
int dy = event->position().toPoint().y() - m_lastPos.y();
|
||||||
|
|
||||||
|
if (event->buttons() & Qt::LeftButton) {
|
||||||
|
setXRotation(m_xRot + 8 * dy);
|
||||||
|
setYRotation(m_yRot + 8 * dx);
|
||||||
|
} else if (event->buttons() & Qt::RightButton) {
|
||||||
|
setXRotation(m_xRot + 8 * dy);
|
||||||
|
setZRotation(m_zRot + 8 * dx);
|
||||||
|
}
|
||||||
|
m_lastPos = event->position().toPoint();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool GLWidget::event(QEvent *event)
|
||||||
|
{
|
||||||
|
auto Result = QOpenGLWidget::event(event);
|
||||||
|
if (event->type() == QEvent::WindowChangeInternal)
|
||||||
|
{
|
||||||
|
qDebug() << "QEvent::WindowChangeInternal";
|
||||||
|
if (!context())
|
||||||
|
{
|
||||||
|
setFormat(QSurfaceFormat::defaultFormat());
|
||||||
|
if (!m_HiddenOnCleanup)
|
||||||
|
{
|
||||||
|
show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Result;
|
||||||
|
}
|
||||||
72
demo/glwidget.h
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
// Copyright (C) 2016 The Qt Company Ltd.
|
||||||
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
||||||
|
|
||||||
|
#ifndef GLWIDGET_H
|
||||||
|
#define GLWIDGET_H
|
||||||
|
|
||||||
|
#include <QOpenGLWidget>
|
||||||
|
#include <QOpenGLFunctions>
|
||||||
|
#include <QOpenGLVertexArrayObject>
|
||||||
|
#include <QOpenGLBuffer>
|
||||||
|
#include <QMatrix4x4>
|
||||||
|
#include "logo.h"
|
||||||
|
|
||||||
|
QT_FORWARD_DECLARE_CLASS(QOpenGLShaderProgram)
|
||||||
|
|
||||||
|
class GLWidget : public QOpenGLWidget, protected QOpenGLFunctions
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
GLWidget(QWidget *parent = nullptr);
|
||||||
|
~GLWidget();
|
||||||
|
|
||||||
|
static bool isTransparent() { return m_transparent; }
|
||||||
|
static void setTransparent(bool t) { m_transparent = t; }
|
||||||
|
|
||||||
|
QSize minimumSizeHint() const override;
|
||||||
|
QSize sizeHint() const override;
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void setXRotation(int angle);
|
||||||
|
void setYRotation(int angle);
|
||||||
|
void setZRotation(int angle);
|
||||||
|
void cleanup();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void xRotationChanged(int angle);
|
||||||
|
void yRotationChanged(int angle);
|
||||||
|
void zRotationChanged(int angle);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void initializeGL() override;
|
||||||
|
void paintGL() override;
|
||||||
|
void resizeGL(int width, int height) override;
|
||||||
|
void mousePressEvent(QMouseEvent *event) override;
|
||||||
|
void mouseMoveEvent(QMouseEvent *event) override;
|
||||||
|
virtual bool event(QEvent *event) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void setupVertexAttribs();
|
||||||
|
|
||||||
|
bool m_core;
|
||||||
|
int m_xRot = 0;
|
||||||
|
int m_yRot = 0;
|
||||||
|
int m_zRot = 0;
|
||||||
|
QPoint m_lastPos;
|
||||||
|
Logo m_logo;
|
||||||
|
QOpenGLVertexArrayObject m_vao;
|
||||||
|
QOpenGLBuffer m_logoVbo;
|
||||||
|
QOpenGLShaderProgram *m_program = nullptr;
|
||||||
|
int m_projMatrixLoc = 0;
|
||||||
|
int m_mvMatrixLoc = 0;
|
||||||
|
int m_normalMatrixLoc = 0;
|
||||||
|
int m_lightPosLoc = 0;
|
||||||
|
QMatrix4x4 m_proj;
|
||||||
|
QMatrix4x4 m_camera;
|
||||||
|
QMatrix4x4 m_world;
|
||||||
|
static bool m_transparent;
|
||||||
|
bool m_HiddenOnCleanup = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
5
demo/images/category.svg
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<svg version="1.1" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<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>
|
||||||
|
<path d="m243.2 467.2 246.4-403.2 246.4 403.2zm492.8 492.8q-84 0-142.8-58.8t-58.8-142.8 58.8-142.8 142.8-58.8 142.8 58.8 58.8 142.8-58.8 142.8-142.8 58.8zm-649.6-22.4v-358.4h358.4v358.4zm649.6-67.2q47.04 0 79.52-32.48t32.48-79.52-32.48-79.52-79.52-32.48-79.52 32.48-32.48 79.52 32.48 79.52 79.52 32.48zm-560-22.4h179.2v-179.2h-179.2zm226.24-470.4h174.72l-87.36-141.12z" fill="#03b8e5" fill-opacity=".87843" stroke-width=".025"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 755 B |
5
demo/images/deployed_code.svg
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<svg version="1.1" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<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>
|
||||||
|
<path d="m467.2 844.64v-306.88l-268.8-155.68v306.88zm89.6 0 268.8-155.68v-306.88l-268.8 155.68zm-44.8-384.16 265.44-153.44-265.44-153.44-265.44 153.44zm-358.4 306.88q-21.28-12.32-33.04-32.48t-11.76-44.8v-356.16q0-24.64 11.76-44.8t33.04-32.48l313.6-180.32q21.28-12.32 44.8-12.32t44.8 12.32l313.6 180.32q21.28 12.32 33.04 32.48t11.76 44.8v356.16q0 24.64-11.76 44.8t-33.04 32.48l-313.6 180.32q-21.28 12.32-44.8 12.32t-44.8-12.32z" fill="#03b8e5" stroke-width=".025"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 791 B |
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 |
103
demo/logo.cpp
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
// Copyright (C) 2016 The Qt Company Ltd.
|
||||||
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
||||||
|
|
||||||
|
#include "logo.h"
|
||||||
|
#include <qmath.h>
|
||||||
|
|
||||||
|
Logo::Logo()
|
||||||
|
{
|
||||||
|
m_data.resize(2500 * 6);
|
||||||
|
|
||||||
|
const GLfloat x1 = +0.06f;
|
||||||
|
const GLfloat y1 = -0.14f;
|
||||||
|
const GLfloat x2 = +0.14f;
|
||||||
|
const GLfloat y2 = -0.06f;
|
||||||
|
const GLfloat x3 = +0.08f;
|
||||||
|
const GLfloat y3 = +0.00f;
|
||||||
|
const GLfloat x4 = +0.30f;
|
||||||
|
const GLfloat y4 = +0.22f;
|
||||||
|
|
||||||
|
quad(x1, y1, x2, y2, y2, x2, y1, x1);
|
||||||
|
quad(x3, y3, x4, y4, y4, x4, y3, x3);
|
||||||
|
|
||||||
|
extrude(x1, y1, x2, y2);
|
||||||
|
extrude(x2, y2, y2, x2);
|
||||||
|
extrude(y2, x2, y1, x1);
|
||||||
|
extrude(y1, x1, x1, y1);
|
||||||
|
extrude(x3, y3, x4, y4);
|
||||||
|
extrude(x4, y4, y4, x4);
|
||||||
|
extrude(y4, x4, y3, x3);
|
||||||
|
|
||||||
|
const int NumSectors = 100;
|
||||||
|
|
||||||
|
for (int i = 0; i < NumSectors; ++i) {
|
||||||
|
GLfloat angle = (i * 2 * M_PI) / NumSectors;
|
||||||
|
GLfloat angleSin = qSin(angle);
|
||||||
|
GLfloat angleCos = qCos(angle);
|
||||||
|
const GLfloat x5 = 0.30f * angleSin;
|
||||||
|
const GLfloat y5 = 0.30f * angleCos;
|
||||||
|
const GLfloat x6 = 0.20f * angleSin;
|
||||||
|
const GLfloat y6 = 0.20f * angleCos;
|
||||||
|
|
||||||
|
angle = ((i + 1) * 2 * M_PI) / NumSectors;
|
||||||
|
angleSin = qSin(angle);
|
||||||
|
angleCos = qCos(angle);
|
||||||
|
const GLfloat x7 = 0.20f * angleSin;
|
||||||
|
const GLfloat y7 = 0.20f * angleCos;
|
||||||
|
const GLfloat x8 = 0.30f * angleSin;
|
||||||
|
const GLfloat y8 = 0.30f * angleCos;
|
||||||
|
|
||||||
|
quad(x5, y5, x6, y6, x7, y7, x8, y8);
|
||||||
|
|
||||||
|
extrude(x6, y6, x7, y7);
|
||||||
|
extrude(x8, y8, x5, y5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Logo::add(const QVector3D &v, const QVector3D &n)
|
||||||
|
{
|
||||||
|
GLfloat *p = m_data.data() + m_count;
|
||||||
|
*p++ = v.x();
|
||||||
|
*p++ = v.y();
|
||||||
|
*p++ = v.z();
|
||||||
|
*p++ = n.x();
|
||||||
|
*p++ = n.y();
|
||||||
|
*p++ = n.z();
|
||||||
|
m_count += 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Logo::quad(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2, GLfloat x3, GLfloat y3, GLfloat x4, GLfloat y4)
|
||||||
|
{
|
||||||
|
QVector3D n = QVector3D::normal(QVector3D(x4 - x1, y4 - y1, 0.0f), QVector3D(x2 - x1, y2 - y1, 0.0f));
|
||||||
|
|
||||||
|
add(QVector3D(x1, y1, -0.05f), n);
|
||||||
|
add(QVector3D(x4, y4, -0.05f), n);
|
||||||
|
add(QVector3D(x2, y2, -0.05f), n);
|
||||||
|
|
||||||
|
add(QVector3D(x3, y3, -0.05f), n);
|
||||||
|
add(QVector3D(x2, y2, -0.05f), n);
|
||||||
|
add(QVector3D(x4, y4, -0.05f), n);
|
||||||
|
|
||||||
|
n = QVector3D::normal(QVector3D(x1 - x4, y1 - y4, 0.0f), QVector3D(x2 - x4, y2 - y4, 0.0f));
|
||||||
|
|
||||||
|
add(QVector3D(x4, y4, 0.05f), n);
|
||||||
|
add(QVector3D(x1, y1, 0.05f), n);
|
||||||
|
add(QVector3D(x2, y2, 0.05f), n);
|
||||||
|
|
||||||
|
add(QVector3D(x2, y2, 0.05f), n);
|
||||||
|
add(QVector3D(x3, y3, 0.05f), n);
|
||||||
|
add(QVector3D(x4, y4, 0.05f), n);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Logo::extrude(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)
|
||||||
|
{
|
||||||
|
QVector3D n = QVector3D::normal(QVector3D(0.0f, 0.0f, -0.1f), QVector3D(x2 - x1, y2 - y1, 0.0f));
|
||||||
|
|
||||||
|
add(QVector3D(x1, y1, +0.05f), n);
|
||||||
|
add(QVector3D(x1, y1, -0.05f), n);
|
||||||
|
add(QVector3D(x2, y2, +0.05f), n);
|
||||||
|
|
||||||
|
add(QVector3D(x2, y2, -0.05f), n);
|
||||||
|
add(QVector3D(x2, y2, +0.05f), n);
|
||||||
|
add(QVector3D(x1, y1, -0.05f), n);
|
||||||
|
}
|
||||||
28
demo/logo.h
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
// Copyright (C) 2016 The Qt Company Ltd.
|
||||||
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
||||||
|
|
||||||
|
#ifndef LOGO_H
|
||||||
|
#define LOGO_H
|
||||||
|
|
||||||
|
#include <qopengl.h>
|
||||||
|
#include <QList>
|
||||||
|
#include <QVector3D>
|
||||||
|
|
||||||
|
class Logo
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Logo();
|
||||||
|
const GLfloat *constData() const { return m_data.constData(); }
|
||||||
|
int count() const { return m_count; }
|
||||||
|
int vertexCount() const { return m_count / 6; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
void quad(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2, GLfloat x3, GLfloat y3, GLfloat x4, GLfloat y4);
|
||||||
|
void extrude(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);
|
||||||
|
void add(const QVector3D &v, const QVector3D &n);
|
||||||
|
|
||||||
|
QList<GLfloat> m_data;
|
||||||
|
int m_count = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // LOGO_H
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QQuickWindow>
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
@@ -41,7 +42,8 @@ int main(int argc, char *argv[])
|
|||||||
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
std::shared_ptr<int> b;
|
QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGL);
|
||||||
|
QApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
a.setApplicationName("Advanced Docking System Demo");
|
a.setApplicationName("Advanced Docking System Demo");
|
||||||
a.setQuitOnLastWindowClosed(true);
|
a.setQuitOnLastWindowClosed(true);
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
from PyQt5 import uic
|
from PyQt5 import uic
|
||||||
from PyQtAds import QtAds
|
import PyQtAds as QtAds
|
||||||
|
|
||||||
UI_FILE = os.path.join(os.path.dirname(__file__), 'StatusDialog.ui')
|
UI_FILE = os.path.join(os.path.dirname(__file__), 'StatusDialog.ui')
|
||||||
StatusDialogUI, StatusDialogBase = uic.loadUiType(UI_FILE)
|
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
|
## 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
|
The Advanced Docking System works with or without a central widget.
|
||||||
border of the main window or you can dock into each dock area - so you are
|
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.
|
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
|
### 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:
|
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_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,10 +27,17 @@
|
|||||||
- [`FloatingContainerForceNativeTitleBar` (Linux only)](#floatingcontainerforcenativetitlebar-linux-only)
|
- [`FloatingContainerForceNativeTitleBar` (Linux only)](#floatingcontainerforcenativetitlebar-linux-only)
|
||||||
- [`FloatingContainerForceQWidgetTitleBar` (Linux only)](#floatingcontainerforceqwidgettitlebar-linux-only)
|
- [`FloatingContainerForceQWidgetTitleBar` (Linux only)](#floatingcontainerforceqwidgettitlebar-linux-only)
|
||||||
- [`MiddleMouseButtonClosesTab`](#middlemousebuttonclosestab)
|
- [`MiddleMouseButtonClosesTab`](#middlemousebuttonclosestab)
|
||||||
|
- [`DisableTabTextEliding`](#disabletabtexteliding)
|
||||||
|
- [`ShowTabTextOnlyForActiveTab`](#showtabtextonlyforactivetab)
|
||||||
- [Auto-Hide Configuration Flags](#auto-hide-configuration-flags)
|
- [Auto-Hide Configuration Flags](#auto-hide-configuration-flags)
|
||||||
- [Auto Hide Dock Widgets](#auto-hide-dock-widgets)
|
- [Auto Hide Dock Widgets](#auto-hide-dock-widgets)
|
||||||
- [Pinning Auto-Hide Widgets to a certain border](#pinning-auto-hide-widgets-to-a-certain-border)
|
- [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)
|
- [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)
|
- [Adding Auto Hide Widgets](#adding-auto-hide-widgets)
|
||||||
- [Setting Auto-Hide Flags](#setting-auto-hide-flags)
|
- [Setting Auto-Hide Flags](#setting-auto-hide-flags)
|
||||||
- [`AutoHideFeatureEnabled`](#autohidefeatureenabled)
|
- [`AutoHideFeatureEnabled`](#autohidefeatureenabled)
|
||||||
@@ -39,6 +46,9 @@
|
|||||||
- [`AutoHideButtonCheckable`](#autohidebuttoncheckable)
|
- [`AutoHideButtonCheckable`](#autohidebuttoncheckable)
|
||||||
- [`AutoHideSideBarsIconOnly`](#autohidesidebarsicononly)
|
- [`AutoHideSideBarsIconOnly`](#autohidesidebarsicononly)
|
||||||
- [`AutoHideShowOnMouseOver`](#autohideshowonmouseover)
|
- [`AutoHideShowOnMouseOver`](#autohideshowonmouseover)
|
||||||
|
- [`AutoHideCloseButtonCollapsesDock`](#autohideclosebuttoncollapsesdock)
|
||||||
|
- [`AutoHideHasCloseButton`](#autohidehasclosebutton)
|
||||||
|
- [`AutoHideHasMinimizeButton`](#autohidehasminimizebutton)
|
||||||
- [DockWidget Feature Flags](#dockwidget-feature-flags)
|
- [DockWidget Feature Flags](#dockwidget-feature-flags)
|
||||||
- [`DockWidgetClosable`](#dockwidgetclosable)
|
- [`DockWidgetClosable`](#dockwidgetclosable)
|
||||||
- [`DockWidgetMovable`](#dockwidgetmovable)
|
- [`DockWidgetMovable`](#dockwidgetmovable)
|
||||||
@@ -293,8 +303,9 @@ or to close it via the close button.
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
The Advanced Docking System is meant for applications without a static central
|
Unless a central widget explicitly has been set with setCentralWidget, the
|
||||||
widget and normally does not know anything about a central static widget.
|
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
|
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.
|
still has a titlebar to drag it out of the main window.
|
||||||
|
|
||||||
@@ -466,6 +477,24 @@ possible in various web browsers.
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
### `DisableTabTextEliding`
|
||||||
|
|
||||||
|
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:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
## Auto-Hide Configuration Flags
|
## Auto-Hide Configuration Flags
|
||||||
|
|
||||||
### Auto Hide Dock Widgets
|
### Auto Hide Dock Widgets
|
||||||
@@ -480,7 +509,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
|
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
|
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
|
holding down the **Ctrl** key, the whole dock area will be pinned to a certain
|
||||||
border.
|
border.
|
||||||
@@ -502,6 +531,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
|
collapsed if the mouse cursor leaves the Auto-Hide widget. Showing and hiding
|
||||||
by mouse click still works if this feature is enabled.
|
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 Auto Hide Widgets
|
||||||
|
|
||||||
Adding an auto hide widget is similar to adding a dock widget, simply call
|
Adding an auto hide widget is similar to adding a dock widget, simply call
|
||||||
@@ -589,6 +671,39 @@ 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
|
mouse outside of the Auto-Hide widget. Showing and hiding my mouse click still
|
||||||
works if this feature is enabled.
|
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.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
## DockWidget Feature Flags
|
## DockWidget Feature Flags
|
||||||
|
|
||||||
### `DockWidgetClosable`
|
### `DockWidgetClosable`
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ add_executable(AutoHideExample WIN32
|
|||||||
mainwindow.ui
|
mainwindow.ui
|
||||||
)
|
)
|
||||||
target_include_directories(AutoHideExample PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../src")
|
target_include_directories(AutoHideExample PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../src")
|
||||||
target_link_libraries(AutoHideExample PRIVATE qtadvanceddocking)
|
target_link_libraries(AutoHideExample PRIVATE qt${QT_VERSION_MAJOR}advanceddocking)
|
||||||
target_link_libraries(AutoHideExample PUBLIC Qt${QT_VERSION_MAJOR}::Core
|
target_link_libraries(AutoHideExample PUBLIC Qt${QT_VERSION_MAJOR}::Core
|
||||||
Qt${QT_VERSION_MAJOR}::Gui
|
Qt${QT_VERSION_MAJOR}::Gui
|
||||||
Qt${QT_VERSION_MAJOR}::Widgets)
|
Qt${QT_VERSION_MAJOR}::Widgets)
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ from PyQt5.QtWidgets import (QApplication, QLabel, QCalendarWidget, QFrame, QTre
|
|||||||
QTableWidget, QFileSystemModel, QPlainTextEdit, QToolBar,
|
QTableWidget, QFileSystemModel, QPlainTextEdit, QToolBar,
|
||||||
QWidgetAction, QComboBox, QAction, QSizePolicy, QInputDialog)
|
QWidgetAction, QComboBox, QAction, QSizePolicy, QInputDialog)
|
||||||
|
|
||||||
from PyQtAds import QtAds
|
import PyQtAds as QtAds
|
||||||
|
|
||||||
UI_FILE = os.path.join(os.path.dirname(__file__), 'mainwindow.ui')
|
UI_FILE = os.path.join(os.path.dirname(__file__), 'mainwindow.ui')
|
||||||
MainWindowUI, MainWindowBase = uic.loadUiType(UI_FILE)
|
MainWindowUI, MainWindowBase = uic.loadUiType(UI_FILE)
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ add_executable(CentralWidgetExample WIN32
|
|||||||
mainwindow.ui
|
mainwindow.ui
|
||||||
)
|
)
|
||||||
target_include_directories(CentralWidgetExample PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../src")
|
target_include_directories(CentralWidgetExample PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../src")
|
||||||
target_link_libraries(CentralWidgetExample PRIVATE qtadvanceddocking)
|
target_link_libraries(CentralWidgetExample PRIVATE qt${QT_VERSION_MAJOR}advanceddocking)
|
||||||
target_link_libraries(CentralWidgetExample PUBLIC Qt${QT_VERSION_MAJOR}::Core
|
target_link_libraries(CentralWidgetExample PUBLIC Qt${QT_VERSION_MAJOR}::Core
|
||||||
Qt${QT_VERSION_MAJOR}::Gui
|
Qt${QT_VERSION_MAJOR}::Gui
|
||||||
Qt${QT_VERSION_MAJOR}::Widgets)
|
Qt${QT_VERSION_MAJOR}::Widgets)
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ from PyQt5.QtWidgets import (QApplication, QLabel, QCalendarWidget, QFrame, QTre
|
|||||||
QTableWidget, QFileSystemModel, QPlainTextEdit, QToolBar,
|
QTableWidget, QFileSystemModel, QPlainTextEdit, QToolBar,
|
||||||
QWidgetAction, QComboBox, QAction, QSizePolicy, QInputDialog)
|
QWidgetAction, QComboBox, QAction, QSizePolicy, QInputDialog)
|
||||||
|
|
||||||
from PyQtAds import QtAds
|
import PyQtAds as QtAds
|
||||||
|
|
||||||
UI_FILE = os.path.join(os.path.dirname(__file__), 'mainwindow.ui')
|
UI_FILE = os.path.join(os.path.dirname(__file__), 'mainwindow.ui')
|
||||||
MainWindowUI, MainWindowBase = uic.loadUiType(UI_FILE)
|
MainWindowUI, MainWindowBase = uic.loadUiType(UI_FILE)
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ add_executable(DeleteOnCloseTest WIN32
|
|||||||
main.cpp
|
main.cpp
|
||||||
)
|
)
|
||||||
target_include_directories(DeleteOnCloseTest PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../src")
|
target_include_directories(DeleteOnCloseTest PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../src")
|
||||||
target_link_libraries(DeleteOnCloseTest PRIVATE qtadvanceddocking)
|
target_link_libraries(DeleteOnCloseTest PRIVATE qt${QT_VERSION_MAJOR}advanceddocking)
|
||||||
target_link_libraries(DeleteOnCloseTest PUBLIC Qt${QT_VERSION_MAJOR}::Core
|
target_link_libraries(DeleteOnCloseTest PUBLIC Qt${QT_VERSION_MAJOR}::Core
|
||||||
Qt${QT_VERSION_MAJOR}::Gui
|
Qt${QT_VERSION_MAJOR}::Gui
|
||||||
Qt${QT_VERSION_MAJOR}::Widgets)
|
Qt${QT_VERSION_MAJOR}::Widgets)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
from PyQtAds import QtAds
|
import PyQtAds as QtAds
|
||||||
from PyQt5.QtGui import QCloseEvent
|
from PyQt5.QtGui import QCloseEvent
|
||||||
from PyQt5.QtCore import (qDebug, pyqtSlot, QObject, pyqtSignal)
|
from PyQt5.QtCore import (qDebug, pyqtSlot, QObject, pyqtSignal)
|
||||||
from PyQt5.QtWidgets import (QMainWindow, QAction, QTextEdit, QApplication,
|
from PyQt5.QtWidgets import (QMainWindow, QAction, QTextEdit, QApplication,
|
||||||
@@ -70,4 +70,4 @@ if __name__ == '__main__':
|
|||||||
action.triggered.connect(on_action2_triggered)
|
action.triggered.connect(on_action2_triggered)
|
||||||
|
|
||||||
w.show()
|
w.show()
|
||||||
app.exec_()
|
app.exec_()
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ add_executable(DockInDockExample WIN32
|
|||||||
mainframe.cpp
|
mainframe.cpp
|
||||||
)
|
)
|
||||||
target_include_directories(DockInDockExample PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../src")
|
target_include_directories(DockInDockExample PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../src")
|
||||||
target_link_libraries(DockInDockExample PRIVATE qtadvanceddocking)
|
target_link_libraries(DockInDockExample PRIVATE qt${QT_VERSION_MAJOR}advanceddocking)
|
||||||
target_link_libraries(DockInDockExample PUBLIC Qt${QT_VERSION_MAJOR}::Core
|
target_link_libraries(DockInDockExample PUBLIC Qt${QT_VERSION_MAJOR}::Core
|
||||||
Qt${QT_VERSION_MAJOR}::Gui
|
Qt${QT_VERSION_MAJOR}::Gui
|
||||||
Qt${QT_VERSION_MAJOR}::Widgets)
|
Qt${QT_VERSION_MAJOR}::Widgets)
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import sys
|
|||||||
from PyQt5.QtWidgets import (QApplication, QWidget, QVBoxLayout, QMessageBox,
|
from PyQt5.QtWidgets import (QApplication, QWidget, QVBoxLayout, QMessageBox,
|
||||||
QInputDialog, QMenu, QLineEdit)
|
QInputDialog, QMenu, QLineEdit)
|
||||||
from PyQt5.QtGui import QIcon
|
from PyQt5.QtGui import QIcon
|
||||||
from PyQtAds import QtAds
|
import PyQtAds as QtAds
|
||||||
|
|
||||||
from dockindockmanager import DockInDockManager
|
from dockindockmanager import DockInDockManager
|
||||||
from perspectiveactions import LoadPerspectiveAction, RemovePerspectiveAction
|
from perspectiveactions import LoadPerspectiveAction, RemovePerspectiveAction
|
||||||
@@ -200,4 +200,4 @@ class DockInDockWidget(QWidget):
|
|||||||
|
|
||||||
for closed in self.getManager().dockWidgetsMap().values():
|
for closed in self.getManager().dockWidgetsMap().values():
|
||||||
if not closed in visible_widgets:
|
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.QtWidgets import QAction, QMenu, QInputDialog, QLineEdit
|
||||||
from PyQt5.QtCore import QSettings
|
from PyQt5.QtCore import QSettings
|
||||||
|
|
||||||
from PyQtAds import QtAds
|
import PyQtAds as QtAds
|
||||||
|
|
||||||
CHILD_PREFIX = "Child-"
|
CHILD_PREFIX = "Child-"
|
||||||
|
|
||||||
@@ -211,4 +211,4 @@ class MoveDockWidgetAction(QAction):
|
|||||||
widget.dockManager().removeDockWidget(widget)
|
widget.dockManager().removeDockWidget(widget)
|
||||||
move_to.addDockWidget(QtAds.CenterDockWidgetArea, widget, move_to.getInsertDefaultPos())
|
move_to.addDockWidget(QtAds.CenterDockWidgetArea, widget, move_to.getInsertDefaultPos())
|
||||||
else:
|
else:
|
||||||
assert False
|
assert False
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include "../../examples/simple/MainWindow.h"
|
#include "mainframe.h"
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import atexit
|
|||||||
|
|
||||||
from PyQt5.QtWidgets import QApplication, QMainWindow, QLabel
|
from PyQt5.QtWidgets import QApplication, QMainWindow, QLabel
|
||||||
from PyQt5.QtCore import Qt
|
from PyQt5.QtCore import Qt
|
||||||
from PyQtAds import QtAds
|
import PyQtAds as QtAds
|
||||||
|
|
||||||
from perspectives import PerspectivesManager
|
from perspectives import PerspectivesManager
|
||||||
from dockindock import DockInDockWidget
|
from dockindock import DockInDockWidget
|
||||||
@@ -69,4 +69,4 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
w = MainWindow()
|
w = MainWindow()
|
||||||
w.show()
|
w.show()
|
||||||
app.exec_()
|
app.exec_()
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import shutil
|
|||||||
import atexit
|
import atexit
|
||||||
|
|
||||||
from PyQt5.QtCore import pyqtSignal, QSettings, QObject
|
from PyQt5.QtCore import pyqtSignal, QSettings, QObject
|
||||||
from PyQtAds import QtAds
|
import PyQtAds as QtAds
|
||||||
|
|
||||||
from dockindockmanager import DockInDockManager
|
from dockindockmanager import DockInDockManager
|
||||||
from dockindock import DockInDockWidget
|
from dockindock import DockInDockWidget
|
||||||
@@ -200,4 +200,4 @@ class PerspectivesManager(QObject):
|
|||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
pass
|
pass
|
||||||
if not shutil.copy(settings.fileName(), to_save):
|
if not shutil.copy(settings.fileName(), to_save):
|
||||||
assert False
|
assert False
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ add_executable(EmptyDockAreaExample WIN32
|
|||||||
mainwindow.ui
|
mainwindow.ui
|
||||||
)
|
)
|
||||||
target_include_directories(EmptyDockAreaExample PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../src")
|
target_include_directories(EmptyDockAreaExample PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../src")
|
||||||
target_link_libraries(EmptyDockAreaExample PRIVATE qtadvanceddocking)
|
target_link_libraries(EmptyDockAreaExample PRIVATE qt${QT_VERSION_MAJOR}advanceddocking)
|
||||||
target_link_libraries(EmptyDockAreaExample PUBLIC Qt${QT_VERSION_MAJOR}::Core
|
target_link_libraries(EmptyDockAreaExample PUBLIC Qt${QT_VERSION_MAJOR}::Core
|
||||||
Qt${QT_VERSION_MAJOR}::Gui
|
Qt${QT_VERSION_MAJOR}::Gui
|
||||||
Qt${QT_VERSION_MAJOR}::Widgets)
|
Qt${QT_VERSION_MAJOR}::Widgets)
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ from PyQt5.QtCore import Qt, QSignalBlocker
|
|||||||
from PyQt5.QtWidgets import (QApplication, QMainWindow, QLabel, QComboBox, QTableWidget,
|
from PyQt5.QtWidgets import (QApplication, QMainWindow, QLabel, QComboBox, QTableWidget,
|
||||||
QAction, QWidgetAction, QSizePolicy, QInputDialog)
|
QAction, QWidgetAction, QSizePolicy, QInputDialog)
|
||||||
from PyQt5.QtGui import QCloseEvent
|
from PyQt5.QtGui import QCloseEvent
|
||||||
from PyQtAds import QtAds
|
import PyQtAds as QtAds
|
||||||
|
|
||||||
|
|
||||||
UI_FILE = os.path.join(os.path.dirname(__file__), 'mainwindow.ui')
|
UI_FILE = os.path.join(os.path.dirname(__file__), 'mainwindow.ui')
|
||||||
@@ -105,4 +105,4 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
w = CMainWindow()
|
w = CMainWindow()
|
||||||
w.show()
|
w.show()
|
||||||
app.exec_()
|
app.exec_()
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ add_executable(HideShowExample WIN32
|
|||||||
MainWindow.ui
|
MainWindow.ui
|
||||||
)
|
)
|
||||||
target_include_directories(HideShowExample PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../src")
|
target_include_directories(HideShowExample PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../src")
|
||||||
target_link_libraries(HideShowExample PRIVATE qtadvanceddocking)
|
target_link_libraries(HideShowExample PRIVATE qt${QT_VERSION_MAJOR}advanceddocking)
|
||||||
target_link_libraries(HideShowExample PUBLIC Qt${QT_VERSION_MAJOR}::Core
|
target_link_libraries(HideShowExample PUBLIC Qt${QT_VERSION_MAJOR}::Core
|
||||||
Qt${QT_VERSION_MAJOR}::Gui
|
Qt${QT_VERSION_MAJOR}::Gui
|
||||||
Qt${QT_VERSION_MAJOR}::Widgets)
|
Qt${QT_VERSION_MAJOR}::Widgets)
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ add_executable(SidebarExample WIN32
|
|||||||
MainWindow.ui
|
MainWindow.ui
|
||||||
)
|
)
|
||||||
target_include_directories(SidebarExample PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../src")
|
target_include_directories(SidebarExample PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../src")
|
||||||
target_link_libraries(SidebarExample PRIVATE qtadvanceddocking)
|
target_link_libraries(SidebarExample PRIVATE qt${QT_VERSION_MAJOR}advanceddocking)
|
||||||
target_link_libraries(SidebarExample PUBLIC Qt${QT_VERSION_MAJOR}::Core
|
target_link_libraries(SidebarExample PUBLIC Qt${QT_VERSION_MAJOR}::Core
|
||||||
Qt${QT_VERSION_MAJOR}::Gui
|
Qt${QT_VERSION_MAJOR}::Gui
|
||||||
Qt${QT_VERSION_MAJOR}::Widgets)
|
Qt${QT_VERSION_MAJOR}::Widgets)
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ from PyQt5 import uic
|
|||||||
from PyQt5.QtCore import Qt, QMargins
|
from PyQt5.QtCore import Qt, QMargins
|
||||||
from PyQt5.QtWidgets import QApplication, QLabel, QVBoxLayout, QPlainTextEdit
|
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')
|
UI_FILE = os.path.join(os.path.dirname(__file__), 'MainWindow.ui')
|
||||||
MainWindowUI, MainWindowBase = uic.loadUiType(UI_FILE)
|
MainWindowUI, MainWindowBase = uic.loadUiType(UI_FILE)
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ add_executable(SimpleExample WIN32
|
|||||||
MainWindow.ui
|
MainWindow.ui
|
||||||
)
|
)
|
||||||
target_include_directories(SimpleExample PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../src")
|
target_include_directories(SimpleExample PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../src")
|
||||||
target_link_libraries(SimpleExample PRIVATE qtadvanceddocking)
|
target_link_libraries(SimpleExample PRIVATE qt${QT_VERSION_MAJOR}advanceddocking)
|
||||||
target_link_libraries(SimpleExample PUBLIC Qt${QT_VERSION_MAJOR}::Core
|
target_link_libraries(SimpleExample PUBLIC Qt${QT_VERSION_MAJOR}::Core
|
||||||
Qt${QT_VERSION_MAJOR}::Gui
|
Qt${QT_VERSION_MAJOR}::Gui
|
||||||
Qt${QT_VERSION_MAJOR}::Widgets)
|
Qt${QT_VERSION_MAJOR}::Widgets)
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ from PyQt5.QtCore import Qt, QTimer
|
|||||||
from PyQt5.QtGui import QCloseEvent
|
from PyQt5.QtGui import QCloseEvent
|
||||||
from PyQt5.QtWidgets import QApplication, QLabel
|
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')
|
UI_FILE = os.path.join(os.path.dirname(__file__), 'MainWindow.ui')
|
||||||
MainWindowUI, MainWindowBase = uic.loadUiType(UI_FILE)
|
MainWindowUI, MainWindowBase = uic.loadUiType(UI_FILE)
|
||||||
|
|||||||
28
project.py
@@ -1,4 +1,5 @@
|
|||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
from pyqtbuild import PyQtBindings, PyQtProject
|
from pyqtbuild import PyQtBindings, PyQtProject
|
||||||
from sipbuild import Option
|
from sipbuild import Option
|
||||||
@@ -16,12 +17,37 @@ class ads(PyQtBindings):
|
|||||||
""" Initialise the bindings. """
|
""" Initialise the bindings. """
|
||||||
|
|
||||||
super().__init__(project, 'ads')
|
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):
|
def apply_user_defaults(self, tool):
|
||||||
""" Set default values for user options that haven't been set yet. """
|
""" Set default values for user options that haven't been set yet. """
|
||||||
|
|
||||||
resource_file = os.path.join(self.project.root_dir,'src','ads.qrc')
|
resource_file = os.path.join(self.project.root_dir,'src','ads.qrc')
|
||||||
print("Adding resource file to qmake project: ", resource_file)
|
print("Adding resource file to qmake project: ", resource_file)
|
||||||
self.builder_settings.append('RESOURCES += '+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)
|
super().apply_user_defaults(tool)
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
# Specify the build system.
|
# Specify the build system.
|
||||||
[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"
|
build-backend = "sipbuild.api"
|
||||||
|
|
||||||
# Specify the PEP 566 metadata for the project.
|
# Specify the PEP 566 metadata for the project.
|
||||||
[tool.sip.metadata]
|
[tool.sip.metadata]
|
||||||
name = "PyQtAds"
|
name = "PyQtAds"
|
||||||
version = "3.8.2"
|
version = "4.4.1"
|
||||||
summary = "Python bindings for Qt Advanced Docking System"
|
summary = "Python bindings for Qt Advanced Docking System"
|
||||||
home-page = "https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/"
|
home-page = "https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/"
|
||||||
license = "LGPL v2.1"
|
license = "LGPL v2.1"
|
||||||
@@ -16,13 +16,18 @@ description-content-type = "text/markdown"
|
|||||||
|
|
||||||
[tool.sip.project]
|
[tool.sip.project]
|
||||||
tag-prefix = "QtAds"
|
tag-prefix = "QtAds"
|
||||||
|
dunder-init = true
|
||||||
|
|
||||||
[tool.sip.bindings.ads]
|
[tool.sip.bindings.ads]
|
||||||
|
pep484-pyi = true
|
||||||
define-macros = ["ADS_SHARED_EXPORT"]
|
define-macros = ["ADS_SHARED_EXPORT"]
|
||||||
sip-file = "ads.sip"
|
sip-file = "ads.sip"
|
||||||
include-dirs = ["src"]
|
include-dirs = ["src"]
|
||||||
qmake-QT = ["widgets"]
|
qmake-QT = ["widgets", "gui-private; platform_system == 'Linux'"]
|
||||||
headers = [
|
headers = [
|
||||||
|
"src/AutoHideDockContainer.h",
|
||||||
|
"src/AutoHideSideBar.h",
|
||||||
|
"src/AutoHideTab.h",
|
||||||
"src/DockAreaTabBar.h",
|
"src/DockAreaTabBar.h",
|
||||||
"src/DockAreaTitleBar.h",
|
"src/DockAreaTitleBar.h",
|
||||||
"src/DockAreaTitleBar_p.h",
|
"src/DockAreaTitleBar_p.h",
|
||||||
@@ -40,10 +45,15 @@ headers = [
|
|||||||
"src/FloatingDockContainer.h",
|
"src/FloatingDockContainer.h",
|
||||||
"src/FloatingDragPreview.h",
|
"src/FloatingDragPreview.h",
|
||||||
"src/IconProvider.h",
|
"src/IconProvider.h",
|
||||||
|
"src/PushButton.h",
|
||||||
|
"src/ResizeHandle.h",
|
||||||
"src/ads_globals.h",
|
"src/ads_globals.h",
|
||||||
# "src/linux/FloatingWidgetTitleBar.h",
|
"src/linux/FloatingWidgetTitleBar.h; platform_system == 'Linux'",
|
||||||
]
|
]
|
||||||
sources = [
|
sources = [
|
||||||
|
"src/AutoHideTab.cpp",
|
||||||
|
"src/AutoHideDockContainer.cpp",
|
||||||
|
"src/AutoHideSideBar.cpp",
|
||||||
"src/DockAreaTabBar.cpp",
|
"src/DockAreaTabBar.cpp",
|
||||||
"src/DockAreaTitleBar.cpp",
|
"src/DockAreaTitleBar.cpp",
|
||||||
"src/DockAreaWidget.cpp",
|
"src/DockAreaWidget.cpp",
|
||||||
@@ -60,6 +70,8 @@ sources = [
|
|||||||
"src/FloatingDockContainer.cpp",
|
"src/FloatingDockContainer.cpp",
|
||||||
"src/FloatingDragPreview.cpp",
|
"src/FloatingDragPreview.cpp",
|
||||||
"src/IconProvider.cpp",
|
"src/IconProvider.cpp",
|
||||||
|
"src/PushButton.cpp",
|
||||||
|
"src/ResizeHandle.cpp",
|
||||||
"src/ads_globals.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;
|
int currentIndex() const;
|
||||||
ads::CDockWidgetTab* currentTab() const;
|
ads::CDockWidgetTab* currentTab() const;
|
||||||
ads::CDockWidgetTab* tab(int Index) 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);
|
virtual bool eventFilter(QObject *watched, QEvent *event);
|
||||||
bool isTabOpen(int Index) const;
|
bool isTabOpen(int Index) const;
|
||||||
virtual QSize minimumSizeHint() const;
|
virtual QSize minimumSizeHint() const;
|
||||||
|
|||||||
@@ -5,6 +5,22 @@
|
|||||||
namespace ads
|
namespace ads
|
||||||
{
|
{
|
||||||
|
|
||||||
|
class CTitleBarButton : QToolButton
|
||||||
|
{
|
||||||
|
%TypeHeaderCode
|
||||||
|
#include <DockAreaTitleBar.h>
|
||||||
|
%End
|
||||||
|
|
||||||
|
public:
|
||||||
|
CTitleBarButton(bool visible = true, QWidget* parent /TransferThis/ = Q_NULLPTR );
|
||||||
|
virtual void setVisible(bool);
|
||||||
|
void setShowInTitleBar(bool);
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool event(QEvent *ev);
|
||||||
|
};
|
||||||
|
|
||||||
class CDockAreaTitleBar : QFrame
|
class CDockAreaTitleBar : QFrame
|
||||||
{
|
{
|
||||||
%TypeHeaderCode
|
%TypeHeaderCode
|
||||||
@@ -26,12 +42,15 @@ public:
|
|||||||
CDockAreaTitleBar(ads::CDockAreaWidget* parent /TransferThis/);
|
CDockAreaTitleBar(ads::CDockAreaWidget* parent /TransferThis/);
|
||||||
virtual ~CDockAreaTitleBar();
|
virtual ~CDockAreaTitleBar();
|
||||||
ads::CDockAreaTabBar* tabBar() const;
|
ads::CDockAreaTabBar* tabBar() const;
|
||||||
QAbstractButton* button(ads::TitleBarButton which) const;
|
ads::CTitleBarButton* button(ads::TitleBarButton which) const;
|
||||||
|
ads::CElidingLabel* autoHideTitleLabel() const;
|
||||||
void updateDockWidgetActionsButtons();
|
void updateDockWidgetActionsButtons();
|
||||||
virtual void setVisible(bool Visible);
|
virtual void setVisible(bool Visible);
|
||||||
void insertWidget(int index, QWidget *widget /Transfer/ );
|
void insertWidget(int index, QWidget *widget /Transfer/ );
|
||||||
int indexOf(QWidget *widget) const;
|
int indexOf(QWidget *widget) const;
|
||||||
|
QString titleBarButtonToolTip(ads::TitleBarButton Button) const;
|
||||||
|
void setAreaFloating();
|
||||||
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void tabBarClicked(int index);
|
void tabBarClicked(int index);
|
||||||
|
|||||||
@@ -5,21 +5,6 @@
|
|||||||
namespace ads
|
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
|
class CSpacerWidget : QWidget
|
||||||
{
|
{
|
||||||
%TypeHeaderCode
|
%TypeHeaderCode
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ protected:
|
|||||||
void updateTitleBarVisibility();
|
void updateTitleBarVisibility();
|
||||||
void internalSetCurrentDockWidget(ads::CDockWidget* DockWidget /Transfer/);
|
void internalSetCurrentDockWidget(ads::CDockWidget* DockWidget /Transfer/);
|
||||||
void markTitleBarMenuOutdated();
|
void markTitleBarMenuOutdated();
|
||||||
|
void updateTitleBarButtonVisibility(bool IsTopLevel) const;
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
void toggleView(bool Open);
|
void toggleView(bool Open);
|
||||||
@@ -39,6 +40,9 @@ public:
|
|||||||
virtual ~CDockAreaWidget();
|
virtual ~CDockAreaWidget();
|
||||||
ads::CDockManager* dockManager() const;
|
ads::CDockManager* dockManager() const;
|
||||||
ads::CDockContainerWidget* dockContainer() const;
|
ads::CDockContainerWidget* dockContainer() const;
|
||||||
|
ads::CAutoHideDockContainer* autoHideDockContainer() const;
|
||||||
|
bool isAutoHide() const;
|
||||||
|
void setAutoHideDockContainer(CAutoHideDockContainer*);
|
||||||
virtual QSize minimumSizeHint() const;
|
virtual QSize minimumSizeHint() const;
|
||||||
QRect titleBarGeometry() const;
|
QRect titleBarGeometry() const;
|
||||||
QRect contentAreaGeometry() const;
|
QRect contentAreaGeometry() const;
|
||||||
@@ -52,6 +56,8 @@ public:
|
|||||||
ads::CDockWidget* currentDockWidget() const;
|
ads::CDockWidget* currentDockWidget() const;
|
||||||
void setCurrentDockWidget(ads::CDockWidget* DockWidget);
|
void setCurrentDockWidget(ads::CDockWidget* DockWidget);
|
||||||
void saveState(QXmlStreamWriter& Stream) const;
|
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;
|
ads::CDockWidget::DockWidgetFeatures features(ads::eBitwiseOperator Mode = ads::BitwiseAnd) const;
|
||||||
QAbstractButton* titleBarButton(ads::TitleBarButton which) const;
|
QAbstractButton* titleBarButton(ads::TitleBarButton which) const;
|
||||||
virtual void setVisible(bool Visible);
|
virtual void setVisible(bool Visible);
|
||||||
@@ -65,11 +71,16 @@ public:
|
|||||||
void setDockAreaFlag(eDockAreaFlag Flag, bool On);
|
void setDockAreaFlag(eDockAreaFlag Flag, bool On);
|
||||||
|
|
||||||
bool isCentralWidgetArea() const;
|
bool isCentralWidgetArea() const;
|
||||||
|
bool containsCentralWidget() const;
|
||||||
|
bool isTopLevelArea() const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setCurrentIndex(int index);
|
void setCurrentIndex(int index);
|
||||||
void closeArea();
|
void closeArea();
|
||||||
|
void setAutoHide(bool Enable, SideBarLocation Location = ads::SideBarNone, int TabIndex = -1);
|
||||||
|
void toggleAutoHide(SideBarLocation Location = ads::SideBarNone);
|
||||||
void closeOtherAreas();
|
void closeOtherAreas();
|
||||||
|
void setFloating();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void tabBarClicked(int index);
|
void tabBarClicked(int index);
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ class CDockComponentsFactory
|
|||||||
public:
|
public:
|
||||||
virtual ~CDockComponentsFactory();
|
virtual ~CDockComponentsFactory();
|
||||||
virtual CDockWidgetTab* createDockWidgetTab(CDockWidget* DockWidget /Transfer/ ) const;
|
virtual CDockWidgetTab* createDockWidgetTab(CDockWidget* DockWidget /Transfer/ ) const;
|
||||||
|
virtual CAutoHideTab* createDockWidgetSideTab(CDockWidget* DockWidget /Transfer/) const;
|
||||||
virtual CDockAreaTabBar* createDockAreaTabBar(CDockAreaWidget* DockArea /Transfer/ ) const;
|
virtual CDockAreaTabBar* createDockAreaTabBar(CDockAreaWidget* DockArea /Transfer/ ) const;
|
||||||
virtual CDockAreaTitleBar* createDockAreaTitleBar(CDockAreaWidget* DockArea /Transfer/ ) const;
|
virtual CDockAreaTitleBar* createDockAreaTitleBar(CDockAreaWidget* DockArea /Transfer/ ) const;
|
||||||
static const CDockComponentsFactory* factory();
|
static const CDockComponentsFactory* factory();
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ namespace ads
|
|||||||
* Container that manages a number of dock areas with single dock widgets
|
* Container that manages a number of dock areas with single dock widgets
|
||||||
* or tabyfied dock widgets in each area.
|
* or tabyfied dock widgets in each area.
|
||||||
* Each window that support docking has a DockContainerWidget. That means
|
* Each window that support docking has a DockContainerWidget. That means
|
||||||
* the main application window and all floating windows are ore contain
|
* the main application window and all floating windows contain a
|
||||||
* an DockContainerWidget.
|
* DockContainerWidget.
|
||||||
*/
|
*/
|
||||||
class CDockContainerWidget : QFrame
|
class CDockContainerWidget : QFrame
|
||||||
{
|
{
|
||||||
@@ -21,9 +21,10 @@ class CDockContainerWidget : QFrame
|
|||||||
protected:
|
protected:
|
||||||
virtual bool event(QEvent *e);
|
virtual bool event(QEvent *e);
|
||||||
QSplitter* rootSplitter() const;
|
QSplitter* rootSplitter() const;
|
||||||
|
ads::CAutoHideDockContainer* createAndSetupAutoHideContainer(ads::SideBarLocation area, ads::CDockWidget* DockWidget /Transfer/, int TabIndex = -1);
|
||||||
void createRootSplitter();
|
void createRootSplitter();
|
||||||
void dropFloatingWidget(ads::CFloatingDockContainer* FloatingWidget, const QPoint& TargetPos);
|
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 addDockArea(ads::CDockAreaWidget* DockAreaWidget /Transfer/, ads::DockWidgetArea area = ads::CenterDockWidgetArea);
|
||||||
void removeDockArea(ads::CDockAreaWidget* area /TransferBack/);
|
void removeDockArea(ads::CDockAreaWidget* area /TransferBack/);
|
||||||
void saveState(QXmlStreamWriter& Stream) const;
|
void saveState(QXmlStreamWriter& Stream) const;
|
||||||
@@ -33,124 +34,44 @@ protected:
|
|||||||
ads::CDockAreaWidget* topLevelDockArea() const;
|
ads::CDockAreaWidget* topLevelDockArea() const;
|
||||||
QList<ads::CDockWidget*> dockWidgets() const;
|
QList<ads::CDockWidget*> dockWidgets() const;
|
||||||
void updateSplitterHandles(QSplitter* splitter);
|
void updateSplitterHandles(QSplitter* splitter);
|
||||||
|
void registerAutoHideWidget(ads::CAutoHideDockContainer* AutoHideWidget /Transfer/);
|
||||||
|
void removeAutoHideWidget(ads::CAutoHideDockContainer* AutoHideWidget /TransferBack/);
|
||||||
|
void handleAutoHideWidgetEvent(QEvent* e, QWidget* w);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
|
||||||
* Default Constructor
|
|
||||||
*/
|
|
||||||
CDockContainerWidget(ads::CDockManager* DockManager /TransferThis/, QWidget* parent /TransferThis/ = 0);
|
CDockContainerWidget(ads::CDockManager* DockManager /TransferThis/, QWidget* parent /TransferThis/ = 0);
|
||||||
|
|
||||||
/**
|
|
||||||
* Virtual Destructor
|
|
||||||
*/
|
|
||||||
virtual ~CDockContainerWidget();
|
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* addDockWidget(ads::DockWidgetArea area, ads::CDockWidget* Dockwidget /Transfer/,
|
||||||
ads::CDockAreaWidget* DockAreaWidget /Transfer/ = 0);
|
ads::CDockAreaWidget* DockAreaWidget /Transfer/ = 0,
|
||||||
|
int Index = -1);
|
||||||
/**
|
|
||||||
* Removes dockwidget
|
|
||||||
*/
|
|
||||||
void removeDockWidget(ads::CDockWidget* Dockwidget) /TransferBack/;
|
void removeDockWidget(ads::CDockWidget* Dockwidget) /TransferBack/;
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the current zOrderIndex
|
|
||||||
*/
|
|
||||||
virtual unsigned int zOrderIndex() const;
|
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;
|
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;
|
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;
|
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::CDockAreaWidget*> openedDockAreas() const;
|
||||||
|
QList<ads::CDockWidget*> openedDockWidgets() const;
|
||||||
bool hasTopLevelDockWidget() const;
|
bool hasTopLevelDockWidget() const;
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the number of dock areas in this container
|
|
||||||
*/
|
|
||||||
int dockAreaCount() const;
|
int dockAreaCount() const;
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the number of visible dock areas
|
|
||||||
*/
|
|
||||||
int visibleDockAreaCount() const;
|
int visibleDockAreaCount() const;
|
||||||
|
|
||||||
/**
|
|
||||||
* This function returns true, if this container is in a floating widget
|
|
||||||
*/
|
|
||||||
bool isFloating() const;
|
bool isFloating() const;
|
||||||
|
|
||||||
/**
|
|
||||||
* Dumps the layout for debugging purposes
|
|
||||||
*/
|
|
||||||
void dumpLayout();
|
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;
|
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;
|
ads::CFloatingDockContainer* floatingWidget() const;
|
||||||
|
|
||||||
/**
|
|
||||||
* Call this function to close all dock areas except the KeepOpenArea
|
|
||||||
*/
|
|
||||||
void closeOtherAreas(ads::CDockAreaWidget* 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:
|
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();
|
void dockAreasAdded();
|
||||||
|
void autoHideWidgetCreated(ads::CAutoHideDockContainer* AutoHideWidget);
|
||||||
/**
|
|
||||||
* This signal is emitted if one or multiple dock areas has been removed
|
|
||||||
*/
|
|
||||||
void dockAreasRemoved();
|
void dockAreasRemoved();
|
||||||
|
|
||||||
/**
|
|
||||||
* This signal is emitted if a dock area is opened or closed via
|
|
||||||
* toggleView() function
|
|
||||||
*/
|
|
||||||
void dockAreaViewToggled(ads::CDockAreaWidget* DockArea, bool Open);
|
void dockAreaViewToggled(ads::CDockAreaWidget* DockArea, bool Open);
|
||||||
}; // class DockContainerWidget
|
|
||||||
};
|
};
|
||||||
// namespace ads
|
|
||||||
|
};
|
||||||
|
|
||||||
%End
|
%End
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ public:
|
|||||||
void notifyFloatingWidgetDrop(ads::CFloatingDockContainer* FloatingWidget);
|
void notifyFloatingWidgetDrop(ads::CFloatingDockContainer* FloatingWidget);
|
||||||
ads::CDockWidget* focusedDockWidget() const;
|
ads::CDockWidget* focusedDockWidget() const;
|
||||||
void setDockWidgetTabFocused(ads::CDockWidgetTab* Tab);
|
void setDockWidgetTabFocused(ads::CDockWidgetTab* Tab);
|
||||||
|
void clearDockWidgetFocus(ads::CDockWidget* dockWidget);
|
||||||
|
void setDockWidgetTabPressed(bool Value);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setDockWidgetFocused(ads::CDockWidget* focusedNow);
|
void setDockWidgetFocused(ads::CDockWidget* focusedNow);
|
||||||
|
|||||||
@@ -156,7 +156,6 @@ public:
|
|||||||
TabCloseButtonIsToolButton,
|
TabCloseButtonIsToolButton,
|
||||||
AllTabsHaveCloseButton,
|
AllTabsHaveCloseButton,
|
||||||
RetainTabSizeWhenCloseButtonHidden,
|
RetainTabSizeWhenCloseButtonHidden,
|
||||||
OpaqueUndocking,
|
|
||||||
DragPreviewIsDynamic,
|
DragPreviewIsDynamic,
|
||||||
DragPreviewShowsContentPixmap,
|
DragPreviewShowsContentPixmap,
|
||||||
DragPreviewHasWindowFrame,
|
DragPreviewHasWindowFrame,
|
||||||
@@ -180,6 +179,18 @@ public:
|
|||||||
NonOpaqueWithWindowFrame,
|
NonOpaqueWithWindowFrame,
|
||||||
};
|
};
|
||||||
typedef QFlags<ads::CDockManager::eConfigFlag> ConfigFlags;
|
typedef QFlags<ads::CDockManager::eConfigFlag> ConfigFlags;
|
||||||
|
enum eAutoHideFlag
|
||||||
|
{
|
||||||
|
AutoHideFeatureEnabled,
|
||||||
|
DockAreaHasAutoHideButton,
|
||||||
|
AutoHideButtonTogglesArea,
|
||||||
|
AutoHideButtonCheckable,
|
||||||
|
AutoHideSideBarsIconOnly,
|
||||||
|
AutoHideShowOnMouseOver,
|
||||||
|
AutoHideCloseButtonCollapsesDock,
|
||||||
|
DefaultAutoHideConfig,
|
||||||
|
};
|
||||||
|
typedef QFlags<ads::CDockManager::eAutoHideFlag> AutoHideFlags;
|
||||||
|
|
||||||
CDockManager(QWidget* parent /TransferThis/ = 0);
|
CDockManager(QWidget* parent /TransferThis/ = 0);
|
||||||
virtual ~CDockManager();
|
virtual ~CDockManager();
|
||||||
@@ -187,13 +198,24 @@ public:
|
|||||||
static void setConfigFlags(const ads::CDockManager::ConfigFlags Flags);
|
static void setConfigFlags(const ads::CDockManager::ConfigFlags Flags);
|
||||||
static void setConfigFlag(ads::CDockManager::eConfigFlag Flag, bool On = true);
|
static void setConfigFlag(ads::CDockManager::eConfigFlag Flag, bool On = true);
|
||||||
static bool testConfigFlag(eConfigFlag Flag);
|
static 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();
|
static ads::CIconProvider& iconProvider();
|
||||||
ads::CDockAreaWidget* addDockWidget(ads::DockWidgetArea area, ads::CDockWidget* Dockwidget /Transfer/,
|
ads::CDockAreaWidget* addDockWidget(ads::DockWidgetArea area, ads::CDockWidget* Dockwidget /Transfer/,
|
||||||
ads::CDockAreaWidget* DockAreaWidget /Transfer/ = 0);
|
ads::CDockAreaWidget* DockAreaWidget /Transfer/ = 0,
|
||||||
|
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::CDockAreaWidget* addDockWidgetTab(ads::DockWidgetArea area,
|
||||||
ads::CDockWidget* Dockwidget /Transfer/);
|
ads::CDockWidget* Dockwidget /Transfer/);
|
||||||
ads::CDockAreaWidget* addDockWidgetTabToArea(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::CFloatingDockContainer* addDockWidgetFloating(ads::CDockWidget* DockWidget /Transfer/);
|
||||||
ads::CDockWidget* findDockWidget(const QString& ObjectName) const;
|
ads::CDockWidget* findDockWidget(const QString& ObjectName) const;
|
||||||
void removeDockWidget(ads::CDockWidget* Dockwidget) /TransferBack/;
|
void removeDockWidget(ads::CDockWidget* Dockwidget) /TransferBack/;
|
||||||
@@ -216,12 +238,16 @@ public:
|
|||||||
QMenu* viewMenu() const;
|
QMenu* viewMenu() const;
|
||||||
void setViewMenuInsertionOrder(ads::CDockManager::eViewMenuInsertionOrder Order);
|
void setViewMenuInsertionOrder(ads::CDockManager::eViewMenuInsertionOrder Order);
|
||||||
bool isRestoringState() const;
|
bool isRestoringState() const;
|
||||||
|
bool isLeavingMinimizedState() const;
|
||||||
static int startDragDistance();
|
static int startDragDistance();
|
||||||
ads::CDockWidget* focusedDockWidget() const;
|
ads::CDockWidget* focusedDockWidget() const;
|
||||||
QList<int> splitterSizes(ads::CDockAreaWidget *ContainedArea) const;
|
QList<int> splitterSizes(ads::CDockAreaWidget *ContainedArea) const;
|
||||||
void setSplitterSizes(ads::CDockAreaWidget *ContainedArea, const QList<int>& sizes);
|
void setSplitterSizes(ads::CDockAreaWidget *ContainedArea, const QList<int>& sizes);
|
||||||
|
static void setFloatingContainersTitle(const QString& Title);
|
||||||
|
static QString floatingContainersTitle();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
void endLeavingMinimizedState();
|
||||||
void openPerspective(const QString& PerspectiveName);
|
void openPerspective(const QString& PerspectiveName);
|
||||||
void setDockWidgetFocused(ads::CDockWidget* DockWidget);
|
void setDockWidgetFocused(ads::CDockWidget* DockWidget);
|
||||||
|
|
||||||
|
|||||||
@@ -22,8 +22,10 @@ public:
|
|||||||
CDockOverlay(QWidget* parent /TransferThis/, eMode Mode = ads::CDockOverlay::ModeDockAreaOverlay);
|
CDockOverlay(QWidget* parent /TransferThis/, eMode Mode = ads::CDockOverlay::ModeDockAreaOverlay);
|
||||||
virtual ~CDockOverlay();
|
virtual ~CDockOverlay();
|
||||||
void setAllowedAreas(ads::DockWidgetAreas areas);
|
void setAllowedAreas(ads::DockWidgetAreas areas);
|
||||||
|
void setAllowedArea(ads::DockWidgetArea area, bool Enable);
|
||||||
ads::DockWidgetAreas allowedAreas() const;
|
ads::DockWidgetAreas allowedAreas() const;
|
||||||
ads::DockWidgetArea dropAreaUnderCursor() const;
|
ads::DockWidgetArea dropAreaUnderCursor() const;
|
||||||
|
int tabIndexUnderCursor() const;
|
||||||
ads::DockWidgetArea visibleDropAreaUnderCursor() const;
|
ads::DockWidgetArea visibleDropAreaUnderCursor() const;
|
||||||
ads::DockWidgetArea showOverlay(QWidget* target);
|
ads::DockWidgetArea showOverlay(QWidget* target);
|
||||||
void hideOverlay();
|
void hideOverlay();
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ public:
|
|||||||
DockWidgetForceCloseWithArea,
|
DockWidgetForceCloseWithArea,
|
||||||
NoTab,
|
NoTab,
|
||||||
DeleteContentOnClose,
|
DeleteContentOnClose,
|
||||||
|
DockWidgetPinnable,
|
||||||
DefaultDockWidgetFeatures,
|
DefaultDockWidgetFeatures,
|
||||||
AllDockWidgetFeatures,
|
AllDockWidgetFeatures,
|
||||||
DockWidgetAlwaysCloseAndDelete,
|
DockWidgetAlwaysCloseAndDelete,
|
||||||
@@ -59,7 +60,9 @@ public:
|
|||||||
enum eMinimumSizeHintMode
|
enum eMinimumSizeHintMode
|
||||||
{
|
{
|
||||||
MinimumSizeHintFromDockWidget,
|
MinimumSizeHintFromDockWidget,
|
||||||
MinimumSizeHintFromContent
|
MinimumSizeHintFromContent,
|
||||||
|
MinimumSizeHintFromDockWidgetMinimumSize,
|
||||||
|
MinimumSizeHintFromContentMinimumSize,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum eToggleViewActionMode
|
enum eToggleViewActionMode
|
||||||
@@ -81,13 +84,20 @@ public:
|
|||||||
ads::CDockWidget::DockWidgetFeatures features() const;
|
ads::CDockWidget::DockWidgetFeatures features() const;
|
||||||
ads::CDockManager* dockManager() const;
|
ads::CDockManager* dockManager() const;
|
||||||
ads::CDockContainerWidget* dockContainer() const;
|
ads::CDockContainerWidget* dockContainer() const;
|
||||||
|
ads::CFloatingDockContainer* floatingDockContainer() const;
|
||||||
ads::CDockAreaWidget* dockAreaWidget() 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 isFloating() const;
|
||||||
bool isInFloatingContainer() const;
|
bool isInFloatingContainer() const;
|
||||||
bool isClosed() const;
|
bool isClosed() const;
|
||||||
QAction* toggleViewAction() const;
|
QAction* toggleViewAction() const;
|
||||||
void setToggleViewActionMode(ads::CDockWidget::eToggleViewActionMode Mode);
|
void setToggleViewActionMode(ads::CDockWidget::eToggleViewActionMode Mode);
|
||||||
void setMinimumSizeHintMode(ads::CDockWidget::eMinimumSizeHintMode Mode);
|
void setMinimumSizeHintMode(ads::CDockWidget::eMinimumSizeHintMode Mode);
|
||||||
|
ads::CDockWidget::eMinimumSizeHintMode minimumSizeHintMode() const;
|
||||||
bool isCentralWidget() const;
|
bool isCentralWidget() const;
|
||||||
void setIcon(const QIcon& Icon);
|
void setIcon(const QIcon& Icon);
|
||||||
QIcon icon() const;
|
QIcon icon() const;
|
||||||
@@ -116,8 +126,11 @@ public slots:
|
|||||||
void setFloating();
|
void setFloating();
|
||||||
void deleteDockWidget();
|
void deleteDockWidget();
|
||||||
void closeDockWidget();
|
void closeDockWidget();
|
||||||
|
void requestCloseDockWidget();
|
||||||
void showFullScreen();
|
void showFullScreen();
|
||||||
void showNormal();
|
void showNormal();
|
||||||
|
void setAutoHide(bool Enable, ads::SideBarLocation Location = ads::SideBarNone, int TabIndex = -1);
|
||||||
|
void toggleAutoHide(ads::SideBarLocation Location = ads::SideBarNone);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void viewToggled(bool Open);
|
void viewToggled(bool Open);
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ protected:
|
|||||||
%If (WS_X11)
|
%If (WS_X11)
|
||||||
virtual void moveEvent(QMoveEvent *event);
|
virtual void moveEvent(QMoveEvent *event);
|
||||||
virtual void resizeEvent(QResizeEvent *event);
|
virtual void resizeEvent(QResizeEvent *event);
|
||||||
|
virtual bool event(QEvent *e);
|
||||||
%End
|
%End
|
||||||
|
|
||||||
%If (WS_WIN)
|
%If (WS_WIN)
|
||||||
|
|||||||
@@ -27,10 +27,9 @@ public:
|
|||||||
public: // implements IFloatingWidget
|
public: // implements IFloatingWidget
|
||||||
virtual void startFloating(const QPoint& DragStartMousePos, const QSize& Size,
|
virtual void startFloating(const QPoint& DragStartMousePos, const QSize& Size,
|
||||||
ads::eDragState DragState, QWidget* MouseEventHandler);
|
ads::eDragState DragState, QWidget* MouseEventHandler);
|
||||||
|
|
||||||
virtual void moveFloating();
|
virtual void moveFloating();
|
||||||
|
|
||||||
virtual void finishDragging();
|
virtual void finishDragging();
|
||||||
|
void cleanupAutoHideContainerWidget(ads::DockWidgetArea ContainerDropArea);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void draggingCanceled();
|
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)
|
%Module(name=PyQtAds, call_super_init=True, keyword_arguments="Optional", use_limited_api=True)
|
||||||
|
%HideNamespace(name=ads)
|
||||||
|
|
||||||
%Import QtCore/QtCoremod.sip
|
%Import QtCore/QtCoremod.sip
|
||||||
%DefaultSupertype sip.simplewrapper
|
%DefaultSupertype sip.simplewrapper
|
||||||
|
|
||||||
%Include ads_globals.sip
|
%Include ads_globals.sip
|
||||||
|
%Include AutoHideDockContainer.sip
|
||||||
|
%Include AutoHideSideBar.sip
|
||||||
|
%Include AutoHideTab.sip
|
||||||
%Include DockWidget.sip
|
%Include DockWidget.sip
|
||||||
%Include DockAreaTabBar.sip
|
%Include DockAreaTabBar.sip
|
||||||
%Include DockAreaTitleBar_p.sip
|
%Include DockAreaTitleBar_p.sip
|
||||||
@@ -20,6 +25,8 @@
|
|||||||
%Include FloatingDockContainer.sip
|
%Include FloatingDockContainer.sip
|
||||||
%Include FloatingDragPreview.sip
|
%Include FloatingDragPreview.sip
|
||||||
%Include IconProvider.sip
|
%Include IconProvider.sip
|
||||||
|
%Include PushButton.sip
|
||||||
|
%Include ResizeHandle.sip
|
||||||
%If (WS_X11)
|
%If (WS_X11)
|
||||||
%Include linux/FloatingWidgetTitleBar.sip
|
%Include linux/FloatingWidgetTitleBar.sip
|
||||||
%End
|
%End
|
||||||
|
|||||||
@@ -50,19 +50,30 @@ namespace ads
|
|||||||
TopDockWidgetArea,
|
TopDockWidgetArea,
|
||||||
BottomDockWidgetArea,
|
BottomDockWidgetArea,
|
||||||
CenterDockWidgetArea,
|
CenterDockWidgetArea,
|
||||||
|
LeftAutoHideArea,
|
||||||
|
RightAutoHideArea,
|
||||||
|
TopAutoHideArea,
|
||||||
|
BottomAutoHideArea,
|
||||||
InvalidDockWidgetArea,
|
InvalidDockWidgetArea,
|
||||||
OuterDockAreas,
|
OuterDockAreas,
|
||||||
|
AutoHideDockAreas,
|
||||||
AllDockAreas
|
AllDockAreas
|
||||||
};
|
};
|
||||||
typedef QFlags<ads::DockWidgetArea> DockWidgetAreas;
|
typedef QFlags<ads::DockWidgetArea> DockWidgetAreas;
|
||||||
|
|
||||||
|
|
||||||
|
enum eTabIndex
|
||||||
|
{
|
||||||
|
TabDefaultInsertIndex,
|
||||||
|
TabInvalidIndex
|
||||||
|
};
|
||||||
|
|
||||||
enum TitleBarButton
|
enum TitleBarButton
|
||||||
{
|
{
|
||||||
TitleBarButtonTabsMenu,
|
TitleBarButtonTabsMenu,
|
||||||
TitleBarButtonUndock,
|
TitleBarButtonUndock,
|
||||||
TitleBarButtonClose
|
TitleBarButtonClose,
|
||||||
|
TitleBarButtonAutoHide
|
||||||
};
|
};
|
||||||
|
|
||||||
enum eDragState
|
enum eDragState
|
||||||
@@ -76,10 +87,10 @@ namespace ads
|
|||||||
enum eIcon
|
enum eIcon
|
||||||
{
|
{
|
||||||
TabCloseIcon,
|
TabCloseIcon,
|
||||||
|
AutoHideIcon,
|
||||||
DockAreaMenuIcon,
|
DockAreaMenuIcon,
|
||||||
DockAreaUndockIcon,
|
DockAreaUndockIcon,
|
||||||
DockAreaCloseIcon,
|
DockAreaCloseIcon,
|
||||||
|
|
||||||
IconCount,
|
IconCount,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -89,6 +100,15 @@ namespace ads
|
|||||||
BitwiseOr
|
BitwiseOr
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum SideBarLocation
|
||||||
|
{
|
||||||
|
SideBarTop,
|
||||||
|
SideBarLeft,
|
||||||
|
SideBarRight,
|
||||||
|
SideBarBottom,
|
||||||
|
SideBarNone
|
||||||
|
};
|
||||||
|
|
||||||
namespace internal
|
namespace internal
|
||||||
{
|
{
|
||||||
void replaceSplitterWidget(QSplitter* Splitter, QWidget* From, QWidget* To);
|
void replaceSplitterWidget(QSplitter* Splitter, QWidget* From, QWidget* To);
|
||||||
@@ -106,6 +126,9 @@ namespace ads
|
|||||||
int insertOffset() const;
|
int insertOffset() const;
|
||||||
};
|
};
|
||||||
ads::internal::CDockInsertParam dockAreaInsertParameters(ads::DockWidgetArea Area);
|
ads::internal::CDockInsertParam dockAreaInsertParameters(ads::DockWidgetArea Area);
|
||||||
|
ads::SideBarLocation toSideBarLocation(ads::DockWidgetArea Area);
|
||||||
|
bool isHorizontalSideBarLocation(ads::SideBarLocation Location);
|
||||||
|
bool isSideBarArea(ads::DockWidgetArea Area);
|
||||||
|
|
||||||
SIP_PYOBJECT findParent(SIP_PYTYPE type, const QWidget *w) const /TypeHint="QObject"/;
|
SIP_PYOBJECT findParent(SIP_PYTYPE type, const QWidget *w) const /TypeHint="QObject"/;
|
||||||
%MethodCode
|
%MethodCode
|
||||||
@@ -131,6 +154,7 @@ namespace ads
|
|||||||
};
|
};
|
||||||
|
|
||||||
void repolishStyle(QWidget* w, ads::internal::eRepolishChildOptions Options = ads::internal::RepolishIgnoreChildren);
|
void repolishStyle(QWidget* w, ads::internal::eRepolishChildOptions Options = ads::internal::RepolishIgnoreChildren);
|
||||||
|
QRect globalGeometry(QWidget* w);
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -117,6 +117,7 @@ struct AutoHideDockContainerPrivate
|
|||||||
CResizeHandle* ResizeHandle = nullptr;
|
CResizeHandle* ResizeHandle = nullptr;
|
||||||
QSize Size; // creates invalid size
|
QSize Size; // creates invalid size
|
||||||
QPointer<CAutoHideTab> SideTab;
|
QPointer<CAutoHideTab> SideTab;
|
||||||
|
QSize SizeCache;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Private data constructor
|
* Private data constructor
|
||||||
@@ -215,6 +216,7 @@ CAutoHideDockContainer::CAutoHideDockContainer(CDockWidget* DockWidget, SideBarL
|
|||||||
bool OpaqueResize = CDockManager::testConfigFlag(CDockManager::OpaqueSplitterResize);
|
bool OpaqueResize = CDockManager::testConfigFlag(CDockManager::OpaqueSplitterResize);
|
||||||
d->ResizeHandle->setOpaqueResize(OpaqueResize);
|
d->ResizeHandle->setOpaqueResize(OpaqueResize);
|
||||||
d->Size = d->DockArea->size();
|
d->Size = d->DockArea->size();
|
||||||
|
d->SizeCache = DockWidget->size();
|
||||||
|
|
||||||
addDockWidget(DockWidget);
|
addDockWidget(DockWidget);
|
||||||
parent->registerAutoHideWidget(this);
|
parent->registerAutoHideWidget(this);
|
||||||
@@ -237,7 +239,6 @@ void CAutoHideDockContainer::updateSize()
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto rect = dockContainerParent->contentRect();
|
auto rect = dockContainerParent->contentRect();
|
||||||
|
|
||||||
switch (sideBarLocation())
|
switch (sideBarLocation())
|
||||||
{
|
{
|
||||||
case SideBarLocation::SideBarTop:
|
case SideBarLocation::SideBarTop:
|
||||||
@@ -271,6 +272,15 @@ void CAutoHideDockContainer::updateSize()
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (orientation() == Qt::Horizontal)
|
||||||
|
{
|
||||||
|
d->SizeCache.setHeight(this->height());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
d->SizeCache.setWidth(this->width());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
@@ -294,7 +304,7 @@ CAutoHideDockContainer::~CAutoHideDockContainer()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
CAutoHideSideBar* CAutoHideDockContainer::sideBar() const
|
CAutoHideSideBar* CAutoHideDockContainer::autoHideSideBar() const
|
||||||
{
|
{
|
||||||
if (d->SideTab)
|
if (d->SideTab)
|
||||||
{
|
{
|
||||||
@@ -303,7 +313,7 @@ CAutoHideSideBar* CAutoHideDockContainer::sideBar() const
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto DockContainer = dockContainer();
|
auto DockContainer = dockContainer();
|
||||||
return DockContainer ? DockContainer->sideTabBar(d->SideTabBarArea) : nullptr;
|
return DockContainer ? DockContainer->autoHideSideBar(d->SideTabBarArea) : nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -344,6 +354,10 @@ void CAutoHideDockContainer::addDockWidget(CDockWidget* DockWidget)
|
|||||||
}
|
}
|
||||||
d->DockArea->addDockWidget(DockWidget);
|
d->DockArea->addDockWidget(DockWidget);
|
||||||
updateSize();
|
updateSize();
|
||||||
|
// The dock area is not visible and will not update the size when updateSize()
|
||||||
|
// is called for this auto hide container. Therefore we explicitly resize
|
||||||
|
// it here. As soon as it will become visible, it will get the right size
|
||||||
|
d->DockArea->resize(size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -643,5 +657,56 @@ bool CAutoHideDockContainer::event(QEvent* event)
|
|||||||
return Super::event(event);
|
return Super::event(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
Qt::Orientation CAutoHideDockContainer::orientation() const
|
||||||
|
{
|
||||||
|
return ads::internal::isHorizontalSideBarLocation(d->SideTabBarArea)
|
||||||
|
? Qt::Horizontal : Qt::Vertical;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
void CAutoHideDockContainer::resetToInitialDockWidgetSize()
|
||||||
|
{
|
||||||
|
if (orientation() == Qt::Horizontal)
|
||||||
|
{
|
||||||
|
setSize(d->SizeCache.height());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setSize(d->SizeCache.width());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
void CAutoHideDockContainer::moveToNewSideBarLocation(SideBarLocation NewSideBarLocation,
|
||||||
|
int TabIndex)
|
||||||
|
{
|
||||||
|
if (NewSideBarLocation == sideBarLocation() && TabIndex == this->tabIndex())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto OldOrientation = orientation();
|
||||||
|
auto SideBar = dockContainer()->autoHideSideBar(NewSideBarLocation);
|
||||||
|
SideBar->addAutoHideWidget(this, TabIndex);
|
||||||
|
// If we move a horizontal auto hide container to a vertical position
|
||||||
|
// then we resize it to the original dock widget size, to avoid
|
||||||
|
// an extremely stretched dock widget after insertion
|
||||||
|
if (SideBar->orientation() != OldOrientation)
|
||||||
|
{
|
||||||
|
resetToInitialDockWidgetSize();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
int CAutoHideDockContainer::tabIndex() const
|
||||||
|
{
|
||||||
|
return d->SideTab->tabIndex();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
#include <QSplitter>
|
#include <QSplitter>
|
||||||
#include "AutoHideTab.h"
|
#include "AutoHideTab.h"
|
||||||
|
|
||||||
class QXmlStreamWriter;
|
QT_FORWARD_DECLARE_CLASS(QXmlStreamWriter)
|
||||||
|
|
||||||
namespace ads
|
namespace ads
|
||||||
{
|
{
|
||||||
@@ -91,9 +91,9 @@ public:
|
|||||||
virtual ~CAutoHideDockContainer();
|
virtual ~CAutoHideDockContainer();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get's the side tab bar
|
* Gets the side tab bar
|
||||||
*/
|
*/
|
||||||
CAutoHideSideBar* sideBar() const;
|
CAutoHideSideBar* autoHideSideBar() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the side tab
|
* Returns the side tab
|
||||||
@@ -101,10 +101,15 @@ public:
|
|||||||
CAutoHideTab* autoHideTab() const;
|
CAutoHideTab* autoHideTab() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get's the dock widget in this dock container
|
* Gets the dock widget in this dock container
|
||||||
*/
|
*/
|
||||||
CDockWidget* dockWidget() const;
|
CDockWidget* dockWidget() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the index of this container in the sidebar
|
||||||
|
*/
|
||||||
|
int tabIndex() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a dock widget and removes the previous dock widget
|
* Adds a dock widget and removes the previous dock widget
|
||||||
*/
|
*/
|
||||||
@@ -162,10 +167,34 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Use this instead of resize.
|
* Use this instead of resize.
|
||||||
* Depending on the sidebar location this will set the width or heigth
|
* Depending on the sidebar location this will set the width or height
|
||||||
* of this auto hide container.
|
* of this auto hide container.
|
||||||
*/
|
*/
|
||||||
void setSize(int Size);
|
void setSize(int Size);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resets the width or height to the initial dock widget size dependinng on
|
||||||
|
* the orientation.
|
||||||
|
* If the orientation is Qt::Horizontal, then the height is reset to
|
||||||
|
* the initial size and if orientation is Qt::Vertical, then the width is
|
||||||
|
* reset to the initial size
|
||||||
|
*/
|
||||||
|
void resetToInitialDockWidgetSize();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns orientation of this container.
|
||||||
|
* Left and right containers have a Qt::Vertical orientation and top / bottom
|
||||||
|
* containers have a Qt::Horizontal orientation.
|
||||||
|
* The function returns the orientation of the corresponding auto hide
|
||||||
|
* side bar.
|
||||||
|
*/
|
||||||
|
Qt::Orientation orientation() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes the AutoHide container from the current side bar and adds
|
||||||
|
* it to the new side bar given in SideBarLocation
|
||||||
|
*/
|
||||||
|
void moveToNewSideBarLocation(SideBarLocation SideBarLocation, int TabIndex = -1);
|
||||||
};
|
};
|
||||||
} // namespace ads
|
} // namespace ads
|
||||||
|
|
||||||
|
|||||||
@@ -127,27 +127,6 @@ void AutoHideSideBarPrivate::handleViewportEvent(QEvent* e)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case QEvent::Resize:
|
|
||||||
if (_this->tabCount())
|
|
||||||
{
|
|
||||||
auto ev = static_cast<QResizeEvent*>(e);
|
|
||||||
auto Tab = _this->tabAt(0);
|
|
||||||
int Size = isHorizontal() ? ev->size().height() : ev->size().width();
|
|
||||||
int TabSize = isHorizontal() ? Tab->size().height() : Tab->size().width();
|
|
||||||
// If the size of the side bar is less than the size of the first tab
|
|
||||||
// then there are no visible tabs in this side bar. This check will
|
|
||||||
// fail if someone will force a very big border via CSS!!
|
|
||||||
if (Size < TabSize)
|
|
||||||
{
|
|
||||||
_this->hide();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_this->hide();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -217,6 +196,7 @@ void CAutoHideSideBar::insertTab(int Index, CAutoHideTab* SideTab)
|
|||||||
{
|
{
|
||||||
SideTab->setSideBar(this);
|
SideTab->setSideBar(this);
|
||||||
SideTab->installEventFilter(this);
|
SideTab->installEventFilter(this);
|
||||||
|
// Default insertion is append
|
||||||
if (Index < 0)
|
if (Index < 0)
|
||||||
{
|
{
|
||||||
d->TabsLayout->insertWidget(d->TabsLayout->count() - 1, SideTab);
|
d->TabsLayout->insertWidget(d->TabsLayout->count() - 1, SideTab);
|
||||||
@@ -254,12 +234,25 @@ void CAutoHideSideBar::removeAutoHideWidget(CAutoHideDockContainer* AutoHideWidg
|
|||||||
}
|
}
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
void CAutoHideSideBar::addAutoHideWidget(CAutoHideDockContainer* AutoHideWidget)
|
void CAutoHideSideBar::addAutoHideWidget(CAutoHideDockContainer* AutoHideWidget,
|
||||||
|
int TabIndex)
|
||||||
{
|
{
|
||||||
auto SideBar = AutoHideWidget->autoHideTab()->sideBar();
|
auto SideBar = AutoHideWidget->autoHideTab()->sideBar();
|
||||||
if (SideBar == this)
|
if (SideBar == this)
|
||||||
{
|
{
|
||||||
return;
|
// If we move to the same tab index or if we insert before the next
|
||||||
|
// tab index, then we will end at the same tab position and can leave
|
||||||
|
if (AutoHideWidget->tabIndex() == TabIndex || (AutoHideWidget->tabIndex() + 1) == TabIndex)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// We remove this auto hide widget from the sidebar in the code below
|
||||||
|
// and therefore need to correct the TabIndex here
|
||||||
|
if (AutoHideWidget->tabIndex() < TabIndex)
|
||||||
|
{
|
||||||
|
--TabIndex;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SideBar)
|
if (SideBar)
|
||||||
@@ -269,7 +262,7 @@ void CAutoHideSideBar::addAutoHideWidget(CAutoHideDockContainer* AutoHideWidget)
|
|||||||
AutoHideWidget->setParent(d->ContainerWidget);
|
AutoHideWidget->setParent(d->ContainerWidget);
|
||||||
AutoHideWidget->setSideBarLocation(d->SideTabArea);
|
AutoHideWidget->setSideBarLocation(d->SideTabArea);
|
||||||
d->ContainerWidget->registerAutoHideWidget(AutoHideWidget);
|
d->ContainerWidget->registerAutoHideWidget(AutoHideWidget);
|
||||||
insertTab(-1, AutoHideWidget->autoHideTab());
|
insertTab(TabIndex, AutoHideWidget->autoHideTab());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -288,20 +281,33 @@ void CAutoHideSideBar::removeTab(CAutoHideTab* SideTab)
|
|||||||
//============================================================================
|
//============================================================================
|
||||||
bool CAutoHideSideBar::eventFilter(QObject *watched, QEvent *event)
|
bool CAutoHideSideBar::eventFilter(QObject *watched, QEvent *event)
|
||||||
{
|
{
|
||||||
if (event->type() != QEvent::ShowToParent)
|
auto Tab = qobject_cast<CAutoHideTab*>(watched);
|
||||||
|
if (!Tab)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// As soon as on tab is shown, we need to show the side tab bar
|
switch (event->type())
|
||||||
auto Tab = qobject_cast<CAutoHideTab*>(watched);
|
|
||||||
if (Tab)
|
|
||||||
{
|
{
|
||||||
show();
|
case QEvent::ShowToParent:
|
||||||
|
show();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case QEvent::HideToParent:
|
||||||
|
if (!hasVisibleTabs())
|
||||||
|
{
|
||||||
|
hide();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
Qt::Orientation CAutoHideSideBar::orientation() const
|
Qt::Orientation CAutoHideSideBar::orientation() const
|
||||||
{
|
{
|
||||||
@@ -310,19 +316,67 @@ Qt::Orientation CAutoHideSideBar::orientation() const
|
|||||||
|
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
CAutoHideTab* CAutoHideSideBar::tabAt(int index) const
|
CAutoHideTab* CAutoHideSideBar::tab(int index) const
|
||||||
{
|
{
|
||||||
return qobject_cast<CAutoHideTab*>(d->TabsLayout->itemAt(index)->widget());
|
return qobject_cast<CAutoHideTab*>(d->TabsLayout->itemAt(index)->widget());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
int CAutoHideSideBar::tabCount() const
|
int CAutoHideSideBar::count() const
|
||||||
{
|
{
|
||||||
return d->TabsLayout->count() - 1;
|
return d->TabsLayout->count() - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
int CAutoHideSideBar::visibleTabCount() const
|
||||||
|
{
|
||||||
|
int VisibleTabCount = 0;
|
||||||
|
auto ParentWidget = parentWidget();
|
||||||
|
for (auto i = 0; i < count(); i++)
|
||||||
|
{
|
||||||
|
if (tab(i)->isVisibleTo(ParentWidget))
|
||||||
|
{
|
||||||
|
VisibleTabCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return VisibleTabCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
bool CAutoHideSideBar::hasVisibleTabs() const
|
||||||
|
{
|
||||||
|
auto ParentWidget = parentWidget();
|
||||||
|
for (auto i = 0; i < count(); i++)
|
||||||
|
{
|
||||||
|
if (tab(i)->isVisibleTo(ParentWidget))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
int CAutoHideSideBar::indexOfTab(const CAutoHideTab& Tab) const
|
||||||
|
{
|
||||||
|
for (auto i = 0; i < count(); i++)
|
||||||
|
{
|
||||||
|
if (tab(i) == &Tab)
|
||||||
|
{
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
SideBarLocation CAutoHideSideBar::sideBarLocation() const
|
SideBarLocation CAutoHideSideBar::sideBarLocation() const
|
||||||
{
|
{
|
||||||
@@ -333,18 +387,18 @@ SideBarLocation CAutoHideSideBar::sideBarLocation() const
|
|||||||
//============================================================================
|
//============================================================================
|
||||||
void CAutoHideSideBar::saveState(QXmlStreamWriter& s) const
|
void CAutoHideSideBar::saveState(QXmlStreamWriter& s) const
|
||||||
{
|
{
|
||||||
if (!tabCount())
|
if (!count())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
s.writeStartElement("SideBar");
|
s.writeStartElement("SideBar");
|
||||||
s.writeAttribute("Area", QString::number(sideBarLocation()));
|
s.writeAttribute("Area", QString::number(sideBarLocation()));
|
||||||
s.writeAttribute("Tabs", QString::number(tabCount()));
|
s.writeAttribute("Tabs", QString::number(count()));
|
||||||
|
|
||||||
for (auto i = 0; i < tabCount(); ++i)
|
for (auto i = 0; i < count(); ++i)
|
||||||
{
|
{
|
||||||
auto Tab = tabAt(i);
|
auto Tab = tab(i);
|
||||||
if (!Tab)
|
if (!Tab)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
@@ -392,5 +446,56 @@ CDockContainerWidget* CAutoHideSideBar::dockContainer() const
|
|||||||
return d->ContainerWidget;
|
return d->ContainerWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
int CAutoHideSideBar::tabAt(const QPoint& Pos) const
|
||||||
|
{
|
||||||
|
if (!isVisible())
|
||||||
|
{
|
||||||
|
return TabInvalidIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (orientation() == Qt::Horizontal)
|
||||||
|
{
|
||||||
|
if (Pos.x() < tab(0)->geometry().x())
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (Pos.y() < tab(0)->geometry().y())
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
for (int i = 0; i < count(); ++i)
|
||||||
|
{
|
||||||
|
if (tab(i)->geometry().contains(Pos))
|
||||||
|
{
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return count();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
int CAutoHideSideBar::tabInsertIndexAt(const QPoint& Pos) const
|
||||||
|
{
|
||||||
|
int Index = tabAt(Pos);
|
||||||
|
if (Index == TabInvalidIndex)
|
||||||
|
{
|
||||||
|
return TabDefaultInsertIndex;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return (Index < 0) ? 0 : Index;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace ads
|
} // namespace ads
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
#include "ads_globals.h"
|
#include "ads_globals.h"
|
||||||
#include "AutoHideTab.h"
|
#include "AutoHideTab.h"
|
||||||
|
|
||||||
class QXmlStreamWriter;
|
QT_FORWARD_DECLARE_CLASS(QXmlStreamWriter)
|
||||||
|
|
||||||
namespace ads
|
namespace ads
|
||||||
{
|
{
|
||||||
@@ -117,7 +117,7 @@ public:
|
|||||||
* If the AutoHideWidget is in another sidebar, then it will be removed
|
* If the AutoHideWidget is in another sidebar, then it will be removed
|
||||||
* from this sidebar.
|
* from this sidebar.
|
||||||
*/
|
*/
|
||||||
void addAutoHideWidget(CAutoHideDockContainer* AutoHideWidget);
|
void addAutoHideWidget(CAutoHideDockContainer* AutoHideWidget, int Index = TabDefaultInsertIndex);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns orientation of side tab.
|
* Returns orientation of side tab.
|
||||||
@@ -125,14 +125,45 @@ public:
|
|||||||
Qt::Orientation orientation() const;
|
Qt::Orientation orientation() const;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* get the side tab widget at position, returns nullptr if it's out of bounds
|
* Get the side tab widget at position, returns nullptr if it's out of bounds
|
||||||
*/
|
*/
|
||||||
CAutoHideTab* tabAt(int index) const;
|
CAutoHideTab* tab(int index) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the tab at the given position.
|
||||||
|
* Returns -1 if the position is left of the first tab and count() if the
|
||||||
|
* position is right of the last tab. Returns InvalidTabIndex (-2) to
|
||||||
|
* indicate an invalid value.
|
||||||
|
*/
|
||||||
|
int tabAt(const QPoint& Pos) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the tab insertion index for the given mouse cursor position
|
||||||
|
*/
|
||||||
|
int tabInsertIndexAt(const QPoint& Pos) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the index of the given tab
|
||||||
|
*/
|
||||||
|
int indexOfTab(const CAutoHideTab& Tab) const;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Gets the count of the tab widgets
|
* Gets the count of the tab widgets
|
||||||
*/
|
*/
|
||||||
int tabCount() const;
|
int count() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the number of visible tabs to its parent widget.
|
||||||
|
*/
|
||||||
|
int visibleTabCount() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true, if the sidebar contains visible tabs to its parent widget.
|
||||||
|
* The function returns as soon as it finds the first visible tab.
|
||||||
|
* That means, if you just want to find out if there are visible tabs
|
||||||
|
* then this function is quicker than visibleTabCount()
|
||||||
|
*/
|
||||||
|
bool hasVisibleTabs() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Getter for side tab bar area property
|
* Getter for side tab bar area property
|
||||||
@@ -142,7 +173,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Overrides the minimumSizeHint() function of QScrollArea
|
* Overrides the minimumSizeHint() function of QScrollArea
|
||||||
* The minimumSizeHint() is bigger than the sizeHint () for the scroll
|
* The minimumSizeHint() is bigger than the sizeHint () for the scroll
|
||||||
* area because even if the scrollbars are invisible, the required speace
|
* area because even if the scrollbars are invisible, the required space
|
||||||
* is reserved in the minimumSizeHint(). This override simply returns
|
* is reserved in the minimumSizeHint(). This override simply returns
|
||||||
* sizeHint();
|
* sizeHint();
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -32,15 +32,19 @@
|
|||||||
#include <QBoxLayout>
|
#include <QBoxLayout>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QElapsedTimer>
|
#include <QElapsedTimer>
|
||||||
|
#include <QMenu>
|
||||||
|
|
||||||
#include "AutoHideDockContainer.h"
|
#include "AutoHideDockContainer.h"
|
||||||
#include "AutoHideSideBar.h"
|
#include "AutoHideSideBar.h"
|
||||||
#include "DockAreaWidget.h"
|
#include "DockAreaWidget.h"
|
||||||
#include "DockManager.h"
|
#include "DockManager.h"
|
||||||
#include "DockWidget.h"
|
#include "DockWidget.h"
|
||||||
|
#include "FloatingDragPreview.h"
|
||||||
|
#include "DockOverlay.h"
|
||||||
|
|
||||||
namespace ads
|
namespace ads
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Private data class of CDockWidgetTab class (pimpl)
|
* Private data class of CDockWidgetTab class (pimpl)
|
||||||
*/
|
*/
|
||||||
@@ -51,6 +55,12 @@ struct AutoHideTabPrivate
|
|||||||
CAutoHideSideBar* SideBar = nullptr;
|
CAutoHideSideBar* SideBar = nullptr;
|
||||||
Qt::Orientation Orientation{Qt::Vertical};
|
Qt::Orientation Orientation{Qt::Vertical};
|
||||||
QElapsedTimer TimeSinceHoverMousePress;
|
QElapsedTimer TimeSinceHoverMousePress;
|
||||||
|
bool MousePressed = false;
|
||||||
|
eDragState DragState = DraggingInactive;
|
||||||
|
QPoint GlobalDragStartMousePosition;
|
||||||
|
QPoint DragStartMousePosition;
|
||||||
|
IFloatingWidget* FloatingWidget = nullptr;
|
||||||
|
Qt::Orientation DragStartOrientation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Private data constructor
|
* Private data constructor
|
||||||
@@ -82,6 +92,55 @@ struct AutoHideTabPrivate
|
|||||||
DockContainer->handleAutoHideWidgetEvent(event, _this);
|
DockContainer->handleAutoHideWidgetEvent(event, _this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper function to create and initialize the menu entries for
|
||||||
|
* the "Auto Hide Group To..." menu
|
||||||
|
*/
|
||||||
|
QAction* createAutoHideToAction(const QString& Title, SideBarLocation Location,
|
||||||
|
QMenu* Menu)
|
||||||
|
{
|
||||||
|
auto Action = Menu->addAction(Title);
|
||||||
|
Action->setProperty(internal::LocationProperty, Location);
|
||||||
|
QObject::connect(Action, &QAction::triggered, _this, &CAutoHideTab::onAutoHideToActionClicked);
|
||||||
|
Action->setEnabled(Location != _this->sideBarLocation());
|
||||||
|
return Action;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test function for current drag state
|
||||||
|
*/
|
||||||
|
bool isDraggingState(eDragState dragState) const
|
||||||
|
{
|
||||||
|
return this->DragState == dragState;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Saves the drag start position in global and local coordinates
|
||||||
|
*/
|
||||||
|
void saveDragStartMousePosition(const QPoint& GlobalPos)
|
||||||
|
{
|
||||||
|
GlobalDragStartMousePosition = GlobalPos;
|
||||||
|
DragStartMousePosition = _this->mapFromGlobal(GlobalPos);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Starts floating of the dock widget that belongs to this title bar
|
||||||
|
* Returns true, if floating has been started and false if floating
|
||||||
|
* is not possible for any reason
|
||||||
|
*/
|
||||||
|
bool startFloating(eDragState DraggingState = DraggingFloatingWidget);
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
IFloatingWidget* createFloatingWidget(T* Widget)
|
||||||
|
{
|
||||||
|
auto w = new CFloatingDragPreview(Widget);
|
||||||
|
_this->connect(w, &CFloatingDragPreview::draggingCanceled, [=]()
|
||||||
|
{
|
||||||
|
DragState = DraggingInactive;
|
||||||
|
});
|
||||||
|
return w;
|
||||||
|
}
|
||||||
}; // struct DockWidgetTabPrivate
|
}; // struct DockWidgetTabPrivate
|
||||||
|
|
||||||
|
|
||||||
@@ -110,6 +169,53 @@ void AutoHideTabPrivate::updateOrientation()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
bool AutoHideTabPrivate::startFloating(eDragState DraggingState)
|
||||||
|
{
|
||||||
|
auto DockArea = DockWidget->dockAreaWidget();
|
||||||
|
ADS_PRINT("isFloating " << dockContainer()->isFloating());
|
||||||
|
|
||||||
|
ADS_PRINT("startFloating");
|
||||||
|
DragState = DraggingState;
|
||||||
|
IFloatingWidget* FloatingWidget = nullptr;
|
||||||
|
FloatingWidget = createFloatingWidget(DockArea);
|
||||||
|
auto Size = DockArea->size();
|
||||||
|
auto StartPos = DragStartMousePosition;
|
||||||
|
auto AutoHideContainer = DockWidget->autoHideDockContainer();
|
||||||
|
DragStartOrientation = AutoHideContainer->orientation();
|
||||||
|
switch (SideBar->sideBarLocation())
|
||||||
|
{
|
||||||
|
case SideBarLeft:
|
||||||
|
StartPos.rx() = AutoHideContainer->rect().left() + 10;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SideBarRight:
|
||||||
|
StartPos.rx() = AutoHideContainer->rect().right() - 10;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SideBarTop:
|
||||||
|
StartPos.ry() = AutoHideContainer->rect().top() + 10;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SideBarBottom:
|
||||||
|
StartPos.ry() = AutoHideContainer->rect().bottom() - 10;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SideBarNone:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
FloatingWidget->startFloating(StartPos, Size, DraggingFloatingWidget, _this);
|
||||||
|
auto DockManager = DockWidget->dockManager();
|
||||||
|
auto Overlay = DockManager->containerOverlay();
|
||||||
|
Overlay->setAllowedAreas(OuterDockAreas);
|
||||||
|
this->FloatingWidget = FloatingWidget;
|
||||||
|
qApp->postEvent(DockWidget, new QEvent((QEvent::Type)internal::DockedWidgetDragStartEvent));
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
void CAutoHideTab::setSideBar(CAutoHideSideBar* SideTabBar)
|
void CAutoHideTab::setSideBar(CAutoHideSideBar* SideTabBar)
|
||||||
{
|
{
|
||||||
@@ -250,32 +356,205 @@ bool CAutoHideTab::event(QEvent* event)
|
|||||||
d->forwardEventToDockContainer(event);
|
d->forwardEventToDockContainer(event);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case QEvent::MouseButtonPress:
|
|
||||||
// If AutoHideShowOnMouseOver is active, then the showing is triggered
|
|
||||||
// by a MousePressEvent sent to this tab. To prevent accidental hiding
|
|
||||||
// of the tab by a mouse click, we wait at least 500 ms before we accept
|
|
||||||
// the mouse click
|
|
||||||
if (!event->spontaneous())
|
|
||||||
{
|
|
||||||
d->TimeSinceHoverMousePress.restart();
|
|
||||||
d->forwardEventToDockContainer(event);
|
|
||||||
}
|
|
||||||
else if (d->TimeSinceHoverMousePress.hasExpired(500))
|
|
||||||
{
|
|
||||||
d->forwardEventToDockContainer(event);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return Super::event(event);
|
return Super::event(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
bool CAutoHideTab::iconOnly() const
|
bool CAutoHideTab::iconOnly() const
|
||||||
{
|
{
|
||||||
return CDockManager::testAutoHideConfigFlag(CDockManager::AutoHideSideBarsIconOnly) && !icon().isNull();
|
return CDockManager::testAutoHideConfigFlag(CDockManager::AutoHideSideBarsIconOnly) && !icon().isNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
void CAutoHideTab::contextMenuEvent(QContextMenuEvent* ev)
|
||||||
|
{
|
||||||
|
ev->accept();
|
||||||
|
d->saveDragStartMousePosition(ev->globalPos());
|
||||||
|
|
||||||
|
const bool isFloatable = d->DockWidget->features().testFlag(CDockWidget::DockWidgetFloatable);
|
||||||
|
QAction* Action;
|
||||||
|
QMenu Menu(this);
|
||||||
|
|
||||||
|
Action = Menu.addAction(tr("Detach"), this, SLOT(setDockWidgetFloating()));
|
||||||
|
Action->setEnabled(isFloatable);
|
||||||
|
auto IsPinnable = d->DockWidget->features().testFlag(CDockWidget::DockWidgetPinnable);
|
||||||
|
Action->setEnabled(IsPinnable);
|
||||||
|
|
||||||
|
auto menu = Menu.addMenu(tr("Pin To..."));
|
||||||
|
menu->setEnabled(IsPinnable);
|
||||||
|
d->createAutoHideToAction(tr("Top"), SideBarTop, menu);
|
||||||
|
d->createAutoHideToAction(tr("Left"), SideBarLeft, menu);
|
||||||
|
d->createAutoHideToAction(tr("Right"), SideBarRight, menu);
|
||||||
|
d->createAutoHideToAction(tr("Bottom"), SideBarBottom, menu);
|
||||||
|
|
||||||
|
Action = Menu.addAction(tr("Unpin (Dock)"), this, SLOT(unpinDockWidget()));
|
||||||
|
Menu.addSeparator();
|
||||||
|
Action = Menu.addAction(tr("Close"), this, SLOT(requestCloseDockWidget()));
|
||||||
|
Action->setEnabled(d->DockWidget->features().testFlag(CDockWidget::DockWidgetClosable));
|
||||||
|
|
||||||
|
Menu.exec(ev->globalPos());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
void CAutoHideTab::setDockWidgetFloating()
|
||||||
|
{
|
||||||
|
d->DockWidget->setFloating();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
void CAutoHideTab::unpinDockWidget()
|
||||||
|
{
|
||||||
|
d->DockWidget->setAutoHide(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
void CAutoHideTab::onAutoHideToActionClicked()
|
||||||
|
{
|
||||||
|
int Location = sender()->property(internal::LocationProperty).toInt();
|
||||||
|
d->DockWidget->setAutoHide(true, (SideBarLocation)Location);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
void CAutoHideTab::mousePressEvent(QMouseEvent* ev)
|
||||||
|
{
|
||||||
|
// If AutoHideShowOnMouseOver is active, then the showing is triggered
|
||||||
|
// by a MousePressEvent sent to this tab. To prevent accidental hiding
|
||||||
|
// of the tab by a mouse click, we wait at least 500 ms before we accept
|
||||||
|
// the mouse click
|
||||||
|
if (!ev->spontaneous())
|
||||||
|
{
|
||||||
|
d->TimeSinceHoverMousePress.restart();
|
||||||
|
d->forwardEventToDockContainer(ev);
|
||||||
|
}
|
||||||
|
else if (d->TimeSinceHoverMousePress.hasExpired(500))
|
||||||
|
{
|
||||||
|
d->forwardEventToDockContainer(ev);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ev->button() == Qt::LeftButton)
|
||||||
|
{
|
||||||
|
ev->accept();
|
||||||
|
d->MousePressed = true;
|
||||||
|
d->saveDragStartMousePosition(internal::globalPositionOf(ev));
|
||||||
|
d->DragState = DraggingMousePressed;
|
||||||
|
}
|
||||||
|
Super::mousePressEvent(ev);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
void CAutoHideTab::mouseReleaseEvent(QMouseEvent* ev)
|
||||||
|
{
|
||||||
|
if (ev->button() == Qt::LeftButton)
|
||||||
|
{
|
||||||
|
d->MousePressed = false;
|
||||||
|
auto CurrentDragState = d->DragState;
|
||||||
|
d->GlobalDragStartMousePosition = QPoint();
|
||||||
|
d->DragStartMousePosition = QPoint();
|
||||||
|
d->DragState = DraggingInactive;
|
||||||
|
|
||||||
|
switch (CurrentDragState)
|
||||||
|
{
|
||||||
|
case DraggingTab:
|
||||||
|
// End of tab moving, emit signal
|
||||||
|
/*if (d->DockArea)
|
||||||
|
{
|
||||||
|
ev->accept();
|
||||||
|
Q_EMIT moved(internal::globalPositionOf(ev));
|
||||||
|
}*/
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DraggingFloatingWidget:
|
||||||
|
ev->accept();
|
||||||
|
d->FloatingWidget->finishDragging();
|
||||||
|
if (d->DockWidget->autoHideDockContainer() && d->DragStartOrientation != orientation())
|
||||||
|
{
|
||||||
|
d->DockWidget->autoHideDockContainer()->resetToInitialDockWidgetSize();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break; // do nothing
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Super::mouseReleaseEvent(ev);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
void CAutoHideTab::mouseMoveEvent(QMouseEvent* ev)
|
||||||
|
{
|
||||||
|
if (!(ev->buttons() & Qt::LeftButton) || d->isDraggingState(DraggingInactive))
|
||||||
|
{
|
||||||
|
d->DragState = DraggingInactive;
|
||||||
|
Super::mouseMoveEvent(ev);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// move floating window
|
||||||
|
if (d->isDraggingState(DraggingFloatingWidget))
|
||||||
|
{
|
||||||
|
d->FloatingWidget->moveFloating();
|
||||||
|
Super::mouseMoveEvent(ev);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// move tab
|
||||||
|
if (d->isDraggingState(DraggingTab))
|
||||||
|
{
|
||||||
|
// Moving the tab is always allowed because it does not mean moving the
|
||||||
|
// dock widget around
|
||||||
|
//d->moveTab(ev);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto MappedPos = mapToParent(ev->pos());
|
||||||
|
bool MouseOutsideBar = (MappedPos.x() < 0) || (MappedPos.x() > parentWidget()->rect().right());
|
||||||
|
// Maybe a fixed drag distance is better here ?
|
||||||
|
int DragDistanceY = qAbs(d->GlobalDragStartMousePosition.y() - internal::globalPositionOf(ev).y());
|
||||||
|
if (DragDistanceY >= CDockManager::startDragDistance() || MouseOutsideBar)
|
||||||
|
{
|
||||||
|
// Floating is only allowed for widgets that are floatable
|
||||||
|
// We can create the drag preview if the widget is movable.
|
||||||
|
auto Features = d->DockWidget->features();
|
||||||
|
if (Features.testFlag(CDockWidget::DockWidgetFloatable) || (Features.testFlag(CDockWidget::DockWidgetMovable)))
|
||||||
|
{
|
||||||
|
d->startFloating();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Super::mouseMoveEvent(ev);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
void CAutoHideTab::requestCloseDockWidget()
|
||||||
|
{
|
||||||
|
d->DockWidget->requestCloseDockWidget();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
int CAutoHideTab::tabIndex() const
|
||||||
|
{
|
||||||
|
if (!d->SideBar)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return d->SideBar->indexOfTab(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,11 +65,17 @@ private:
|
|||||||
friend class CDockContainerWidget;
|
friend class CDockContainerWidget;
|
||||||
friend DockContainerWidgetPrivate;
|
friend DockContainerWidgetPrivate;
|
||||||
|
|
||||||
|
private Q_SLOTS:
|
||||||
|
void onAutoHideToActionClicked();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void setSideBar(CAutoHideSideBar *SideTabBar);
|
void setSideBar(CAutoHideSideBar *SideTabBar);
|
||||||
void removeFromSideBar();
|
void removeFromSideBar();
|
||||||
virtual bool event(QEvent* event) override;
|
virtual bool event(QEvent* event) override;
|
||||||
|
virtual void contextMenuEvent(QContextMenuEvent* ev) override;
|
||||||
|
virtual void mousePressEvent(QMouseEvent* ev) override;
|
||||||
|
virtual void mouseReleaseEvent(QMouseEvent* ev) override;
|
||||||
|
virtual void mouseMoveEvent(QMouseEvent* ev) override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using Super = CPushButton;
|
using Super = CPushButton;
|
||||||
@@ -133,6 +139,27 @@ public:
|
|||||||
* not in a side bar
|
* not in a side bar
|
||||||
*/
|
*/
|
||||||
CAutoHideSideBar* sideBar() const;
|
CAutoHideSideBar* sideBar() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the index of this tab in the sideBar
|
||||||
|
*/
|
||||||
|
int tabIndex() const;
|
||||||
|
|
||||||
|
public Q_SLOTS:
|
||||||
|
/**
|
||||||
|
* Set the dock widget floating, if it is floatable
|
||||||
|
*/
|
||||||
|
void setDockWidgetFloating();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unpin and dock the auto hide widget
|
||||||
|
*/
|
||||||
|
void unpinDockWidget();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calls the requestCloseDockWidget() function for the assigned dock widget
|
||||||
|
*/
|
||||||
|
void requestCloseDockWidget();
|
||||||
}; // class AutoHideTab
|
}; // class AutoHideTab
|
||||||
}
|
}
|
||||||
// namespace ads
|
// namespace ads
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
cmake_minimum_required(VERSION 3.5)
|
cmake_minimum_required(VERSION 3.5)
|
||||||
project(QtAdvancedDockingSystem LANGUAGES CXX VERSION ${VERSION_SHORT})
|
project(QtAdvancedDockingSystem LANGUAGES CXX VERSION ${VERSION_SHORT})
|
||||||
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED)
|
if (${QT_VERSION_MAJOR})
|
||||||
|
message(STATUS "Forced to use Qt version ${QT_VERSION_MAJOR}")
|
||||||
|
find_package(QT NAMES Qt${QT_VERSION_MAJOR} COMPONENTS Core REQUIRED)
|
||||||
|
else()
|
||||||
|
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED)
|
||||||
|
endif()
|
||||||
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Gui Widgets REQUIRED)
|
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Gui Widgets REQUIRED)
|
||||||
if (UNIX AND NOT APPLE)
|
if (UNIX AND NOT APPLE)
|
||||||
include_directories(${Qt${QT_VERSION_MAJOR}Gui_PRIVATE_INCLUDE_DIRS})
|
include_directories(${Qt${QT_VERSION_MAJOR}Gui_PRIVATE_INCLUDE_DIRS})
|
||||||
@@ -31,7 +36,7 @@ set(ads_SRCS
|
|||||||
AutoHideTab.cpp
|
AutoHideTab.cpp
|
||||||
AutoHideDockContainer.cpp
|
AutoHideDockContainer.cpp
|
||||||
PushButton.cpp
|
PushButton.cpp
|
||||||
ResizeHandle.cpp
|
ResizeHandle.cpp
|
||||||
ads.qrc
|
ads.qrc
|
||||||
)
|
)
|
||||||
set(ads_HEADERS
|
set(ads_HEADERS
|
||||||
@@ -57,57 +62,65 @@ set(ads_HEADERS
|
|||||||
AutoHideTab.h
|
AutoHideTab.h
|
||||||
AutoHideDockContainer.h
|
AutoHideDockContainer.h
|
||||||
PushButton.h
|
PushButton.h
|
||||||
ResizeHandle.h
|
ResizeHandle.h
|
||||||
)
|
)
|
||||||
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")
|
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")
|
||||||
if (UNIX AND NOT APPLE)
|
if (UNIX AND NOT APPLE)
|
||||||
set(ads_SRCS linux/FloatingWidgetTitleBar.cpp ${ads_SRCS})
|
set(ads_SRCS linux/FloatingWidgetTitleBar.cpp ${ads_SRCS})
|
||||||
set(ads_HEADERS linux/FloatingWidgetTitleBar.h ${ads_HEADERS})
|
set(ads_HEADERS linux/FloatingWidgetTitleBar.h ${ads_HEADERS})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
set(library_name "qt${QT_VERSION_MAJOR}advanceddocking")
|
||||||
if(BUILD_STATIC)
|
if(BUILD_STATIC)
|
||||||
add_library(qtadvanceddocking STATIC ${ads_SRCS} ${ads_HEADERS})
|
add_library(${library_name} STATIC ${ads_SRCS} ${ads_HEADERS})
|
||||||
target_compile_definitions(qtadvanceddocking PUBLIC ADS_STATIC)
|
target_compile_definitions( ${library_name} PUBLIC ADS_STATIC)
|
||||||
else()
|
else()
|
||||||
add_library(qtadvanceddocking SHARED ${ads_SRCS} ${ads_HEADERS})
|
add_library( ${library_name} SHARED ${ads_SRCS} ${ads_HEADERS})
|
||||||
target_compile_definitions(qtadvanceddocking PRIVATE ADS_SHARED_EXPORT)
|
target_compile_definitions( ${library_name} PRIVATE ADS_SHARED_EXPORT)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_library(ads::qtadvanceddocking ALIAS qtadvanceddocking)
|
add_library(ads::${library_name} ALIAS ${library_name})
|
||||||
|
|
||||||
target_link_libraries(qtadvanceddocking PUBLIC Qt${QT_VERSION_MAJOR}::Core
|
target_link_libraries(${library_name} PUBLIC Qt${QT_VERSION_MAJOR}::Core
|
||||||
Qt${QT_VERSION_MAJOR}::Gui
|
Qt${QT_VERSION_MAJOR}::Gui
|
||||||
Qt${QT_VERSION_MAJOR}::Widgets)
|
Qt${QT_VERSION_MAJOR}::Widgets)
|
||||||
if (UNIX AND NOT APPLE)
|
if (UNIX AND NOT APPLE)
|
||||||
target_link_libraries(qtadvanceddocking PUBLIC xcb)
|
if (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
||||||
|
find_package(X11 REQUIRED)
|
||||||
|
target_link_libraries(${library_name} PUBLIC X11::xcb)
|
||||||
|
else()
|
||||||
|
target_link_libraries(${library_name} PUBLIC xcb)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
set_target_properties(qtadvanceddocking PROPERTIES
|
set_target_properties(${library_name} PROPERTIES
|
||||||
AUTOMOC ON
|
AUTOMOC ON
|
||||||
AUTORCC ON
|
AUTORCC ON
|
||||||
CXX_EXTENSIONS OFF
|
CXX_EXTENSIONS OFF
|
||||||
VERSION ${VERSION_SHORT}
|
VERSION ${VERSION_SHORT}
|
||||||
EXPORT_NAME "qtadvanceddocking"
|
EXPORT_NAME ${library_name}
|
||||||
|
DEBUG_POSTFIX "d"
|
||||||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib"
|
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib"
|
||||||
LIBRARY_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"
|
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/bin"
|
||||||
)
|
)
|
||||||
if(QT_VERSION_MAJOR STREQUAL "5")
|
if(QT_VERSION_MAJOR STREQUAL "5")
|
||||||
set_target_properties(qtadvanceddocking PROPERTIES
|
set_target_properties(${library_name} PROPERTIES
|
||||||
CXX_STANDARD 14
|
CXX_STANDARD 14
|
||||||
CXX_STANDARD_REQUIRED ON)
|
CXX_STANDARD_REQUIRED ON)
|
||||||
elseif(QT_VERSION_MAJOR STREQUAL "6")
|
elseif(QT_VERSION_MAJOR STREQUAL "6")
|
||||||
set_target_properties(qtadvanceddocking PROPERTIES
|
set_target_properties(${library_name} PROPERTIES
|
||||||
CXX_STANDARD 17
|
CXX_STANDARD 17
|
||||||
CXX_STANDARD_REQUIRED ON)
|
CXX_STANDARD_REQUIRED ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include(CMakePackageConfigHelpers)
|
include(CMakePackageConfigHelpers)
|
||||||
write_basic_package_version_file(
|
write_basic_package_version_file(
|
||||||
"qtadvanceddockingConfigVersion.cmake"
|
"${library_name}ConfigVersion.cmake"
|
||||||
VERSION ${VERSION_SHORT}
|
VERSION ${VERSION_SHORT}
|
||||||
COMPATIBILITY SameMajorVersion
|
COMPATIBILITY SameMajorVersion
|
||||||
)
|
)
|
||||||
install(FILES ${ads_HEADERS}
|
install(FILES ${ads_HEADERS}
|
||||||
DESTINATION include
|
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${library_name}
|
||||||
COMPONENT headers
|
COMPONENT headers
|
||||||
)
|
)
|
||||||
install(FILES
|
install(FILES
|
||||||
@@ -116,24 +129,27 @@ install(FILES
|
|||||||
DESTINATION license/ads
|
DESTINATION license/ads
|
||||||
COMPONENT license
|
COMPONENT license
|
||||||
)
|
)
|
||||||
install(TARGETS qtadvanceddocking
|
install(TARGETS ${library_name}
|
||||||
EXPORT adsTargets
|
EXPORT adsTargets
|
||||||
RUNTIME DESTINATION bin
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||||
LIBRARY DESTINATION lib
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
ARCHIVE DESTINATION lib
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
INCLUDES DESTINATION include
|
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${library_name}
|
||||||
)
|
)
|
||||||
|
|
||||||
install(EXPORT adsTargets
|
install(EXPORT adsTargets
|
||||||
FILE adsTargets.cmake
|
FILE adsTargets.cmake
|
||||||
NAMESPACE ads::
|
NAMESPACE ads::
|
||||||
DESTINATION lib/cmake/qtadvanceddocking
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${library_name}
|
||||||
)
|
)
|
||||||
install(FILES qtadvanceddockingConfig.cmake "${CMAKE_CURRENT_BINARY_DIR}/qtadvanceddockingConfigVersion.cmake"
|
install(FILES qtadvanceddockingConfig.cmake RENAME ${library_name}Config.cmake
|
||||||
DESTINATION lib/cmake/qtadvanceddocking
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${library_name}
|
||||||
|
)
|
||||||
|
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${library_name}ConfigVersion.cmake"
|
||||||
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${library_name}
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(qtadvanceddocking PUBLIC
|
target_include_directories(${library_name} PUBLIC
|
||||||
$<INSTALL_INTERFACE:include>
|
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
#include <QBoxLayout>
|
#include <QBoxLayout>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
#include "FloatingDockContainer.h"
|
#include "FloatingDockContainer.h"
|
||||||
#include "DockAreaWidget.h"
|
#include "DockAreaWidget.h"
|
||||||
@@ -107,7 +108,13 @@ void DockAreaTabBarPrivate::updateTabs()
|
|||||||
{
|
{
|
||||||
TabWidget->show();
|
TabWidget->show();
|
||||||
TabWidget->setActiveTab(true);
|
TabWidget->setActiveTab(true);
|
||||||
_this->ensureWidgetVisible(TabWidget);
|
// Sometimes the synchronous calculation of the rectangular area fails
|
||||||
|
// Therefore we use QTimer::singleShot here to execute the call
|
||||||
|
// within the event loop - see #520
|
||||||
|
QTimer::singleShot(0, TabWidget, [&, TabWidget]
|
||||||
|
{
|
||||||
|
_this->ensureWidgetVisible(TabWidget);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -294,7 +301,7 @@ int CDockAreaTabBar::currentIndex() const
|
|||||||
//===========================================================================
|
//===========================================================================
|
||||||
CDockWidgetTab* CDockAreaTabBar::currentTab() const
|
CDockWidgetTab* CDockAreaTabBar::currentTab() const
|
||||||
{
|
{
|
||||||
if (d->CurrentIndex < 0)
|
if (d->CurrentIndex < 0 || d->CurrentIndex >= d->TabsLayout->count())
|
||||||
{
|
{
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@@ -498,6 +505,46 @@ QSize CDockAreaTabBar::sizeHint() const
|
|||||||
return d->TabsContainerWidget->sizeHint();
|
return d->TabsContainerWidget->sizeHint();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
int CDockAreaTabBar::tabAt(const QPoint& Pos) const
|
||||||
|
{
|
||||||
|
if (!isVisible())
|
||||||
|
{
|
||||||
|
return TabInvalidIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Pos.x() < tab(0)->geometry().x())
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < count(); ++i)
|
||||||
|
{
|
||||||
|
if (tab(i)->geometry().contains(Pos))
|
||||||
|
{
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return count();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
int CDockAreaTabBar::tabInsertIndexAt(const QPoint& Pos) const
|
||||||
|
{
|
||||||
|
int Index = tabAt(Pos);
|
||||||
|
if (Index == TabInvalidIndex)
|
||||||
|
{
|
||||||
|
return TabDefaultInsertIndex;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return (Index < 0) ? 0 : Index;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace ads
|
} // namespace ads
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -113,6 +113,19 @@ public:
|
|||||||
*/
|
*/
|
||||||
CDockWidgetTab* tab(int Index) const;
|
CDockWidgetTab* tab(int Index) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the tab at the given position.
|
||||||
|
* Returns -1 if the position is left of the first tab and count() if the
|
||||||
|
* position is right of the last tab. Returns -2 to indicate an invalid
|
||||||
|
* value.
|
||||||
|
*/
|
||||||
|
int tabAt(const QPoint& Pos) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the tab insertion index for the given mouse cursor position
|
||||||
|
*/
|
||||||
|
int tabInsertIndexAt(const QPoint& Pos) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filters the tab widget events
|
* Filters the tab widget events
|
||||||
*/
|
*/
|
||||||
@@ -128,7 +141,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Overrides the minimumSizeHint() function of QScrollArea
|
* Overrides the minimumSizeHint() function of QScrollArea
|
||||||
* The minimumSizeHint() is bigger than the sizeHint () for the scroll
|
* The minimumSizeHint() is bigger than the sizeHint () for the scroll
|
||||||
* area because even if the scrollbars are invisible, the required speace
|
* area because even if the scrollbars are invisible, the required space
|
||||||
* is reserved in the minimumSizeHint(). This override simply returns
|
* is reserved in the minimumSizeHint(). This override simply returns
|
||||||
* sizeHint();
|
* sizeHint();
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -60,7 +60,6 @@
|
|||||||
|
|
||||||
namespace ads
|
namespace ads
|
||||||
{
|
{
|
||||||
static const char* const LocationProperty = "Location";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Private data class of CDockAreaTitleBar class (pimpl)
|
* Private data class of CDockAreaTitleBar class (pimpl)
|
||||||
@@ -68,14 +67,15 @@ static const char* const LocationProperty = "Location";
|
|||||||
struct DockAreaTitleBarPrivate
|
struct DockAreaTitleBarPrivate
|
||||||
{
|
{
|
||||||
CDockAreaTitleBar* _this;
|
CDockAreaTitleBar* _this;
|
||||||
QPointer<tTitleBarButton> TabsMenuButton;
|
QPointer<CTitleBarButton> TabsMenuButton;
|
||||||
QPointer<tTitleBarButton> AutoHideButton;
|
QPointer<CTitleBarButton> AutoHideButton;
|
||||||
QPointer<tTitleBarButton> UndockButton;
|
QPointer<CTitleBarButton> UndockButton;
|
||||||
QPointer<tTitleBarButton> CloseButton;
|
QPointer<CTitleBarButton> CloseButton;
|
||||||
|
QPointer<CTitleBarButton> MinimizeButton;
|
||||||
QBoxLayout* Layout;
|
QBoxLayout* Layout;
|
||||||
CDockAreaWidget* DockArea;
|
CDockAreaWidget* DockArea;
|
||||||
CDockAreaTabBar* TabBar;
|
CDockAreaTabBar* TabBar;
|
||||||
CElidingLabel* AutoHideTitleLabel;
|
CElidingLabel* AutoHideTitleLabel = nullptr;
|
||||||
bool MenuOutdated = true;
|
bool MenuOutdated = true;
|
||||||
QMenu* TabsMenu;
|
QMenu* TabsMenu;
|
||||||
QList<tTitleBarButton*> DockWidgetActionsButtons;
|
QList<tTitleBarButton*> DockWidgetActionsButtons;
|
||||||
@@ -158,7 +158,7 @@ struct DockAreaTitleBarPrivate
|
|||||||
QMenu* Menu)
|
QMenu* Menu)
|
||||||
{
|
{
|
||||||
auto Action = Menu->addAction(Title);
|
auto Action = Menu->addAction(Title);
|
||||||
Action->setProperty("Location", Location);
|
Action->setProperty(internal::LocationProperty, Location);
|
||||||
QObject::connect(Action, &QAction::triggered, _this, &CDockAreaTitleBar::onAutoHideToActionClicked);
|
QObject::connect(Action, &QAction::triggered, _this, &CDockAreaTitleBar::onAutoHideToActionClicked);
|
||||||
return Action;
|
return Action;
|
||||||
}
|
}
|
||||||
@@ -178,7 +178,8 @@ void DockAreaTitleBarPrivate::createButtons()
|
|||||||
QSizePolicy ButtonSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
|
QSizePolicy ButtonSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
|
||||||
|
|
||||||
// Tabs menu button
|
// Tabs menu button
|
||||||
TabsMenuButton = new CTitleBarButton(testConfigFlag(CDockManager::DockAreaHasTabsMenuButton));
|
TabsMenuButton = new CTitleBarButton(testConfigFlag(CDockManager::DockAreaHasTabsMenuButton),
|
||||||
|
false, TitleBarButtonTabsMenu);
|
||||||
TabsMenuButton->setObjectName("tabsMenuButton");
|
TabsMenuButton->setObjectName("tabsMenuButton");
|
||||||
TabsMenuButton->setAutoRaise(true);
|
TabsMenuButton->setAutoRaise(true);
|
||||||
TabsMenuButton->setPopupMode(QToolButton::InstantPopup);
|
TabsMenuButton->setPopupMode(QToolButton::InstantPopup);
|
||||||
@@ -196,7 +197,8 @@ void DockAreaTitleBarPrivate::createButtons()
|
|||||||
SLOT(onTabsMenuActionTriggered(QAction*)));
|
SLOT(onTabsMenuActionTriggered(QAction*)));
|
||||||
|
|
||||||
// Undock button
|
// Undock button
|
||||||
UndockButton = new CTitleBarButton(testConfigFlag(CDockManager::DockAreaHasUndockButton));
|
UndockButton = new CTitleBarButton(testConfigFlag(CDockManager::DockAreaHasUndockButton),
|
||||||
|
true, TitleBarButtonUndock);
|
||||||
UndockButton->setObjectName("detachGroupButton");
|
UndockButton->setObjectName("detachGroupButton");
|
||||||
UndockButton->setAutoRaise(true);
|
UndockButton->setAutoRaise(true);
|
||||||
internal::setToolTip(UndockButton, QObject::tr("Detach Group"));
|
internal::setToolTip(UndockButton, QObject::tr("Detach Group"));
|
||||||
@@ -207,7 +209,8 @@ void DockAreaTitleBarPrivate::createButtons()
|
|||||||
|
|
||||||
// AutoHide Button
|
// AutoHide Button
|
||||||
const auto autoHideEnabled = testAutoHideConfigFlag(CDockManager::AutoHideFeatureEnabled);
|
const auto autoHideEnabled = testAutoHideConfigFlag(CDockManager::AutoHideFeatureEnabled);
|
||||||
AutoHideButton = new CTitleBarButton(testAutoHideConfigFlag(CDockManager::DockAreaHasAutoHideButton) && autoHideEnabled);
|
AutoHideButton = new CTitleBarButton(testAutoHideConfigFlag(CDockManager::DockAreaHasAutoHideButton) && autoHideEnabled,
|
||||||
|
true, TitleBarButtonAutoHide);
|
||||||
AutoHideButton->setObjectName("dockAreaAutoHideButton");
|
AutoHideButton->setObjectName("dockAreaAutoHideButton");
|
||||||
AutoHideButton->setAutoRaise(true);
|
AutoHideButton->setAutoRaise(true);
|
||||||
internal::setToolTip(AutoHideButton, _this->titleBarButtonToolTip(TitleBarButtonAutoHide));
|
internal::setToolTip(AutoHideButton, _this->titleBarButtonToolTip(TitleBarButtonAutoHide));
|
||||||
@@ -218,8 +221,21 @@ void DockAreaTitleBarPrivate::createButtons()
|
|||||||
Layout->addWidget(AutoHideButton, 0);
|
Layout->addWidget(AutoHideButton, 0);
|
||||||
_this->connect(AutoHideButton, SIGNAL(clicked()), SLOT(onAutoHideButtonClicked()));
|
_this->connect(AutoHideButton, SIGNAL(clicked()), SLOT(onAutoHideButtonClicked()));
|
||||||
|
|
||||||
|
// Minimize button
|
||||||
|
MinimizeButton = new CTitleBarButton(testAutoHideConfigFlag(CDockManager::AutoHideHasMinimizeButton),
|
||||||
|
false, TitleBarButtonMinimize);
|
||||||
|
MinimizeButton->setObjectName("dockAreaMinimizeButton");
|
||||||
|
MinimizeButton->setAutoRaise(true);
|
||||||
|
MinimizeButton->setVisible(false);
|
||||||
|
internal::setButtonIcon(MinimizeButton, QStyle::SP_TitleBarMinButton, ads::DockAreaMinimizeIcon);
|
||||||
|
internal::setToolTip(MinimizeButton, QObject::tr("Minimize"));
|
||||||
|
MinimizeButton->setSizePolicy(ButtonSizePolicy);
|
||||||
|
Layout->addWidget(MinimizeButton, 0);
|
||||||
|
_this->connect(MinimizeButton, SIGNAL(clicked()), SLOT(minimizeAutoHideContainer()));
|
||||||
|
|
||||||
// Close button
|
// Close button
|
||||||
CloseButton = new CTitleBarButton(testConfigFlag(CDockManager::DockAreaHasCloseButton));
|
CloseButton = new CTitleBarButton(testConfigFlag(CDockManager::DockAreaHasCloseButton),
|
||||||
|
true, TitleBarButtonClose);
|
||||||
CloseButton->setObjectName("dockAreaCloseButton");
|
CloseButton->setObjectName("dockAreaCloseButton");
|
||||||
CloseButton->setAutoRaise(true);
|
CloseButton->setAutoRaise(true);
|
||||||
internal::setButtonIcon(CloseButton, QStyle::SP_TitleBarCloseButton, ads::DockAreaCloseIcon);
|
internal::setButtonIcon(CloseButton, QStyle::SP_TitleBarCloseButton, ads::DockAreaCloseIcon);
|
||||||
@@ -236,7 +252,10 @@ void DockAreaTitleBarPrivate::createAutoHideTitleLabel()
|
|||||||
{
|
{
|
||||||
AutoHideTitleLabel = new CElidingLabel("");
|
AutoHideTitleLabel = new CElidingLabel("");
|
||||||
AutoHideTitleLabel->setObjectName("autoHideTitleLabel");
|
AutoHideTitleLabel->setObjectName("autoHideTitleLabel");
|
||||||
Layout->addWidget(AutoHideTitleLabel);
|
// At position 0 is the tab bar - insert behind tab bar
|
||||||
|
Layout->insertWidget(1, AutoHideTitleLabel);
|
||||||
|
AutoHideTitleLabel->setVisible(false); // Default hidden
|
||||||
|
Layout->insertWidget(2 ,new CSpacerWidget(_this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -324,10 +343,8 @@ CDockAreaTitleBar::CDockAreaTitleBar(CDockAreaWidget* parent) :
|
|||||||
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
||||||
|
|
||||||
d->createTabBar();
|
d->createTabBar();
|
||||||
d->createAutoHideTitleLabel();
|
|
||||||
d->AutoHideTitleLabel->setVisible(false); // Default hidden
|
|
||||||
d->Layout->addWidget(new CSpacerWidget(this));
|
|
||||||
d->createButtons();
|
d->createButtons();
|
||||||
|
d->createAutoHideTitleLabel();
|
||||||
|
|
||||||
setFocusPolicy(Qt::NoFocus);
|
setFocusPolicy(Qt::NoFocus);
|
||||||
}
|
}
|
||||||
@@ -415,7 +432,12 @@ void CDockAreaTitleBar::onTabsMenuAboutToShow()
|
|||||||
void CDockAreaTitleBar::onCloseButtonClicked()
|
void CDockAreaTitleBar::onCloseButtonClicked()
|
||||||
{
|
{
|
||||||
ADS_PRINT("CDockAreaTitleBar::onCloseButtonClicked");
|
ADS_PRINT("CDockAreaTitleBar::onCloseButtonClicked");
|
||||||
if (d->testConfigFlag(CDockManager::DockAreaCloseButtonClosesTab))
|
if (CDockManager::testAutoHideConfigFlag(CDockManager::AutoHideCloseButtonCollapsesDock) &&
|
||||||
|
d->DockArea->autoHideDockContainer())
|
||||||
|
{
|
||||||
|
d->DockArea->autoHideDockContainer()->collapseView(true);
|
||||||
|
}
|
||||||
|
else if (d->testConfigFlag(CDockManager::DockAreaCloseButtonClosesTab))
|
||||||
{
|
{
|
||||||
d->TabBar->closeTab(d->TabBar->currentIndex());
|
d->TabBar->closeTab(d->TabBar->currentIndex());
|
||||||
}
|
}
|
||||||
@@ -426,6 +448,24 @@ void CDockAreaTitleBar::onCloseButtonClicked()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
void CDockAreaTitleBar::onAutoHideCloseActionTriggered()
|
||||||
|
{
|
||||||
|
d->DockArea->closeArea();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
void CDockAreaTitleBar::minimizeAutoHideContainer()
|
||||||
|
{
|
||||||
|
auto AutoHideContainer = d->DockArea->autoHideDockContainer();
|
||||||
|
if (AutoHideContainer)
|
||||||
|
{
|
||||||
|
AutoHideContainer->collapseView(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
void CDockAreaTitleBar::onUndockButtonClicked()
|
void CDockAreaTitleBar::onUndockButtonClicked()
|
||||||
{
|
{
|
||||||
@@ -474,7 +514,7 @@ void CDockAreaTitleBar::updateDockWidgetActionsButtons()
|
|||||||
int InsertIndex = indexOf(d->TabsMenuButton);
|
int InsertIndex = indexOf(d->TabsMenuButton);
|
||||||
for (auto Action : Actions)
|
for (auto Action : Actions)
|
||||||
{
|
{
|
||||||
auto Button = new CTitleBarButton(true, this);
|
auto Button = new CTitleBarButton(true, false, TitleBarButtonTabsMenu, this);
|
||||||
Button->setDefaultAction(Action);
|
Button->setDefaultAction(Action);
|
||||||
Button->setAutoRaise(true);
|
Button->setAutoRaise(true);
|
||||||
Button->setPopupMode(QToolButton::InstantPopup);
|
Button->setPopupMode(QToolButton::InstantPopup);
|
||||||
@@ -528,13 +568,13 @@ void CDockAreaTitleBar::onAutoHideDockAreaActionClicked()
|
|||||||
//============================================================================
|
//============================================================================
|
||||||
void CDockAreaTitleBar::onAutoHideToActionClicked()
|
void CDockAreaTitleBar::onAutoHideToActionClicked()
|
||||||
{
|
{
|
||||||
int Location = sender()->property(LocationProperty).toInt();
|
int Location = sender()->property(internal::LocationProperty).toInt();
|
||||||
d->DockArea->toggleAutoHide((SideBarLocation)Location);
|
d->DockArea->toggleAutoHide((SideBarLocation)Location);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
QAbstractButton* CDockAreaTitleBar::button(TitleBarButton which) const
|
CTitleBarButton* CDockAreaTitleBar::button(TitleBarButton which) const
|
||||||
{
|
{
|
||||||
switch (which)
|
switch (which)
|
||||||
{
|
{
|
||||||
@@ -542,6 +582,7 @@ QAbstractButton* CDockAreaTitleBar::button(TitleBarButton which) const
|
|||||||
case TitleBarButtonUndock: return d->UndockButton;
|
case TitleBarButtonUndock: return d->UndockButton;
|
||||||
case TitleBarButtonClose: return d->CloseButton;
|
case TitleBarButtonClose: return d->CloseButton;
|
||||||
case TitleBarButtonAutoHide: return d->AutoHideButton;
|
case TitleBarButtonAutoHide: return d->AutoHideButton;
|
||||||
|
case TitleBarButtonMinimize: return d->MinimizeButton;
|
||||||
default:
|
default:
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@@ -672,6 +713,28 @@ void CDockAreaTitleBar::mouseDoubleClickEvent(QMouseEvent *event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
void CDockAreaTitleBar::setAreaFloating()
|
||||||
|
{
|
||||||
|
// If this is the last dock area in a dock container it does not make
|
||||||
|
// sense to move it to a new floating widget and leave this one
|
||||||
|
// empty.
|
||||||
|
auto DockContainer = d->DockArea->dockContainer();
|
||||||
|
if (DockContainer->isFloating() && DockContainer->dockAreaCount() == 1
|
||||||
|
&& !d->DockArea->isAutoHide())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!d->DockArea->features().testFlag(CDockWidget::DockWidgetFloatable))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
d->makeAreaFloating(mapFromGlobal(QCursor::pos()), DraggingInactive);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
void CDockAreaTitleBar::contextMenuEvent(QContextMenuEvent* ev)
|
void CDockAreaTitleBar::contextMenuEvent(QContextMenuEvent* ev)
|
||||||
{
|
{
|
||||||
@@ -708,7 +771,17 @@ void CDockAreaTitleBar::contextMenuEvent(QContextMenuEvent* ev)
|
|||||||
}
|
}
|
||||||
Menu.addSeparator();
|
Menu.addSeparator();
|
||||||
}
|
}
|
||||||
Action = Menu.addAction(isAutoHide ? tr("Close") : tr("Close Group"), this, SLOT(onCloseButtonClicked()));
|
|
||||||
|
if (isAutoHide)
|
||||||
|
{
|
||||||
|
Action = Menu.addAction(tr("Minimize"), this, SLOT(minimizeAutoHideContainer()));
|
||||||
|
Action = Menu.addAction(tr("Close"), this, SLOT(onAutoHideCloseActionTriggered()));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Action = Menu.addAction(isAutoHide ? tr("Close") : tr("Close Group"), this, SLOT(onCloseButtonClicked()));
|
||||||
|
}
|
||||||
|
|
||||||
Action->setEnabled(d->DockArea->features().testFlag(CDockWidget::DockWidgetClosable));
|
Action->setEnabled(d->DockArea->features().testFlag(CDockWidget::DockWidgetClosable));
|
||||||
if (!isAutoHide && !isTopLevelArea)
|
if (!isAutoHide && !isTopLevelArea)
|
||||||
{
|
{
|
||||||
@@ -755,7 +828,8 @@ QString CDockAreaTitleBar::titleBarButtonToolTip(TitleBarButton Button) const
|
|||||||
case TitleBarButtonClose:
|
case TitleBarButtonClose:
|
||||||
if (d->DockArea->isAutoHide())
|
if (d->DockArea->isAutoHide())
|
||||||
{
|
{
|
||||||
return tr("Close");
|
bool Minimize = CDockManager::testAutoHideConfigFlag(CDockManager::AutoHideCloseButtonCollapsesDock);
|
||||||
|
return Minimize ? tr("Minimize") : tr("Close");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CDockManager::testConfigFlag(CDockManager::DockAreaCloseButtonClosesTab))
|
if (CDockManager::testConfigFlag(CDockManager::DockAreaCloseButtonClosesTab))
|
||||||
@@ -775,11 +849,36 @@ QString CDockAreaTitleBar::titleBarButtonToolTip(TitleBarButton Button) const
|
|||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
CTitleBarButton::CTitleBarButton(bool visible, QWidget* parent)
|
void CDockAreaTitleBar::showAutoHideControls(bool Show)
|
||||||
|
{
|
||||||
|
d->TabBar->setVisible(!Show); // Auto hide toolbar never has tabs
|
||||||
|
d->MinimizeButton->setVisible(Show);
|
||||||
|
d->AutoHideTitleLabel->setVisible(Show);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
bool CDockAreaTitleBar::isAutoHide() const
|
||||||
|
{
|
||||||
|
return d->DockArea && d->DockArea->isAutoHide();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
CDockAreaWidget* CDockAreaTitleBar::dockAreaWidget() const
|
||||||
|
{
|
||||||
|
return d->DockArea;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
CTitleBarButton::CTitleBarButton(bool showInTitleBar, bool hideWhenDisabled, TitleBarButton ButtonId, QWidget* parent)
|
||||||
: tTitleBarButton(parent),
|
: tTitleBarButton(parent),
|
||||||
Visible(visible),
|
ShowInTitleBar(showInTitleBar),
|
||||||
HideWhenDisabled(CDockManager::testConfigFlag(CDockManager::DockAreaHideDisabledButtons))
|
HideWhenDisabled(CDockManager::testConfigFlag(CDockManager::DockAreaHideDisabledButtons) && hideWhenDisabled),
|
||||||
|
TitleBarButtonId(ButtonId)
|
||||||
{
|
{
|
||||||
setFocusPolicy(Qt::NoFocus);
|
setFocusPolicy(Qt::NoFocus);
|
||||||
}
|
}
|
||||||
@@ -787,8 +886,8 @@ CTitleBarButton::CTitleBarButton(bool visible, QWidget* parent)
|
|||||||
//============================================================================
|
//============================================================================
|
||||||
void CTitleBarButton::setVisible(bool visible)
|
void CTitleBarButton::setVisible(bool visible)
|
||||||
{
|
{
|
||||||
// 'visible' can stay 'true' if and only if this button is configured to generaly visible:
|
// 'visible' can stay 'true' if and only if this button is configured to generally visible:
|
||||||
visible = visible && this->Visible;
|
visible = visible && this->ShowInTitleBar;
|
||||||
|
|
||||||
// 'visible' can stay 'true' unless: this button is configured to be invisible when it is disabled and it is currently disabled:
|
// 'visible' can stay 'true' unless: this button is configured to be invisible when it is disabled and it is currently disabled:
|
||||||
if (visible && HideWhenDisabled)
|
if (visible && HideWhenDisabled)
|
||||||
@@ -799,19 +898,62 @@ void CTitleBarButton::setVisible(bool visible)
|
|||||||
Super::setVisible(visible);
|
Super::setVisible(visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
void CTitleBarButton::setShowInTitleBar(bool Show)
|
||||||
|
{
|
||||||
|
this->ShowInTitleBar = Show;
|
||||||
|
if (!Show)
|
||||||
|
{
|
||||||
|
setVisible(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
bool CTitleBarButton::event(QEvent *ev)
|
bool CTitleBarButton::event(QEvent *ev)
|
||||||
{
|
{
|
||||||
if (QEvent::EnabledChange == ev->type() && HideWhenDisabled)
|
if (QEvent::EnabledChange != ev->type() || !HideWhenDisabled || !ShowInTitleBar)
|
||||||
{
|
{
|
||||||
// force setVisible() call
|
return Super::event(ev);
|
||||||
// Calling setVisible() directly here doesn't work well when button is expected to be shown first time
|
|
||||||
QMetaObject::invokeMethod(this, "setVisible", Qt::QueuedConnection, Q_ARG(bool, isEnabled()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Show = true;
|
||||||
|
if (isInAutoHideArea())
|
||||||
|
{
|
||||||
|
switch (TitleBarButtonId)
|
||||||
|
{
|
||||||
|
case TitleBarButtonClose: Show = CDockManager::testAutoHideConfigFlag(CDockManager::AutoHideHasCloseButton); break;
|
||||||
|
case TitleBarButtonUndock: Show = false; break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// force setVisible() call - Calling setVisible() directly here doesn't
|
||||||
|
// work well when button is expected to be shown first time
|
||||||
|
QMetaObject::invokeMethod(this, "setVisible", Qt::QueuedConnection,
|
||||||
|
Q_ARG(bool, isEnabledTo(this->parentWidget()) & Show));
|
||||||
|
|
||||||
return Super::event(ev);
|
return Super::event(ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
CDockAreaTitleBar* CTitleBarButton::titleBar() const
|
||||||
|
{
|
||||||
|
return qobject_cast<CDockAreaTitleBar*>(parentWidget());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
bool CTitleBarButton::isInAutoHideArea() const
|
||||||
|
{
|
||||||
|
auto TitleBar = titleBar();
|
||||||
|
return TitleBar && TitleBar->isAutoHide();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
CSpacerWidget::CSpacerWidget(QWidget* Parent /*= 0*/) : Super(Parent)
|
CSpacerWidget::CSpacerWidget(QWidget* Parent /*= 0*/) : Super(Parent)
|
||||||
{
|
{
|
||||||
@@ -819,6 +961,7 @@ CSpacerWidget::CSpacerWidget(QWidget* Parent /*= 0*/) : Super(Parent)
|
|||||||
setStyleSheet("border: none; background: none;");
|
setStyleSheet("border: none; background: none;");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace ads
|
} // namespace ads
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
//============================================================================
|
//============================================================================
|
||||||
// INCLUDES
|
// INCLUDES
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
#include <QToolButton>
|
||||||
#include <QFrame>
|
#include <QFrame>
|
||||||
|
|
||||||
#include "ads_globals.h"
|
#include "ads_globals.h"
|
||||||
@@ -42,6 +43,63 @@ class CDockAreaTabBar;
|
|||||||
class CDockAreaWidget;
|
class CDockAreaWidget;
|
||||||
struct DockAreaTitleBarPrivate;
|
struct DockAreaTitleBarPrivate;
|
||||||
class CElidingLabel;
|
class CElidingLabel;
|
||||||
|
class CDockAreaTitleBar;
|
||||||
|
|
||||||
|
using tTitleBarButton = QToolButton;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Title bar button of a dock area that customizes tTitleBarButton appearance/behaviour
|
||||||
|
* according to various config flags such as:
|
||||||
|
* CDockManager::DockAreaHas_xxx_Button - if set to 'false' keeps the button always invisible
|
||||||
|
* CDockManager::DockAreaHideDisabledButtons - if set to 'true' hides button when it is disabled
|
||||||
|
*/
|
||||||
|
class CTitleBarButton : public tTitleBarButton
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool ShowInTitleBar = true;
|
||||||
|
bool HideWhenDisabled = false;
|
||||||
|
TitleBarButton TitleBarButtonId;
|
||||||
|
|
||||||
|
public:
|
||||||
|
using Super = tTitleBarButton;
|
||||||
|
CTitleBarButton(bool ShowInTitleBar, bool HideWhenDisabled, TitleBarButton ButtonId,
|
||||||
|
QWidget* parent = nullptr);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adjust this visibility change request with our internal settings:
|
||||||
|
*/
|
||||||
|
virtual void setVisible(bool visible) override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configures, if the title bar button should be shown in title bar
|
||||||
|
*/
|
||||||
|
void setShowInTitleBar(bool Show);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Identifier for the title bar button
|
||||||
|
*/
|
||||||
|
TitleBarButton buttonId() const {return TitleBarButtonId;}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the title bar that contains this button
|
||||||
|
*/
|
||||||
|
CDockAreaTitleBar* titleBar() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true, if the button is in a title bar in an auto hide area
|
||||||
|
*/
|
||||||
|
bool isInAutoHideArea() const;
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
/**
|
||||||
|
* Handle EnabledChanged signal to set button invisible if the configured
|
||||||
|
*/
|
||||||
|
bool event(QEvent *ev) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Title bar of a dock area.
|
* Title bar of a dock area.
|
||||||
@@ -58,6 +116,8 @@ private:
|
|||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void onTabsMenuAboutToShow();
|
void onTabsMenuAboutToShow();
|
||||||
void onCloseButtonClicked();
|
void onCloseButtonClicked();
|
||||||
|
void onAutoHideCloseActionTriggered();
|
||||||
|
void minimizeAutoHideContainer();
|
||||||
void onUndockButtonClicked();
|
void onUndockButtonClicked();
|
||||||
void onTabsMenuActionTriggered(QAction* Action);
|
void onTabsMenuActionTriggered(QAction* Action);
|
||||||
void onCurrentTabChanged(int Index);
|
void onCurrentTabChanged(int Index);
|
||||||
@@ -121,13 +181,18 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Returns the button corresponding to the given title bar button identifier
|
* Returns the button corresponding to the given title bar button identifier
|
||||||
*/
|
*/
|
||||||
QAbstractButton* button(TitleBarButton which) const;
|
CTitleBarButton* button(TitleBarButton which) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the auto hide title label, used when the dock area is expanded and auto hidden
|
* Returns the auto hide title label, used when the dock area is expanded and auto hidden
|
||||||
*/
|
*/
|
||||||
CElidingLabel* autoHideTitleLabel() const;
|
CElidingLabel* autoHideTitleLabel() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the dock area widget that contains this title bar
|
||||||
|
*/
|
||||||
|
CDockAreaWidget* dockAreaWidget() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the visibility of the dock widget actions in the title bar
|
* Updates the visibility of the dock widget actions in the title bar
|
||||||
*/
|
*/
|
||||||
@@ -163,6 +228,22 @@ public:
|
|||||||
*/
|
*/
|
||||||
QString titleBarButtonToolTip(TitleBarButton Button) const;
|
QString titleBarButtonToolTip(TitleBarButton Button) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Moves the dock area into its own floating widget if the area
|
||||||
|
* DockWidgetFloatable flag is true
|
||||||
|
*/
|
||||||
|
void setAreaFloating();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Call this function, to create all the required auto hide controls
|
||||||
|
*/
|
||||||
|
void showAutoHideControls(bool Show);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true, if the auto hide controls are visible
|
||||||
|
*/
|
||||||
|
bool isAutoHide() const;
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
/**
|
/**
|
||||||
* This signal is emitted if a tab in the tab bar is clicked by the user
|
* This signal is emitted if a tab in the tab bar is clicked by the user
|
||||||
|
|||||||
@@ -31,43 +31,12 @@
|
|||||||
// INCLUDES
|
// INCLUDES
|
||||||
//============================================================================
|
//============================================================================
|
||||||
#include <QFrame>
|
#include <QFrame>
|
||||||
#include <QToolButton>
|
|
||||||
|
|
||||||
#include "ads_globals.h"
|
#include "ads_globals.h"
|
||||||
|
|
||||||
namespace ads
|
namespace ads
|
||||||
{
|
{
|
||||||
using tTitleBarButton = QToolButton;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Title bar button of a dock area that customizes tTitleBarButton appearance/behaviour
|
|
||||||
* according to various config flags such as:
|
|
||||||
* CDockManager::DockAreaHas_xxx_Button - if set to 'false' keeps the button always invisible
|
|
||||||
* CDockManager::DockAreaHideDisabledButtons - if set to 'true' hides button when it is disabled
|
|
||||||
*/
|
|
||||||
class CTitleBarButton : public tTitleBarButton
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
private:
|
|
||||||
bool Visible = true;
|
|
||||||
bool HideWhenDisabled = false;
|
|
||||||
|
|
||||||
public:
|
|
||||||
using Super = tTitleBarButton;
|
|
||||||
CTitleBarButton(bool visible = true, QWidget* parent = nullptr);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adjust this visibility change request with our internal settings:
|
|
||||||
*/
|
|
||||||
virtual void setVisible(bool visible) override;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
/**
|
|
||||||
* Handle EnabledChanged signal to set button invisible if the configured
|
|
||||||
*/
|
|
||||||
bool event(QEvent *ev) override;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -83,7 +52,7 @@ class CSpacerWidget : public QWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
using Super = QWidget;
|
using Super = QWidget;
|
||||||
CSpacerWidget(QWidget* Parent = 0);
|
CSpacerWidget(QWidget* Parent = nullptr);
|
||||||
virtual QSize sizeHint() const override {return QSize(0, 0);}
|
virtual QSize sizeHint() const override {return QSize(0, 0);}
|
||||||
virtual QSize minimumSizeHint() const override {return QSize(0, 0);}
|
virtual QSize minimumSizeHint() const override {return QSize(0, 0);}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ class CDockAreaLayout
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
QBoxLayout* m_ParentLayout;
|
QBoxLayout* m_ParentLayout;
|
||||||
QList<QWidget*> m_Widgets;
|
QList<QPointer<QWidget>> m_Widgets;
|
||||||
int m_CurrentIndex = -1;
|
int m_CurrentIndex = -1;
|
||||||
QWidget* m_CurrentWidget = nullptr;
|
QWidget* m_CurrentWidget = nullptr;
|
||||||
|
|
||||||
@@ -140,6 +140,7 @@ public:
|
|||||||
{
|
{
|
||||||
LayoutItem->widget()->setParent(nullptr);
|
LayoutItem->widget()->setParent(nullptr);
|
||||||
}
|
}
|
||||||
|
delete LayoutItem;
|
||||||
m_CurrentWidget = nullptr;
|
m_CurrentWidget = nullptr;
|
||||||
m_CurrentIndex = -1;
|
m_CurrentIndex = -1;
|
||||||
}
|
}
|
||||||
@@ -316,12 +317,12 @@ struct DockAreaWidgetPrivate
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Udpates the enable state of the close and detach button
|
* Updates the enable state of the close and detach button
|
||||||
*/
|
*/
|
||||||
void updateTitleBarButtonStates();
|
void updateTitleBarButtonStates();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Udpates the enable state of the close and detach button
|
* Updates the enable state of the close and detach button
|
||||||
*/
|
*/
|
||||||
void updateTitleBarButtonVisibility(bool isTopLevel);
|
void updateTitleBarButtonVisibility(bool isTopLevel);
|
||||||
|
|
||||||
@@ -369,10 +370,21 @@ void DockAreaWidgetPrivate::updateTitleBarButtonStates()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
TitleBar->button(TitleBarButtonClose)->setEnabled(
|
if (_this->isAutoHide())
|
||||||
_this->features().testFlag(CDockWidget::DockWidgetClosable));
|
{
|
||||||
TitleBar->button(TitleBarButtonUndock)->setEnabled(
|
if (CDockManager::testAutoHideConfigFlag(CDockManager::AutoHideHasCloseButton))
|
||||||
_this->features().testFlag(CDockWidget::DockWidgetFloatable));
|
{
|
||||||
|
TitleBar->button(TitleBarButtonClose)->setEnabled(
|
||||||
|
_this->features().testFlag(CDockWidget::DockWidgetClosable));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TitleBar->button(TitleBarButtonUndock)->setEnabled(
|
||||||
|
_this->features().testFlag(CDockWidget::DockWidgetFloatable));
|
||||||
|
TitleBar->button(TitleBarButtonClose)->setEnabled(
|
||||||
|
_this->features().testFlag(CDockWidget::DockWidgetClosable));
|
||||||
|
}
|
||||||
TitleBar->button(TitleBarButtonAutoHide)->setEnabled(
|
TitleBar->button(TitleBarButtonAutoHide)->setEnabled(
|
||||||
_this->features().testFlag(CDockWidget::DockWidgetPinnable));
|
_this->features().testFlag(CDockWidget::DockWidgetPinnable));
|
||||||
TitleBar->updateDockWidgetActionsButtons();
|
TitleBar->updateDockWidgetActionsButtons();
|
||||||
@@ -389,20 +401,30 @@ void DockAreaWidgetPrivate::updateTitleBarButtonVisibility(bool IsTopLevel)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsTopLevel)
|
bool IsAutoHide = _this->isAutoHide();
|
||||||
|
if (IsAutoHide)
|
||||||
|
{
|
||||||
|
bool ShowCloseButton = CDockManager::testAutoHideConfigFlag(CDockManager::AutoHideHasCloseButton);
|
||||||
|
TitleBar->button(TitleBarButtonClose)->setVisible(ShowCloseButton);
|
||||||
|
TitleBar->button(TitleBarButtonAutoHide)->setVisible(true);
|
||||||
|
TitleBar->button(TitleBarButtonUndock)->setVisible(false);
|
||||||
|
TitleBar->button(TitleBarButtonTabsMenu)->setVisible(false);
|
||||||
|
}
|
||||||
|
else if (IsTopLevel)
|
||||||
{
|
{
|
||||||
TitleBar->button(TitleBarButtonClose)->setVisible(!container->isFloating());
|
TitleBar->button(TitleBarButtonClose)->setVisible(!container->isFloating());
|
||||||
TitleBar->button(TitleBarButtonAutoHide)->setVisible(!container->isFloating());
|
TitleBar->button(TitleBarButtonAutoHide)->setVisible(!container->isFloating());
|
||||||
// Undock and tabs should never show when auto hidden
|
// Undock and tabs should never show when auto hidden
|
||||||
TitleBar->button(TitleBarButtonUndock)->setVisible(!container->isFloating() && !_this->isAutoHide());
|
TitleBar->button(TitleBarButtonUndock)->setVisible(!container->isFloating());
|
||||||
TitleBar->button(TitleBarButtonTabsMenu)->setVisible(!_this->isAutoHide());
|
TitleBar->button(TitleBarButtonTabsMenu)->setVisible(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TitleBar->button(TitleBarButtonClose)->setVisible(true);
|
TitleBar->button(TitleBarButtonClose)->setVisible(true);
|
||||||
TitleBar->button(TitleBarButtonAutoHide)->setVisible(true);
|
bool ShowAutoHideButton = CDockManager::testAutoHideConfigFlag(CDockManager::DockAreaHasAutoHideButton);
|
||||||
TitleBar->button(TitleBarButtonUndock)->setVisible(!_this->isAutoHide());
|
TitleBar->button(TitleBarButtonAutoHide)->setVisible(ShowAutoHideButton);
|
||||||
TitleBar->button(TitleBarButtonTabsMenu)->setVisible(!_this->isAutoHide());
|
TitleBar->button(TitleBarButtonUndock)->setVisible(true);
|
||||||
|
TitleBar->button(TitleBarButtonTabsMenu)->setVisible(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -454,6 +476,13 @@ CAutoHideDockContainer* CDockAreaWidget::autoHideDockContainer() const
|
|||||||
return d->AutoHideDockContainer;
|
return d->AutoHideDockContainer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
CDockSplitter* CDockAreaWidget::parentSplitter() const
|
||||||
|
{
|
||||||
|
return internal::findParent<CDockSplitter*>(this);
|
||||||
|
}
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
bool CDockAreaWidget::isAutoHide() const
|
bool CDockAreaWidget::isAutoHide() const
|
||||||
{
|
{
|
||||||
@@ -466,6 +495,7 @@ void CDockAreaWidget::setAutoHideDockContainer(CAutoHideDockContainer* AutoHideD
|
|||||||
d->AutoHideDockContainer = AutoHideDockContainer;
|
d->AutoHideDockContainer = AutoHideDockContainer;
|
||||||
updateAutoHideButtonCheckState();
|
updateAutoHideButtonCheckState();
|
||||||
updateTitleBarButtonsToolTips();
|
updateTitleBarButtonsToolTips();
|
||||||
|
d->TitleBar->button(TitleBarButtonAutoHide)->setShowInTitleBar(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -589,7 +619,7 @@ void CDockAreaWidget::hideAreaWithNoVisibleContent()
|
|||||||
this->toggleView(false);
|
this->toggleView(false);
|
||||||
|
|
||||||
// Hide empty parent splitters
|
// Hide empty parent splitters
|
||||||
auto Splitter = internal::findParent<CDockSplitter*>(this);
|
auto Splitter = parentSplitter();
|
||||||
internal::hideEmptyParentSplitters(Splitter);
|
internal::hideEmptyParentSplitters(Splitter);
|
||||||
|
|
||||||
//Hide empty floating widget
|
//Hide empty floating widget
|
||||||
@@ -625,15 +655,7 @@ void CDockAreaWidget::hideAreaWithNoVisibleContent()
|
|||||||
void CDockAreaWidget::onTabCloseRequested(int Index)
|
void CDockAreaWidget::onTabCloseRequested(int Index)
|
||||||
{
|
{
|
||||||
ADS_PRINT("CDockAreaWidget::onTabCloseRequested " << Index);
|
ADS_PRINT("CDockAreaWidget::onTabCloseRequested " << Index);
|
||||||
auto* DockWidget = dockWidget(Index);
|
dockWidget(Index)->requestCloseDockWidget();
|
||||||
if (DockWidget->features().testFlag(CDockWidget::DockWidgetDeleteOnClose) || DockWidget->features().testFlag(CDockWidget::CustomCloseHandling))
|
|
||||||
{
|
|
||||||
DockWidget->closeDockWidgetInternal();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
DockWidget->toggleView(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -746,7 +768,7 @@ int CDockAreaWidget::openDockWidgetsCount() const
|
|||||||
int Count = 0;
|
int Count = 0;
|
||||||
for (int i = 0; i < d->ContentsLayout->count(); ++i)
|
for (int i = 0; i < d->ContentsLayout->count(); ++i)
|
||||||
{
|
{
|
||||||
if (!dockWidget(i)->isClosed())
|
if (dockWidget(i) && !dockWidget(i)->isClosed())
|
||||||
{
|
{
|
||||||
++Count;
|
++Count;
|
||||||
}
|
}
|
||||||
@@ -762,7 +784,7 @@ QList<CDockWidget*> CDockAreaWidget::openedDockWidgets() const
|
|||||||
for (int i = 0; i < d->ContentsLayout->count(); ++i)
|
for (int i = 0; i < d->ContentsLayout->count(); ++i)
|
||||||
{
|
{
|
||||||
CDockWidget* DockWidget = dockWidget(i);
|
CDockWidget* DockWidget = dockWidget(i);
|
||||||
if (!DockWidget->isClosed())
|
if (DockWidget && !DockWidget->isClosed())
|
||||||
{
|
{
|
||||||
DockWidgetList.append(dockWidget(i));
|
DockWidgetList.append(dockWidget(i));
|
||||||
}
|
}
|
||||||
@@ -776,7 +798,7 @@ int CDockAreaWidget::indexOfFirstOpenDockWidget() const
|
|||||||
{
|
{
|
||||||
for (int i = 0; i < d->ContentsLayout->count(); ++i)
|
for (int i = 0; i < d->ContentsLayout->count(); ++i)
|
||||||
{
|
{
|
||||||
if (!dockWidget(i)->isClosed())
|
if (dockWidget(i) && !dockWidget(i)->isClosed())
|
||||||
{
|
{
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
@@ -799,7 +821,6 @@ CDockWidget* CDockAreaWidget::dockWidget(int Index) const
|
|||||||
return qobject_cast<CDockWidget*>(d->ContentsLayout->widget(Index));
|
return qobject_cast<CDockWidget*>(d->ContentsLayout->widget(Index));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
void CDockAreaWidget::reorderDockWidget(int fromIndex, int toIndex)
|
void CDockAreaWidget::reorderDockWidget(int fromIndex, int toIndex)
|
||||||
{
|
{
|
||||||
@@ -853,9 +874,7 @@ void CDockAreaWidget::updateTitleBarVisibility()
|
|||||||
|
|
||||||
if (isAutoHideFeatureEnabled())
|
if (isAutoHideFeatureEnabled())
|
||||||
{
|
{
|
||||||
auto tabBar = d->TitleBar->tabBar();
|
d->TitleBar->showAutoHideControls(IsAutoHide);
|
||||||
tabBar->setVisible(!IsAutoHide); // Never show tab bar when auto hidden
|
|
||||||
d->TitleBar->autoHideTitleLabel()->setVisible(IsAutoHide); // Always show when auto hidden, never otherwise
|
|
||||||
updateTitleBarButtonVisibility(Container->topLevelDockArea() == this);
|
updateTitleBarButtonVisibility(Container->topLevelDockArea() == this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1289,17 +1308,17 @@ SideBarLocation CDockAreaWidget::calculateSideTabBarArea() const
|
|||||||
case BorderHorizontalLeft: SideTab = SideBarLocation::SideBarLeft; break;
|
case BorderHorizontalLeft: SideTab = SideBarLocation::SideBarLeft; break;
|
||||||
case BorderHorizontalRight: SideTab = SideBarLocation::SideBarRight; break;
|
case BorderHorizontalRight: SideTab = SideBarLocation::SideBarRight; break;
|
||||||
|
|
||||||
// 3. Its touching horizontal or vertical borders
|
// 3. It's touching horizontal or vertical borders
|
||||||
case BorderVertical : SideTab = SideBarLocation::SideBarBottom; break;
|
case BorderVertical : SideTab = SideBarLocation::SideBarBottom; break;
|
||||||
case BorderHorizontal: SideTab = SideBarLocation::SideBarRight; break;
|
case BorderHorizontal: SideTab = SideBarLocation::SideBarRight; break;
|
||||||
|
|
||||||
// 4. Its in a corner
|
// 4. It's in a corner
|
||||||
case BorderTopLeft : SideTab = HorizontalOrientation ? SideBarLocation::SideBarTop : SideBarLocation::SideBarLeft; break;
|
case BorderTopLeft : SideTab = HorizontalOrientation ? SideBarLocation::SideBarTop : SideBarLocation::SideBarLeft; break;
|
||||||
case BorderTopRight : SideTab = HorizontalOrientation ? SideBarLocation::SideBarTop : SideBarLocation::SideBarRight; break;
|
case BorderTopRight : SideTab = HorizontalOrientation ? SideBarLocation::SideBarTop : SideBarLocation::SideBarRight; break;
|
||||||
case BorderBottomLeft : SideTab = HorizontalOrientation ? SideBarLocation::SideBarBottom : SideBarLocation::SideBarLeft; break;
|
case BorderBottomLeft : SideTab = HorizontalOrientation ? SideBarLocation::SideBarBottom : SideBarLocation::SideBarLeft; break;
|
||||||
case BorderBottomRight : SideTab = HorizontalOrientation ? SideBarLocation::SideBarBottom : SideBarLocation::SideBarRight; break;
|
case BorderBottomRight : SideTab = HorizontalOrientation ? SideBarLocation::SideBarBottom : SideBarLocation::SideBarRight; break;
|
||||||
|
|
||||||
// 5 Ists touching only one border
|
// 5. It's touching only one border
|
||||||
case BorderLeft: SideTab = SideBarLocation::SideBarLeft; break;
|
case BorderLeft: SideTab = SideBarLocation::SideBarLeft; break;
|
||||||
case BorderRight: SideTab = SideBarLocation::SideBarRight; break;
|
case BorderRight: SideTab = SideBarLocation::SideBarRight; break;
|
||||||
case BorderTop: SideTab = SideBarLocation::SideBarTop; break;
|
case BorderTop: SideTab = SideBarLocation::SideBarTop; break;
|
||||||
@@ -1311,7 +1330,7 @@ SideBarLocation CDockAreaWidget::calculateSideTabBarArea() const
|
|||||||
|
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
void CDockAreaWidget::setAutoHide(bool Enable, SideBarLocation Location)
|
void CDockAreaWidget::setAutoHide(bool Enable, SideBarLocation Location, int TabIndex)
|
||||||
{
|
{
|
||||||
if (!isAutoHideFeatureEnabled())
|
if (!isAutoHideFeatureEnabled())
|
||||||
{
|
{
|
||||||
@@ -1322,11 +1341,18 @@ void CDockAreaWidget::setAutoHide(bool Enable, SideBarLocation Location)
|
|||||||
{
|
{
|
||||||
if (isAutoHide())
|
if (isAutoHide())
|
||||||
{
|
{
|
||||||
autoHideDockContainer()->moveContentsToParent();
|
d->AutoHideDockContainer->moveContentsToParent();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If this is already an auto hide container, then move it to new location
|
||||||
|
if (isAutoHide())
|
||||||
|
{
|
||||||
|
d->AutoHideDockContainer->moveToNewSideBarLocation(Location, TabIndex);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
auto area = (SideBarNone == Location) ? calculateSideTabBarArea() : Location;
|
auto area = (SideBarNone == Location) ? calculateSideTabBarArea() : Location;
|
||||||
for (const auto DockWidget : openedDockWidgets())
|
for (const auto DockWidget : openedDockWidgets())
|
||||||
{
|
{
|
||||||
@@ -1340,7 +1366,7 @@ void CDockAreaWidget::setAutoHide(bool Enable, SideBarLocation Location)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
dockContainer()->createAndSetupAutoHideContainer(area, DockWidget);
|
dockContainer()->createAndSetupAutoHideContainer(area, DockWidget, TabIndex++);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1441,6 +1467,13 @@ bool CDockAreaWidget::isTopLevelArea() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
void CDockAreaWidget::setFloating()
|
||||||
|
{
|
||||||
|
d->TitleBar->setAreaFloating();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
//============================================================================
|
//============================================================================
|
||||||
bool CDockAreaWidget::event(QEvent *e)
|
bool CDockAreaWidget::event(QEvent *e)
|
||||||
|
|||||||