Compare commits
154 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
985ff74ccf | ||
|
|
a9aa10f4c2 | ||
|
|
7b30229355 | ||
|
|
4a0b636148 | ||
|
|
544c624f07 | ||
|
|
bbde511603 | ||
|
|
ee3a526adb | ||
|
|
e2c960238d | ||
|
|
62bc6fced7 | ||
|
|
dd83812b29 | ||
|
|
88db64451e | ||
|
|
1a96a06cb6 | ||
|
|
00f88d9666 | ||
|
|
664d02edd4 | ||
|
|
72e5c566b7 | ||
|
|
e78133b7b2 | ||
|
|
f9ad1d7801 | ||
|
|
34b68d6eab | ||
|
|
f8143d5419 | ||
|
|
d01ffe3bee | ||
|
|
87cffe5d40 | ||
|
|
d47d87e4b8 | ||
|
|
3b0f6f92a9 | ||
|
|
12cb417682 | ||
|
|
a674eea1cd | ||
|
|
a2854a7740 | ||
|
|
cd984881e5 | ||
|
|
eb22a9aef6 | ||
|
|
d709230510 | ||
|
|
d467b21960 | ||
|
|
893af516b2 | ||
|
|
9fd5002886 | ||
|
|
39c8407e0c | ||
|
|
e922a1e5bc | ||
|
|
66e10e022b | ||
|
|
3342fd6596 | ||
|
|
c1977c51fa | ||
|
|
dc1e76d60c | ||
|
|
6c073b2833 | ||
|
|
11004ebaa0 | ||
|
|
2583408420 | ||
|
|
dec0442007 | ||
|
|
c020f82a6c | ||
|
|
c1555c30cc | ||
|
|
d6cb127320 | ||
|
|
c2373eb7de | ||
|
|
d5843ff7d3 | ||
|
|
c135782001 | ||
|
|
79c208da4f | ||
|
|
b67c4a0c84 | ||
|
|
6b9105b813 | ||
|
|
6c6e0333a9 | ||
|
|
d55387d087 | ||
|
|
bf9560f8ea | ||
|
|
949ed40006 | ||
|
|
f2a9dd4db4 | ||
|
|
ed67081b74 | ||
|
|
705d931231 | ||
|
|
d1367c9dd4 | ||
|
|
31402ee9f8 | ||
|
|
b7cbac88b3 | ||
|
|
fe8c88771f | ||
|
|
befcd9eadf | ||
|
|
46e5aea61c | ||
|
|
103db689ff | ||
|
|
bc34470d3c | ||
|
|
646bddfea3 | ||
|
|
ec196715e0 | ||
|
|
cb63f0e6ea | ||
|
|
c941b2dfde | ||
|
|
671b932804 | ||
|
|
f76d3b4834 | ||
|
|
c248f79971 | ||
|
|
0566677a9d | ||
|
|
268998961b | ||
|
|
716d6f7f25 | ||
|
|
ceb7c91844 | ||
|
|
0a78dcf460 | ||
|
|
da7d23c127 | ||
|
|
64d80b2c53 | ||
|
|
f2a029a0c6 | ||
|
|
c1b60959ae | ||
|
|
d53728c0a8 | ||
|
|
a7ad4386e4 | ||
|
|
4e90a38c52 | ||
|
|
4947548224 | ||
|
|
991b69cc51 | ||
|
|
df1fa27127 | ||
|
|
936eba01cd | ||
|
|
9f8dd99cac | ||
|
|
90e5adde29 | ||
|
|
ddbed9ea14 | ||
|
|
c305432ab2 | ||
|
|
e836b154eb | ||
|
|
782589523e | ||
|
|
bb105d2ef6 | ||
|
|
483bb7354a | ||
|
|
7d9f9b43a7 | ||
|
|
7fd5cbe9d7 | ||
|
|
a16d17a8bf | ||
|
|
faf24cd531 | ||
|
|
979d76aa47 | ||
|
|
0a55bcd586 | ||
|
|
f41a6f06fe | ||
|
|
349d584228 | ||
|
|
fcad7763ff | ||
|
|
1bec4234c3 | ||
|
|
0be5ba8cf6 | ||
|
|
7245dced84 | ||
|
|
e2f611ea9a | ||
|
|
1f21eb0200 | ||
|
|
f2378636e2 | ||
|
|
509b2356d1 | ||
|
|
30b802bd10 | ||
|
|
e857421fdf | ||
|
|
8dcdc8fad2 | ||
|
|
f964ce2c68 | ||
|
|
eb9b439d11 | ||
|
|
a13ed7e4d6 | ||
|
|
8cfa5c8e0e | ||
|
|
2878559ee6 | ||
|
|
6ff39bccf8 | ||
|
|
952131a1e9 | ||
|
|
5edbcc1970 | ||
|
|
04f6d9168e | ||
|
|
cea1327dac | ||
|
|
1c41cbff82 | ||
|
|
06e8451fc0 | ||
|
|
3ff6918b1f | ||
|
|
ac3af4c6cd | ||
|
|
41bb861417 | ||
|
|
6e63418798 | ||
|
|
65781b7cac | ||
|
|
d7e6c613c6 | ||
|
|
8da0713bf0 | ||
|
|
08da925fde | ||
|
|
fb58c435ef | ||
|
|
6bf593ef4b | ||
|
|
6b3b7750cb | ||
|
|
541db8e214 | ||
|
|
644c828f00 | ||
|
|
ed6636ae26 | ||
|
|
1a543e946d | ||
|
|
9bdefd6055 | ||
|
|
8fd691968c | ||
|
|
7abc698d09 | ||
|
|
5b23248fb8 | ||
|
|
46a5cee9c9 | ||
|
|
6c2c9888be | ||
|
|
44ff9e9956 | ||
|
|
f848df74c3 | ||
|
|
6c98c29855 | ||
|
|
c34d479d5c | ||
|
|
a7a97e6978 |
151
.appveyor.yml
@@ -1,151 +0,0 @@
|
|||||||
version: '{build}'
|
|
||||||
branches:
|
|
||||||
only:
|
|
||||||
- master
|
|
||||||
|
|
||||||
image: Visual Studio 2017
|
|
||||||
|
|
||||||
environment:
|
|
||||||
global:
|
|
||||||
# Appveyor doesn't have Qt 12 yet
|
|
||||||
LatestQtVersion: 5.13
|
|
||||||
matrix:
|
|
||||||
# 32 bit builds
|
|
||||||
# MSVC 2015 builds
|
|
||||||
# Dynamic Library builds
|
|
||||||
# LTS version of Qt, dll, 32bit, MSVC 2015, qmake
|
|
||||||
- QT5: C:\Qt\%LatestQtVersion%\msvc2017
|
|
||||||
COMPILER: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build
|
|
||||||
targetPlatform: x86
|
|
||||||
use_mingw: "false"
|
|
||||||
use_static: "false"
|
|
||||||
use_cmake: "false"
|
|
||||||
# LTS version of Qt, dll, 32bit, MSVC 2015, cmake
|
|
||||||
- QT5: C:\Qt\%LatestQtVersion%\msvc2017
|
|
||||||
COMPILER: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build
|
|
||||||
targetPlatform: x86
|
|
||||||
use_mingw: "false"
|
|
||||||
use_static: "false"
|
|
||||||
use_cmake: "true"
|
|
||||||
# end Dynamic Library builds
|
|
||||||
# Static Library builds
|
|
||||||
# LTS version of Qt, static, 32bit, MSVC 2015, qmake
|
|
||||||
- QT5: C:\Qt\%LatestQtVersion%\msvc2017
|
|
||||||
COMPILER: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build
|
|
||||||
targetPlatform: x86
|
|
||||||
use_mingw: "false"
|
|
||||||
use_static: "true"
|
|
||||||
use_cmake: "false"
|
|
||||||
# LTS version of Qt, static, 32bit, MSVC 2015, cmake
|
|
||||||
- QT5: C:\Qt\%LatestQtVersion%\msvc2017
|
|
||||||
COMPILER: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build
|
|
||||||
targetPlatform: x86
|
|
||||||
use_mingw: "false"
|
|
||||||
use_static: "true"
|
|
||||||
use_cmake: "true"
|
|
||||||
# end Static Library builds
|
|
||||||
# end MSVC 2015 builds
|
|
||||||
# MinGW builds
|
|
||||||
# Dynamic Library builds
|
|
||||||
# LTS version of Qt, dll, 32bit, MinGW, qmake
|
|
||||||
- QT5: C:\Qt\%LatestQtVersion%\mingw73_32
|
|
||||||
COMPILER: C:\Qt\Tools\mingw730_32
|
|
||||||
targetPlatform: x86
|
|
||||||
use_mingw: "true"
|
|
||||||
use_static: "false"
|
|
||||||
use_cmake: "false"
|
|
||||||
# LTS version of Qt, dll, 32bit, MinGW, cmake
|
|
||||||
- QT5: C:\Qt\%LatestQtVersion%\mingw73_32
|
|
||||||
COMPILER: C:\Qt\Tools\mingw730_32
|
|
||||||
targetPlatform: x86
|
|
||||||
use_mingw: "true"
|
|
||||||
use_static: "false"
|
|
||||||
use_cmake: "true"
|
|
||||||
# end Dynamic Library builds
|
|
||||||
# Static Library builds
|
|
||||||
# LTS version of Qt, static, 32bit, MinGW, qmake
|
|
||||||
- QT5: C:\Qt\%LatestQtVersion%\mingw73_32
|
|
||||||
COMPILER: C:\Qt\Tools\mingw730_32
|
|
||||||
targetPlatform: x86
|
|
||||||
use_mingw: "true"
|
|
||||||
use_static: "true"
|
|
||||||
use_cmake: "false"
|
|
||||||
# LTS version of Qt, static, 32bit, MinGW, cmake
|
|
||||||
- QT5: C:\Qt\%LatestQtVersion%\mingw73_32
|
|
||||||
COMPILER: C:\Qt\Tools\mingw730_32
|
|
||||||
targetPlatform: x86
|
|
||||||
use_mingw: "true"
|
|
||||||
use_static: "true"
|
|
||||||
use_cmake: "true"
|
|
||||||
# end Static Library builds
|
|
||||||
# end MinGW builds
|
|
||||||
# end 32 bit builds
|
|
||||||
# 64 bit builds
|
|
||||||
# MSVC 2015 builds
|
|
||||||
# Dynamic Library builds
|
|
||||||
# LTS version of Qt, dll, 64bit, MSVC 2015, qmake
|
|
||||||
- QT5: C:\Qt\%LatestQtVersion%\msvc2017_64
|
|
||||||
COMPILER: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build
|
|
||||||
targetPlatform: amd64
|
|
||||||
use_mingw: "false"
|
|
||||||
use_static: "false"
|
|
||||||
use_cmake: "false"
|
|
||||||
# LTS version of Qt, dll, 64bit, MSVC 2015, cmake
|
|
||||||
- QT5: C:\Qt\%LatestQtVersion%\msvc2017_64
|
|
||||||
COMPILER: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build
|
|
||||||
targetPlatform: amd64
|
|
||||||
use_mingw: "false"
|
|
||||||
use_static: "false"
|
|
||||||
use_cmake: "true"
|
|
||||||
# end Dynamic Library builds
|
|
||||||
# Static Library builds
|
|
||||||
# LTS version of Qt, static, 64bit, MSVC 2015, qmake
|
|
||||||
- QT5: C:\Qt\%LatestQtVersion%\msvc2017_64
|
|
||||||
COMPILER: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build
|
|
||||||
targetPlatform: amd64
|
|
||||||
use_mingw: "false"
|
|
||||||
use_static: "true"
|
|
||||||
use_cmake: "false"
|
|
||||||
# LTS version of Qt, static, 64bit, MSVC 2015, cmake
|
|
||||||
- QT5: C:\Qt\%LatestQtVersion%\msvc2017_64
|
|
||||||
COMPILER: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build
|
|
||||||
targetPlatform: amd64
|
|
||||||
use_mingw: "false"
|
|
||||||
use_static: "true"
|
|
||||||
use_cmake: "true"
|
|
||||||
# end Static Library builds
|
|
||||||
# end MSVC 2015 builds
|
|
||||||
# end 64 bit builds
|
|
||||||
|
|
||||||
matrix:
|
|
||||||
fast_finish: true
|
|
||||||
|
|
||||||
before_build:
|
|
||||||
- set originalWD=%CD%
|
|
||||||
- call "%QT5%\bin\qtenv2.bat"
|
|
||||||
- cd /D %originalWD%
|
|
||||||
- if %use_mingw%==false call "%COMPILER%\vcvarsall.bat" %targetPlatform%
|
|
||||||
- if %use_static%==true (set USESTATIC=ON) else (set USESTATIC=OFF)
|
|
||||||
- if %use_mingw%==true (set CMAKEGENERATOR="MinGW Makefiles") else (set CMAKEGENERATOR="NMake Makefiles")
|
|
||||||
- if %use_mingw%==true (set MAKEENGINE=mingw32-make) else (set MAKEENGINE=nmake)
|
|
||||||
- if %use_mingw%==true set PATH=%PATH:C:\Program Files\Git\usr\bin;=%
|
|
||||||
|
|
||||||
build_script:
|
|
||||||
- if %use_cmake%==true mkdir build
|
|
||||||
- if %use_cmake%==true cd build
|
|
||||||
- if %use_cmake%==true cmake --version
|
|
||||||
- if %use_cmake%==true cmake -G %CMAKEGENERATOR% -DCMAKE_BUILD_TYPE=DEBUG -DBUILD_EXAMPLES=ON -DCMAKE_DEBUG_POSTFIX=d -DBUILD_STATIC=%USESTATIC% -DCMAKE_INSTALL_PREFIX="./installed" ../
|
|
||||||
- if %use_cmake%==true cmake --build .
|
|
||||||
- if %use_cmake%==true cmake --build . --target install
|
|
||||||
- if %use_cmake%==true cmake -G %CMAKEGENERATOR% -DCMAKE_BUILD_TYPE=RELEASE -DBUILD_EXAMPLES=ON -DBUILD_STATIC=%USESTATIC% -DCMAKE_INSTALL_PREFIX="./installed" ../
|
|
||||||
- if %use_cmake%==true cmake --build .
|
|
||||||
- if %use_cmake%==true cmake --build . --target install
|
|
||||||
- if %use_cmake%==false if %use_static%==true qmake "CONFIG+=adsBuildStatic"
|
|
||||||
- if %use_cmake%==false if %use_static%==false qmake
|
|
||||||
- if %use_cmake%==false %MAKEENGINE% debug
|
|
||||||
- if %use_cmake%==false %MAKEENGINE% install
|
|
||||||
- if %use_cmake%==false %MAKEENGINE% release
|
|
||||||
- if %use_cmake%==false %MAKEENGINE% install
|
|
||||||
|
|
||||||
after_build:
|
|
||||||
- if %use_mingw%==true set PATH=C:\Program Files\Git\usr\bin;%PATH%
|
|
||||||
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
|
||||||
57
.github/workflows/linux-builds.yml
vendored
@@ -1,26 +1,51 @@
|
|||||||
name: linux-builds
|
name: linux-builds
|
||||||
|
|
||||||
on: [push]
|
on:
|
||||||
|
push:
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build_ubuntu_2204_cmake:
|
||||||
strategy:
|
runs-on: ubuntu-22.04
|
||||||
matrix:
|
|
||||||
os: [ubuntu-20.04]
|
|
||||||
|
|
||||||
runs-on: ${{ matrix.os }}
|
env:
|
||||||
|
QT_VERSION: 6.4.2
|
||||||
|
QT_DIR: ${{ github.workspace }}/Qt
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- name: Checkout source
|
||||||
- name: install qt
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0 # Fetch full history and tags
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update --fix-missing
|
sudo apt-get update
|
||||||
sudo apt-get install qt5-default
|
sudo apt-get install -y build-essential cmake ninja-build libgl1-mesa-dev libxkbcommon-x11-0 libx11-dev
|
||||||
sudo apt-get install qtbase5-private-dev qtdeclarative5-dev
|
|
||||||
- name: qmake
|
- name: Install Qt
|
||||||
run: qmake
|
uses: jurplel/install-qt-action@v3
|
||||||
- name: make
|
with:
|
||||||
run: make -j4
|
version: ${{ env.QT_VERSION }}
|
||||||
|
target: desktop
|
||||||
|
host: linux
|
||||||
|
arch: gcc_64
|
||||||
|
dir: ${{ env.QT_DIR }}
|
||||||
|
setup-python: false
|
||||||
|
|
||||||
|
- name: Configure with CMake
|
||||||
|
run: |
|
||||||
|
cmake -S . -B build \
|
||||||
|
-DCMAKE_PREFIX_PATH="${{ env.QT_DIR }}/Qt/${{ env.QT_VERSION }}/gcc_64" \
|
||||||
|
-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/install \
|
||||||
|
-DCMAKE_BUILD_TYPE=Release \
|
||||||
|
-G Ninja
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: cmake --build build
|
||||||
|
|
||||||
|
- name: Run CMake install (optional)
|
||||||
|
run: cmake --install build
|
||||||
|
|
||||||
build_ubuntu_2204:
|
build_ubuntu_2204:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
@@ -28,7 +53,7 @@ jobs:
|
|||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Cache Qt
|
- name: Cache Qt
|
||||||
id: cache-qt-6-4
|
id: cache-qt-6-4
|
||||||
uses: actions/cache@v1 # not v2!
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: ../Qt/6.4.2
|
path: ../Qt/6.4.2
|
||||||
key: ${{ runner.os }}-QtCache-Qt6-4
|
key: ${{ runner.os }}-QtCache-Qt6-4
|
||||||
|
|||||||
102
.github/workflows/windows-cmake.yml
vendored
Normal file
@@ -0,0 +1,102 @@
|
|||||||
|
name: windows-builds
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build_windows_msvc:
|
||||||
|
name: Build with MSVC and Ninja
|
||||||
|
runs-on: windows-2022
|
||||||
|
|
||||||
|
env:
|
||||||
|
QT_VERSION: 6.4.2
|
||||||
|
QT_DIR: ${{ github.workspace }}\Qt
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: 📦 Checkout source code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: ⚙️ Install Ninja build system
|
||||||
|
run: choco install ninja --no-progress
|
||||||
|
|
||||||
|
- name: 📥 Install Qt for MSVC
|
||||||
|
uses: jurplel/install-qt-action@v3
|
||||||
|
with:
|
||||||
|
version: ${{ env.QT_VERSION }}
|
||||||
|
target: desktop
|
||||||
|
host: windows
|
||||||
|
arch: win64_msvc2019_64
|
||||||
|
dir: ${{ env.QT_DIR }}
|
||||||
|
setup-python: false
|
||||||
|
|
||||||
|
- name: 🏗️ Setup MSVC Developer Environment
|
||||||
|
uses: TheMrMilchmann/setup-msvc-dev@v3
|
||||||
|
with:
|
||||||
|
arch: x64
|
||||||
|
|
||||||
|
- name: 🛠️ Configure CMake with Ninja + MSVC
|
||||||
|
run: |
|
||||||
|
cmake -S . -B build -G Ninja `
|
||||||
|
-DCMAKE_PREFIX_PATH="${{ env.QT_DIR }}\Qt\${{ env.QT_VERSION }}\msvc2019_64" `
|
||||||
|
-DCMAKE_INSTALL_PREFIX="${{ github.workspace }}\install" `
|
||||||
|
-DCMAKE_BUILD_TYPE=Release
|
||||||
|
shell: powershell
|
||||||
|
|
||||||
|
- name: 🔨 Build with Ninja + MSVC
|
||||||
|
run: cmake --build build
|
||||||
|
shell: powershell
|
||||||
|
|
||||||
|
- name: 📦 Install built files
|
||||||
|
run: cmake --install build
|
||||||
|
shell: powershell
|
||||||
|
|
||||||
|
build_windows_mingw:
|
||||||
|
name: Build with Qt's MinGW and CMake (no Ninja)
|
||||||
|
runs-on: windows-2022
|
||||||
|
|
||||||
|
env:
|
||||||
|
QT_VERSION: 6.8.3
|
||||||
|
QT_DIR: ${{ github.workspace }}\Qt
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: 📦 Checkout source code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: 📥 Install Qt + MinGW
|
||||||
|
uses: jurplel/install-qt-action@v4
|
||||||
|
with:
|
||||||
|
aqtversion: '==3.1.19'
|
||||||
|
version: ${{ env.QT_VERSION }}
|
||||||
|
target: desktop
|
||||||
|
host: windows
|
||||||
|
arch: win64_mingw
|
||||||
|
dir: ${{ env.QT_DIR }}
|
||||||
|
tools: 'tools_mingw1310'
|
||||||
|
setup-python: false
|
||||||
|
|
||||||
|
- name: ➕ Add Qt-bundled MinGW to PATH
|
||||||
|
shell: powershell
|
||||||
|
run: |
|
||||||
|
echo "${{ env.QT_DIR }}\Tools\mingw1310_64\bin" >> $env:GITHUB_PATH
|
||||||
|
|
||||||
|
- name: 🛠️ Configure CMake (MinGW)
|
||||||
|
shell: powershell
|
||||||
|
run: |
|
||||||
|
cmake -S . -B build-mingw `
|
||||||
|
-DCMAKE_PREFIX_PATH="${{ env.QT_DIR }}\Qt\${{ env.QT_VERSION }}\mingw_64" `
|
||||||
|
-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}\install `
|
||||||
|
-DCMAKE_BUILD_TYPE=Release `
|
||||||
|
-G "MinGW Makefiles"
|
||||||
|
|
||||||
|
- name: 🔨 Build with CMake (MinGW)
|
||||||
|
shell: powershell
|
||||||
|
run: cmake --build build-mingw -- -j2
|
||||||
|
|
||||||
|
- name: 📦 Install built files (MinGW)
|
||||||
|
shell: powershell
|
||||||
|
run: cmake --install build-mingw
|
||||||
2
.gitignore
vendored
@@ -9,7 +9,7 @@ ui_*
|
|||||||
Makefile
|
Makefile
|
||||||
*.dll
|
*.dll
|
||||||
*.a
|
*.a
|
||||||
build-*
|
build*
|
||||||
|
|
||||||
# IDEs
|
# IDEs
|
||||||
.idea
|
.idea
|
||||||
|
|||||||
233
.travis.yml
@@ -1,233 +0,0 @@
|
|||||||
language: cpp
|
|
||||||
# gcc is clang on mac
|
|
||||||
compiler: gcc
|
|
||||||
|
|
||||||
matrix:
|
|
||||||
fast_finish: true
|
|
||||||
include:
|
|
||||||
- name: Ubuntu qmake Qt5.5.1
|
|
||||||
os: linux
|
|
||||||
dist: trusty
|
|
||||||
group: stable
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
- sourceline: 'ppa:beineri/opt-qt551-trusty'
|
|
||||||
update: true
|
|
||||||
packages:
|
|
||||||
- qt55base
|
|
||||||
- qt55tools
|
|
||||||
- gcc-9
|
|
||||||
- g++-9
|
|
||||||
script:
|
|
||||||
- PATH="/opt/qt55/bin:$PATH"
|
|
||||||
- CXX="g++-9"
|
|
||||||
- CC="gcc-9"
|
|
||||||
- qt55-env.sh
|
|
||||||
- qmake
|
|
||||||
- make
|
|
||||||
- make install
|
|
||||||
- name: Ubuntu qmake dll
|
|
||||||
os: linux
|
|
||||||
dist: bionic
|
|
||||||
group: stable
|
|
||||||
services:
|
|
||||||
- xvfb
|
|
||||||
compiler: gcc
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
- sourceline: 'ppa:beineri/opt-qt-5.14.2-bionic'
|
|
||||||
update: true
|
|
||||||
packages:
|
|
||||||
- qt514base
|
|
||||||
- qt514tools
|
|
||||||
- gcc-9
|
|
||||||
- g++-9
|
|
||||||
- libc6-i386
|
|
||||||
- libgl-dev
|
|
||||||
- libgl1-mesa-dev
|
|
||||||
- mesa-common-dev
|
|
||||||
script:
|
|
||||||
- PATH="/opt/qt514/bin:$PATH"
|
|
||||||
- CXX="g++-9"
|
|
||||||
- CC="gcc-9"
|
|
||||||
- qt514-env.sh
|
|
||||||
- qmake
|
|
||||||
- make
|
|
||||||
- make install
|
|
||||||
- name: Ubuntu qmake static
|
|
||||||
os: linux
|
|
||||||
dist: bionic
|
|
||||||
group: stable
|
|
||||||
services:
|
|
||||||
- xvfb
|
|
||||||
compiler: gcc
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
- sourceline: 'ppa:beineri/opt-qt-5.14.2-bionic'
|
|
||||||
update: true
|
|
||||||
packages:
|
|
||||||
- qt514base
|
|
||||||
- qt514tools
|
|
||||||
- gcc-9
|
|
||||||
- g++-9
|
|
||||||
- libc6-i386
|
|
||||||
- libgl-dev
|
|
||||||
- libgl1-mesa-dev
|
|
||||||
- mesa-common-dev
|
|
||||||
script:
|
|
||||||
- PATH="/opt/qt514/bin:$PATH"
|
|
||||||
- CXX="g++-9"
|
|
||||||
- CC="gcc-9"
|
|
||||||
- qt514-env.sh
|
|
||||||
- qmake "CONFIG+=adsBuildStatic"
|
|
||||||
- make
|
|
||||||
- make install
|
|
||||||
- name: Ubuntu CMake dll
|
|
||||||
os: linux
|
|
||||||
dist: bionic
|
|
||||||
group: stable
|
|
||||||
services:
|
|
||||||
- xvfb
|
|
||||||
compiler: gcc
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
- sourceline: 'ppa:beineri/opt-qt-5.14.2-bionic'
|
|
||||||
update: true
|
|
||||||
packages:
|
|
||||||
- qt514base
|
|
||||||
- qt514tools
|
|
||||||
- gcc-9
|
|
||||||
- g++-9
|
|
||||||
- libc6-i386
|
|
||||||
- libgl-dev
|
|
||||||
- libgl1-mesa-dev
|
|
||||||
- mesa-common-dev
|
|
||||||
script:
|
|
||||||
- PATH="/opt/qt514/bin:$PATH"
|
|
||||||
- CXX="g++-9"
|
|
||||||
- CC="gcc-9"
|
|
||||||
- qt514-env.sh
|
|
||||||
- mkdir ./build
|
|
||||||
- cd ./build
|
|
||||||
- cmake --version
|
|
||||||
- cmake -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=RELEASE -DBUILD_STATIC=OFF -DBUILD_EXAMPLES=ON -DCMAKE_INSTALL_PREFIX="./installed" ../
|
|
||||||
- cmake --build .
|
|
||||||
- cmake --build . --target install
|
|
||||||
- cmake -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=DEBUG -DBUILD_STATIC=OFF -DBUILD_EXAMPLES=ON -DCMAKE_DEBUG_POSTFIX=d -DCMAKE_INSTALL_PREFIX="./installed" ../
|
|
||||||
- cmake --build .
|
|
||||||
- cmake --build . --target install
|
|
||||||
- name: Ubuntu CMake Static
|
|
||||||
os: linux
|
|
||||||
dist: bionic
|
|
||||||
group: stable
|
|
||||||
services:
|
|
||||||
- xvfb
|
|
||||||
compiler: gcc
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
- sourceline: 'ppa:beineri/opt-qt-5.14.2-bionic'
|
|
||||||
update: true
|
|
||||||
packages:
|
|
||||||
- qt514base
|
|
||||||
- qt514tools
|
|
||||||
- gcc-9
|
|
||||||
- g++-9
|
|
||||||
- libc6-i386
|
|
||||||
- libgl-dev
|
|
||||||
- libgl1-mesa-dev
|
|
||||||
- mesa-common-dev
|
|
||||||
script:
|
|
||||||
- PATH="/opt/qt514/bin:$PATH"
|
|
||||||
- CXX="g++-9"
|
|
||||||
- CC="gcc-9"
|
|
||||||
- qt514-env.sh
|
|
||||||
- mkdir ./build
|
|
||||||
- cd ./build
|
|
||||||
- cmake --version
|
|
||||||
- cmake -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=RELEASE -DBUILD_STATIC=ON -DBUILD_EXAMPLES=ON -DCMAKE_INSTALL_PREFIX="./installed" ../
|
|
||||||
- cmake --build .
|
|
||||||
- cmake --build . --target install
|
|
||||||
- cmake -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=DEBUG -DBUILD_STATIC=ON -DBUILD_EXAMPLES=ON -DCMAKE_DEBUG_POSTFIX=d -DCMAKE_INSTALL_PREFIX="./installed" ../
|
|
||||||
- cmake --build .
|
|
||||||
- cmake --build . --target install
|
|
||||||
- name: macOS CMake dll
|
|
||||||
os: osx
|
|
||||||
osx_image: xcode11.3
|
|
||||||
compiler: clang
|
|
||||||
addons:
|
|
||||||
homebrew:
|
|
||||||
packages:
|
|
||||||
- qt
|
|
||||||
update: true
|
|
||||||
script:
|
|
||||||
- PATH="/usr/local/opt/qt5/bin:$PATH"
|
|
||||||
- mkdir -p build
|
|
||||||
- cd build
|
|
||||||
- cmake --version
|
|
||||||
- cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=DEBUG -DCMAKE_DEBUG_POSTFIX=_debug -DBUILD_EXAMPLES=ON -DBUILD_STATIC=OFF -DCMAKE_INSTALL_PREFIX="./installed" ../
|
|
||||||
- cmake --build .
|
|
||||||
- cmake --build . --target install
|
|
||||||
- cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=RELEASE -DBUILD_EXAMPLES=ON -DBUILD_STATIC=OFF -DCMAKE_INSTALL_PREFIX="./installed" ../
|
|
||||||
- cmake --build .
|
|
||||||
- cmake --build . --target install
|
|
||||||
- name: macOS CMake static
|
|
||||||
os: osx
|
|
||||||
osx_image: xcode11.3
|
|
||||||
compiler: clang
|
|
||||||
addons:
|
|
||||||
homebrew:
|
|
||||||
packages:
|
|
||||||
- qt
|
|
||||||
update: true
|
|
||||||
script:
|
|
||||||
- PATH="/usr/local/opt/qt5/bin:$PATH"
|
|
||||||
- mkdir -p build
|
|
||||||
- cd build
|
|
||||||
- cmake --version
|
|
||||||
- cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=DEBUG -DCMAKE_DEBUG_POSTFIX=_debug -DBUILD_EXAMPLES=ON -DBUILD_STATIC=ON -DCMAKE_INSTALL_PREFIX="./installed" ../
|
|
||||||
- cmake --build .
|
|
||||||
- cmake --build . --target install
|
|
||||||
- cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=RELEASE -DBUILD_EXAMPLES=ON -DBUILD_STATIC=ON -DCMAKE_INSTALL_PREFIX="./installed" ../
|
|
||||||
- cmake --build .
|
|
||||||
- cmake --build . --target install
|
|
||||||
- name: macOS qmake dll
|
|
||||||
os: osx
|
|
||||||
osx_image: xcode11.3
|
|
||||||
compiler: clang
|
|
||||||
addons:
|
|
||||||
homebrew:
|
|
||||||
packages:
|
|
||||||
- qt
|
|
||||||
update: true
|
|
||||||
script:
|
|
||||||
- PATH="/usr/local/opt/qt5/bin:$PATH"
|
|
||||||
- qmake
|
|
||||||
- make
|
|
||||||
- make install
|
|
||||||
- name: macOS qmake static
|
|
||||||
os: osx
|
|
||||||
osx_image: xcode11.3
|
|
||||||
compiler: clang
|
|
||||||
addons:
|
|
||||||
homebrew:
|
|
||||||
packages:
|
|
||||||
- qt
|
|
||||||
update: true
|
|
||||||
script:
|
|
||||||
- PATH="/usr/local/opt/qt5/bin:$PATH"
|
|
||||||
- qmake "CONFIG+=adsBuildStatic"
|
|
||||||
- make
|
|
||||||
- make install
|
|
||||||
notifications:
|
|
||||||
email: false
|
|
||||||
|
|
||||||
@@ -1,26 +1,35 @@
|
|||||||
cmake_minimum_required(VERSION 3.5)
|
cmake_minimum_required(VERSION 3.16)
|
||||||
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
if (POLICY CMP0091)
|
if (POLICY CMP0091)
|
||||||
cmake_policy(SET CMP0091 NEW)
|
cmake_policy(SET CMP0091 NEW)
|
||||||
endif (POLICY CMP0091)
|
endif (POLICY CMP0091)
|
||||||
|
|
||||||
|
# Add cmake modules path (required for Versioning.cmake and git revision description)
|
||||||
|
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH})
|
||||||
|
|
||||||
# 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
|
||||||
# used independently of its original git repo (e.g. vendored in another project)
|
# used independently of its original git repo (e.g. vendored in another project)
|
||||||
if(NOT ADS_VERSION)
|
if(NOT ADS_VERSION)
|
||||||
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH})
|
|
||||||
include(GetGitRevisionDescription)
|
include(GetGitRevisionDescription)
|
||||||
git_describe(GitTagVersion --tags)
|
git_describe(GitTagVersion --tags)
|
||||||
string(REGEX REPLACE "^([0-9]+)\\..*" "\\1" VERSION_MAJOR "${GitTagVersion}")
|
string(REGEX REPLACE "^([0-9]+)\\..*" "\\1" VERSION_MAJOR "${GitTagVersion}")
|
||||||
string(REGEX REPLACE "^[0-9]+\\.([0-9]+).*" "\\1" VERSION_MINOR "${GitTagVersion}")
|
string(REGEX REPLACE "^[0-9]+\\.([0-9]+).*" "\\1" VERSION_MINOR "${GitTagVersion}")
|
||||||
string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" VERSION_PATCH "${GitTagVersion}")
|
string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" VERSION_PATCH "${GitTagVersion}")
|
||||||
set(VERSION_SHORT "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
|
set(VERSION_SHORT "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
|
||||||
|
set(VERSION_SONAME "${VERSION_MAJOR}")
|
||||||
else()
|
else()
|
||||||
string(REGEX MATCHALL "[\.]" VERSION_DOT_MATCHES ${ADS_VERSION})
|
string(REGEX MATCHALL "[\.]" VERSION_DOT_MATCHES ${ADS_VERSION})
|
||||||
list(LENGTH VERSION_DOT_MATCHES VERSION_DOT_COUNT)
|
list(LENGTH VERSION_DOT_MATCHES VERSION_DOT_COUNT)
|
||||||
if(VERSION_DOT_COUNT EQUAL 2)
|
if(VERSION_DOT_COUNT EQUAL 2)
|
||||||
set(VERSION_SHORT ${ADS_VERSION})
|
set(VERSION_SHORT ${ADS_VERSION})
|
||||||
|
string(REGEX REPLACE "^([0-9]+)\\..*" "\\1" VERSION_SONAME "${ADS_VERSION}")
|
||||||
|
# Set PROJECT_VERSION_* variables for Versioning.cmake
|
||||||
|
string(REGEX MATCHALL "[0-9]+" VERSION_PARTS "${ADS_VERSION}")
|
||||||
|
list(GET VERSION_PARTS 0 PROJECT_VERSION_MAJOR)
|
||||||
|
list(GET VERSION_PARTS 1 PROJECT_VERSION_MINOR)
|
||||||
|
list(GET VERSION_PARTS 2 PROJECT_VERSION_PATCH)
|
||||||
else()
|
else()
|
||||||
message(FATAL_ERROR "ADS_VERSION must be in major.minor.patch format, e.g. 3.8.1. Got ${ADS_VERSION}")
|
message(FATAL_ERROR "ADS_VERSION must be in major.minor.patch format, e.g. 3.8.1. Got ${ADS_VERSION}")
|
||||||
endif()
|
endif()
|
||||||
@@ -32,10 +41,15 @@ project(QtADS LANGUAGES CXX VERSION ${VERSION_SHORT})
|
|||||||
option(BUILD_STATIC "Build the static library" OFF)
|
option(BUILD_STATIC "Build the static library" OFF)
|
||||||
option(BUILD_EXAMPLES "Build the examples" ON)
|
option(BUILD_EXAMPLES "Build the examples" ON)
|
||||||
|
|
||||||
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "4")
|
# Platform directory: auto-detected based on pointer size, or manually set
|
||||||
set(ads_PlatformDir "x86")
|
if(NOT ADS_PLATFORM_DIR)
|
||||||
|
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "4")
|
||||||
|
set(ads_PlatformDir "x86")
|
||||||
|
else()
|
||||||
|
set(ads_PlatformDir "x64")
|
||||||
|
endif()
|
||||||
else()
|
else()
|
||||||
set(ads_PlatformDir "x64")
|
set(ads_PlatformDir "${ADS_PLATFORM_DIR}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
|
|||||||
106
README.md
@@ -4,10 +4,10 @@
|
|||||||
|
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
[](https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/releases/latest)
|
[](https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/releases/latest)
|
||||||
[](gnu-lgpl-v2.1.md)
|
[](gnu-lgpl-v2.1.md)
|
||||||
[](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)
|
||||||
[](https://ci.appveyor.com/project/githubuser0xFFFF/qt-advanced-docking-system/branch/master)
|
[](https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/actions/workflows/windows-cmake.yml)
|
||||||
[](https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/graphs/contributors)
|
[](https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/graphs/contributors)
|
||||||
|
|
||||||
Qt Advanced Docking System lets you create customizable layouts using a full
|
Qt Advanced Docking System lets you create customizable layouts using a full
|
||||||
@@ -15,13 +15,25 @@ featured window docking system similar to what is found in many popular
|
|||||||
integrated development environments (IDEs) such as Visual Studio.
|
integrated development environments (IDEs) such as Visual Studio.
|
||||||
|
|
||||||
- [What's new...](https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/releases/latest)
|
- [What's new...](https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/releases/latest)
|
||||||
- [Documentation](doc/user-guide.md)
|
- [Documentation](https://githubuser0xffff.github.io/Qt-Advanced-Docking-System/doc/user-guide.html)
|
||||||
- Original Repository: https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System
|
- Original Repository: [https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System](https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System)
|
||||||
|
|
||||||
[](https://www.youtube.com/watch?v=7pdNfafg3Qc)
|
[](https://www.youtube.com/watch?v=7pdNfafg3Qc)
|
||||||
|
|
||||||
## New and Noteworthy
|
## New and Noteworthy
|
||||||
|
|
||||||
|
### Release 4.5
|
||||||
|
|
||||||
|
#### Tabs at Bottom
|
||||||
|
|
||||||
|
A new global dock manager flag `TabsAtBottom` has been added to configuration flags. This flag allows to configure if the tabs of dock areas are shown at the top (default) or at the bottom of the respective container.
|
||||||
|
|
||||||
|
If the flag is set, tabs will be shown at the bottom instead of in the title bar.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### Release 4.1
|
||||||
|
|
||||||
Release [4.1](https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/releases/latest) significantly improves the Auto-Hide functionality and also brings improvements
|
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:
|
for Drag and Drop of dock widgets into dock area tabs. These are the highlights of the new version:
|
||||||
|
|
||||||
@@ -141,6 +153,9 @@ know it from Visual Studio.
|
|||||||
### Overview
|
### Overview
|
||||||
|
|
||||||
- [New and Noteworthy](#new-and-noteworthy)
|
- [New and Noteworthy](#new-and-noteworthy)
|
||||||
|
- [Release 4.5](#release-45)
|
||||||
|
- [Tabs at Bottom](#tabs-at-bottom)
|
||||||
|
- [Release 4.1](#release-41)
|
||||||
- [Drag \& Drop to Auto-Hide](#drag--drop-to-auto-hide)
|
- [Drag \& Drop to Auto-Hide](#drag--drop-to-auto-hide)
|
||||||
- [Auto-Hide Tab Insertion Order](#auto-hide-tab-insertion-order)
|
- [Auto-Hide Tab Insertion Order](#auto-hide-tab-insertion-order)
|
||||||
- [Auto-Hide Tab Sorting](#auto-hide-tab-sorting)
|
- [Auto-Hide Tab Sorting](#auto-hide-tab-sorting)
|
||||||
@@ -161,6 +176,7 @@ know it from Visual Studio.
|
|||||||
- [Auto-Hide Functionality](#auto-hide-functionality)
|
- [Auto-Hide Functionality](#auto-hide-functionality)
|
||||||
- [Python Bindings](#python-bindings)
|
- [Python Bindings](#python-bindings)
|
||||||
- [PySide6](#pyside6)
|
- [PySide6](#pyside6)
|
||||||
|
- [PyQt6](#pyqt6)
|
||||||
- [PyQt5](#pyqt5)
|
- [PyQt5](#pyqt5)
|
||||||
- [Tested Compatible Environments](#tested-compatible-environments)
|
- [Tested Compatible Environments](#tested-compatible-environments)
|
||||||
- [Supported Qt Versions](#supported-qt-versions)
|
- [Supported Qt Versions](#supported-qt-versions)
|
||||||
@@ -189,8 +205,10 @@ know it from Visual Studio.
|
|||||||
- [RDE – Robox Development Environment](#rde--robox-development-environment)
|
- [RDE – Robox Development Environment](#rde--robox-development-environment)
|
||||||
- [ResInsight](#resinsight)
|
- [ResInsight](#resinsight)
|
||||||
- [ADTF 3](#adtf-3)
|
- [ADTF 3](#adtf-3)
|
||||||
- [DREAM.3D NX](#dream3d-nx)
|
- [DREAM3D-NX](#dream3d-nx)
|
||||||
- [LabPlot](#labplot)
|
- [LabPlot](#labplot)
|
||||||
|
- [Scrutiny Debugger](#scrutiny-debugger)
|
||||||
|
- [PiSoWorks](#pisoworks)
|
||||||
- [Alternative Docking System Implementations](#alternative-docking-system-implementations)
|
- [Alternative Docking System Implementations](#alternative-docking-system-implementations)
|
||||||
- [KDDockWidgets](#kddockwidgets)
|
- [KDDockWidgets](#kddockwidgets)
|
||||||
- [QtitanDocking](#qtitandocking)
|
- [QtitanDocking](#qtitandocking)
|
||||||
@@ -252,6 +270,7 @@ If this flag is cleared, the widget resizing is deferred until the mouse button
|
|||||||
In contrast to the standard Qt docking system, docking with the ADS works more like a drag & 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.
|
In contrast to the standard Qt docking system, docking with the ADS works more like a drag & 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:
|
||||||
|
|
||||||
- `DragPreviewIsDynamic`: if this flag is enabled, the preview will be adjusted dynamically to the drop area
|
- `DragPreviewIsDynamic`: if this flag is enabled, the preview will be adjusted dynamically to the drop area
|
||||||
- `DragPreviewShowsContentPixmap`: the created drag preview window shows a static copy of the content of the dock widget / dock are that is dragged
|
- `DragPreviewShowsContentPixmap`: the created drag preview window shows a static copy of the content of the dock widget / dock are that is dragged
|
||||||
- `DragPreviewHasWindowFrame`: this flag configures if the drag preview is frameless like a QRubberBand or looks like a real window
|
- `DragPreviewHasWindowFrame`: this flag configures if the drag preview is frameless like a QRubberBand or looks like a real window
|
||||||
@@ -308,7 +327,7 @@ More about the auto hide configuration options in the [online documentation...](
|
|||||||

|

|
||||||
|
|
||||||
Thanks to the contribution of several users, the Advanced Docking System comes
|
Thanks to the contribution of several users, the Advanced Docking System comes
|
||||||
with a complete Python integration. Python bindings are available for **PyQt5** and
|
with a complete Python integration. Python bindings are available for **PyQt5**, **PyQt6**, and
|
||||||
**PySide6**.
|
**PySide6**.
|
||||||
|
|
||||||
### PySide6
|
### PySide6
|
||||||
@@ -321,13 +340,30 @@ pip install PySide6-QtAds
|
|||||||
```
|
```
|
||||||
|
|
||||||
Sample code is available [here](https://github.com/mborgerson/Qt-Advanced-Docking-System/tree/pyside6/examples). To run the samples, you'll also need to install latest qtpy
|
Sample code is available [here](https://github.com/mborgerson/Qt-Advanced-Docking-System/tree/pyside6/examples). To run the samples, you'll also need to install latest qtpy
|
||||||
from source (pip install https://github.com/spyder-ide/qtpy/archive/refs/heads/master.zip).
|
from source (pip install <https://github.com/spyder-ide/qtpy/archive/refs/heads/master.zip>).
|
||||||
The PySide6 bindings were contributed by:
|
The PySide6 bindings were contributed by:
|
||||||
|
|
||||||
- [mborgerson](https://github.com/mborgerson)
|
- [mborgerson](https://github.com/mborgerson)
|
||||||
|
|
||||||
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.
|
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.
|
||||||
|
|
||||||
|
### PyQt6
|
||||||
|
|
||||||
|
A PyQt6 ADS package is available via PyPi and can be installed on Windows,
|
||||||
|
macOS, and Linux with:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pip install PyQt6Ads
|
||||||
|
```
|
||||||
|
|
||||||
|
Sample code is available [here](https://github.com/pyapp-kit/PyQt6Ads/tree/main/examples).
|
||||||
|
|
||||||
|
The PyQt6 bindings were contributed by:
|
||||||
|
|
||||||
|
- [tlambert03](https://github.com/tlambert03)
|
||||||
|
|
||||||
|
Please file PyQt6Ads-specific issues at [pyapp-kit/PyQt6Ads](https://github.com/pyapp-kit/PyQt6Ads).
|
||||||
|
|
||||||
### PyQt5
|
### PyQt5
|
||||||
|
|
||||||
A package is available via [conda-forge](https://github.com/conda-forge/pyqtads-feedstock).
|
A package is available via [conda-forge](https://github.com/conda-forge/pyqtads-feedstock).
|
||||||
@@ -351,24 +387,22 @@ The library supports **Qt5** and **Qt6**.
|
|||||||
|
|
||||||
### Windows
|
### Windows
|
||||||
|
|
||||||
Windows 10 [](https://ci.appveyor.com/project/githubuser0xFFFF/qt-advanced-docking-system/branch/master)
|
Windows 10 / 11
|
||||||
|
[](https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/actions/workflows/windows-cmake.yml)
|
||||||
|
|
||||||
The library was developed on and for Windows. It is used in a commercial Windows application and is therefore constantly tested.
|
The library was developed on and for Windows. It is used in a commercial Windows application and is therefore constantly tested.
|
||||||
|
|
||||||
### macOS
|
### macOS
|
||||||
|
|
||||||
macOS [](https://travis-ci.org/githubuser0xFFFF/Qt-Advanced-Docking-System)
|
|
||||||
|
|
||||||
The application can be compiled for macOS. A user reported, that the library works on macOS. If have not tested it.
|
The application can be compiled for macOS. A user reported, that the library works on macOS. If have not tested it.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
### Linux
|
### Linux
|
||||||
|
|
||||||
[](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 some Linux distributions. Depending on the used window manager or compositor, dock widgets
|
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,
|
with native title bars are supported or not. If native title bars are not supported,
|
||||||
the library switches to `QWidget` based title bars.
|
the library switches to `QWidget` based title bars.
|
||||||
|
|
||||||
@@ -462,7 +496,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
// Create the dock manager after the ui is setup. Because the
|
// Create the dock manager after the ui is setup. Because the
|
||||||
// parent parameter is a QMainWindow the dock manager registers
|
// parent parameter is a QMainWindow the dock manager registers
|
||||||
// itself as the central widget as such the ui must be set up first.
|
// itself as the central widget as such the ui must be set up first.
|
||||||
m_DockManager = new ads::CDockManager(this);
|
DockManager = new ads::CDockManager(this);
|
||||||
|
|
||||||
// Create example content label - this can be any application specific
|
// Create example content label - this can be any application specific
|
||||||
// widget
|
// widget
|
||||||
@@ -473,7 +507,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
|
|
||||||
// Create a dock widget with the title Label 1 and set the created label
|
// Create a dock widget with the title Label 1 and set the created label
|
||||||
// as the dock widget content
|
// as the dock widget content
|
||||||
ads::CDockWidget* DockWidget = new ads::CDockWidget("Label 1");
|
ads::CDockWidget* DockWidget = DockManager->createDockWidget("Label 1");
|
||||||
DockWidget->setWidget(l);
|
DockWidget->setWidget(l);
|
||||||
|
|
||||||
// Add the toggleViewAction of the dock widget to the menu to give
|
// Add the toggleViewAction of the dock widget to the menu to give
|
||||||
@@ -481,7 +515,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
ui->menuView->addAction(DockWidget->toggleViewAction());
|
ui->menuView->addAction(DockWidget->toggleViewAction());
|
||||||
|
|
||||||
// Add the dock widget to the top dock widget area
|
// Add the dock widget to the top dock widget area
|
||||||
m_DockManager->addDockWidget(ads::TopDockWidgetArea, DockWidget);
|
DockManager->addDockWidget(ads::TopDockWidgetArea, DockWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow()
|
||||||
@@ -582,7 +616,7 @@ highlights are:
|
|||||||
- Simple Drag & Drop user interface.
|
- Simple Drag & Drop user interface.
|
||||||
- Load data from file.
|
- Load data from file.
|
||||||
- Connect to live streaming of data.
|
- Connect to live streaming of data.
|
||||||
- Save the visualization layout and configurations to re-use them later.
|
- Save the visualization layout and configurations to reuse them later.
|
||||||
- Fast OpenGL visualization.
|
- Fast OpenGL visualization.
|
||||||
- Can handle thousands of timeseries and millions of data points.
|
- Can handle thousands of timeseries and millions of data points.
|
||||||
- Transform your data using a simple editor: derivative, moving average, integral, etc…
|
- Transform your data using a simple editor: derivative, moving average, integral, etc…
|
||||||
@@ -667,15 +701,17 @@ says about the switch to Qt Advanced Docking:
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
### [DREAM.3D NX](https://github.com/BlueQuartzSoftware/DREAM3D)
|
### [DREAM3D-NX](https://www.dream3d.io)
|
||||||
|
|
||||||
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.
|
DREAM3D-NX *(Digital Representation Environment for Analysis of Materials in 3D)* is a 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.
|
[BlueQuartz Software](http://www.bluequartz.net/) has completely rewritten the old DREAM.3D version 6.5 application
|
||||||
|
taking advantage of the Advanced Docking System to present a highly customizable user interface
|
||||||
|
for DREAM3D-NX Version 7.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
[read more...](http://dream3d.bluequartz.net/)
|
[read more...](http://www.dream3d.io/)
|
||||||
|
|
||||||
### [LabPlot](https://labplot.kde.org/)
|
### [LabPlot](https://labplot.kde.org/)
|
||||||
|
|
||||||
@@ -687,6 +723,36 @@ The LabPlot project recently switched to the Qt Advanced Docking System for thei
|
|||||||
|
|
||||||
[read more...](https://labplot.kde.org/)
|
[read more...](https://labplot.kde.org/)
|
||||||
|
|
||||||
|
### [Scrutiny Debugger](https://scrutinydebugger.com/)
|
||||||
|
|
||||||
|
Scrutiny is an [open source](https://github.com/scrutinydebugger/) non-intrusive, real-time debugger for embedded systems, built for fast introspection, memory access, and signal visualization—without stopping your application. It uses the Qt Advanced Docking System (ADS) to provide fully customizable dashboards for monitoring and control.
|
||||||
|
|
||||||
|
Some of the highlights are:
|
||||||
|
|
||||||
|
- **Debug without interfering** — Inspect C++ memory live without disrupting execution flow.
|
||||||
|
- **HIL testing made easy** — Write to variables through the GUI or SDK to simulate conditions.
|
||||||
|
- **Configure during production** — Access and tweak variables anytime via GUI or Python.
|
||||||
|
- **Catch fast events** — Embedded graphs sample at task-level frequency, even with multithreading.
|
||||||
|
- **Build your dashboard** — Use ADS to create and save custom layouts for your debug sessions.
|
||||||
|
- **No JTAG needed** — Communicates over serial, CAN, or network interfaces.
|
||||||
|
- **Compact C++11 library** — Lightweight and easy to integrate into your firmware.
|
||||||
|
- **Live graphs and runtime values** — Visualize variables, RPVs, and aliases in real time.
|
||||||
|
|
||||||
|
ADS powers Scrutiny’s flexible interface, letting users organize views and data panels to suit their workflow — ideal for real-time monitoring, testing, and debugging.
|
||||||
|
|
||||||
|
[read more...](https://scrutinydebugger.com/)
|
||||||
|
|
||||||
|
[](https://www.youtube.com/watch?v=Dd3osxW-Clo)
|
||||||
|
|
||||||
|
|
||||||
|
### [PiSoWorks](https://pypi.org/project/pisoworks/)
|
||||||
|
|
||||||
|
PiSoWorks is an application for controlling the piezo amplifiers, such as the [NV200/D](https://www.piezosystem.com/product/nv-200-d-compact-amplifier/), from [piezosystem jena](https://www.piezosystem.com/) GmbH.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
[read more...](https://piezosystemjena.github.io/PiSoWorks/)
|
||||||
|
|
||||||
## 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.
|
||||||
|
|||||||
29
cmake/modules/FileVersionInfo.rc.in
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
#include <windows.h>
|
||||||
|
|
||||||
|
VS_VERSION_INFO VERSIONINFO
|
||||||
|
FILEVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@,0
|
||||||
|
PRODUCTVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@,0
|
||||||
|
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
|
||||||
|
FILEFLAGS 0
|
||||||
|
FILEOS VOS__WINDOWS32
|
||||||
|
FILETYPE VFT_APP
|
||||||
|
FILESUBTYPE 0
|
||||||
|
BEGIN
|
||||||
|
BLOCK "StringFileInfo"
|
||||||
|
BEGIN
|
||||||
|
BLOCK "040904b0"
|
||||||
|
BEGIN
|
||||||
|
VALUE "CompanyName", "My Company\0"
|
||||||
|
VALUE "FileDescription", "@PROJECT_NAME@\0"
|
||||||
|
VALUE "FileVersion", "@PROJECT_VERSION_STRING@\0"
|
||||||
|
VALUE "ProductVersion", "@PROJECT_VERSION_STRING@\0"
|
||||||
|
VALUE "GitCommitFull", "@PROJECT_GIT_HASH@\0"
|
||||||
|
VALUE "GitCommitShort", "@PROJECT_GIT_HASH_SHORT@\0"
|
||||||
|
END
|
||||||
|
END
|
||||||
|
|
||||||
|
BLOCK "VarFileInfo"
|
||||||
|
BEGIN
|
||||||
|
VALUE "Translation", 0x0409, 1200
|
||||||
|
END
|
||||||
|
END
|
||||||
100
cmake/modules/Versioning.cmake
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
# ============================================================
|
||||||
|
# Versioning.cmake (Reusable Version + Resource Generator)
|
||||||
|
# ============================================================
|
||||||
|
|
||||||
|
# Freeze the directory where this module lives
|
||||||
|
# This is critical — it prevents paths from breaking when the
|
||||||
|
# function is invoked from other CMakeLists.txt files.
|
||||||
|
set(_VERSIONING_MODULE_DIR "${CMAKE_CURRENT_LIST_DIR}" CACHE INTERNAL "Versioning module directory")
|
||||||
|
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
# Extract version information from Git or use predefined version
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
if(NOT DEFINED PROJECT_VERSION_MAJOR OR NOT DEFINED PROJECT_VERSION_MINOR OR NOT DEFINED PROJECT_VERSION_PATCH)
|
||||||
|
# Get tag (expected: v1.2.3 or 1.2.3 or 1.2.3-12-gHASH)
|
||||||
|
execute_process(
|
||||||
|
COMMAND git describe --tags --dirty
|
||||||
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
OUTPUT_VARIABLE GIT_DESC_RAW
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
|
)
|
||||||
|
|
||||||
|
# Remove leading "v" if present
|
||||||
|
string(REGEX REPLACE "^v" "" GIT_DESC "${GIT_DESC_RAW}")
|
||||||
|
|
||||||
|
# Extract major.minor.patch
|
||||||
|
string(REGEX MATCH "^([0-9]+)\\.([0-9]+)\\.([0-9]+)" _ "${GIT_DESC}")
|
||||||
|
set(PROJECT_VERSION_MAJOR "${CMAKE_MATCH_1}")
|
||||||
|
set(PROJECT_VERSION_MINOR "${CMAKE_MATCH_2}")
|
||||||
|
set(PROJECT_VERSION_PATCH "${CMAKE_MATCH_3}")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Commit hash (full + short)
|
||||||
|
execute_process(
|
||||||
|
COMMAND git rev-parse HEAD
|
||||||
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
OUTPUT_VARIABLE PROJECT_GIT_HASH
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
|
)
|
||||||
|
|
||||||
|
execute_process(
|
||||||
|
COMMAND git rev-parse --short HEAD
|
||||||
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
OUTPUT_VARIABLE PROJECT_GIT_HASH_SHORT
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(PROJECT_VERSION_STRING
|
||||||
|
"${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Export variables to parent scope
|
||||||
|
set(PROJECT_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}" PARENT_SCOPE)
|
||||||
|
set(PROJECT_VERSION_MINOR "${PROJECT_VERSION_MINOR}" PARENT_SCOPE)
|
||||||
|
set(PROJECT_VERSION_PATCH "${PROJECT_VERSION_PATCH}" PARENT_SCOPE)
|
||||||
|
set(PROJECT_VERSION_STRING "${PROJECT_VERSION_STRING}" PARENT_SCOPE)
|
||||||
|
set(PROJECT_GIT_HASH "${PROJECT_GIT_HASH}" PARENT_SCOPE)
|
||||||
|
set(PROJECT_GIT_HASH_SHORT "${PROJECT_GIT_HASH_SHORT}" PARENT_SCOPE)
|
||||||
|
|
||||||
|
# Public variable for users
|
||||||
|
set(PROJECT_AUTO_VERSION "${PROJECT_VERSION_STRING}" PARENT_SCOPE)
|
||||||
|
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
# Reusable function: Attach Windows version resources to target
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
function(add_windows_version_resources target)
|
||||||
|
if(NOT WIN32)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT TARGET "${target}")
|
||||||
|
message(FATAL_ERROR "add_windows_version_resources: target '${target}' not found.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Absolute path to the template (never changes)
|
||||||
|
get_filename_component(_rc_in
|
||||||
|
"${_VERSIONING_MODULE_DIR}/FileVersionInfo.rc.in"
|
||||||
|
ABSOLUTE
|
||||||
|
)
|
||||||
|
|
||||||
|
if(NOT EXISTS "${_rc_in}")
|
||||||
|
message(FATAL_ERROR
|
||||||
|
"FileVersionInfo.rc.in missing at: ${_rc_in}"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Output in the caller's binary dir
|
||||||
|
set(_rc_out "${CMAKE_CURRENT_BINARY_DIR}/${target}_version.rc")
|
||||||
|
get_filename_component(_rc_out "${_rc_out}" ABSOLUTE)
|
||||||
|
|
||||||
|
# Ensure directory exists
|
||||||
|
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||||
|
|
||||||
|
# Configure the template
|
||||||
|
configure_file("${_rc_in}" "${_rc_out}" @ONLY)
|
||||||
|
|
||||||
|
# Add to the target
|
||||||
|
target_sources(${target} PRIVATE "${_rc_out}")
|
||||||
|
endfunction()
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.5)
|
cmake_minimum_required(VERSION 3.16)
|
||||||
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)
|
||||||
@@ -27,7 +27,7 @@ target_link_libraries(AdvancedDockingSystemDemo PUBLIC Qt${QT_VERSION_MAJOR}::Co
|
|||||||
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 qt${QT_VERSION_MAJOR}advanceddocking)
|
target_link_libraries(AdvancedDockingSystemDemo PRIVATE qtadvanceddocking-qt${QT_VERSION_MAJOR})
|
||||||
set_target_properties(AdvancedDockingSystemDemo PROPERTIES
|
set_target_properties(AdvancedDockingSystemDemo PROPERTIES
|
||||||
AUTOMOC ON
|
AUTOMOC ON
|
||||||
AUTORCC ON
|
AUTORCC ON
|
||||||
|
|||||||
@@ -75,18 +75,17 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "DockManager.h"
|
|
||||||
#include "DockWidget.h"
|
|
||||||
#include "DockAreaWidget.h"
|
|
||||||
#include "DockAreaTitleBar.h"
|
|
||||||
#include "DockAreaTabBar.h"
|
#include "DockAreaTabBar.h"
|
||||||
#include "FloatingDockContainer.h"
|
#include "DockAreaTitleBar.h"
|
||||||
|
#include "DockAreaWidget.h"
|
||||||
#include "DockComponentsFactory.h"
|
#include "DockComponentsFactory.h"
|
||||||
#include "StatusDialog.h"
|
#include "DockManager.h"
|
||||||
#include "DockSplitter.h"
|
#include "DockSplitter.h"
|
||||||
|
#include "DockWidget.h"
|
||||||
|
#include "FloatingDockContainer.h"
|
||||||
#include "ImageViewer.h"
|
#include "ImageViewer.h"
|
||||||
|
#include "MyDockAreaTitleBar.h"
|
||||||
|
#include "StatusDialog.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a random number from 0 to highest - 1
|
* Returns a random number from 0 to highest - 1
|
||||||
@@ -147,7 +146,7 @@ public:
|
|||||||
using Super = ads::CDockComponentsFactory;
|
using Super = ads::CDockComponentsFactory;
|
||||||
ads::CDockAreaTitleBar* createDockAreaTitleBar(ads::CDockAreaWidget* DockArea) const override
|
ads::CDockAreaTitleBar* createDockAreaTitleBar(ads::CDockAreaWidget* DockArea) const override
|
||||||
{
|
{
|
||||||
auto TitleBar = new ads::CDockAreaTitleBar(DockArea);
|
auto TitleBar = new MyDockAreaTitleBar(DockArea);
|
||||||
auto CustomButton = new QToolButton(DockArea);
|
auto CustomButton = new QToolButton(DockArea);
|
||||||
CustomButton->setToolTip(QObject::tr("Help"));
|
CustomButton->setToolTip(QObject::tr("Help"));
|
||||||
CustomButton->setIcon(svgIcon(":/adsdemo/images/help_outline.svg"));
|
CustomButton->setIcon(svgIcon(":/adsdemo/images/help_outline.svg"));
|
||||||
@@ -237,7 +236,7 @@ struct MainWindowPrivate
|
|||||||
m->setRootPath(QDir::currentPath());
|
m->setRootPath(QDir::currentPath());
|
||||||
w->setModel(m);
|
w->setModel(m);
|
||||||
w->setRootIndex(m->index(QDir::currentPath()));
|
w->setRootIndex(m->index(QDir::currentPath()));
|
||||||
ads::CDockWidget* DockWidget = new ads::CDockWidget(QString("Filesystem %1")
|
ads::CDockWidget* DockWidget = DockManager->createDockWidget(QString("Filesystem %1")
|
||||||
.arg(FileSystemCount++));
|
.arg(FileSystemCount++));
|
||||||
DockWidget->setWidget(w);
|
DockWidget->setWidget(w);
|
||||||
DockWidget->setIcon(svgIcon(":/adsdemo/images/folder_open.svg"));
|
DockWidget->setIcon(svgIcon(":/adsdemo/images/folder_open.svg"));
|
||||||
@@ -258,7 +257,7 @@ struct MainWindowPrivate
|
|||||||
{
|
{
|
||||||
static int CalendarCount = 0;
|
static int CalendarCount = 0;
|
||||||
QCalendarWidget* w = new QCalendarWidget();
|
QCalendarWidget* w = new QCalendarWidget();
|
||||||
ads::CDockWidget* DockWidget = new ads::CDockWidget(QString("Calendar %1").arg(CalendarCount++));
|
ads::CDockWidget* DockWidget = DockManager->createDockWidget(QString("Calendar %1").arg(CalendarCount++));
|
||||||
// The following lines are for testing the setWidget() and takeWidget()
|
// The following lines are for testing the setWidget() and takeWidget()
|
||||||
// functionality
|
// functionality
|
||||||
DockWidget->setWidget(w);
|
DockWidget->setWidget(w);
|
||||||
@@ -303,7 +302,7 @@ struct MainWindowPrivate
|
|||||||
.arg(LabelCount)
|
.arg(LabelCount)
|
||||||
.arg(QTime::currentTime().toString("hh:mm:ss:zzz")));
|
.arg(QTime::currentTime().toString("hh:mm:ss:zzz")));
|
||||||
|
|
||||||
ads::CDockWidget* DockWidget = new ads::CDockWidget(QString("Label %1").arg(LabelCount++));
|
ads::CDockWidget* DockWidget = DockManager->createDockWidget(QString("Label %1").arg(LabelCount++));
|
||||||
DockWidget->setWidget(l);
|
DockWidget->setWidget(l);
|
||||||
DockWidget->setIcon(svgIcon(":/adsdemo/images/font_download.svg"));
|
DockWidget->setIcon(svgIcon(":/adsdemo/images/font_download.svg"));
|
||||||
ui.menuView->addAction(DockWidget->toggleViewAction());
|
ui.menuView->addAction(DockWidget->toggleViewAction());
|
||||||
@@ -321,7 +320,7 @@ struct MainWindowPrivate
|
|||||||
w->setPlaceholderText("This is an editor. If you close the editor, it will be "
|
w->setPlaceholderText("This is an editor. If you close the editor, it will be "
|
||||||
"deleted. Enter your text here.");
|
"deleted. Enter your text here.");
|
||||||
w->setStyleSheet("border: none");
|
w->setStyleSheet("border: none");
|
||||||
ads::CDockWidget* DockWidget = new ads::CDockWidget(QString("Editor %1").arg(EditorCount++));
|
ads::CDockWidget* DockWidget = DockManager->createDockWidget(QString("Editor %1").arg(EditorCount++));
|
||||||
DockWidget->setWidget(w);
|
DockWidget->setWidget(w);
|
||||||
DockWidget->setIcon(svgIcon(":/adsdemo/images/edit.svg"));
|
DockWidget->setIcon(svgIcon(":/adsdemo/images/edit.svg"));
|
||||||
DockWidget->setFeature(ads::CDockWidget::CustomCloseHandling, true);
|
DockWidget->setFeature(ads::CDockWidget::CustomCloseHandling, true);
|
||||||
@@ -364,7 +363,7 @@ struct MainWindowPrivate
|
|||||||
|
|
||||||
auto Result = w->loadFile(FileName);
|
auto Result = w->loadFile(FileName);
|
||||||
qDebug() << "loadFile result: " << Result;
|
qDebug() << "loadFile result: " << Result;
|
||||||
ads::CDockWidget* DockWidget = new ads::CDockWidget(QString("Image Viewer %1").arg(ImageViewerCount++));
|
ads::CDockWidget* DockWidget = DockManager->createDockWidget(QString("Image Viewer %1").arg(ImageViewerCount++));
|
||||||
DockWidget->setIcon(svgIcon(":/adsdemo/images/photo.svg"));
|
DockWidget->setIcon(svgIcon(":/adsdemo/images/photo.svg"));
|
||||||
DockWidget->setWidget(w,ads:: CDockWidget::ForceNoScrollArea);
|
DockWidget->setWidget(w,ads:: CDockWidget::ForceNoScrollArea);
|
||||||
auto ToolBar = DockWidget->createDefaultToolBar();
|
auto ToolBar = DockWidget->createDefaultToolBar();
|
||||||
@@ -379,7 +378,7 @@ struct MainWindowPrivate
|
|||||||
{
|
{
|
||||||
static int TableCount = 0;
|
static int TableCount = 0;
|
||||||
auto w = new CMinSizeTableWidget();
|
auto w = new CMinSizeTableWidget();
|
||||||
ads::CDockWidget* DockWidget = new ads::CDockWidget(QString("Table %1").arg(TableCount++));
|
ads::CDockWidget* DockWidget = DockManager->createDockWidget(QString("Table %1").arg(TableCount++));
|
||||||
static int colCount = 5;
|
static int colCount = 5;
|
||||||
static int rowCount = 30;
|
static int rowCount = 30;
|
||||||
w->setColumnCount(colCount);
|
w->setColumnCount(colCount);
|
||||||
@@ -397,7 +396,7 @@ struct MainWindowPrivate
|
|||||||
DockWidget->setMinimumSizeHintMode(ads::CDockWidget::MinimumSizeHintFromContent);
|
DockWidget->setMinimumSizeHintMode(ads::CDockWidget::MinimumSizeHintFromContent);
|
||||||
auto ToolBar = DockWidget->createDefaultToolBar();
|
auto ToolBar = DockWidget->createDefaultToolBar();
|
||||||
auto Action = ToolBar->addAction(svgIcon(":/adsdemo/images/fullscreen.svg"), "Toggle Fullscreen");
|
auto Action = ToolBar->addAction(svgIcon(":/adsdemo/images/fullscreen.svg"), "Toggle Fullscreen");
|
||||||
QObject::connect(Action, &QAction::triggered, [=]()
|
QObject::connect(Action, &QAction::triggered, [DockWidget]()
|
||||||
{
|
{
|
||||||
if (DockWidget->isFullScreen())
|
if (DockWidget->isFullScreen())
|
||||||
{
|
{
|
||||||
@@ -418,7 +417,7 @@ struct MainWindowPrivate
|
|||||||
ads::CDockWidget *createQQuickWidget()
|
ads::CDockWidget *createQQuickWidget()
|
||||||
{
|
{
|
||||||
QQuickWidget *widget = new QQuickWidget();
|
QQuickWidget *widget = new QQuickWidget();
|
||||||
ads::CDockWidget *dockWidget = new ads::CDockWidget("Quick");
|
ads::CDockWidget *dockWidget = DockManager->createDockWidget("Quick");
|
||||||
dockWidget->setWidget(widget);
|
dockWidget->setWidget(widget);
|
||||||
return dockWidget;
|
return dockWidget;
|
||||||
}
|
}
|
||||||
@@ -433,7 +432,7 @@ struct MainWindowPrivate
|
|||||||
{
|
{
|
||||||
static int ActiveXCount = 0;
|
static int ActiveXCount = 0;
|
||||||
QAxWidget* w = new QAxWidget("{6bf52a52-394a-11d3-b153-00c04f79faa6}", parent);
|
QAxWidget* w = new QAxWidget("{6bf52a52-394a-11d3-b153-00c04f79faa6}", parent);
|
||||||
ads::CDockWidget* DockWidget = new ads::CDockWidget(QString("Active X %1").arg(ActiveXCount++));
|
ads::CDockWidget* DockWidget = DockManager->createDockWidget(QString("Active X %1").arg(ActiveXCount++));
|
||||||
DockWidget->setWidget(w);
|
DockWidget->setWidget(w);
|
||||||
ui.menuView->addAction(DockWidget->toggleViewAction());
|
ui.menuView->addAction(DockWidget->toggleViewAction());
|
||||||
return DockWidget;
|
return DockWidget;
|
||||||
@@ -471,12 +470,12 @@ void MainWindowPrivate::createContent()
|
|||||||
appendFeaturStringToWindowTitle(FileSystemWidget);
|
appendFeaturStringToWindowTitle(FileSystemWidget);
|
||||||
|
|
||||||
// Test custom factory - we inject a help button into the title bar
|
// Test custom factory - we inject a help button into the title bar
|
||||||
ads::CDockComponentsFactory::setFactory(new CCustomComponentsFactory());
|
DockManager->setComponentsFactory(new CCustomComponentsFactory());
|
||||||
auto TopDockArea = DockManager->addDockWidget(ads::TopDockWidgetArea, FileSystemWidget);
|
auto TopDockArea = DockManager->addDockWidget(ads::TopDockWidgetArea, FileSystemWidget);
|
||||||
// Uncomment the next line if you would like to test the
|
// Uncomment the next line if you would like to test the
|
||||||
// HideSingleWidgetTitleBar functionality
|
// HideSingleWidgetTitleBar functionality
|
||||||
// TopDockArea->setDockAreaFlag(ads::CDockAreaWidget::HideSingleWidgetTitleBar, true);
|
// TopDockArea->setDockAreaFlag(ads::CDockAreaWidget::HideSingleWidgetTitleBar, true);
|
||||||
ads::CDockComponentsFactory::resetDefaultFactory();
|
DockManager->setComponentsFactory(ads::CDockComponentsFactory::factory());
|
||||||
|
|
||||||
// We create a calendar widget and clear all flags to prevent the dock area
|
// We create a calendar widget and clear all flags to prevent the dock area
|
||||||
// from closing
|
// from closing
|
||||||
@@ -511,7 +510,7 @@ void MainWindowPrivate::createContent()
|
|||||||
auto TitleBar = DockArea->titleBar();
|
auto TitleBar = DockArea->titleBar();
|
||||||
int Index = TitleBar->indexOf(TitleBar->tabBar());
|
int Index = TitleBar->indexOf(TitleBar->tabBar());
|
||||||
TitleBar->insertWidget(Index + 1, CustomButton);
|
TitleBar->insertWidget(Index + 1, CustomButton);
|
||||||
QObject::connect(CustomButton, &QToolButton::clicked, [=]()
|
QObject::connect(CustomButton, &QToolButton::clicked, [DockArea, this]()
|
||||||
{
|
{
|
||||||
auto DockWidget = createEditorWidget();
|
auto DockWidget = createEditorWidget();
|
||||||
DockWidget->setFeature(ads::CDockWidget::DockWidgetDeleteOnClose, true);
|
DockWidget->setFeature(ads::CDockWidget::DockWidgetDeleteOnClose, true);
|
||||||
@@ -592,19 +591,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"));
|
||||||
@@ -626,6 +635,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"));
|
||||||
@@ -759,6 +769,9 @@ CMainWindow::CMainWindow(QWidget *parent) :
|
|||||||
// 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 disable closing auto hide widget with mouse click outside of auto hide container
|
||||||
|
//CDockManager::setAutoHideConfigFlag(CDockManager::AutoHideCloseOnOutsideMouseClick, false);
|
||||||
|
|
||||||
// uncomment if you would like to enable an equal distribution of the
|
// 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
|
||||||
// CDockManager::setConfigFlag(CDockManager::EqualSplitOnInsertion, true);
|
// CDockManager::setConfigFlag(CDockManager::EqualSplitOnInsertion, true);
|
||||||
@@ -766,6 +779,9 @@ CMainWindow::CMainWindow(QWidget *parent) :
|
|||||||
// uncomment if you would like to close tabs with the middle mouse button, web browser style
|
// uncomment if you would like to close tabs with the middle mouse button, web browser style
|
||||||
// CDockManager::setConfigFlag(CDockManager::MiddleMouseButtonClosesTab, true);
|
// CDockManager::setConfigFlag(CDockManager::MiddleMouseButtonClosesTab, true);
|
||||||
|
|
||||||
|
// uncomment if you would like to avoid using the built-in QSS stylesheet
|
||||||
|
// CDockManager::setConfigFlag(CDockManager::DisableStylesheet, true);
|
||||||
|
|
||||||
// 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);
|
d->DockManager->setDockWidgetToolBarStyle(Qt::ToolButtonIconOnly, ads::CDockWidget::StateFloating);
|
||||||
@@ -1030,3 +1046,17 @@ void CMainWindow::createImageViewer()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
void CMainWindow::lockWorkspace(bool Value)
|
||||||
|
{
|
||||||
|
if (Value)
|
||||||
|
{
|
||||||
|
d->DockManager->lockDockWidgetFeaturesGlobally();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
d->DockManager->lockDockWidgetFeaturesGlobally(ads::CDockWidget::NoDockWidgetFeatures);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ private slots:
|
|||||||
void toggleDockWidgetWindowTitle();
|
void toggleDockWidgetWindowTitle();
|
||||||
void applyVsStyle();
|
void applyVsStyle();
|
||||||
void createImageViewer();
|
void createImageViewer();
|
||||||
|
void lockWorkspace(bool Value);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MAINWINDOW_H
|
#endif // MAINWINDOW_H
|
||||||
|
|||||||
58
demo/MyDockAreaTitleBar.h
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
#ifndef QTADS_MYDOCKAREATITLEBAR_H
|
||||||
|
#define QTADS_MYDOCKAREATITLEBAR_H
|
||||||
|
/*******************************************************************************
|
||||||
|
** Qt Advanced Docking System
|
||||||
|
** Copyright (C) 2017 Uwe Kindler
|
||||||
|
**
|
||||||
|
** This library is free software; you can redistribute it and/or
|
||||||
|
** modify it under the terms of the GNU Lesser General Public
|
||||||
|
** License as published by the Free Software Foundation; either
|
||||||
|
** version 2.1 of the License, or (at your option) any later version.
|
||||||
|
**
|
||||||
|
** This library is distributed in the hope that it will be useful,
|
||||||
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
** Lesser General Public License for more details.
|
||||||
|
**
|
||||||
|
** You should have received a copy of the GNU Lesser General Public
|
||||||
|
** License along with this library; If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
// INCLUDES
|
||||||
|
//============================================================================
|
||||||
|
#include <DockAreaTitleBar.h>
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Custom DockAreaTitleBar that adds a custom context menu
|
||||||
|
*/
|
||||||
|
class MyDockAreaTitleBar : public ads::CDockAreaTitleBar
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit MyDockAreaTitleBar(ads::CDockAreaWidget *parent) :
|
||||||
|
CDockAreaTitleBar(parent)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
QMenu* buildContextMenu(QMenu*) override
|
||||||
|
{
|
||||||
|
auto menu = ads::CDockAreaTitleBar::buildContextMenu(nullptr);
|
||||||
|
menu->addSeparator();
|
||||||
|
auto action = menu->addAction(tr("Format HardDrive"));
|
||||||
|
|
||||||
|
connect(action, &QAction::triggered, this, [this]()
|
||||||
|
{
|
||||||
|
QMessageBox msgBox;
|
||||||
|
msgBox.setText("No, just kidding");
|
||||||
|
msgBox.setStandardButtons(QMessageBox::Abort);
|
||||||
|
msgBox.setDefaultButton(QMessageBox::Abort);
|
||||||
|
msgBox.exec();
|
||||||
|
});
|
||||||
|
|
||||||
|
return menu;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // QTADS_MYDOCKAREATITLEBAR_H
|
||||||
@@ -36,5 +36,8 @@
|
|||||||
<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>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|||||||
6
demo/images/lock.svg
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0,0,1024,1024">
|
||||||
|
<desc>lock icon - Licensed under Apache License v2.0 (http://www.apache.org/licenses/LICENSE-2.0) - Created with Iconfu.com - Derivative work of Material icons (Copyright Google Inc.)</desc>
|
||||||
|
<g fill="#03b8e5" fill-rule="nonzero" style="mix-blend-mode: normal">
|
||||||
|
<path d="M853.33,426.67v426.66c0,46.93 -38.4,85.34 -85.33,85.34h-512c-46.93,0 -85.33,-38.41 -85.33,-85.34v-426.66c0,-46.93 38.4,-85.34 85.33,-85.34h42.67v-85.33c0,-117.76 95.57,-213.33 213.33,-213.33c117.76,0 213.33,95.57 213.33,213.33v85.33h42.67c46.93,0 85.33,38.41 85.33,85.34zM644.27,256c0,-72.96 -59.31,-132.27 -132.27,-132.27c-72.96,0 -132.27,59.31 -132.27,132.27v85.33h264.54zM597.33,640c0,-46.93 -38.4,-85.33 -85.33,-85.33c-46.93,0 -85.33,38.4 -85.33,85.33c0,46.93 38.4,85.33 85.33,85.33c46.93,0 85.33,-38.4 85.33,-85.33z"/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 932 B |
6
demo/images/lock_open.svg
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0,0,1024,1024">
|
||||||
|
<desc>lock_open icon - Licensed under Apache License v2.0 (http://www.apache.org/licenses/LICENSE-2.0) - Created with Iconfu.com - Derivative work of Material icons (Copyright Google Inc.)</desc>
|
||||||
|
<g fill="#03b8e5" fill-rule="nonzero" style="mix-blend-mode: normal">
|
||||||
|
<path d="M853.33,426.67v426.66c0,46.93 -38.4,85.34 -85.33,85.34h-512c-46.93,0 -85.33,-38.41 -85.33,-85.34v-426.66c0,-46.93 38.4,-85.34 85.33,-85.34h388.27v-85.33c0,-72.96 -59.31,-132.27 -132.27,-132.27c-72.96,0 -132.27,59.31 -132.27,132.27h-81.06c0,-117.76 95.57,-213.33 213.33,-213.33c117.76,0 213.33,95.57 213.33,213.33v85.33h42.67c46.93,0 85.33,38.41 85.33,85.34zM768,426.67h-512v426.66h512zM426.67,640c0,-46.93 38.4,-85.33 85.33,-85.33c46.93,0 85.33,38.4 85.33,85.33c0,46.93 -38.4,85.33 -85.33,85.33c-46.93,0 -85.33,-38.4 -85.33,-85.33z"/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 948 B |
6
demo/images/lock_outline.svg
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0,0,1024,1024">
|
||||||
|
<desc>lock_outline icon - Licensed under Apache License v2.0 (http://www.apache.org/licenses/LICENSE-2.0) - Created with Iconfu.com - Derivative work of Material icons (Copyright Google Inc.)</desc>
|
||||||
|
<g fill="#03b8e5" fill-rule="nonzero" style="mix-blend-mode: normal">
|
||||||
|
<path d="M853.33,426.67v426.66c0,46.93 -38.4,85.34 -85.33,85.34h-512c-46.93,0 -85.33,-38.41 -85.33,-85.34v-426.66c0,-46.93 38.4,-85.34 85.33,-85.34h42.67v-85.33c0,-117.76 95.57,-213.33 213.33,-213.33c117.76,0 213.33,95.57 213.33,213.33v85.33h42.67c46.93,0 85.33,38.41 85.33,85.34zM768,426.67h-512v426.66h512zM379.73,341.33h264.54v-85.33c0,-72.96 -59.31,-132.27 -132.27,-132.27c-72.96,0 -132.27,59.31 -132.27,132.27zM426.67,640c0,-46.93 38.4,-85.33 85.33,-85.33c46.93,0 85.33,38.4 85.33,85.33c0,46.93 -38.4,85.33 -85.33,85.33c-46.93,0 -85.33,-38.4 -85.33,-85.33z"/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 972 B |
@@ -41,6 +41,7 @@ int main(int argc, char *argv[])
|
|||||||
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
QApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
|
||||||
std::shared_ptr<int> b;
|
std::shared_ptr<int> b;
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
a.setApplicationName("Advanced Docking System Demo");
|
a.setApplicationName("Advanced Docking System Demo");
|
||||||
|
|||||||
@@ -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.
|
||||||
|
|
||||||

|

|
||||||
|
|||||||
BIN
doc/cfg_flag_AutoHideOpenOnDragHover.gif
Normal file
|
After Width: | Height: | Size: 269 KiB |
BIN
doc/cfg_flag_TabsAtBottom.png
Normal file
|
After Width: | Height: | Size: 25 KiB |
BIN
doc/cfg_flag_TabsAtBottom_true.png
Normal file
|
After Width: | Height: | Size: 35 KiB |
|
Before Width: | Height: | Size: 364 KiB After Width: | Height: | Size: 382 KiB |
BIN
doc/showcase_pysoworks.png
Normal file
|
After Width: | Height: | Size: 224 KiB |
BIN
doc/showcase_scrutiny-dark.png
Normal file
|
After Width: | Height: | Size: 197 KiB |
@@ -1,69 +1,81 @@
|
|||||||
# User Guide
|
# User Guide
|
||||||
|
|
||||||
- [Configuration Flags](#configuration-flags)
|
- [User Guide](#user-guide)
|
||||||
- [Setting Configuration Flags](#setting-configuration-flags)
|
- [Configuration Flags](#configuration-flags)
|
||||||
- [`ActiveTabHasCloseButton`](#activetabhasclosebutton)
|
- [Setting Configuration Flags](#setting-configuration-flags)
|
||||||
- [`DockAreaHasCloseButton`](#dockareahasclosebutton)
|
- [`ActiveTabHasCloseButton`](#activetabhasclosebutton)
|
||||||
- [`DockAreaCloseButtonClosesTab`](#dockareaclosebuttonclosestab)
|
- [`DockAreaHasCloseButton`](#dockareahasclosebutton)
|
||||||
- [`OpaqueSplitterResize`](#opaquesplitterresize)
|
- [`DockAreaCloseButtonClosesTab`](#dockareaclosebuttonclosestab)
|
||||||
- [`XmlAutoFormattingEnabled`](#xmlautoformattingenabled)
|
- [`OpaqueSplitterResize`](#opaquesplitterresize)
|
||||||
- [`XmlCompressionEnabled`](#xmlcompressionenabled)
|
- [`XmlAutoFormattingEnabled`](#xmlautoformattingenabled)
|
||||||
- [`TabCloseButtonIsToolButton`](#tabclosebuttonistoolbutton)
|
- [`XmlCompressionEnabled`](#xmlcompressionenabled)
|
||||||
- [`AllTabsHaveCloseButton`](#alltabshaveclosebutton)
|
- [`TabCloseButtonIsToolButton`](#tabclosebuttonistoolbutton)
|
||||||
- [`RetainTabSizeWhenCloseButtonHidden`](#retaintabsizewhenclosebuttonhidden)
|
- [`AllTabsHaveCloseButton`](#alltabshaveclosebutton)
|
||||||
- [`DragPreviewIsDynamic`](#dragpreviewisdynamic)
|
- [`RetainTabSizeWhenCloseButtonHidden`](#retaintabsizewhenclosebuttonhidden)
|
||||||
- [`DragPreviewShowsContentPixmap`](#dragpreviewshowscontentpixmap)
|
- [`DragPreviewIsDynamic`](#dragpreviewisdynamic)
|
||||||
- [`DragPreviewHasWindowFrame`](#dragpreviewhaswindowframe)
|
- [`DragPreviewShowsContentPixmap`](#dragpreviewshowscontentpixmap)
|
||||||
- [`AlwaysShowTabs`](#alwaysshowtabs)
|
- [`DragPreviewHasWindowFrame`](#dragpreviewhaswindowframe)
|
||||||
- [`DockAreaHasUndockButton`](#dockareahasundockbutton)
|
- [`AlwaysShowTabs`](#alwaysshowtabs)
|
||||||
- [`DockAreaHasTabsMenuButton`](#dockareahastabsmenubutton)
|
- [`DockAreaHasUndockButton`](#dockareahasundockbutton)
|
||||||
- [`DockAreaHideDisabledButtons`](#dockareahidedisabledbuttons)
|
- [`DockAreaHasTabsMenuButton`](#dockareahastabsmenubutton)
|
||||||
- [`DockAreaDynamicTabsMenuButtonVisibility`](#dockareadynamictabsmenubuttonvisibility)
|
- [`DockAreaHideDisabledButtons`](#dockareahidedisabledbuttons)
|
||||||
- [`FloatingContainerHasWidgetTitle`](#floatingcontainerhaswidgettitle)
|
- [`DockAreaDynamicTabsMenuButtonVisibility`](#dockareadynamictabsmenubuttonvisibility)
|
||||||
- [`FloatingContainerHasWidgetIcon`](#floatingcontainerhaswidgeticon)
|
- [`FloatingContainerHasWidgetTitle`](#floatingcontainerhaswidgettitle)
|
||||||
- [`HideSingleCentralWidgetTitleBar`](#hidesinglecentralwidgettitlebar)
|
- [`FloatingContainerHasWidgetIcon`](#floatingcontainerhaswidgeticon)
|
||||||
- [`FocusHighlighting`](#focushighlighting)
|
- [`HideSingleCentralWidgetTitleBar`](#hidesinglecentralwidgettitlebar)
|
||||||
- [`EqualSplitOnInsertion`](#equalsplitoninsertion)
|
- [`FocusHighlighting`](#focushighlighting)
|
||||||
- [`FloatingContainerForceNativeTitleBar` (Linux only)](#floatingcontainerforcenativetitlebar-linux-only)
|
- [`EqualSplitOnInsertion`](#equalsplitoninsertion)
|
||||||
- [`FloatingContainerForceQWidgetTitleBar` (Linux only)](#floatingcontainerforceqwidgettitlebar-linux-only)
|
- [`FloatingContainerForceNativeTitleBar` (Linux only)](#floatingcontainerforcenativetitlebar-linux-only)
|
||||||
- [`MiddleMouseButtonClosesTab`](#middlemousebuttonclosestab)
|
- [`FloatingContainerForceQWidgetTitleBar` (Linux only)](#floatingcontainerforceqwidgettitlebar-linux-only)
|
||||||
- [`DisableTabTextEliding`](#disabletabtexteliding)
|
- [`MiddleMouseButtonClosesTab`](#middlemousebuttonclosestab)
|
||||||
- [`ShowTabTextOnlyForActiveTab`](#showtabtextonlyforactivetab)
|
- [`DisableTabTextEliding`](#disabletabtexteliding)
|
||||||
- [Auto-Hide Configuration Flags](#auto-hide-configuration-flags)
|
- [`ShowTabTextOnlyForActiveTab`](#showtabtextonlyforactivetab)
|
||||||
|
- [`DoubleClickUndocksWidget`](#doubleclickundockswidget)
|
||||||
|
- [`TabsAtBottom`](#tabsatbottom)
|
||||||
- [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)
|
- [Drag \& Drop to Auto-Hide](#drag--drop-to-auto-hide)
|
||||||
- [Auto-Hide Tab Insertion Order](#auto-hide-tab-insertion-order)
|
- [Auto-Hide Tab Insertion Order](#auto-hide-tab-insertion-order)
|
||||||
- [Auto-Hide Tab Sorting](#auto-hide-tab-sorting)
|
- [Auto-Hide Tab Sorting](#auto-hide-tab-sorting)
|
||||||
- [Auto-Hide Drag to Float / Dock](#auto-hide-drag-to-float--dock)
|
- [Auto-Hide Drag to Float / Dock](#auto-hide-drag-to-float--dock)
|
||||||
- [Auto-Hide Context Menu](#auto-hide-context-menu)
|
- [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)
|
- [Auto-Hide Configuration Flags](#auto-hide-configuration-flags)
|
||||||
- [`AutoHideFeatureEnabled`](#autohidefeatureenabled)
|
- [Setting Auto-Hide Flags](#setting-auto-hide-flags)
|
||||||
- [`DockAreaHasAutoHideButton`](#dockareahasautohidebutton)
|
- [`AutoHideFeatureEnabled`](#autohidefeatureenabled)
|
||||||
- [`AutoHideButtonTogglesArea`](#autohidebuttontogglesarea)
|
- [`DockAreaHasAutoHideButton`](#dockareahasautohidebutton)
|
||||||
- [`AutoHideButtonCheckable`](#autohidebuttoncheckable)
|
- [`AutoHideButtonTogglesArea`](#autohidebuttontogglesarea)
|
||||||
- [`AutoHideSideBarsIconOnly`](#autohidesidebarsicononly)
|
- [`AutoHideButtonCheckable`](#autohidebuttoncheckable)
|
||||||
- [`AutoHideShowOnMouseOver`](#autohideshowonmouseover)
|
- [`AutoHideSideBarsIconOnly`](#autohidesidebarsicononly)
|
||||||
- [`AutoHideCloseButtonCollapsesDock`](#autohideclosebuttoncollapsesdock)
|
- [`AutoHideShowOnMouseOver`](#autohideshowonmouseover)
|
||||||
- [`AutoHideHasCloseButton`](#autohidehasclosebutton)
|
- [`AutoHideCloseButtonCollapsesDock`](#autohideclosebuttoncollapsesdock)
|
||||||
- [`AutoHideHasMinimizeButton`](#autohidehasminimizebutton)
|
- [`AutoHideHasCloseButton`](#autohidehasclosebutton)
|
||||||
- [DockWidget Feature Flags](#dockwidget-feature-flags)
|
- [`AutoHideHasMinimizeButton`](#autohidehasminimizebutton)
|
||||||
- [`DockWidgetClosable`](#dockwidgetclosable)
|
- [`AutoHideOpenOnDragHover`](#autohideopenondraghover)
|
||||||
- [`DockWidgetMovable`](#dockwidgetmovable)
|
- [`AutoHideCloseOnOutsideMouseClick`](#autohidecloseonoutsidemouseclick)
|
||||||
- [`DockWidgetFloatable`](#dockwidgetfloatable)
|
- [DockWidget Feature Flags](#dockwidget-feature-flags)
|
||||||
- [`DockWidgetDeleteOnClose`](#dockwidgetdeleteonclose)
|
- [`DockWidgetClosable`](#dockwidgetclosable)
|
||||||
- [`CustomCloseHandling`](#customclosehandling)
|
- [`DockWidgetMovable`](#dockwidgetmovable)
|
||||||
- [`DockWidgetFocusable`](#dockwidgetfocusable)
|
- [`DockWidgetFloatable`](#dockwidgetfloatable)
|
||||||
- [`DockWidgetForceCloseWithArea`](#dockwidgetforceclosewitharea)
|
- [`DockWidgetDeleteOnClose`](#dockwidgetdeleteonclose)
|
||||||
- [`NoTab`](#notab)
|
- [`CustomCloseHandling`](#customclosehandling)
|
||||||
- [`DeleteContentOnClose`](#deletecontentonclose)
|
- [`DockWidgetFocusable`](#dockwidgetfocusable)
|
||||||
- [Central Widget](#central-widget)
|
- [`DockWidgetForceCloseWithArea`](#dockwidgetforceclosewitharea)
|
||||||
- [Empty Dock Area](#empty-dock-area)
|
- [`NoTab`](#notab)
|
||||||
- [Custom Close Handling](#custom-close-handling)
|
- [`DeleteContentOnClose`](#deletecontentonclose)
|
||||||
- [Styling](#styling)
|
- [Central Widget](#central-widget)
|
||||||
- [Disabling the Internal Style Sheet](#disabling-the-internal-style-sheet)
|
- [Empty Dock Area](#empty-dock-area)
|
||||||
|
- [Custom Close Handling](#custom-close-handling)
|
||||||
|
- [Globally Lock Docking Features](#globally-lock-docking-features)
|
||||||
|
- [Dock Widget Size / Minimum Size Handling](#dock-widget-size--minimum-size-handling)
|
||||||
|
- [Styling](#styling)
|
||||||
|
- [Disabling the Internal Style Sheet](#disabling-the-internal-style-sheet)
|
||||||
|
- [Using ADS on Linux](#using-ads-on-linux)
|
||||||
|
- [Supported Distributions](#supported-distributions)
|
||||||
|
- [Requirements](#requirements)
|
||||||
|
- [Manjaro xfce 25.0.1 and Xubuntu 24.04.2 issues](#manjaro-xfce-2501-and-xubuntu-24042-issues)
|
||||||
|
- [OpenGl + ADS](#opengl--ads)
|
||||||
|
|
||||||
## Configuration Flags
|
## Configuration Flags
|
||||||
|
|
||||||
@@ -303,8 +315,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.
|
||||||
|
|
||||||
@@ -494,9 +507,18 @@ for active tabs. Inactive tabs only show their icon:
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
## Auto-Hide Configuration Flags
|
### `DoubleClickUndocksWidget`
|
||||||
|
|
||||||
### Auto Hide Dock Widgets
|
If the flag is set (default), a double click on a tab undocks the dock widget.
|
||||||
|
If you would like to disable undocking, just clear this flag.
|
||||||
|
|
||||||
|
### `TabsAtBottom`
|
||||||
|
|
||||||
|
If the flag is set, tabs will be shown at the bottom instead of in the title bar.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## Auto Hide Dock Widgets
|
||||||
|
|
||||||
The Advanced Docking System supports "Auto-Hide" functionality for **all**
|
The Advanced Docking System supports "Auto-Hide" functionality for **all**
|
||||||
dock containers. The "Auto Hide" feature allows to display more information
|
dock containers. The "Auto Hide" feature allows to display more information
|
||||||
@@ -597,6 +619,8 @@ DockManager->addAutoHideDockWidget(SideBarLeft, TableDockWidget);
|
|||||||
|
|
||||||
See `autohide` example or the demo application to learn how it works.
|
See `autohide` example or the demo application to learn how it works.
|
||||||
|
|
||||||
|
## Auto-Hide Configuration Flags
|
||||||
|
|
||||||
### Setting Auto-Hide Flags
|
### Setting Auto-Hide Flags
|
||||||
|
|
||||||
The Advanced Docking System has a number of global configuration flags to
|
The Advanced Docking System has a number of global configuration flags to
|
||||||
@@ -703,6 +727,20 @@ If this flag is set (disabled by default), then each auto hide widget has a mini
|
|||||||
|
|
||||||

|

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

|
||||||
|
|
||||||
|
Said dock must be set to accept drops to hide when cursor leaves its scope. See `AutoHideDragNDropExample` for more details.
|
||||||
|
|
||||||
|
### `AutoHideCloseOnOutsideMouseClick`
|
||||||
|
|
||||||
|
If this flag is set (default), the auto hide dock container will collapse if the
|
||||||
|
user clicks outside of the container. If not set, the auto hide container can be
|
||||||
|
closed only via click on auto hide sidebar tab.
|
||||||
|
|
||||||
## DockWidget Feature Flags
|
## DockWidget Feature Flags
|
||||||
|
|
||||||
### `DockWidgetClosable`
|
### `DockWidgetClosable`
|
||||||
@@ -824,6 +862,93 @@ Normally clicking the close button of a dock widget will just hide the widget an
|
|||||||
|
|
||||||
When an entire area is closed, the default behavior is to hide the dock widgets it contains regardless of the `DockWidgetDeleteOnClose` flag except if there is only one dock widget. In this special case, the `DockWidgetDeleteOnClose` flag is followed. This behavior can be changed by setting the `DockWidgetForceCloseWithArea` flag to all the dock widgets that needs to be closed with their area.
|
When an entire area is closed, the default behavior is to hide the dock widgets it contains regardless of the `DockWidgetDeleteOnClose` flag except if there is only one dock widget. In this special case, the `DockWidgetDeleteOnClose` flag is followed. This behavior can be changed by setting the `DockWidgetForceCloseWithArea` flag to all the dock widgets that needs to be closed with their area.
|
||||||
|
|
||||||
|
## Globally Lock Docking Features
|
||||||
|
|
||||||
|
It is possible to globally lock features of all dock widgets to "freeze" the
|
||||||
|
current workspace layout. That means, you can now lock your workspace
|
||||||
|
to avoid accidentally dragging a docked view. When locking wasn't possible,
|
||||||
|
users had to manually dock it back to the desired place after each accidental
|
||||||
|
undock.
|
||||||
|
|
||||||
|
You can use a combination of the following feature flags to define which features
|
||||||
|
shall get locked:
|
||||||
|
|
||||||
|
- `CDockWidget::DockWidgetClosable`
|
||||||
|
- `CDockWidget::DockWidgetMovable`
|
||||||
|
- `CDockWidget::DockWidgetFloatable`
|
||||||
|
- `CDockWidget::DockWidgetPinable`
|
||||||
|
|
||||||
|
To clear the locked features, you can use `CDockWidget::NoDockWidgetFeatures`
|
||||||
|
The following code shows how to lock and unlock all dock widget features
|
||||||
|
globally.
|
||||||
|
|
||||||
|
```c++
|
||||||
|
DockManager->lockDockWidgetFeaturesGlobally();
|
||||||
|
DockManager->lockDockWidgetFeaturesGlobally(CDockWidget::NoDockWidgetFeatures);
|
||||||
|
```
|
||||||
|
|
||||||
|
## Dock Widget Size / Minimum Size Handling
|
||||||
|
|
||||||
|
There are several `CDockWidget` mode enums to control how a `CDockWidget` is
|
||||||
|
resized and how the docking system handles the minimum size of a dockwidget.
|
||||||
|
|
||||||
|
The first one is the `eInsertMode` enum:
|
||||||
|
|
||||||
|
```c++
|
||||||
|
enum eInsertMode
|
||||||
|
{
|
||||||
|
AutoScrollArea,
|
||||||
|
ForceScrollArea,
|
||||||
|
ForceNoScrollArea
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
The InsertMode defines how the widget is inserted into the dock widget, when you
|
||||||
|
call the `CDockWidget::setWidget` method:
|
||||||
|
|
||||||
|
```c++
|
||||||
|
DockWidget->setWidget(widget, CDockWidget::AutoScrollArea);
|
||||||
|
```
|
||||||
|
|
||||||
|
The content of a dock widget should be resizable do a very small size to
|
||||||
|
prevent the dock widget from blocking the resizing. To ensure, that a
|
||||||
|
dock widget can be resized very well, it is better to insert the content
|
||||||
|
widget into a scroll area or to provide a widget that is already a scroll
|
||||||
|
area or that contains a scroll area (such as an `QAbstractItemView`)
|
||||||
|
If the InsertMode is `AutoScrollArea`, the DockWidget tries to automatically
|
||||||
|
detect how to insert the given widget. If the widget is derived from
|
||||||
|
`QScrollArea` (i.e. an `QAbstractItemView`), then the widget is inserted
|
||||||
|
directly. If the given widget is not a scroll area, the widget will be
|
||||||
|
inserted into a scroll area.
|
||||||
|
|
||||||
|
To force insertion into a scroll area, you can also provide the InsertMode
|
||||||
|
`ForceScrollArea`. In this case a scroll area will also be created for content
|
||||||
|
widgets that are derived from `QScrollArea` To prevent insertion into a scroll
|
||||||
|
area, you can provide the InsertMode `ForceNoScrollArea`. In this case, the
|
||||||
|
content widget is always inserted directly.
|
||||||
|
|
||||||
|
A second enum, the `eMinimumSizeHintMode` defines, which value will be returned
|
||||||
|
from the `CDockWidget::minimumSizeHint()` function:
|
||||||
|
|
||||||
|
```c++
|
||||||
|
enum eMinimumSizeHintMode
|
||||||
|
{
|
||||||
|
MinimumSizeHintFromDockWidget,
|
||||||
|
MinimumSizeHintFromContent,
|
||||||
|
MinimumSizeHintFromDockWidgetMinimumSize,
|
||||||
|
MinimumSizeHintFromContentMinimumSize,
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
To ensure, that a dock widget does not block resizing, the dock widget
|
||||||
|
reimplements `minimumSizeHint()` function to return a very small minimum
|
||||||
|
size hint. If you would like to adhere the `minimumSizeHint()` from the
|
||||||
|
content widget, then set the `minimumSizeHintMode()` to
|
||||||
|
`MinimumSizeHintFromContent`. If you would like to use the `minimumSize()`
|
||||||
|
value of the content widget or the dock widget, then you can use the
|
||||||
|
`MinimumSizeHintFromDockWidgetMinimumSize` or
|
||||||
|
`MinimumSizeHintFromContentMinimumSize` modes.
|
||||||
|
|
||||||
## Styling
|
## Styling
|
||||||
|
|
||||||
The Advanced Docking System supports styling via [Qt Style Sheets](https://doc.qt.io/qt-5/stylesheet.html). All components like splitters, tabs, buttons, titlebar and
|
The Advanced Docking System supports styling via [Qt Style Sheets](https://doc.qt.io/qt-5/stylesheet.html). All components like splitters, tabs, buttons, titlebar and
|
||||||
@@ -841,3 +966,51 @@ just call the function for settings the stylesheet with an empty string.
|
|||||||
DockManager->setStyleSheet("");
|
DockManager->setStyleSheet("");
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Using ADS on Linux
|
||||||
|
|
||||||
|
### Supported 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** - uses KWin - no native title bars
|
||||||
|
- **Ubuntu 18.04, 19.10 and 20.04** - native title bars are supported
|
||||||
|
- **Ubuntu 22.04** - uses Wayland -> no native title bars
|
||||||
|
|
||||||
|
### Requirements
|
||||||
|
|
||||||
|
There are some requirements for the Linux distribution that have to be met:
|
||||||
|
|
||||||
|
- an X server that supports ARGB visuals and a compositing window manager. This is required to display the translucent dock overlays ([https://doc.qt.io/qt-5/qwidget.html#creating-translucent-windows](https://doc.qt.io/qt-5/qwidget.html#creating-translucent-windows)). If your Linux distribution does not support this, or if you disable this feature, you will very likely see issue [#95](https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/issues/95).
|
||||||
|
- Wayland is not properly supported by Qt yet. If you use Wayland, then you should set the session type to x11: `XDG_SESSION_TYPE=x11 ./AdvancedDockingSystemDemo`. You will find more details about this in issue [#288](https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/issues/288).
|
||||||
|
|
||||||
|
Screenshot Kubuntu:
|
||||||
|

|
||||||
|
|
||||||
|
Screenshot Ubuntu:
|
||||||
|

|
||||||
|
|
||||||
|
### Manjaro xfce 25.0.1 and Xubuntu 24.04.2 issues
|
||||||
|
|
||||||
|
There is a known focus stealing issue with the xfce4 compositor reported in issue [#734]. This issue
|
||||||
|
can be solved by enabling the setting **Activate focus stealing prevention**. `Settings > Window Manager Tweaks` has a tab called `Focus`.
|
||||||
|
|
||||||
|
Selecting `Activate focus stealing prevention` and `Do nothing` for `When a window raises itself`, seems to mitigate the issue. Deselecting `Enable display compositing` on the `Compositor` tab, also works.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## OpenGl + ADS
|
||||||
|
|
||||||
|
If you would like to use OpenGL widgets with ADS such as `GLWidget`, QML or `QWebEngineView`, then you need
|
||||||
|
to set `QApplication::setAttribute(Qt::AA_ShareOpenGLContexts)` before creating your application and your
|
||||||
|
widgets (see issue [#732])
|
||||||
|
|
||||||
|
```c++
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
QApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
|
||||||
|
QApplication application(argc, argv);
|
||||||
|
...
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|||||||
BIN
doc/xfce4_focus_stealing_issue.png
Normal file
|
After Width: | Height: | Size: 32 KiB |
@@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.5)
|
cmake_minimum_required(VERSION 3.16)
|
||||||
project(QtADSExamples LANGUAGES CXX VERSION ${VERSION_SHORT})
|
project(QtADSExamples LANGUAGES CXX VERSION ${VERSION_SHORT})
|
||||||
add_subdirectory(simple)
|
add_subdirectory(simple)
|
||||||
add_subdirectory(hideshow)
|
add_subdirectory(hideshow)
|
||||||
@@ -6,5 +6,7 @@ add_subdirectory(sidebar)
|
|||||||
add_subdirectory(deleteonclose)
|
add_subdirectory(deleteonclose)
|
||||||
add_subdirectory(centralwidget)
|
add_subdirectory(centralwidget)
|
||||||
add_subdirectory(autohide)
|
add_subdirectory(autohide)
|
||||||
|
add_subdirectory(autohidedragndrop)
|
||||||
add_subdirectory(emptydockarea)
|
add_subdirectory(emptydockarea)
|
||||||
add_subdirectory(dockindock)
|
add_subdirectory(dockindock)
|
||||||
|
add_subdirectory(configflags)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.5)
|
cmake_minimum_required(VERSION 3.16)
|
||||||
project(ads_example_autohide VERSION ${VERSION_SHORT})
|
project(ads_example_autohide 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 REQUIRED)
|
||||||
@@ -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 qt${QT_VERSION_MAJOR}advanceddocking)
|
target_link_libraries(AutoHideExample PRIVATE qtadvanceddocking-qt${QT_VERSION_MAJOR})
|
||||||
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)
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ CMainWindow::CMainWindow(QWidget *parent)
|
|||||||
// Set central widget
|
// Set central widget
|
||||||
QPlainTextEdit* w = new QPlainTextEdit();
|
QPlainTextEdit* w = new QPlainTextEdit();
|
||||||
w->setPlaceholderText("This is the central editor. Enter your text here.");
|
w->setPlaceholderText("This is the central editor. Enter your text here.");
|
||||||
CDockWidget* CentralDockWidget = new CDockWidget("CentralWidget");
|
CDockWidget* CentralDockWidget = DockManager->createDockWidget("CentralWidget");
|
||||||
CentralDockWidget->setWidget(w);
|
CentralDockWidget->setWidget(w);
|
||||||
auto* CentralDockArea = DockManager->setCentralWidget(CentralDockWidget);
|
auto* CentralDockArea = DockManager->setCentralWidget(CentralDockWidget);
|
||||||
CentralDockArea->setAllowedAreas(DockWidgetArea::OuterDockAreas);
|
CentralDockArea->setAllowedAreas(DockWidgetArea::OuterDockAreas);
|
||||||
@@ -42,7 +42,7 @@ CMainWindow::CMainWindow(QWidget *parent)
|
|||||||
QTableWidget* table = new QTableWidget();
|
QTableWidget* table = new QTableWidget();
|
||||||
table->setColumnCount(3);
|
table->setColumnCount(3);
|
||||||
table->setRowCount(10);
|
table->setRowCount(10);
|
||||||
CDockWidget* TableDockWidget = new CDockWidget("Table 1");
|
CDockWidget* TableDockWidget = DockManager->createDockWidget("Table 1");
|
||||||
TableDockWidget->setWidget(table);
|
TableDockWidget->setWidget(table);
|
||||||
TableDockWidget->setMinimumSizeHintMode(CDockWidget::MinimumSizeHintFromDockWidget);
|
TableDockWidget->setMinimumSizeHintMode(CDockWidget::MinimumSizeHintFromDockWidget);
|
||||||
TableDockWidget->setMinimumSize(200,150);
|
TableDockWidget->setMinimumSize(200,150);
|
||||||
@@ -53,7 +53,7 @@ CMainWindow::CMainWindow(QWidget *parent)
|
|||||||
table = new QTableWidget();
|
table = new QTableWidget();
|
||||||
table->setColumnCount(5);
|
table->setColumnCount(5);
|
||||||
table->setRowCount(1020);
|
table->setRowCount(1020);
|
||||||
TableDockWidget = new CDockWidget("Table 2");
|
TableDockWidget = DockManager->createDockWidget("Table 2");
|
||||||
TableDockWidget->setWidget(table);
|
TableDockWidget->setWidget(table);
|
||||||
TableDockWidget->setMinimumSizeHintMode(CDockWidget::MinimumSizeHintFromDockWidget);
|
TableDockWidget->setMinimumSizeHintMode(CDockWidget::MinimumSizeHintFromDockWidget);
|
||||||
TableDockWidget->resize(250, 150);
|
TableDockWidget->resize(250, 150);
|
||||||
@@ -64,7 +64,7 @@ CMainWindow::CMainWindow(QWidget *parent)
|
|||||||
QTableWidget* propertiesTable = new QTableWidget();
|
QTableWidget* propertiesTable = new QTableWidget();
|
||||||
propertiesTable->setColumnCount(3);
|
propertiesTable->setColumnCount(3);
|
||||||
propertiesTable->setRowCount(10);
|
propertiesTable->setRowCount(10);
|
||||||
CDockWidget* PropertiesDockWidget = new CDockWidget("Properties");
|
CDockWidget* PropertiesDockWidget = DockManager->createDockWidget("Properties");
|
||||||
PropertiesDockWidget->setWidget(propertiesTable);
|
PropertiesDockWidget->setWidget(propertiesTable);
|
||||||
PropertiesDockWidget->setMinimumSizeHintMode(CDockWidget::MinimumSizeHintFromDockWidget);
|
PropertiesDockWidget->setMinimumSizeHintMode(CDockWidget::MinimumSizeHintFromDockWidget);
|
||||||
PropertiesDockWidget->resize(250, 150);
|
PropertiesDockWidget->resize(250, 150);
|
||||||
|
|||||||
29
examples/autohidedragndrop/CMakeLists.txt
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.16)
|
||||||
|
project(ads_example_autohide_dragndrop VERSION ${VERSION_SHORT})
|
||||||
|
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED)
|
||||||
|
find_package(Qt${QT_VERSION_MAJOR} 5.5 COMPONENTS Core Gui Widgets REQUIRED)
|
||||||
|
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||||
|
add_executable(AutoHideDragNDropExample WIN32
|
||||||
|
main.cpp
|
||||||
|
mainwindow.cpp
|
||||||
|
mainwindow.ui
|
||||||
|
droppableitem.cpp
|
||||||
|
)
|
||||||
|
target_include_directories(AutoHideDragNDropExample PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../src")
|
||||||
|
target_link_libraries(AutoHideDragNDropExample PRIVATE qtadvanceddocking-qt${QT_VERSION_MAJOR})
|
||||||
|
target_link_libraries(AutoHideDragNDropExample PUBLIC Qt${QT_VERSION_MAJOR}::Core
|
||||||
|
Qt${QT_VERSION_MAJOR}::Gui
|
||||||
|
Qt${QT_VERSION_MAJOR}::Widgets)
|
||||||
|
set_target_properties(AutoHideDragNDropExample PROPERTIES
|
||||||
|
AUTOMOC ON
|
||||||
|
AUTORCC ON
|
||||||
|
AUTOUIC ON
|
||||||
|
CXX_STANDARD 14
|
||||||
|
CXX_STANDARD_REQUIRED ON
|
||||||
|
CXX_EXTENSIONS OFF
|
||||||
|
VERSION ${VERSION_SHORT}
|
||||||
|
EXPORT_NAME "Qt Advanced Docking System Auto Hide With Drag N Drop Example"
|
||||||
|
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib"
|
||||||
|
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib"
|
||||||
|
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/bin"
|
||||||
|
)
|
||||||
36
examples/autohidedragndrop/autohidedragndrop.pro
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
ADS_OUT_ROOT = $${OUT_PWD}/../..
|
||||||
|
|
||||||
|
QT += core gui widgets
|
||||||
|
|
||||||
|
TARGET = AutoHideDragNDropExample
|
||||||
|
DESTDIR = $${ADS_OUT_ROOT}/lib
|
||||||
|
TEMPLATE = app
|
||||||
|
CONFIG += c++14
|
||||||
|
CONFIG += debug_and_release
|
||||||
|
adsBuildStatic {
|
||||||
|
DEFINES += ADS_STATIC
|
||||||
|
}
|
||||||
|
|
||||||
|
# The following define makes your compiler emit warnings if you use
|
||||||
|
# any Qt feature that has been marked deprecated (the exact warnings
|
||||||
|
# depend on your compiler). Please consult the documentation of the
|
||||||
|
# deprecated API in order to know how to port your code away from it.
|
||||||
|
DEFINES += QT_DEPRECATED_WARNINGS
|
||||||
|
|
||||||
|
SOURCES += \
|
||||||
|
main.cpp \
|
||||||
|
mainwindow.cpp \
|
||||||
|
droppableitem.cpp
|
||||||
|
|
||||||
|
HEADERS += \
|
||||||
|
mainwindow.h \
|
||||||
|
droppableitem.h
|
||||||
|
|
||||||
|
FORMS += \
|
||||||
|
mainwindow.ui
|
||||||
|
|
||||||
|
LIBS += -L$${ADS_OUT_ROOT}/lib
|
||||||
|
include(../../ads.pri)
|
||||||
|
INCLUDEPATH += ../../src
|
||||||
|
DEPENDPATH += ../../src
|
||||||
|
|
||||||
38
examples/autohidedragndrop/droppableitem.cpp
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
#include "droppableitem.h"
|
||||||
|
|
||||||
|
#include <QDragEnterEvent>
|
||||||
|
#include <QDragLeaveEvent>
|
||||||
|
#include <QDropEvent>
|
||||||
|
#include <QMimeData>
|
||||||
|
#include <qsizepolicy.h>
|
||||||
|
|
||||||
|
DroppableItem::DroppableItem(const QString& text, QWidget* parent)
|
||||||
|
: QPushButton(text, parent)
|
||||||
|
{
|
||||||
|
setAcceptDrops(true);
|
||||||
|
setSizePolicy(QSizePolicy::Policy::Expanding, QSizePolicy::Policy::Expanding);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DroppableItem::dragEnterEvent(QDragEnterEvent* event)
|
||||||
|
{
|
||||||
|
if (event->mimeData()->hasText())
|
||||||
|
{
|
||||||
|
event->acceptProposedAction();
|
||||||
|
setCursor(Qt::DragMoveCursor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DroppableItem::dragLeaveEvent(QDragLeaveEvent* event)
|
||||||
|
{
|
||||||
|
Q_UNUSED(event);
|
||||||
|
unsetCursor();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DroppableItem::dropEvent(QDropEvent* event)
|
||||||
|
{
|
||||||
|
if (event->mimeData()->hasText())
|
||||||
|
{
|
||||||
|
event->acceptProposedAction();
|
||||||
|
setText(event->mimeData()->text());
|
||||||
|
}
|
||||||
|
}
|
||||||
19
examples/autohidedragndrop/droppableitem.h
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
#include <QObject>
|
||||||
|
#include <QPushButton>
|
||||||
|
|
||||||
|
class QDragEnterEvent;
|
||||||
|
class QDragLeaveEvent;
|
||||||
|
class QDropEvent;
|
||||||
|
|
||||||
|
class DroppableItem : public QPushButton
|
||||||
|
{
|
||||||
|
Q_OBJECT;
|
||||||
|
|
||||||
|
public:
|
||||||
|
DroppableItem(const QString& text = QString(), QWidget* parent = nullptr);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void dragEnterEvent(QDragEnterEvent* event) override;
|
||||||
|
void dragLeaveEvent(QDragLeaveEvent* event) override;
|
||||||
|
void dropEvent(QDropEvent* event) override;
|
||||||
|
};
|
||||||
10
examples/autohidedragndrop/main.cpp
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
#include <mainwindow.h>
|
||||||
|
#include <QApplication>
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
QApplication a(argc, argv);
|
||||||
|
CMainWindow w;
|
||||||
|
w.show();
|
||||||
|
return a.exec();
|
||||||
|
}
|
||||||
84
examples/autohidedragndrop/main.py
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
from PyQt5 import uic
|
||||||
|
from PyQt5.QtCore import Qt, QTimer, QDir, QSignalBlocker
|
||||||
|
from PyQt5.QtGui import QCloseEvent, QIcon
|
||||||
|
from PyQt5.QtWidgets import (QApplication, QLabel, QCalendarWidget, QFrame, QTreeView,
|
||||||
|
QTableWidget, QFileSystemModel, QPlainTextEdit, QToolBar,
|
||||||
|
QWidgetAction, QComboBox, QAction, QSizePolicy, QInputDialog)
|
||||||
|
|
||||||
|
import PyQtAds as QtAds
|
||||||
|
|
||||||
|
UI_FILE = os.path.join(os.path.dirname(__file__), 'mainwindow.ui')
|
||||||
|
MainWindowUI, MainWindowBase = uic.loadUiType(UI_FILE)
|
||||||
|
|
||||||
|
class MainWindow(MainWindowUI, MainWindowBase):
|
||||||
|
|
||||||
|
def __init__(self, parent=None):
|
||||||
|
super().__init__(parent)
|
||||||
|
|
||||||
|
self.setupUi(self)
|
||||||
|
|
||||||
|
QtAds.CDockManager.setConfigFlag(QtAds.CDockManager.OpaqueSplitterResize, True)
|
||||||
|
QtAds.CDockManager.setConfigFlag(QtAds.CDockManager.XmlCompressionEnabled, False)
|
||||||
|
QtAds.CDockManager.setConfigFlag(QtAds.CDockManager.FocusHighlighting, True)
|
||||||
|
QtAds.CDockManager.setAutoHideConfigFlag(QtAds.CDockManager.AutoHideOpenOnDragHover, True);
|
||||||
|
self.dock_manager = QtAds.CDockManager(self)
|
||||||
|
|
||||||
|
# Set central widget
|
||||||
|
text_edit = QPlainTextEdit()
|
||||||
|
text_edit.setPlaceholderText("This is the central editor. Enter your text here.")
|
||||||
|
central_dock_widget = QtAds.CDockWidget("CentralWidget")
|
||||||
|
central_dock_widget.setWidget(text_edit)
|
||||||
|
central_dock_area = self.dock_manager.setCentralWidget(central_dock_widget)
|
||||||
|
central_dock_area.setAllowedAreas(QtAds.DockWidgetArea.OuterDockAreas)
|
||||||
|
|
||||||
|
|
||||||
|
droppable_item = DroppableItem("Drop text here.")
|
||||||
|
drop_dock_widget = QtAds.CDockWidget("Tab")
|
||||||
|
drop_dock_widget.setWidget(droppable_item)
|
||||||
|
drop_dock_widget.setMinimumSizeHintMode(QtAds.CDockWidget.MinimumSizeHintFromDockWidget)
|
||||||
|
drop_dock_widget.setMinimumSize(200, 150)
|
||||||
|
drop_dock_widget.setAcceptDrops(True)
|
||||||
|
drop_area = self.dock_manager.addDockWidget(QtAds.DockWidgetArea.LeftDockWidgetArea, drop_dock_widget)
|
||||||
|
drop_area.setAcceptDrops(True)
|
||||||
|
self.menuView.addAction(drop_dock_widget.toggleViewAction())
|
||||||
|
|
||||||
|
self.create_perspective_ui()
|
||||||
|
|
||||||
|
def create_perspective_ui(self):
|
||||||
|
save_perspective_action = QAction("Create Perspective", self)
|
||||||
|
save_perspective_action.triggered.connect(self.save_perspective)
|
||||||
|
perspective_list_action = QWidgetAction(self)
|
||||||
|
self.perspective_combobox = QComboBox(self)
|
||||||
|
self.perspective_combobox.setSizeAdjustPolicy(QComboBox.AdjustToContents)
|
||||||
|
self.perspective_combobox.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
|
||||||
|
self.perspective_combobox.activated[str].connect(self.dock_manager.openPerspective)
|
||||||
|
perspective_list_action.setDefaultWidget(self.perspective_combobox)
|
||||||
|
self.toolBar.addSeparator()
|
||||||
|
self.toolBar.addAction(perspective_list_action)
|
||||||
|
self.toolBar.addAction(save_perspective_action)
|
||||||
|
|
||||||
|
def save_perspective(self):
|
||||||
|
perspective_name, ok = QInputDialog.getText(self, "Save Perspective", "Enter Unique name:")
|
||||||
|
if not ok or not perspective_name:
|
||||||
|
return
|
||||||
|
|
||||||
|
self.dock_manager.addPerspective(perspective_name)
|
||||||
|
blocker = QSignalBlocker(self.perspective_combobox)
|
||||||
|
self.perspective_combobox.clear()
|
||||||
|
self.perspective_combobox.addItems(self.dock_manager.perspectiveNames())
|
||||||
|
self.perspective_combobox.setCurrentText(perspective_name)
|
||||||
|
|
||||||
|
def closeEvent(self, event: QCloseEvent):
|
||||||
|
self.dock_manager.deleteLater()
|
||||||
|
super().closeEvent(event)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
app = QApplication(sys.argv)
|
||||||
|
|
||||||
|
w = MainWindow()
|
||||||
|
w.show()
|
||||||
|
app.exec_()
|
||||||
132
examples/autohidedragndrop/mainwindow.cpp
Normal file
@@ -0,0 +1,132 @@
|
|||||||
|
#include "mainwindow.h"
|
||||||
|
#include "droppableitem.h"
|
||||||
|
|
||||||
|
#include "ui_mainwindow.h"
|
||||||
|
|
||||||
|
#include <QWidgetAction>
|
||||||
|
#include <QFileSystemModel>
|
||||||
|
#include <QTableWidget>
|
||||||
|
#include <QHBoxLayout>
|
||||||
|
#include <QInputDialog>
|
||||||
|
#include <QFileDialog>
|
||||||
|
#include <QSettings>
|
||||||
|
#include <QPlainTextEdit>
|
||||||
|
#include <QToolBar>
|
||||||
|
|
||||||
|
#include "AutoHideDockContainer.h"
|
||||||
|
#include "DockAreaWidget.h"
|
||||||
|
#include "DockAreaTitleBar.h"
|
||||||
|
|
||||||
|
using namespace ads;
|
||||||
|
|
||||||
|
CMainWindow::CMainWindow(QWidget *parent)
|
||||||
|
: QMainWindow(parent)
|
||||||
|
, ui(new Ui::CMainWindow)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
CDockManager::setConfigFlag(CDockManager::OpaqueSplitterResize, true);
|
||||||
|
CDockManager::setConfigFlag(CDockManager::XmlCompressionEnabled, false);
|
||||||
|
CDockManager::setConfigFlag(CDockManager::FocusHighlighting, true);
|
||||||
|
CDockManager::setConfigFlag(CDockManager::TabsAtBottom, true);
|
||||||
|
CDockManager::setAutoHideConfigFlags(CDockManager::DefaultAutoHideConfig);
|
||||||
|
CDockManager::setAutoHideConfigFlag(CDockManager::AutoHideOpenOnDragHover, true);
|
||||||
|
CDockManager::setConfigParam(CDockManager::AutoHideOpenOnDragHoverDelay_ms, 500);
|
||||||
|
DockManager = new CDockManager(this);
|
||||||
|
|
||||||
|
// Set central widget
|
||||||
|
QPlainTextEdit* w = new QPlainTextEdit();
|
||||||
|
w->setPlaceholderText("This is the central editor. Enter your text here.");
|
||||||
|
CDockWidget* CentralDockWidget = DockManager->createDockWidget("CentralWidget");
|
||||||
|
CentralDockWidget->setWidget(w);
|
||||||
|
auto* CentralDockArea = DockManager->setCentralWidget(CentralDockWidget);
|
||||||
|
CentralDockArea->setAllowedAreas(DockWidgetArea::OuterDockAreas);
|
||||||
|
|
||||||
|
{
|
||||||
|
DroppableItem* droppableItem = new DroppableItem("Drop text here.");
|
||||||
|
CDockWidget* dropDockWidget = DockManager->createDockWidget("Tab 1");
|
||||||
|
dropDockWidget->setWidget(droppableItem);
|
||||||
|
dropDockWidget->setMinimumSizeHintMode(CDockWidget::MinimumSizeHintFromDockWidget);
|
||||||
|
dropDockWidget->setMinimumSize(200,150);
|
||||||
|
dropDockWidget->setAcceptDrops(true);
|
||||||
|
const auto autoHideContainer = DockManager->addAutoHideDockWidget(SideBarLocation::SideBarLeft, dropDockWidget);
|
||||||
|
autoHideContainer->setSize(480);
|
||||||
|
autoHideContainer->setAcceptDrops(true);
|
||||||
|
ui->menuView->addAction(dropDockWidget->toggleViewAction());
|
||||||
|
}
|
||||||
|
{
|
||||||
|
DroppableItem* droppableItem = new DroppableItem("Drop text here.");
|
||||||
|
CDockWidget* dropDockWidget = DockManager->createDockWidget("Tab 2");
|
||||||
|
dropDockWidget->setWidget(droppableItem);
|
||||||
|
dropDockWidget->setMinimumSizeHintMode(CDockWidget::MinimumSizeHintFromDockWidget);
|
||||||
|
dropDockWidget->setMinimumSize(200,150);
|
||||||
|
dropDockWidget->setAcceptDrops(true);
|
||||||
|
const auto autoHideContainer = DockManager->addAutoHideDockWidget(SideBarLocation::SideBarRight, dropDockWidget);
|
||||||
|
autoHideContainer->setSize(480);
|
||||||
|
autoHideContainer->setAcceptDrops(true);
|
||||||
|
ui->menuView->addAction(dropDockWidget->toggleViewAction());
|
||||||
|
}
|
||||||
|
|
||||||
|
QTableWidget* propertiesTable = new QTableWidget();
|
||||||
|
propertiesTable->setColumnCount(3);
|
||||||
|
propertiesTable->setRowCount(10);
|
||||||
|
CDockWidget* PropertiesDockWidget = DockManager->createDockWidget("Properties");
|
||||||
|
PropertiesDockWidget->setWidget(propertiesTable);
|
||||||
|
PropertiesDockWidget->setMinimumSizeHintMode(CDockWidget::MinimumSizeHintFromDockWidget);
|
||||||
|
PropertiesDockWidget->resize(250, 150);
|
||||||
|
PropertiesDockWidget->setMinimumSize(200,150);
|
||||||
|
DockManager->addDockWidget(DockWidgetArea::RightDockWidgetArea, PropertiesDockWidget, CentralDockArea);
|
||||||
|
ui->menuView->addAction(PropertiesDockWidget->toggleViewAction());
|
||||||
|
|
||||||
|
createPerspectiveUi();
|
||||||
|
}
|
||||||
|
|
||||||
|
CMainWindow::~CMainWindow()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CMainWindow::createPerspectiveUi()
|
||||||
|
{
|
||||||
|
SavePerspectiveAction = new QAction("Create Perspective", this);
|
||||||
|
connect(SavePerspectiveAction, SIGNAL(triggered()), SLOT(savePerspective()));
|
||||||
|
PerspectiveListAction = new QWidgetAction(this);
|
||||||
|
PerspectiveComboBox = new QComboBox(this);
|
||||||
|
PerspectiveComboBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||||
|
PerspectiveComboBox->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
|
||||||
|
connect(PerspectiveComboBox, SIGNAL(currentTextChanged(const QString&)),
|
||||||
|
DockManager, SLOT(openPerspective(const QString&)));
|
||||||
|
PerspectiveListAction->setDefaultWidget(PerspectiveComboBox);
|
||||||
|
ui->toolBar->addSeparator();
|
||||||
|
ui->toolBar->addAction(PerspectiveListAction);
|
||||||
|
ui->toolBar->addAction(SavePerspectiveAction);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CMainWindow::savePerspective()
|
||||||
|
{
|
||||||
|
QString PerspectiveName = QInputDialog::getText(this, "Save Perspective", "Enter unique name:");
|
||||||
|
if (PerspectiveName.isEmpty())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
DockManager->addPerspective(PerspectiveName);
|
||||||
|
QSignalBlocker Blocker(PerspectiveComboBox);
|
||||||
|
PerspectiveComboBox->clear();
|
||||||
|
PerspectiveComboBox->addItems(DockManager->perspectiveNames());
|
||||||
|
PerspectiveComboBox->setCurrentText(PerspectiveName);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
void CMainWindow::closeEvent(QCloseEvent* event)
|
||||||
|
{
|
||||||
|
// Delete dock manager here to delete all floating widgets. This ensures
|
||||||
|
// that all top level windows of the dock manager are properly closed
|
||||||
|
DockManager->deleteLater();
|
||||||
|
QMainWindow::closeEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
43
examples/autohidedragndrop/mainwindow.h
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
#ifndef MAINWINDOW_H
|
||||||
|
#define MAINWINDOW_H
|
||||||
|
|
||||||
|
#include <QMainWindow>
|
||||||
|
#include <QComboBox>
|
||||||
|
#include <QWidgetAction>
|
||||||
|
|
||||||
|
#include "DockManager.h"
|
||||||
|
#include "DockAreaWidget.h"
|
||||||
|
#include "DockWidget.h"
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
namespace Ui { class CMainWindow; }
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
class CMainWindow : public QMainWindow
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
CMainWindow(QWidget *parent = nullptr);
|
||||||
|
~CMainWindow();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void closeEvent(QCloseEvent* event) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
QAction* SavePerspectiveAction = nullptr;
|
||||||
|
QWidgetAction* PerspectiveListAction = nullptr;
|
||||||
|
QComboBox* PerspectiveComboBox = nullptr;
|
||||||
|
|
||||||
|
Ui::CMainWindow *ui;
|
||||||
|
|
||||||
|
ads::CDockManager* DockManager;
|
||||||
|
ads::CDockAreaWidget* StatusDockArea;
|
||||||
|
ads::CDockWidget* TimelineDockWidget;
|
||||||
|
|
||||||
|
void createPerspectiveUi();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void savePerspective();
|
||||||
|
};
|
||||||
|
#endif // MAINWINDOW_H
|
||||||
47
examples/autohidedragndrop/mainwindow.ui
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>CMainWindow</class>
|
||||||
|
<widget class="QMainWindow" name="CMainWindow">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>1284</width>
|
||||||
|
<height>757</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>MainWindow</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="centralwidget"/>
|
||||||
|
<widget class="QMenuBar" name="menubar">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>1284</width>
|
||||||
|
<height>21</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<widget class="QMenu" name="menuView">
|
||||||
|
<property name="title">
|
||||||
|
<string>View</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<addaction name="menuView"/>
|
||||||
|
</widget>
|
||||||
|
<widget class="QToolBar" name="toolBar">
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>toolBar</string>
|
||||||
|
</property>
|
||||||
|
<attribute name="toolBarArea">
|
||||||
|
<enum>TopToolBarArea</enum>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="toolBarBreak">
|
||||||
|
<bool>false</bool>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.5)
|
cmake_minimum_required(VERSION 3.16)
|
||||||
project(ads_example_centralwidget VERSION ${VERSION_SHORT})
|
project(ads_example_centralwidget 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 REQUIRED)
|
||||||
@@ -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 qt${QT_VERSION_MAJOR}advanceddocking)
|
target_link_libraries(CentralWidgetExample PRIVATE qtadvanceddocking-qt${QT_VERSION_MAJOR})
|
||||||
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)
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ CMainWindow::CMainWindow(QWidget *parent)
|
|||||||
// Set central widget
|
// Set central widget
|
||||||
QPlainTextEdit* w = new QPlainTextEdit();
|
QPlainTextEdit* w = new QPlainTextEdit();
|
||||||
w->setPlaceholderText("This is the central editor. Enter your text here.");
|
w->setPlaceholderText("This is the central editor. Enter your text here.");
|
||||||
CDockWidget* CentralDockWidget = new CDockWidget("CentralWidget");
|
CDockWidget* CentralDockWidget = DockManager->createDockWidget("CentralWidget");
|
||||||
CentralDockWidget->setWidget(w);
|
CentralDockWidget->setWidget(w);
|
||||||
auto* CentralDockArea = DockManager->setCentralWidget(CentralDockWidget);
|
auto* CentralDockArea = DockManager->setCentralWidget(CentralDockWidget);
|
||||||
CentralDockArea->setAllowedAreas(DockWidgetArea::OuterDockAreas);
|
CentralDockArea->setAllowedAreas(DockWidgetArea::OuterDockAreas);
|
||||||
@@ -49,7 +49,7 @@ CMainWindow::CMainWindow(QWidget *parent)
|
|||||||
QTableWidget* table = new QTableWidget();
|
QTableWidget* table = new QTableWidget();
|
||||||
table->setColumnCount(3);
|
table->setColumnCount(3);
|
||||||
table->setRowCount(10);
|
table->setRowCount(10);
|
||||||
CDockWidget* TableDockWidget = new CDockWidget("Table 1");
|
CDockWidget* TableDockWidget = DockManager->createDockWidget("Table 1");
|
||||||
TableDockWidget->setWidget(table);
|
TableDockWidget->setWidget(table);
|
||||||
TableDockWidget->setMinimumSizeHintMode(CDockWidget::MinimumSizeHintFromDockWidget);
|
TableDockWidget->setMinimumSizeHintMode(CDockWidget::MinimumSizeHintFromDockWidget);
|
||||||
TableDockWidget->resize(250, 150);
|
TableDockWidget->resize(250, 150);
|
||||||
@@ -60,7 +60,7 @@ CMainWindow::CMainWindow(QWidget *parent)
|
|||||||
table = new QTableWidget();
|
table = new QTableWidget();
|
||||||
table->setColumnCount(5);
|
table->setColumnCount(5);
|
||||||
table->setRowCount(1020);
|
table->setRowCount(1020);
|
||||||
TableDockWidget = new CDockWidget("Table 2");
|
TableDockWidget = DockManager->createDockWidget("Table 2");
|
||||||
TableDockWidget->setWidget(table);
|
TableDockWidget->setWidget(table);
|
||||||
TableDockWidget->setMinimumSizeHintMode(CDockWidget::MinimumSizeHintFromDockWidget);
|
TableDockWidget->setMinimumSizeHintMode(CDockWidget::MinimumSizeHintFromDockWidget);
|
||||||
TableDockWidget->resize(250, 150);
|
TableDockWidget->resize(250, 150);
|
||||||
@@ -71,7 +71,7 @@ CMainWindow::CMainWindow(QWidget *parent)
|
|||||||
QTableWidget* propertiesTable = new QTableWidget();
|
QTableWidget* propertiesTable = new QTableWidget();
|
||||||
propertiesTable->setColumnCount(3);
|
propertiesTable->setColumnCount(3);
|
||||||
propertiesTable->setRowCount(10);
|
propertiesTable->setRowCount(10);
|
||||||
CDockWidget* PropertiesDockWidget = new CDockWidget("Properties");
|
CDockWidget* PropertiesDockWidget = DockManager->createDockWidget("Properties");
|
||||||
PropertiesDockWidget->setWidget(propertiesTable);
|
PropertiesDockWidget->setWidget(propertiesTable);
|
||||||
PropertiesDockWidget->setMinimumSizeHintMode(CDockWidget::MinimumSizeHintFromDockWidget);
|
PropertiesDockWidget->setMinimumSizeHintMode(CDockWidget::MinimumSizeHintFromDockWidget);
|
||||||
PropertiesDockWidget->resize(250, 150);
|
PropertiesDockWidget->resize(250, 150);
|
||||||
|
|||||||
28
examples/configflags/CMakeLists.txt
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.16)
|
||||||
|
project(ads_example_configflags VERSION ${VERSION_SHORT})
|
||||||
|
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED)
|
||||||
|
find_package(Qt${QT_VERSION_MAJOR} 5.5 COMPONENTS Core Gui Widgets REQUIRED)
|
||||||
|
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||||
|
add_executable(ConfigFlagsExample WIN32
|
||||||
|
main.cpp
|
||||||
|
mainwindow.cpp
|
||||||
|
mainwindow.ui
|
||||||
|
)
|
||||||
|
target_include_directories(ConfigFlagsExample PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../src")
|
||||||
|
target_link_libraries(ConfigFlagsExample PRIVATE qtadvanceddocking-qt${QT_VERSION_MAJOR})
|
||||||
|
target_link_libraries(ConfigFlagsExample PUBLIC Qt${QT_VERSION_MAJOR}::Core
|
||||||
|
Qt${QT_VERSION_MAJOR}::Gui
|
||||||
|
Qt${QT_VERSION_MAJOR}::Widgets)
|
||||||
|
set_target_properties(ConfigFlagsExample PROPERTIES
|
||||||
|
AUTOMOC ON
|
||||||
|
AUTORCC ON
|
||||||
|
AUTOUIC ON
|
||||||
|
CXX_STANDARD 14
|
||||||
|
CXX_STANDARD_REQUIRED ON
|
||||||
|
CXX_EXTENSIONS OFF
|
||||||
|
VERSION ${VERSION_SHORT}
|
||||||
|
EXPORT_NAME "Qt Advanced Docking System Config Flags"
|
||||||
|
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib"
|
||||||
|
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib"
|
||||||
|
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/bin"
|
||||||
|
)
|
||||||
34
examples/configflags/configflags.pro
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
ADS_OUT_ROOT = $${OUT_PWD}/../..
|
||||||
|
|
||||||
|
QT += core gui widgets
|
||||||
|
|
||||||
|
TARGET = ConfigFlagsExample
|
||||||
|
DESTDIR = $${ADS_OUT_ROOT}/lib
|
||||||
|
TEMPLATE = app
|
||||||
|
CONFIG += c++14
|
||||||
|
CONFIG += debug_and_release
|
||||||
|
adsBuildStatic {
|
||||||
|
DEFINES += ADS_STATIC
|
||||||
|
}
|
||||||
|
|
||||||
|
# The following define makes your compiler emit warnings if you use
|
||||||
|
# any Qt feature that has been marked deprecated (the exact warnings
|
||||||
|
# depend on your compiler). Please consult the documentation of the
|
||||||
|
# deprecated API in order to know how to port your code away from it.
|
||||||
|
DEFINES += QT_DEPRECATED_WARNINGS
|
||||||
|
|
||||||
|
SOURCES += \
|
||||||
|
main.cpp \
|
||||||
|
mainwindow.cpp
|
||||||
|
|
||||||
|
HEADERS += \
|
||||||
|
mainwindow.h
|
||||||
|
|
||||||
|
FORMS += \
|
||||||
|
mainwindow.ui
|
||||||
|
|
||||||
|
LIBS += -L$${ADS_OUT_ROOT}/lib
|
||||||
|
include(../../ads.pri)
|
||||||
|
INCLUDEPATH += ../../src
|
||||||
|
DEPENDPATH += ../../src
|
||||||
|
|
||||||
10
examples/configflags/main.cpp
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
#include <mainwindow.h>
|
||||||
|
#include <QApplication>
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
QApplication a(argc, argv);
|
||||||
|
CMainWindow w;
|
||||||
|
w.show();
|
||||||
|
return a.exec();
|
||||||
|
}
|
||||||
64
examples/configflags/mainwindow.cpp
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
#include "mainwindow.h"
|
||||||
|
|
||||||
|
#include "ui_mainwindow.h"
|
||||||
|
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QToolBar>
|
||||||
|
|
||||||
|
#include "DockAreaWidget.h"
|
||||||
|
|
||||||
|
|
||||||
|
using namespace ads;
|
||||||
|
|
||||||
|
|
||||||
|
CMainWindow::CMainWindow(QWidget *parent) :
|
||||||
|
QMainWindow(parent),
|
||||||
|
ui(new Ui::CMainWindow)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
// Add the toolbar
|
||||||
|
auto toolbar_ = addToolBar("Top Toolbar");
|
||||||
|
|
||||||
|
// Create the dock manager
|
||||||
|
ads::CDockManager::setConfigFlags(ads::CDockManager::DefaultOpaqueConfig);
|
||||||
|
ads::CDockManager::setConfigFlag(ads::CDockManager::DockAreaHasCloseButton,
|
||||||
|
false);
|
||||||
|
ads::CDockManager::setConfigFlag(ads::CDockManager::DockAreaHasUndockButton,
|
||||||
|
false);
|
||||||
|
ads::CDockManager::setConfigFlag(
|
||||||
|
ads::CDockManager::DockAreaHasTabsMenuButton, false);
|
||||||
|
auto DockManager = new ads::CDockManager(this);
|
||||||
|
|
||||||
|
// Create a dockable widget
|
||||||
|
QLabel *l1 = new QLabel();
|
||||||
|
l1->setWordWrap(true);
|
||||||
|
l1->setAlignment(Qt::AlignTop | Qt::AlignLeft);
|
||||||
|
l1->setText("Docking widget 1");
|
||||||
|
ads::CDockWidget *dockWidget1 = DockManager->createDockWidget("Dock 1");
|
||||||
|
dockWidget1->setWidget(l1);
|
||||||
|
DockManager->addDockWidget(ads::LeftDockWidgetArea, dockWidget1);
|
||||||
|
|
||||||
|
QLabel *l2 = new QLabel();
|
||||||
|
l2->setWordWrap(true);
|
||||||
|
l2->setAlignment(Qt::AlignTop | Qt::AlignLeft);
|
||||||
|
l2->setText("Docking widget 2");
|
||||||
|
ads::CDockWidget *dockWidget2 = DockManager->createDockWidget("Dock 2");
|
||||||
|
dockWidget2->setWidget(l2);
|
||||||
|
DockManager->addDockWidget(ads::RightDockWidgetArea, dockWidget2);
|
||||||
|
|
||||||
|
// Add menu actions
|
||||||
|
ui->menuView->addAction(dockWidget1->toggleViewAction());
|
||||||
|
ui->menuView->addAction(dockWidget2->toggleViewAction());
|
||||||
|
toolbar_->addAction(dockWidget1->toggleViewAction());
|
||||||
|
toolbar_->addAction(dockWidget2->toggleViewAction());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CMainWindow::~CMainWindow()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
27
examples/configflags/mainwindow.h
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
#ifndef MAINWINDOW_H
|
||||||
|
#define MAINWINDOW_H
|
||||||
|
|
||||||
|
#include <QMainWindow>
|
||||||
|
#include <QComboBox>
|
||||||
|
#include <QWidgetAction>
|
||||||
|
|
||||||
|
#include "DockManager.h"
|
||||||
|
#include "DockAreaWidget.h"
|
||||||
|
#include "DockWidget.h"
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
namespace Ui { class CMainWindow; }
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
class CMainWindow : public QMainWindow
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
CMainWindow(QWidget *parent = nullptr);
|
||||||
|
~CMainWindow();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::CMainWindow *ui;
|
||||||
|
};
|
||||||
|
#endif // MAINWINDOW_H
|
||||||
47
examples/configflags/mainwindow.ui
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>CMainWindow</class>
|
||||||
|
<widget class="QMainWindow" name="CMainWindow">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>1284</width>
|
||||||
|
<height>757</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>MainWindow</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="centralwidget"/>
|
||||||
|
<widget class="QMenuBar" name="menubar">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>1284</width>
|
||||||
|
<height>21</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<widget class="QMenu" name="menuView">
|
||||||
|
<property name="title">
|
||||||
|
<string>View</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<addaction name="menuView"/>
|
||||||
|
</widget>
|
||||||
|
<widget class="QToolBar" name="toolBar">
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>toolBar</string>
|
||||||
|
</property>
|
||||||
|
<attribute name="toolBarArea">
|
||||||
|
<enum>TopToolBarArea</enum>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="toolBarBreak">
|
||||||
|
<bool>false</bool>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.5)
|
cmake_minimum_required(VERSION 3.16)
|
||||||
project(ads_example_deleteonclose VERSION ${VERSION_SHORT})
|
project(ads_example_deleteonclose 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 REQUIRED)
|
||||||
@@ -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 qt${QT_VERSION_MAJOR}advanceddocking)
|
target_link_libraries(DeleteOnCloseTest PRIVATE qtadvanceddocking-qt${QT_VERSION_MAJOR})
|
||||||
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)
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
QObject::connect(action, &QAction::triggered, [&]() {
|
QObject::connect(action, &QAction::triggered, [&]() {
|
||||||
auto dw = new ads::CDockWidget(QStringLiteral("test %1 [DockWidgetDeleteOnClose]").arg(i++), &w);
|
auto dw = dockManager->createDockWidget(QStringLiteral("test %1 [DockWidgetDeleteOnClose]").arg(i++), &w);
|
||||||
auto editor = new QTextEdit(QStringLiteral("lorem ipsum..."), dw);
|
auto editor = new QTextEdit(QStringLiteral("lorem ipsum..."), dw);
|
||||||
dw->setWidget(editor);
|
dw->setWidget(editor);
|
||||||
dw->setFeature(ads::CDockWidget::DockWidgetDeleteOnClose, true);
|
dw->setFeature(ads::CDockWidget::DockWidgetDeleteOnClose, true);
|
||||||
@@ -54,7 +54,7 @@ int main(int argc, char *argv[])
|
|||||||
qDebug() << "doc dock widget created!" << dw << area;
|
qDebug() << "doc dock widget created!" << dw << area;
|
||||||
});
|
});
|
||||||
|
|
||||||
auto dw = new ads::CDockWidget(QStringLiteral("test %1 [DeleteContentOnClose]").arg(i++), &w);
|
auto dw = dockManager->createDockWidget(QStringLiteral("test %1 [DeleteContentOnClose]").arg(i++), &w);
|
||||||
auto editor = new QTextEdit(QStringLiteral("recreated lorem ipsum......"), dw);
|
auto editor = new QTextEdit(QStringLiteral("recreated lorem ipsum......"), dw);
|
||||||
dw->setWidget(editor);
|
dw->setWidget(editor);
|
||||||
dw->setFeature(ads::CDockWidget::DeleteContentOnClose, true);
|
dw->setFeature(ads::CDockWidget::DeleteContentOnClose, true);
|
||||||
@@ -77,7 +77,7 @@ int main(int argc, char *argv[])
|
|||||||
action = new QAction("New", &w);
|
action = new QAction("New", &w);
|
||||||
w.menuBar()->addAction(action);
|
w.menuBar()->addAction(action);
|
||||||
QObject::connect(action, &QAction::triggered, [&]() {
|
QObject::connect(action, &QAction::triggered, [&]() {
|
||||||
auto dw = new ads::CDockWidget(QStringLiteral("test %1").arg(i++), &w);
|
auto dw = dockManager->createDockWidget(QStringLiteral("test %1").arg(i++), &w);
|
||||||
auto editor = new QTextEdit(QStringLiteral("lorem ipsum..."), dw);
|
auto editor = new QTextEdit(QStringLiteral("lorem ipsum..."), dw);
|
||||||
dw->setWidget(editor);
|
dw->setWidget(editor);
|
||||||
auto area = dockManager->addDockWidgetTab(ads::CenterDockWidgetArea, dw);
|
auto area = dockManager->addDockWidgetTab(ads::CenterDockWidgetArea, dw);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.5)
|
cmake_minimum_required(VERSION 3.16)
|
||||||
project(ads_example_dockindock VERSION ${VERSION_SHORT})
|
project(ads_example_dockindock 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 REQUIRED)
|
||||||
@@ -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 qt${QT_VERSION_MAJOR}advanceddocking)
|
target_link_libraries(DockInDockExample PRIVATE qtadvanceddocking-qt${QT_VERSION_MAJOR})
|
||||||
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)
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ ads::CDockAreaWidget* DockInDockWidget::addTabWidget( QWidget* widget, const QSt
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ads::CDockWidget* DockWidget = new ads::CDockWidget(name);
|
ads::CDockWidget* DockWidget = m_mgr->createDockWidget(name);
|
||||||
DockWidget->setWidget(widget);
|
DockWidget->setWidget(widget);
|
||||||
DockWidget->setIcon( icon );
|
DockWidget->setIcon( icon );
|
||||||
|
|
||||||
@@ -101,7 +101,7 @@ DockInDockWidget* DockInDockWidget::createGroup( const QString& groupName, QIcon
|
|||||||
DockInDockWidget* child = new DockInDockWidget( this, m_topLevelDockWidget, m_perspectivesManager );
|
DockInDockWidget* child = new DockInDockWidget( this, m_topLevelDockWidget, m_perspectivesManager );
|
||||||
child->setObjectName( groupName );
|
child->setObjectName( groupName );
|
||||||
|
|
||||||
ads::CDockWidget* DockWidget = new ads::CDockWidget(groupName);
|
ads::CDockWidget* DockWidget = m_mgr->createDockWidget(groupName);
|
||||||
DockWidget->setWidget(child);
|
DockWidget->setWidget(child);
|
||||||
DockWidget->setIcon(icon);
|
DockWidget->setIcon(icon);
|
||||||
|
|
||||||
|
|||||||
@@ -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[])
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.5)
|
cmake_minimum_required(VERSION 3.16)
|
||||||
project(ads_example_centralwidget VERSION ${VERSION_SHORT})
|
project(ads_example_centralwidget 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 REQUIRED)
|
||||||
@@ -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 qt${QT_VERSION_MAJOR}advanceddocking)
|
target_link_libraries(EmptyDockAreaExample PRIVATE qtadvanceddocking-qt${QT_VERSION_MAJOR})
|
||||||
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)
|
||||||
|
|||||||
@@ -19,8 +19,6 @@
|
|||||||
#include <QToolBar>
|
#include <QToolBar>
|
||||||
|
|
||||||
#include "DockAreaWidget.h"
|
#include "DockAreaWidget.h"
|
||||||
#include "DockAreaTitleBar.h"
|
|
||||||
#include "DockAreaTabBar.h"
|
|
||||||
#include "FloatingDockContainer.h"
|
#include "FloatingDockContainer.h"
|
||||||
#include "DockComponentsFactory.h"
|
#include "DockComponentsFactory.h"
|
||||||
|
|
||||||
@@ -32,16 +30,19 @@ CMainWindow::CMainWindow(QWidget *parent)
|
|||||||
, ui(new Ui::CMainWindow)
|
, ui(new Ui::CMainWindow)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
CDockManager::setConfigFlag(CDockManager::OpaqueSplitterResize, true);
|
ads::CDockManager::setConfigFlag( ads::CDockManager::DockAreaHasCloseButton, false );
|
||||||
CDockManager::setConfigFlag(CDockManager::XmlCompressionEnabled, false);
|
ads::CDockManager::setConfigFlag( ads::CDockManager::AllTabsHaveCloseButton, true );
|
||||||
CDockManager::setConfigFlag(CDockManager::FocusHighlighting, true);
|
ads::CDockManager::setConfigFlag( ads::CDockManager::DockAreaHasUndockButton, false );
|
||||||
|
ads::CDockManager::setConfigFlag( ads::CDockManager::DockAreaDynamicTabsMenuButtonVisibility, true );
|
||||||
|
ads::CDockManager::setConfigFlag( ads::CDockManager::DisableTabTextEliding, true );
|
||||||
|
ads::CDockManager::setConfigFlag( ads::CDockManager::DoubleClickUndocksWidget, false );
|
||||||
DockManager = new CDockManager(this);
|
DockManager = new CDockManager(this);
|
||||||
|
|
||||||
// Set central widget
|
// Set central widget
|
||||||
QLabel* label = new QLabel();
|
QLabel* label = new QLabel();
|
||||||
label->setText("This is a DockArea which is always visible, even if it does not contain any DockWidgets.");
|
label->setText("This is a DockArea which is always visible, even if it does not contain any DockWidgets.");
|
||||||
label->setAlignment(Qt::AlignCenter);
|
label->setAlignment(Qt::AlignCenter);
|
||||||
CDockWidget* CentralDockWidget = new CDockWidget("CentralWidget");
|
CDockWidget* CentralDockWidget = DockManager->createDockWidget("CentralWidget");
|
||||||
CentralDockWidget->setWidget(label);
|
CentralDockWidget->setWidget(label);
|
||||||
CentralDockWidget->setFeature(ads::CDockWidget::NoTab, true);
|
CentralDockWidget->setFeature(ads::CDockWidget::NoTab, true);
|
||||||
auto* CentralDockArea = DockManager->setCentralWidget(CentralDockWidget);
|
auto* CentralDockArea = DockManager->setCentralWidget(CentralDockWidget);
|
||||||
@@ -50,7 +51,7 @@ CMainWindow::CMainWindow(QWidget *parent)
|
|||||||
QTableWidget* table = new QTableWidget();
|
QTableWidget* table = new QTableWidget();
|
||||||
table->setColumnCount(3);
|
table->setColumnCount(3);
|
||||||
table->setRowCount(10);
|
table->setRowCount(10);
|
||||||
CDockWidget* TableDockWidget = new CDockWidget("Table 1");
|
CDockWidget* TableDockWidget = DockManager->createDockWidget("Table 1");
|
||||||
TableDockWidget->setWidget(table);
|
TableDockWidget->setWidget(table);
|
||||||
TableDockWidget->setMinimumSizeHintMode(CDockWidget::MinimumSizeHintFromDockWidget);
|
TableDockWidget->setMinimumSizeHintMode(CDockWidget::MinimumSizeHintFromDockWidget);
|
||||||
TableDockWidget->resize(250, 150);
|
TableDockWidget->resize(250, 150);
|
||||||
@@ -62,7 +63,7 @@ CMainWindow::CMainWindow(QWidget *parent)
|
|||||||
table = new QTableWidget();
|
table = new QTableWidget();
|
||||||
table->setColumnCount(5);
|
table->setColumnCount(5);
|
||||||
table->setRowCount(1020);
|
table->setRowCount(1020);
|
||||||
TableDockWidget = new CDockWidget("Table 2");
|
TableDockWidget = DockManager->createDockWidget("Table 2");
|
||||||
TableDockWidget->setWidget(table);
|
TableDockWidget->setWidget(table);
|
||||||
TableDockWidget->setMinimumSizeHintMode(CDockWidget::MinimumSizeHintFromDockWidget);
|
TableDockWidget->setMinimumSizeHintMode(CDockWidget::MinimumSizeHintFromDockWidget);
|
||||||
TableDockWidget->resize(250, 150);
|
TableDockWidget->resize(250, 150);
|
||||||
@@ -73,7 +74,7 @@ CMainWindow::CMainWindow(QWidget *parent)
|
|||||||
QTableWidget* propertiesTable = new QTableWidget();
|
QTableWidget* propertiesTable = new QTableWidget();
|
||||||
propertiesTable->setColumnCount(3);
|
propertiesTable->setColumnCount(3);
|
||||||
propertiesTable->setRowCount(10);
|
propertiesTable->setRowCount(10);
|
||||||
CDockWidget* PropertiesDockWidget = new CDockWidget("Properties");
|
CDockWidget* PropertiesDockWidget = DockManager->createDockWidget("Properties");
|
||||||
PropertiesDockWidget->setWidget(propertiesTable);
|
PropertiesDockWidget->setWidget(propertiesTable);
|
||||||
PropertiesDockWidget->setMinimumSizeHintMode(CDockWidget::MinimumSizeHintFromDockWidget);
|
PropertiesDockWidget->setMinimumSizeHintMode(CDockWidget::MinimumSizeHintFromDockWidget);
|
||||||
PropertiesDockWidget->resize(250, 150);
|
PropertiesDockWidget->resize(250, 150);
|
||||||
@@ -98,8 +99,13 @@ void CMainWindow::createPerspectiveUi()
|
|||||||
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::Preferred);
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||||
|
connect(PerspectiveComboBox, &QComboBox::textActivated,
|
||||||
|
DockManager, &CDockManager::openPerspective);
|
||||||
|
#else
|
||||||
connect(PerspectiveComboBox, SIGNAL(activated(const QString&)),
|
connect(PerspectiveComboBox, SIGNAL(activated(const QString&)),
|
||||||
DockManager, SLOT(openPerspective(const QString&)));
|
DockManager, SLOT(openPerspective(const QString&)));
|
||||||
|
#endif
|
||||||
PerspectiveListAction->setDefaultWidget(PerspectiveComboBox);
|
PerspectiveListAction->setDefaultWidget(PerspectiveComboBox);
|
||||||
ui->toolBar->addSeparator();
|
ui->toolBar->addSeparator();
|
||||||
ui->toolBar->addAction(PerspectiveListAction);
|
ui->toolBar->addAction(PerspectiveListAction);
|
||||||
|
|||||||
@@ -2,10 +2,12 @@ TEMPLATE = subdirs
|
|||||||
|
|
||||||
SUBDIRS = \
|
SUBDIRS = \
|
||||||
autohide \
|
autohide \
|
||||||
|
autohidedragndrop \
|
||||||
centralwidget \
|
centralwidget \
|
||||||
simple \
|
simple \
|
||||||
hideshow \
|
hideshow \
|
||||||
sidebar \
|
sidebar \
|
||||||
deleteonclose \
|
deleteonclose \
|
||||||
emptydockarea \
|
emptydockarea \
|
||||||
dockindock
|
dockindock \
|
||||||
|
configflags
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.5)
|
cmake_minimum_required(VERSION 3.16)
|
||||||
project(ads_example_hideshow VERSION ${VERSION_SHORT})
|
project(ads_example_hideshow 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 REQUIRED)
|
||||||
@@ -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 qt${QT_VERSION_MAJOR}advanceddocking)
|
target_link_libraries(HideShowExample PRIVATE qtadvanceddocking-qt${QT_VERSION_MAJOR})
|
||||||
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)
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
|
|
||||||
// Create a dock widget with the title Label 1 and set the created label
|
// Create a dock widget with the title Label 1 and set the created label
|
||||||
// as the dock widget content
|
// as the dock widget content
|
||||||
ads::CDockWidget* DockWidget = new ads::CDockWidget("Label 1");
|
ads::CDockWidget* DockWidget = m_DockManager->createDockWidget("Label 1");
|
||||||
DockWidget->setWidget(l);
|
DockWidget->setWidget(l);
|
||||||
|
|
||||||
// Add the toggleViewAction of the dock widget to the menu to give
|
// Add the toggleViewAction of the dock widget to the menu to give
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.5)
|
cmake_minimum_required(VERSION 3.16)
|
||||||
project(ads_example_sidebar VERSION ${VERSION_SHORT})
|
project(ads_example_sidebar 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 REQUIRED)
|
||||||
@@ -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 qt${QT_VERSION_MAJOR}advanceddocking)
|
target_link_libraries(SidebarExample PRIVATE qtadvanceddocking-qt${QT_VERSION_MAJOR})
|
||||||
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)
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
|
|
||||||
// Create a dock widget with the title Label 1 and set the created label
|
// Create a dock widget with the title Label 1 and set the created label
|
||||||
// as the dock widget content
|
// as the dock widget content
|
||||||
ads::CDockWidget* DockWidget = new ads::CDockWidget("Label 1");
|
ads::CDockWidget* DockWidget = m_DockManager->createDockWidget("Label 1");
|
||||||
DockWidget->setWidget(l);
|
DockWidget->setWidget(l);
|
||||||
|
|
||||||
// Add the toggleViewAction of the dock widget to the menu to give
|
// Add the toggleViewAction of the dock widget to the menu to give
|
||||||
@@ -42,7 +42,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
// Create an example editor
|
// Create an example editor
|
||||||
QPlainTextEdit* te = new QPlainTextEdit();
|
QPlainTextEdit* te = new QPlainTextEdit();
|
||||||
te->setPlaceholderText("Please enter your text here into this QPlainTextEdit...");
|
te->setPlaceholderText("Please enter your text here into this QPlainTextEdit...");
|
||||||
DockWidget = new ads::CDockWidget("Editor 1");
|
DockWidget = m_DockManager->createDockWidget("Editor 1");
|
||||||
DockWidget->setWidget(te);
|
DockWidget->setWidget(te);
|
||||||
ui->menuView->addAction(DockWidget->toggleViewAction());
|
ui->menuView->addAction(DockWidget->toggleViewAction());
|
||||||
m_DockManager->addDockWidget(ads::BottomDockWidgetArea, DockWidget);
|
m_DockManager->addDockWidget(ads::BottomDockWidgetArea, DockWidget);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.5)
|
cmake_minimum_required(VERSION 3.16)
|
||||||
project(ads_example_simple VERSION ${VERSION_SHORT})
|
project(ads_example_simple 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 REQUIRED)
|
||||||
@@ -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 qt${QT_VERSION_MAJOR}advanceddocking)
|
target_link_libraries(SimpleExample PRIVATE qtadvanceddocking-qt${QT_VERSION_MAJOR})
|
||||||
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)
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
|
|
||||||
// Create a dock widget with the title Label 1 and set the created label
|
// Create a dock widget with the title Label 1 and set the created label
|
||||||
// as the dock widget content
|
// as the dock widget content
|
||||||
ads::CDockWidget* DockWidget = new ads::CDockWidget("Label 1");
|
ads::CDockWidget* DockWidget = m_DockManager->createDockWidget("Label 1");
|
||||||
DockWidget->setWidget(l);
|
DockWidget->setWidget(l);
|
||||||
|
|
||||||
// Add the toggleViewAction of the dock widget to the menu to give
|
// Add the toggleViewAction of the dock widget to the menu to give
|
||||||
|
|||||||
@@ -12,10 +12,14 @@ class CTitleBarButton : QToolButton
|
|||||||
%End
|
%End
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CTitleBarButton(bool visible = true, QWidget* parent /TransferThis/ = Q_NULLPTR );
|
CTitleBarButton(bool ShowInTitleBar, bool HideWhenDisabled, TitleBarButton ButtonId,
|
||||||
|
QWidget* /TransferThis/ = Q_NULLPTR );
|
||||||
virtual void setVisible(bool);
|
virtual void setVisible(bool);
|
||||||
void setShowInTitleBar(bool);
|
void setShowInTitleBar(bool);
|
||||||
|
|
||||||
|
TitleBarButton buttonId() const;
|
||||||
|
ads::CDockAreaTitleBar* titleBar() const;
|
||||||
|
bool isInAutoHideArea() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool event(QEvent *ev);
|
bool event(QEvent *ev);
|
||||||
@@ -44,13 +48,15 @@ public:
|
|||||||
ads::CDockAreaTabBar* tabBar() const;
|
ads::CDockAreaTabBar* tabBar() const;
|
||||||
ads::CTitleBarButton* button(ads::TitleBarButton which) const;
|
ads::CTitleBarButton* button(ads::TitleBarButton which) const;
|
||||||
ads::CElidingLabel* autoHideTitleLabel() const;
|
ads::CElidingLabel* autoHideTitleLabel() const;
|
||||||
|
ads::CDockAreaWidget* dockAreaWidget() 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;
|
QString titleBarButtonToolTip(ads::TitleBarButton Button) const;
|
||||||
void setAreaFloating();
|
void setAreaFloating();
|
||||||
|
void showAutoHideControls(bool Show);
|
||||||
|
bool isAutoHide() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void tabBarClicked(int index);
|
void tabBarClicked(int index);
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ public:
|
|||||||
ads::CDockManager* dockManager() const;
|
ads::CDockManager* dockManager() const;
|
||||||
ads::CDockContainerWidget* dockContainer() const;
|
ads::CDockContainerWidget* dockContainer() const;
|
||||||
ads::CAutoHideDockContainer* autoHideDockContainer() const;
|
ads::CAutoHideDockContainer* autoHideDockContainer() const;
|
||||||
|
ads::CDockSplitter* parentSplitter() const;
|
||||||
bool isAutoHide() const;
|
bool isAutoHide() const;
|
||||||
void setAutoHideDockContainer(CAutoHideDockContainer*);
|
void setAutoHideDockContainer(CAutoHideDockContainer*);
|
||||||
virtual QSize minimumSizeHint() const;
|
virtual QSize minimumSizeHint() const;
|
||||||
|
|||||||
@@ -20,13 +20,14 @@ class CDockContainerWidget : QFrame
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool event(QEvent *e);
|
virtual bool event(QEvent *e);
|
||||||
QSplitter* rootSplitter() const;
|
ads::CDockSplitter* rootSplitter() const;
|
||||||
ads::CAutoHideDockContainer* createAndSetupAutoHideContainer(ads::SideBarLocation area, ads::CDockWidget* DockWidget /Transfer/, int TabIndex = -1);
|
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, int TabIndex = -1);
|
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/);
|
||||||
|
/*QList<QPointer<ads::CDockAreaWidget>> removeAllDockAreas();*/
|
||||||
void saveState(QXmlStreamWriter& Stream) const;
|
void saveState(QXmlStreamWriter& Stream) const;
|
||||||
bool restoreState(CDockingStateReader& Stream, bool Testing);
|
bool restoreState(CDockingStateReader& Stream, bool Testing);
|
||||||
ads::CDockAreaWidget* lastAddedDockAreaWidget(ads::DockWidgetArea area) const;
|
ads::CDockAreaWidget* lastAddedDockAreaWidget(ads::DockWidgetArea area) const;
|
||||||
|
|||||||
@@ -172,6 +172,8 @@ public:
|
|||||||
FloatingContainerForceNativeTitleBar,
|
FloatingContainerForceNativeTitleBar,
|
||||||
FloatingContainerForceQWidgetTitleBar,
|
FloatingContainerForceQWidgetTitleBar,
|
||||||
MiddleMouseButtonClosesTab,
|
MiddleMouseButtonClosesTab,
|
||||||
|
DisableTabTextEliding,
|
||||||
|
ShowTabTextOnlyForActiveTab,
|
||||||
DefaultDockAreaButtons,
|
DefaultDockAreaButtons,
|
||||||
DefaultBaseConfig,
|
DefaultBaseConfig,
|
||||||
DefaultOpaqueConfig,
|
DefaultOpaqueConfig,
|
||||||
@@ -188,6 +190,8 @@ public:
|
|||||||
AutoHideSideBarsIconOnly,
|
AutoHideSideBarsIconOnly,
|
||||||
AutoHideShowOnMouseOver,
|
AutoHideShowOnMouseOver,
|
||||||
AutoHideCloseButtonCollapsesDock,
|
AutoHideCloseButtonCollapsesDock,
|
||||||
|
AutoHideHasCloseButton,
|
||||||
|
AutoHideHasMinimizeButton,
|
||||||
DefaultAutoHideConfig,
|
DefaultAutoHideConfig,
|
||||||
};
|
};
|
||||||
typedef QFlags<ads::CDockManager::eAutoHideFlag> AutoHideFlags;
|
typedef QFlags<ads::CDockManager::eAutoHideFlag> AutoHideFlags;
|
||||||
@@ -245,6 +249,12 @@ public:
|
|||||||
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 void setFloatingContainersTitle(const QString& Title);
|
||||||
static QString floatingContainersTitle();
|
static QString floatingContainersTitle();
|
||||||
|
void setDockWidgetToolBarStyle(Qt::ToolButtonStyle Style, ads::CDockWidget::eState State);
|
||||||
|
Qt::ToolButtonStyle dockWidgetToolBarStyle(ads::CDockWidget::eState State) const;
|
||||||
|
void setDockWidgetToolBarIconSize(const QSize& IconSize, ads::CDockWidget::eState State);
|
||||||
|
QSize dockWidgetToolBarIconSize(ads::CDockWidget::eState State) const;
|
||||||
|
ads::CDockWidget::DockWidgetFeatures globallyLockedDockWidgetFeatures() const;
|
||||||
|
void lockDockWidgetFeaturesGlobally(ads::CDockWidget::DockWidgetFeatures Features = ads::CDockWidget::GloballyLockableFeatures);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void endLeavingMinimizedState();
|
void endLeavingMinimizedState();
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ public:
|
|||||||
DefaultDockWidgetFeatures,
|
DefaultDockWidgetFeatures,
|
||||||
AllDockWidgetFeatures,
|
AllDockWidgetFeatures,
|
||||||
DockWidgetAlwaysCloseAndDelete,
|
DockWidgetAlwaysCloseAndDelete,
|
||||||
|
GloballyLockableFeatures,
|
||||||
NoDockWidgetFeatures
|
NoDockWidgetFeatures
|
||||||
};
|
};
|
||||||
typedef QFlags<ads::CDockWidget::DockWidgetFeature> DockWidgetFeatures;
|
typedef QFlags<ads::CDockWidget::DockWidgetFeature> DockWidgetFeatures;
|
||||||
@@ -50,6 +51,12 @@ public:
|
|||||||
StateFloating
|
StateFloating
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum eToolBarStyleSource
|
||||||
|
{
|
||||||
|
ToolBarStyleFromDockManager,
|
||||||
|
ToolBarStyleFromDockWidget
|
||||||
|
};
|
||||||
|
|
||||||
enum eInsertMode
|
enum eInsertMode
|
||||||
{
|
{
|
||||||
AutoScrollArea,
|
AutoScrollArea,
|
||||||
@@ -72,7 +79,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
CDockWidget(const QString &title, QWidget* parent /TransferThis/ = 0);
|
CDockWidget(const QString &title, QWidget* parent /TransferThis/ = Q_NULLPTR);
|
||||||
virtual ~CDockWidget();
|
virtual ~CDockWidget();
|
||||||
virtual QSize minimumSizeHint() const;
|
virtual QSize minimumSizeHint() const;
|
||||||
void setWidget(QWidget* widget /Transfer/, ads::CDockWidget::eInsertMode InsertMode = AutoScrollArea);
|
void setWidget(QWidget* widget /Transfer/, ads::CDockWidget::eInsertMode InsertMode = AutoScrollArea);
|
||||||
@@ -82,6 +89,7 @@ public:
|
|||||||
void setFeatures(ads::CDockWidget::DockWidgetFeatures features);
|
void setFeatures(ads::CDockWidget::DockWidgetFeatures features);
|
||||||
void setFeature(ads::CDockWidget::DockWidgetFeature flag, bool on);
|
void setFeature(ads::CDockWidget::DockWidgetFeature flag, bool on);
|
||||||
ads::CDockWidget::DockWidgetFeatures features() const;
|
ads::CDockWidget::DockWidgetFeatures features() const;
|
||||||
|
void notifyFeaturesChanged();
|
||||||
ads::CDockManager* dockManager() const;
|
ads::CDockManager* dockManager() const;
|
||||||
ads::CDockContainerWidget* dockContainer() const;
|
ads::CDockContainerWidget* dockContainer() const;
|
||||||
ads::CFloatingDockContainer* floatingDockContainer() const;
|
ads::CFloatingDockContainer* floatingDockContainer() const;
|
||||||
@@ -95,6 +103,7 @@ public:
|
|||||||
bool isInFloatingContainer() const;
|
bool isInFloatingContainer() const;
|
||||||
bool isClosed() const;
|
bool isClosed() const;
|
||||||
QAction* toggleViewAction() const;
|
QAction* toggleViewAction() const;
|
||||||
|
void setToggleViewAction(QAction* action);
|
||||||
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;
|
ads::CDockWidget::eMinimumSizeHintMode minimumSizeHintMode() const;
|
||||||
@@ -104,6 +113,8 @@ public:
|
|||||||
QToolBar* toolBar() const;
|
QToolBar* toolBar() const;
|
||||||
QToolBar* createDefaultToolBar();
|
QToolBar* createDefaultToolBar();
|
||||||
void setToolBar(QToolBar* ToolBar /Transfer/ );
|
void setToolBar(QToolBar* ToolBar /Transfer/ );
|
||||||
|
void setToolBarStyleSource(ads::CDockWidget::eToolBarStyleSource Source);
|
||||||
|
ads::CDockWidget::eToolBarStyleSource toolBarStyleSource() const;
|
||||||
void setToolBarStyle(Qt::ToolButtonStyle Style, ads::CDockWidget::eState State);
|
void setToolBarStyle(Qt::ToolButtonStyle Style, ads::CDockWidget::eState State);
|
||||||
Qt::ToolButtonStyle toolBarStyle(ads::CDockWidget::eState State) const;
|
Qt::ToolButtonStyle toolBarStyle(ads::CDockWidget::eState State) const;
|
||||||
void setToolBarIconSize(const QSize& IconSize, ads::CDockWidget::eState State);
|
void setToolBarIconSize(const QSize& IconSize, ads::CDockWidget::eState State);
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ protected:
|
|||||||
virtual void mouseDoubleClickEvent( QMouseEvent *ev );
|
virtual void mouseDoubleClickEvent( QMouseEvent *ev );
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CElidingLabel(QWidget* parent /TransferThis/ = 0, Qt::WindowFlags f = 0);
|
CElidingLabel(QWidget* parent /TransferThis/ = Q_NULLPTR, Qt::WindowFlags f = Qt::WindowFlags ());
|
||||||
CElidingLabel(const QString& text, QWidget* parent /TransferThis/ = 0, Qt::WindowFlags f = 0);
|
CElidingLabel(const QString& text, QWidget* parent /TransferThis/ = Q_NULLPTR, Qt::WindowFlags f = Qt::WindowFlags ());
|
||||||
virtual ~CElidingLabel();
|
virtual ~CElidingLabel();
|
||||||
Qt::TextElideMode elideMode() const;
|
Qt::TextElideMode elideMode() const;
|
||||||
void setElideMode(Qt::TextElideMode mode);
|
void setElideMode(Qt::TextElideMode mode);
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ protected:
|
|||||||
void startDragging(const QPoint& DragStartMousePos, const QSize& Size,
|
void startDragging(const QPoint& DragStartMousePos, const QSize& Size,
|
||||||
QWidget* MouseEventHandler);
|
QWidget* MouseEventHandler);
|
||||||
virtual void finishDragging();
|
virtual void finishDragging();
|
||||||
|
void deleteContent();
|
||||||
void initFloatingGeometry(const QPoint& DragStartMousePos, const QSize& Size);
|
void initFloatingGeometry(const QPoint& DragStartMousePos, const QSize& Size);
|
||||||
void moveFloating();
|
void moveFloating();
|
||||||
bool restoreState(ads::CDockingStateReader& Stream, bool Testing);
|
bool restoreState(ads::CDockingStateReader& Stream, bool Testing);
|
||||||
@@ -82,6 +83,7 @@ public:
|
|||||||
bool hasTopLevelDockWidget() const;
|
bool hasTopLevelDockWidget() const;
|
||||||
ads::CDockWidget* topLevelDockWidget() const;
|
ads::CDockWidget* topLevelDockWidget() const;
|
||||||
QList<ads::CDockWidget*> dockWidgets() const;
|
QList<ads::CDockWidget*> dockWidgets() const;
|
||||||
|
void finishDropOperation();
|
||||||
|
|
||||||
%If (WS_X11)
|
%If (WS_X11)
|
||||||
void onMaximizeRequest();
|
void onMaximizeRequest();
|
||||||
|
|||||||
@@ -73,7 +73,8 @@ namespace ads
|
|||||||
TitleBarButtonTabsMenu,
|
TitleBarButtonTabsMenu,
|
||||||
TitleBarButtonUndock,
|
TitleBarButtonUndock,
|
||||||
TitleBarButtonClose,
|
TitleBarButtonClose,
|
||||||
TitleBarButtonAutoHide
|
TitleBarButtonAutoHide,
|
||||||
|
TitleBarButtonMinimize
|
||||||
};
|
};
|
||||||
|
|
||||||
enum eDragState
|
enum eDragState
|
||||||
|
|||||||
@@ -124,6 +124,21 @@ struct AutoHideDockContainerPrivate
|
|||||||
*/
|
*/
|
||||||
AutoHideDockContainerPrivate(CAutoHideDockContainer *_public);
|
AutoHideDockContainerPrivate(CAutoHideDockContainer *_public);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convenience function to ease access to dock manager components factory
|
||||||
|
*/
|
||||||
|
QSharedPointer<ads::CDockComponentsFactory> componentsFactory() const
|
||||||
|
{
|
||||||
|
if (!DockWidget || !DockWidget->dockManager())
|
||||||
|
{
|
||||||
|
return CDockComponentsFactory::factory();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return DockWidget->dockManager()->componentsFactory();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convenience function to get a dock widget area
|
* Convenience function to get a dock widget area
|
||||||
*/
|
*/
|
||||||
@@ -199,7 +214,7 @@ CAutoHideDockContainer::CAutoHideDockContainer(CDockWidget* DockWidget, SideBarL
|
|||||||
{
|
{
|
||||||
hide(); // auto hide dock container is initially always hidden
|
hide(); // auto hide dock container is initially always hidden
|
||||||
d->SideTabBarArea = area;
|
d->SideTabBarArea = area;
|
||||||
d->SideTab = componentsFactory()->createDockWidgetSideTab(nullptr);
|
d->SideTab = d->componentsFactory()->createDockWidgetSideTab(nullptr);
|
||||||
connect(d->SideTab, &CAutoHideTab::pressed, this, &CAutoHideDockContainer::toggleCollapseState);
|
connect(d->SideTab, &CAutoHideTab::pressed, this, &CAutoHideDockContainer::toggleCollapseState);
|
||||||
d->DockArea = new CDockAreaWidget(DockWidget->dockManager(), parent);
|
d->DockArea = new CDockAreaWidget(DockWidget->dockManager(), parent);
|
||||||
d->DockArea->setObjectName("autoHideDockArea");
|
d->DockArea->setObjectName("autoHideDockArea");
|
||||||
@@ -400,7 +415,31 @@ void CAutoHideDockContainer::moveContentsToParent()
|
|||||||
// to the user and he does not have to search where the widget was inserted.
|
// to the user and he does not have to search where the widget was inserted.
|
||||||
d->DockWidget->setDockArea(nullptr);
|
d->DockWidget->setDockArea(nullptr);
|
||||||
auto DockContainer = dockContainer();
|
auto DockContainer = dockContainer();
|
||||||
DockContainer->addDockWidget(d->getDockWidgetArea(d->SideTabBarArea), d->DockWidget);
|
auto targetArea = d->getDockWidgetArea(d->SideTabBarArea);
|
||||||
|
|
||||||
|
// If the widget has a preferred auto-hide location, try to find an existing
|
||||||
|
// opened dock area that contains a widget with the same preferred location
|
||||||
|
// and merge as a tab instead of creating a new split.
|
||||||
|
auto preferred = d->DockWidget->preferredAutoHideSideBarLocation();
|
||||||
|
if (preferred != SideBarNone)
|
||||||
|
{
|
||||||
|
for (auto area : DockContainer->openedDockAreas())
|
||||||
|
{
|
||||||
|
if (!area || area->isAutoHide()) continue;
|
||||||
|
// Check if any widget in this area has the same preferred location
|
||||||
|
for (auto dw : area->dockWidgets())
|
||||||
|
{
|
||||||
|
if (dw && dw->preferredAutoHideSideBarLocation() == preferred)
|
||||||
|
{
|
||||||
|
DockContainer->addDockWidget(CenterDockWidgetArea,
|
||||||
|
d->DockWidget, area);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DockContainer->addDockWidget(targetArea, d->DockWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -410,8 +449,8 @@ void CAutoHideDockContainer::cleanupAndDelete()
|
|||||||
const auto dockWidget = d->DockWidget;
|
const auto dockWidget = d->DockWidget;
|
||||||
if (dockWidget)
|
if (dockWidget)
|
||||||
{
|
{
|
||||||
|
|
||||||
auto SideTab = d->SideTab;
|
auto SideTab = d->SideTab;
|
||||||
|
dockWidget->setSideTabWidget(nullptr);
|
||||||
SideTab->removeFromSideBar();
|
SideTab->removeFromSideBar();
|
||||||
SideTab->setParent(nullptr);
|
SideTab->setParent(nullptr);
|
||||||
SideTab->hide();
|
SideTab->hide();
|
||||||
@@ -467,6 +506,17 @@ void CAutoHideDockContainer::collapseView(bool Enable)
|
|||||||
{
|
{
|
||||||
updateSize();
|
updateSize();
|
||||||
d->updateResizeHandleSizeLimitMax();
|
d->updateResizeHandleSizeLimitMax();
|
||||||
|
// If the parent dock container has native child windows (e.g. because
|
||||||
|
// an OpenGL or VTK content widget called winId()), this panel is an
|
||||||
|
// alien (non-native) widget and will always be obscured by those native
|
||||||
|
// sibling windows regardless of Qt's paint order. Native OS windows are
|
||||||
|
// rendered above the parent's painted (alien) content by the windowing
|
||||||
|
// system. To allow raise() to use OS-level Z-order and appear on top,
|
||||||
|
// this panel must first be promoted to a native window itself.
|
||||||
|
if (parentWidget() && parentWidget()->internalWinId() && !internalWinId())
|
||||||
|
{
|
||||||
|
winId();
|
||||||
|
}
|
||||||
raise();
|
raise();
|
||||||
show();
|
show();
|
||||||
d->DockWidget->dockManager()->setDockWidgetFocused(d->DockWidget);
|
d->DockWidget->dockManager()->setDockWidgetFocused(d->DockWidget);
|
||||||
@@ -587,8 +637,12 @@ bool CAutoHideDockContainer::eventFilter(QObject* watched, QEvent* event)
|
|||||||
return Super::eventFilter(watched, event);
|
return Super::eventFilter(watched, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
// user clicked into container - collapse the auto hide widget
|
// user clicked outside of autohide container - collapse the auto hide widget
|
||||||
collapseView(true);
|
if (CDockManager::testAutoHideConfigFlag(
|
||||||
|
CDockManager::AutoHideCloseOnOutsideMouseClick))
|
||||||
|
{
|
||||||
|
collapseView(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (event->type() == internal::FloatingWidgetDragStartEvent)
|
else if (event->type() == internal::FloatingWidgetDragStartEvent)
|
||||||
{
|
{
|
||||||
@@ -657,6 +711,14 @@ bool CAutoHideDockContainer::event(QEvent* event)
|
|||||||
return Super::event(event);
|
return Super::event(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
void CAutoHideDockContainer::dragLeaveEvent(QDragLeaveEvent*)
|
||||||
|
{
|
||||||
|
if (CDockManager::testAutoHideConfigFlag(CDockManager::AutoHideOpenOnDragHover))
|
||||||
|
{
|
||||||
|
collapseView(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
Qt::Orientation CAutoHideDockContainer::orientation() const
|
Qt::Orientation CAutoHideDockContainer::orientation() const
|
||||||
@@ -709,4 +771,3 @@ int CAutoHideDockContainer::tabIndex() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
{
|
{
|
||||||
@@ -65,6 +65,7 @@ protected:
|
|||||||
virtual void resizeEvent(QResizeEvent* event) override;
|
virtual void resizeEvent(QResizeEvent* event) override;
|
||||||
virtual void leaveEvent(QEvent *event) override;
|
virtual void leaveEvent(QEvent *event) override;
|
||||||
virtual bool event(QEvent* event) override;
|
virtual bool event(QEvent* event) override;
|
||||||
|
virtual void dragLeaveEvent(QDragLeaveEvent* ev) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the size considering the size limits and the resize margins
|
* Updates the size considering the size limits and the resize margins
|
||||||
|
|||||||
@@ -414,7 +414,14 @@ void CAutoHideSideBar::saveState(QXmlStreamWriter& s) const
|
|||||||
QSize CAutoHideSideBar::minimumSizeHint() const
|
QSize CAutoHideSideBar::minimumSizeHint() const
|
||||||
{
|
{
|
||||||
QSize Size = sizeHint();
|
QSize Size = sizeHint();
|
||||||
Size.setWidth(10);
|
if (d->isHorizontal())
|
||||||
|
{
|
||||||
|
Size.setWidth(0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Size.setHeight(0);
|
||||||
|
}
|
||||||
return Size;
|
return Size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -33,6 +33,8 @@
|
|||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QElapsedTimer>
|
#include <QElapsedTimer>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
|
#include <QEvent>
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
#include "AutoHideDockContainer.h"
|
#include "AutoHideDockContainer.h"
|
||||||
#include "AutoHideSideBar.h"
|
#include "AutoHideSideBar.h"
|
||||||
@@ -41,10 +43,10 @@
|
|||||||
#include "DockWidget.h"
|
#include "DockWidget.h"
|
||||||
#include "FloatingDragPreview.h"
|
#include "FloatingDragPreview.h"
|
||||||
#include "DockOverlay.h"
|
#include "DockOverlay.h"
|
||||||
|
#include "ads_globals.h"
|
||||||
|
|
||||||
namespace ads
|
namespace ads
|
||||||
{
|
{
|
||||||
static const char* const LocationProperty = "Location";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Private data class of CDockWidgetTab class (pimpl)
|
* Private data class of CDockWidgetTab class (pimpl)
|
||||||
@@ -56,6 +58,7 @@ struct AutoHideTabPrivate
|
|||||||
CAutoHideSideBar* SideBar = nullptr;
|
CAutoHideSideBar* SideBar = nullptr;
|
||||||
Qt::Orientation Orientation{Qt::Vertical};
|
Qt::Orientation Orientation{Qt::Vertical};
|
||||||
QElapsedTimer TimeSinceHoverMousePress;
|
QElapsedTimer TimeSinceHoverMousePress;
|
||||||
|
QTimer DragOverTimer;
|
||||||
bool MousePressed = false;
|
bool MousePressed = false;
|
||||||
eDragState DragState = DraggingInactive;
|
eDragState DragState = DraggingInactive;
|
||||||
QPoint GlobalDragStartMousePosition;
|
QPoint GlobalDragStartMousePosition;
|
||||||
@@ -102,7 +105,7 @@ struct AutoHideTabPrivate
|
|||||||
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, &CAutoHideTab::onAutoHideToActionClicked);
|
QObject::connect(Action, &QAction::triggered, _this, &CAutoHideTab::onAutoHideToActionClicked);
|
||||||
Action->setEnabled(Location != _this->sideBarLocation());
|
Action->setEnabled(Location != _this->sideBarLocation());
|
||||||
return Action;
|
return Action;
|
||||||
@@ -136,7 +139,7 @@ struct AutoHideTabPrivate
|
|||||||
IFloatingWidget* createFloatingWidget(T* Widget)
|
IFloatingWidget* createFloatingWidget(T* Widget)
|
||||||
{
|
{
|
||||||
auto w = new CFloatingDragPreview(Widget);
|
auto w = new CFloatingDragPreview(Widget);
|
||||||
_this->connect(w, &CFloatingDragPreview::draggingCanceled, [=]()
|
_this->connect(w, &CFloatingDragPreview::draggingCanceled, [this]()
|
||||||
{
|
{
|
||||||
DragState = DraggingInactive;
|
DragState = DraggingInactive;
|
||||||
});
|
});
|
||||||
@@ -174,7 +177,7 @@ void AutoHideTabPrivate::updateOrientation()
|
|||||||
bool AutoHideTabPrivate::startFloating(eDragState DraggingState)
|
bool AutoHideTabPrivate::startFloating(eDragState DraggingState)
|
||||||
{
|
{
|
||||||
auto DockArea = DockWidget->dockAreaWidget();
|
auto DockArea = DockWidget->dockAreaWidget();
|
||||||
ADS_PRINT("isFloating " << dockContainer->isFloating());
|
ADS_PRINT("isFloating " << dockContainer()->isFloating());
|
||||||
|
|
||||||
ADS_PRINT("startFloating");
|
ADS_PRINT("startFloating");
|
||||||
DragState = DraggingState;
|
DragState = DraggingState;
|
||||||
@@ -253,6 +256,14 @@ CAutoHideTab::CAutoHideTab(QWidget* parent) :
|
|||||||
{
|
{
|
||||||
setAttribute(Qt::WA_NoMousePropagation);
|
setAttribute(Qt::WA_NoMousePropagation);
|
||||||
setFocusPolicy(Qt::NoFocus);
|
setFocusPolicy(Qt::NoFocus);
|
||||||
|
if (CDockManager::testAutoHideConfigFlag(CDockManager::AutoHideOpenOnDragHover)) {
|
||||||
|
setAcceptDrops(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
d->DragOverTimer.setInterval(CDockManager::configParam(
|
||||||
|
CDockManager::AutoHideOpenOnDragHoverDelay_ms, 500).toInt());
|
||||||
|
d->DragOverTimer.setSingleShot(true);
|
||||||
|
connect(&d->DragOverTimer, &QTimer::timeout, this, &CAutoHideTab::onDragHoverDelayExpired);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -356,7 +367,6 @@ bool CAutoHideTab::event(QEvent* event)
|
|||||||
case QEvent::Leave:
|
case QEvent::Leave:
|
||||||
d->forwardEventToDockContainer(event);
|
d->forwardEventToDockContainer(event);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -419,7 +429,7 @@ void CAutoHideTab::unpinDockWidget()
|
|||||||
//===========================================================================
|
//===========================================================================
|
||||||
void CAutoHideTab::onAutoHideToActionClicked()
|
void CAutoHideTab::onAutoHideToActionClicked()
|
||||||
{
|
{
|
||||||
int Location = sender()->property(LocationProperty).toInt();
|
int Location = sender()->property(internal::LocationProperty).toInt();
|
||||||
d->DockWidget->setAutoHide(true, (SideBarLocation)Location);
|
d->DockWidget->setAutoHide(true, (SideBarLocation)Location);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -494,48 +504,74 @@ void CAutoHideTab::mouseReleaseEvent(QMouseEvent* ev)
|
|||||||
|
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
void CAutoHideTab::mouseMoveEvent(QMouseEvent* ev)
|
void CAutoHideTab::mouseMoveEvent(QMouseEvent *ev)
|
||||||
{
|
{
|
||||||
if (!(ev->buttons() & Qt::LeftButton) || d->isDraggingState(DraggingInactive))
|
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
|
d->DragState = DraggingInactive;
|
||||||
// We can create the drag preview if the widget is movable.
|
Super::mouseMoveEvent(ev);
|
||||||
auto Features = d->DockWidget->features();
|
return;
|
||||||
if (Features.testFlag(CDockWidget::DockWidgetFloatable) || (Features.testFlag(CDockWidget::DockWidgetMovable)))
|
|
||||||
{
|
|
||||||
d->startFloating();
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Super::mouseMoveEvent(ev);
|
// 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::dragEnterEvent(QDragEnterEvent *ev)
|
||||||
|
{
|
||||||
|
Q_UNUSED(ev);
|
||||||
|
if (CDockManager::testAutoHideConfigFlag(CDockManager::AutoHideOpenOnDragHover))
|
||||||
|
{
|
||||||
|
d->DragOverTimer.start();
|
||||||
|
ev->accept();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
void CAutoHideTab::dragLeaveEvent(QDragLeaveEvent *ev)
|
||||||
|
{
|
||||||
|
Q_UNUSED(ev);
|
||||||
|
if (CDockManager::testAutoHideConfigFlag(CDockManager::AutoHideOpenOnDragHover))
|
||||||
|
{
|
||||||
|
d->DragOverTimer.stop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -545,7 +581,6 @@ void CAutoHideTab::requestCloseDockWidget()
|
|||||||
d->DockWidget->requestCloseDockWidget();
|
d->DockWidget->requestCloseDockWidget();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
int CAutoHideTab::tabIndex() const
|
int CAutoHideTab::tabIndex() const
|
||||||
{
|
{
|
||||||
@@ -558,4 +593,28 @@ int CAutoHideTab::tabIndex() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
void CAutoHideTab::onDragHoverDelayExpired()
|
||||||
|
{
|
||||||
|
static const char* const PropertyId = "ActiveDragOverAutoHideContainer";
|
||||||
|
|
||||||
|
// First we check if there is an active auto hide container that is visible
|
||||||
|
// In this case, we collapse it before we open the new one
|
||||||
|
auto v = d->DockWidget->dockManager()->property(PropertyId);
|
||||||
|
if (v.isValid())
|
||||||
|
{
|
||||||
|
auto ActiveAutoHideContainer = v.value<QPointer<CAutoHideDockContainer>>();
|
||||||
|
if (ActiveAutoHideContainer)
|
||||||
|
{
|
||||||
|
ActiveAutoHideContainer->collapseView(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
auto AutoHideContainer = d->DockWidget->autoHideDockContainer();
|
||||||
|
AutoHideContainer->collapseView(false);
|
||||||
|
d->DockWidget->dockManager()->setProperty(PropertyId,
|
||||||
|
QVariant::fromValue(QPointer<CAutoHideDockContainer>(AutoHideContainer)));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ private:
|
|||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void onAutoHideToActionClicked();
|
void onAutoHideToActionClicked();
|
||||||
|
void onDragHoverDelayExpired();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void setSideBar(CAutoHideSideBar *SideTabBar);
|
void setSideBar(CAutoHideSideBar *SideTabBar);
|
||||||
@@ -76,6 +77,8 @@ protected:
|
|||||||
virtual void mousePressEvent(QMouseEvent* ev) override;
|
virtual void mousePressEvent(QMouseEvent* ev) override;
|
||||||
virtual void mouseReleaseEvent(QMouseEvent* ev) override;
|
virtual void mouseReleaseEvent(QMouseEvent* ev) override;
|
||||||
virtual void mouseMoveEvent(QMouseEvent* ev) override;
|
virtual void mouseMoveEvent(QMouseEvent* ev) override;
|
||||||
|
virtual void dragEnterEvent(QDragEnterEvent* ev) override;
|
||||||
|
virtual void dragLeaveEvent(QDragLeaveEvent* ev) override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using Super = CPushButton;
|
using Super = CPushButton;
|
||||||
@@ -90,7 +93,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Virtual Destructor
|
* Virtual Destructor
|
||||||
*/
|
*/
|
||||||
virtual ~CAutoHideTab();
|
~CAutoHideTab() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update stylesheet style if a property changes
|
* Update stylesheet style if a property changes
|
||||||
|
|||||||
@@ -1,15 +1,23 @@
|
|||||||
cmake_minimum_required(VERSION 3.5)
|
cmake_minimum_required(VERSION 3.16)
|
||||||
project(QtAdvancedDockingSystem LANGUAGES CXX VERSION ${VERSION_SHORT})
|
project(QtAdvancedDockingSystem LANGUAGES CXX VERSION ${VERSION_SHORT})
|
||||||
|
include(GNUInstallDirs)
|
||||||
|
include(Versioning)
|
||||||
if (${QT_VERSION_MAJOR})
|
if (${QT_VERSION_MAJOR})
|
||||||
message(STATUS "Forced to use Qt version ${QT_VERSION_MAJOR}")
|
message(STATUS "Forced to use Qt version ${QT_VERSION_MAJOR}")
|
||||||
find_package(QT NAMES Qt${QT_VERSION_MAJOR} COMPONENTS Core REQUIRED)
|
find_package(QT NAMES Qt${QT_VERSION_MAJOR} COMPONENTS Core REQUIRED)
|
||||||
else()
|
else()
|
||||||
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED)
|
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED)
|
||||||
endif()
|
endif()
|
||||||
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Gui Widgets REQUIRED)
|
|
||||||
if (UNIX AND NOT APPLE)
|
set(ads_DEP_LIBS Core Gui Widgets)
|
||||||
include_directories(${Qt${QT_VERSION_MAJOR}Gui_PRIVATE_INCLUDE_DIRS})
|
if (UNIX AND NOT APPLE AND QT_VERSION_MAJOR STREQUAL "6" AND QT_VERSION_MINOR GREATER 8)
|
||||||
|
set(ads_DEP_LIBS Core Gui GuiPrivate Widgets)
|
||||||
endif()
|
endif()
|
||||||
|
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS ${ads_DEP_LIBS} REQUIRED)
|
||||||
|
if (UNIX AND NOT APPLE AND ((QT_VERSION_MAJOR STREQUAL "6" AND QT_VERSION_MINOR GREATER 8) OR QT_VERSION_MAJOR STREQUAL "5"))
|
||||||
|
include_directories(${Qt${QT_VERSION_MAJOR}Gui_PRIVATE_INCLUDE_DIRS})
|
||||||
|
endif()
|
||||||
|
|
||||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||||
if(BUILD_STATIC)
|
if(BUILD_STATIC)
|
||||||
set(CMAKE_STATIC_LIBRARY_SUFFIX "_static${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
set(CMAKE_STATIC_LIBRARY_SUFFIX "_static${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
||||||
@@ -36,7 +44,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
|
||||||
@@ -62,7 +70,7 @@ 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)
|
||||||
@@ -70,12 +78,15 @@ if (UNIX AND NOT APPLE)
|
|||||||
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")
|
set(library_name "qtadvanceddocking-qt${QT_VERSION_MAJOR}")
|
||||||
if(BUILD_STATIC)
|
if(BUILD_STATIC)
|
||||||
add_library(${library_name} STATIC ${ads_SRCS} ${ads_HEADERS})
|
add_library(${library_name} STATIC ${ads_SRCS} ${ads_HEADERS})
|
||||||
target_compile_definitions( ${library_name} PUBLIC ADS_STATIC)
|
target_compile_definitions( ${library_name} PUBLIC ADS_STATIC)
|
||||||
else()
|
else()
|
||||||
add_library( ${library_name} SHARED ${ads_SRCS} ${ads_HEADERS})
|
add_library( ${library_name} SHARED ${ads_SRCS} ${ads_HEADERS})
|
||||||
|
if(WIN32)
|
||||||
|
add_windows_version_resources(${library_name})
|
||||||
|
endif()
|
||||||
target_compile_definitions( ${library_name} PRIVATE ADS_SHARED_EXPORT)
|
target_compile_definitions( ${library_name} PRIVATE ADS_SHARED_EXPORT)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -84,6 +95,11 @@ add_library(ads::${library_name} ALIAS ${library_name})
|
|||||||
target_link_libraries(${library_name} 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 AND QT_VERSION_MAJOR STREQUAL "6")
|
||||||
|
target_link_libraries(${library_name} PRIVATE Qt6::GuiPrivate) #needed for <qpa/qplatformnativeinterface.h>
|
||||||
|
endif()
|
||||||
|
|
||||||
if (UNIX AND NOT APPLE)
|
if (UNIX AND NOT APPLE)
|
||||||
if (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
if (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
||||||
find_package(X11 REQUIRED)
|
find_package(X11 REQUIRED)
|
||||||
@@ -97,6 +113,7 @@ set_target_properties(${library_name} PROPERTIES
|
|||||||
AUTORCC ON
|
AUTORCC ON
|
||||||
CXX_EXTENSIONS OFF
|
CXX_EXTENSIONS OFF
|
||||||
VERSION ${VERSION_SHORT}
|
VERSION ${VERSION_SHORT}
|
||||||
|
SOVERSION ${VERSION_SONAME}
|
||||||
EXPORT_NAME ${library_name}
|
EXPORT_NAME ${library_name}
|
||||||
DEBUG_POSTFIX "d"
|
DEBUG_POSTFIX "d"
|
||||||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib"
|
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib"
|
||||||
@@ -120,36 +137,36 @@ write_basic_package_version_file(
|
|||||||
COMPATIBILITY SameMajorVersion
|
COMPATIBILITY SameMajorVersion
|
||||||
)
|
)
|
||||||
install(FILES ${ads_HEADERS}
|
install(FILES ${ads_HEADERS}
|
||||||
DESTINATION include/${library_name}
|
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${library_name}
|
||||||
COMPONENT headers
|
COMPONENT headers
|
||||||
)
|
)
|
||||||
install(FILES
|
install(FILES
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/../LICENSE"
|
"${CMAKE_CURRENT_SOURCE_DIR}/../LICENSE"
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/../gnu-lgpl-v2.1.md"
|
"${CMAKE_CURRENT_SOURCE_DIR}/../gnu-lgpl-v2.1.md"
|
||||||
DESTINATION license/ads
|
DESTINATION share/ads/license
|
||||||
COMPONENT license
|
COMPONENT license
|
||||||
)
|
)
|
||||||
install(TARGETS ${library_name}
|
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/${library_name}
|
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/${library_name}
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${library_name}
|
||||||
)
|
)
|
||||||
install(FILES qtadvanceddockingConfig.cmake RENAME ${library_name}Config.cmake
|
install(FILES qtadvanceddockingConfig.cmake RENAME ${library_name}Config.cmake
|
||||||
DESTINATION lib/cmake/${library_name}
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${library_name}
|
||||||
)
|
)
|
||||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${library_name}ConfigVersion.cmake"
|
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${library_name}ConfigVersion.cmake"
|
||||||
DESTINATION lib/cmake/${library_name}
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${library_name}
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(${library_name} 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}>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -111,8 +111,9 @@ void DockAreaTabBarPrivate::updateTabs()
|
|||||||
// Sometimes the synchronous calculation of the rectangular area fails
|
// Sometimes the synchronous calculation of the rectangular area fails
|
||||||
// Therefore we use QTimer::singleShot here to execute the call
|
// Therefore we use QTimer::singleShot here to execute the call
|
||||||
// within the event loop - see #520
|
// within the event loop - see #520
|
||||||
QTimer::singleShot(0, [&, TabWidget]{
|
QTimer::singleShot(0, _this, [&, TabWidget]
|
||||||
_this->ensureWidgetVisible(TabWidget);
|
{
|
||||||
|
_this->ensureWidgetVisible(TabWidget);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -159,19 +160,9 @@ CDockAreaTabBar::~CDockAreaTabBar()
|
|||||||
//============================================================================
|
//============================================================================
|
||||||
void CDockAreaTabBar::wheelEvent(QWheelEvent* Event)
|
void CDockAreaTabBar::wheelEvent(QWheelEvent* Event)
|
||||||
{
|
{
|
||||||
Event->accept();
|
QCoreApplication::sendEvent(horizontalScrollBar(), Event);
|
||||||
const int direction = Event->angleDelta().y();
|
|
||||||
if (direction < 0)
|
|
||||||
{
|
|
||||||
horizontalScrollBar()->setValue(horizontalScrollBar()->value() + 20);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
horizontalScrollBar()->setValue(horizontalScrollBar()->value() - 20);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
void CDockAreaTabBar::setCurrentIndex(int index)
|
void CDockAreaTabBar::setCurrentIndex(int index)
|
||||||
{
|
{
|
||||||
@@ -343,27 +334,13 @@ void CDockAreaTabBar::onTabCloseRequested()
|
|||||||
void CDockAreaTabBar::onCloseOtherTabsRequested()
|
void CDockAreaTabBar::onCloseOtherTabsRequested()
|
||||||
{
|
{
|
||||||
auto Sender = qobject_cast<CDockWidgetTab*>(sender());
|
auto Sender = qobject_cast<CDockWidgetTab*>(sender());
|
||||||
for (int i = 0; i < count(); ++i)
|
|
||||||
{
|
|
||||||
auto Tab = tab(i);
|
|
||||||
if (Tab->isClosable() && !Tab->isHidden() && Tab != Sender)
|
|
||||||
{
|
|
||||||
// If the dock widget is deleted with the closeTab() call, its tab
|
|
||||||
// it will no longer be in the layout, and thus the index needs to
|
|
||||||
// be updated to not skip any tabs
|
|
||||||
int Offset = Tab->dockWidget()->features().testFlag(
|
|
||||||
CDockWidget::DockWidgetDeleteOnClose) ? 1 : 0;
|
|
||||||
closeTab(i);
|
|
||||||
|
|
||||||
// If the the dock widget blocks closing, i.e. if the flag
|
for (int i = count() - 1; i >= 0; --i) {
|
||||||
// CustomCloseHandling is set, and the dock widget is still open,
|
auto Tab = tab(i);
|
||||||
// then we do not need to correct the index
|
if (Tab->isClosable() && !Tab->isHidden() && Tab != Sender) {
|
||||||
if (Tab->dockWidget()->isClosed())
|
closeTab(i);
|
||||||
{
|
}
|
||||||
i -= Offset;
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -389,15 +366,18 @@ void CDockAreaTabBar::onTabWidgetMoved(const QPoint& GlobalPos)
|
|||||||
|
|
||||||
int fromIndex = d->TabsLayout->indexOf(MovingTab);
|
int fromIndex = d->TabsLayout->indexOf(MovingTab);
|
||||||
auto MousePos = mapFromGlobal(GlobalPos);
|
auto MousePos = mapFromGlobal(GlobalPos);
|
||||||
MousePos.rx() = qMax(d->firstTab()->geometry().left(), MousePos.x());
|
MousePos.rx() = qMax(0, MousePos.x());
|
||||||
MousePos.rx() = qMin(d->lastTab()->geometry().right(), MousePos.x());
|
MousePos.rx() = qMin(width(), MousePos.x());
|
||||||
int toIndex = -1;
|
int toIndex = -1;
|
||||||
// Find tab under mouse
|
// Find tab under mouse
|
||||||
for (int i = 0; i < count(); ++i)
|
for (int i = 0; i < count(); ++i)
|
||||||
{
|
{
|
||||||
CDockWidgetTab* DropTab = tab(i);
|
CDockWidgetTab* DropTab = tab(i);
|
||||||
|
auto TabGeometry = DropTab->geometry();
|
||||||
|
TabGeometry.setTopLeft(d->TabsContainerWidget->mapToParent(TabGeometry.topLeft()));
|
||||||
|
TabGeometry.setBottomRight(d->TabsContainerWidget->mapToParent(TabGeometry.bottomRight()));
|
||||||
if (DropTab == MovingTab || !DropTab->isVisibleTo(this)
|
if (DropTab == MovingTab || !DropTab->isVisibleTo(this)
|
||||||
|| !DropTab->geometry().contains(MousePos))
|
|| !TabGeometry.contains(MousePos))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -469,6 +449,15 @@ bool CDockAreaTabBar::eventFilter(QObject *watched, QEvent *event)
|
|||||||
updateGeometry();
|
updateGeometry();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// Manage wheel event
|
||||||
|
case QEvent::Wheel:
|
||||||
|
// Ignore wheel events if tab is currently dragged
|
||||||
|
if (Tab->dragState() == DraggingInactive)
|
||||||
|
{
|
||||||
|
wheelEvent((QWheelEvent* )event);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -544,6 +533,13 @@ int CDockAreaTabBar::tabInsertIndexAt(const QPoint& Pos) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
bool CDockAreaTabBar::areTabsOverflowing() const
|
||||||
|
{
|
||||||
|
return d->TabsContainerWidget->width() > width();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace ads
|
} // namespace ads
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -65,8 +65,7 @@ private Q_SLOTS:
|
|||||||
void onTabWidgetMoved(const QPoint& GlobalPos);
|
void onTabWidgetMoved(const QPoint& GlobalPos);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void wheelEvent(QWheelEvent* Event) override;
|
virtual void wheelEvent(QWheelEvent* Event) override;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using Super = QScrollArea;
|
using Super = QScrollArea;
|
||||||
@@ -153,6 +152,12 @@ public:
|
|||||||
*/
|
*/
|
||||||
virtual QSize sizeHint() const override;
|
virtual QSize sizeHint() const override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function returns true, if the tabs need more space than the size
|
||||||
|
* of the tab bar.
|
||||||
|
*/
|
||||||
|
bool areTabsOverflowing() const;
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
/**
|
/**
|
||||||
* This property sets the index of the tab bar's visible tab
|
* This property sets the index of the tab bar's visible tab
|
||||||
|
|||||||
@@ -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)
|
||||||
@@ -115,6 +114,14 @@ struct DockAreaTitleBarPrivate
|
|||||||
return DockArea->dockManager();
|
return DockArea->dockManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convenience function for access to dock manager components factory
|
||||||
|
*/
|
||||||
|
QSharedPointer<ads::CDockComponentsFactory> componentsFactory() const
|
||||||
|
{
|
||||||
|
return dockManager()->componentsFactory();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the given config flag is set
|
* Returns true if the given config flag is set
|
||||||
* Convenience function to ease config flag testing
|
* Convenience function to ease config flag testing
|
||||||
@@ -159,7 +166,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;
|
||||||
}
|
}
|
||||||
@@ -179,7 +186,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);
|
||||||
@@ -197,7 +205,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"));
|
||||||
@@ -208,7 +217,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));
|
||||||
@@ -220,7 +230,8 @@ void DockAreaTitleBarPrivate::createButtons()
|
|||||||
_this->connect(AutoHideButton, SIGNAL(clicked()), SLOT(onAutoHideButtonClicked()));
|
_this->connect(AutoHideButton, SIGNAL(clicked()), SLOT(onAutoHideButtonClicked()));
|
||||||
|
|
||||||
// Minimize button
|
// Minimize button
|
||||||
MinimizeButton = new CTitleBarButton(testAutoHideConfigFlag(CDockManager::AutoHideHasMinimizeButton));
|
MinimizeButton = new CTitleBarButton(testAutoHideConfigFlag(CDockManager::AutoHideHasMinimizeButton),
|
||||||
|
false, TitleBarButtonMinimize);
|
||||||
MinimizeButton->setObjectName("dockAreaMinimizeButton");
|
MinimizeButton->setObjectName("dockAreaMinimizeButton");
|
||||||
MinimizeButton->setAutoRaise(true);
|
MinimizeButton->setAutoRaise(true);
|
||||||
MinimizeButton->setVisible(false);
|
MinimizeButton->setVisible(false);
|
||||||
@@ -231,7 +242,8 @@ void DockAreaTitleBarPrivate::createButtons()
|
|||||||
_this->connect(MinimizeButton, SIGNAL(clicked()), SLOT(minimizeAutoHideContainer()));
|
_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);
|
||||||
@@ -248,10 +260,10 @@ void DockAreaTitleBarPrivate::createAutoHideTitleLabel()
|
|||||||
{
|
{
|
||||||
AutoHideTitleLabel = new CElidingLabel("");
|
AutoHideTitleLabel = new CElidingLabel("");
|
||||||
AutoHideTitleLabel->setObjectName("autoHideTitleLabel");
|
AutoHideTitleLabel->setObjectName("autoHideTitleLabel");
|
||||||
// At position 0 is the tab bar - insert behind tab bar
|
// When the tabs are at the top, they will be at position 0, insert the label behind them, and hide it.
|
||||||
Layout->insertWidget(1, AutoHideTitleLabel);
|
Layout->addWidget(AutoHideTitleLabel);
|
||||||
AutoHideTitleLabel->setVisible(false); // Default hidden
|
AutoHideTitleLabel->setVisible(CDockManager::testConfigFlag(CDockManager::TabsAtBottom));
|
||||||
Layout->insertWidget(2 ,new CSpacerWidget(_this));
|
Layout->addWidget(new CSpacerWidget(_this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -260,7 +272,9 @@ void DockAreaTitleBarPrivate::createTabBar()
|
|||||||
{
|
{
|
||||||
TabBar = componentsFactory()->createDockAreaTabBar(DockArea);
|
TabBar = componentsFactory()->createDockAreaTabBar(DockArea);
|
||||||
TabBar->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
|
TabBar->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
|
||||||
Layout->addWidget(TabBar);
|
if (!CDockManager::testConfigFlag(CDockManager::TabsAtBottom))
|
||||||
|
Layout->addWidget(TabBar);
|
||||||
|
|
||||||
_this->connect(TabBar, SIGNAL(tabClosed(int)), SLOT(markTabsMenuOutdated()));
|
_this->connect(TabBar, SIGNAL(tabClosed(int)), SLOT(markTabsMenuOutdated()));
|
||||||
_this->connect(TabBar, SIGNAL(tabOpened(int)), SLOT(markTabsMenuOutdated()));
|
_this->connect(TabBar, SIGNAL(tabOpened(int)), SLOT(markTabsMenuOutdated()));
|
||||||
_this->connect(TabBar, SIGNAL(tabInserted(int)), SLOT(markTabsMenuOutdated()));
|
_this->connect(TabBar, SIGNAL(tabInserted(int)), SLOT(markTabsMenuOutdated()));
|
||||||
@@ -291,7 +305,7 @@ IFloatingWidget* DockAreaTitleBarPrivate::makeAreaFloating(const QPoint& Offset,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto w = new CFloatingDragPreview(DockArea);
|
auto w = new CFloatingDragPreview(DockArea);
|
||||||
QObject::connect(w, &CFloatingDragPreview::draggingCanceled, [=]()
|
QObject::connect(w, &CFloatingDragPreview::draggingCanceled, [this]()
|
||||||
{
|
{
|
||||||
this->DragState = DraggingInactive;
|
this->DragState = DraggingInactive;
|
||||||
});
|
});
|
||||||
@@ -339,8 +353,8 @@ CDockAreaTitleBar::CDockAreaTitleBar(CDockAreaWidget* parent) :
|
|||||||
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
||||||
|
|
||||||
d->createTabBar();
|
d->createTabBar();
|
||||||
d->createButtons();
|
|
||||||
d->createAutoHideTitleLabel();
|
d->createAutoHideTitleLabel();
|
||||||
|
d->createButtons();
|
||||||
|
|
||||||
setFocusPolicy(Qt::NoFocus);
|
setFocusPolicy(Qt::NoFocus);
|
||||||
}
|
}
|
||||||
@@ -373,27 +387,51 @@ CDockAreaTabBar* CDockAreaTitleBar::tabBar() const
|
|||||||
return d->TabBar;
|
return d->TabBar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
void CDockAreaTitleBar::resizeEvent(QResizeEvent *event)
|
||||||
|
{
|
||||||
|
Super::resizeEvent(event);
|
||||||
|
if (CDockManager::testConfigFlag(CDockManager::DockAreaDynamicTabsMenuButtonVisibility)
|
||||||
|
&& CDockManager::testConfigFlag(CDockManager::DisableTabTextEliding))
|
||||||
|
{
|
||||||
|
// Use queued connection to ensure that the resizing and relayouting has
|
||||||
|
// finished to ensure that the d->TabBar->areTabsOverflowing() function
|
||||||
|
// returns the correct value
|
||||||
|
QMetaObject::invokeMethod(this, "markTabsMenuOutdated", Qt::QueuedConnection);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
void CDockAreaTitleBar::markTabsMenuOutdated()
|
void CDockAreaTitleBar::markTabsMenuOutdated()
|
||||||
{
|
{
|
||||||
if(DockAreaTitleBarPrivate::testConfigFlag(CDockManager::DockAreaDynamicTabsMenuButtonVisibility))
|
if (CDockManager::testConfigFlag(CDockManager::DockAreaDynamicTabsMenuButtonVisibility))
|
||||||
{
|
{
|
||||||
bool hasElidedTabTitle = false;
|
bool TabsMenuButtonVisible = false;
|
||||||
for (int i = 0; i < d->TabBar->count(); ++i)
|
if (CDockManager::testConfigFlag(CDockManager::DisableTabTextEliding))
|
||||||
{
|
{
|
||||||
if (!d->TabBar->isTabOpen(i))
|
TabsMenuButtonVisible = d->TabBar->areTabsOverflowing();
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
CDockWidgetTab* Tab = d->TabBar->tab(i);
|
|
||||||
if(Tab->isTitleElided())
|
|
||||||
{
|
|
||||||
hasElidedTabTitle = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
bool visible = (hasElidedTabTitle && (d->TabBar->count() > 1));
|
else
|
||||||
QMetaObject::invokeMethod(d->TabsMenuButton, "setVisible", Qt::QueuedConnection, Q_ARG(bool, visible));
|
{
|
||||||
|
bool hasElidedTabTitle = false;
|
||||||
|
for (int i = 0; i < d->TabBar->count(); ++i)
|
||||||
|
{
|
||||||
|
if (!d->TabBar->isTabOpen(i))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
CDockWidgetTab* Tab = d->TabBar->tab(i);
|
||||||
|
if(Tab->isTitleElided())
|
||||||
|
{
|
||||||
|
hasElidedTabTitle = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
TabsMenuButtonVisible = (hasElidedTabTitle && (d->TabBar->count() > 1));
|
||||||
|
}
|
||||||
|
QMetaObject::invokeMethod(d->TabsMenuButton, "setVisible", Qt::QueuedConnection, Q_ARG(bool, TabsMenuButtonVisible));
|
||||||
}
|
}
|
||||||
d->MenuOutdated = true;
|
d->MenuOutdated = true;
|
||||||
}
|
}
|
||||||
@@ -510,7 +548,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);
|
||||||
@@ -564,7 +602,7 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -705,6 +743,11 @@ void CDockAreaTitleBar::mouseDoubleClickEvent(QMouseEvent *event)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!CDockManager::testConfigFlag(CDockManager::DoubleClickUndocksWidget))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
d->makeAreaFloating(event->pos(), DraggingInactive);
|
d->makeAreaFloating(event->pos(), DraggingInactive);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -740,24 +783,35 @@ void CDockAreaTitleBar::contextMenuEvent(QContextMenuEvent* ev)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool isAutoHide = d->DockArea->isAutoHide();
|
auto Menu = buildContextMenu(nullptr);
|
||||||
|
Menu->exec(ev->globalPos());
|
||||||
|
delete Menu;
|
||||||
|
}
|
||||||
|
|
||||||
|
QMenu* CDockAreaTitleBar::buildContextMenu(QMenu *Menu)
|
||||||
|
{
|
||||||
|
const bool isAutoHide = d->DockArea->isAutoHide();
|
||||||
const bool isTopLevelArea = d->DockArea->isTopLevelArea();
|
const bool isTopLevelArea = d->DockArea->isTopLevelArea();
|
||||||
QAction* Action;
|
QAction* Action;
|
||||||
QMenu Menu(this);
|
if (Menu == nullptr)
|
||||||
if (!isTopLevelArea)
|
{
|
||||||
|
Menu = new QMenu(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isTopLevelArea)
|
||||||
{
|
{
|
||||||
Action = Menu.addAction(isAutoHide ? tr("Detach") : tr("Detach Group"),
|
Action = Menu->addAction(isAutoHide ? tr("Detach") : tr("Detach Group"),
|
||||||
this, SLOT(onUndockButtonClicked()));
|
this, SLOT(onUndockButtonClicked()));
|
||||||
Action->setEnabled(d->DockArea->features().testFlag(CDockWidget::DockWidgetFloatable));
|
Action->setEnabled(d->DockArea->features().testFlag(CDockWidget::DockWidgetFloatable));
|
||||||
if (CDockManager::testAutoHideConfigFlag(CDockManager::AutoHideFeatureEnabled))
|
if (CDockManager::testAutoHideConfigFlag(CDockManager::AutoHideFeatureEnabled))
|
||||||
{
|
{
|
||||||
Action = Menu.addAction(isAutoHide ? tr("Unpin (Dock)") : tr("Pin Group"), this, SLOT(onAutoHideDockAreaActionClicked()));
|
Action = Menu->addAction(isAutoHide ? tr("Unpin (Dock)") : tr("Pin Group"), this, SLOT(onAutoHideDockAreaActionClicked()));
|
||||||
auto AreaIsPinnable = d->DockArea->features().testFlag(CDockWidget::DockWidgetPinnable);
|
auto AreaIsPinnable = d->DockArea->features().testFlag(CDockWidget::DockWidgetPinnable);
|
||||||
Action->setEnabled(AreaIsPinnable);
|
Action->setEnabled(AreaIsPinnable);
|
||||||
|
|
||||||
if (!isAutoHide)
|
if (!isAutoHide)
|
||||||
{
|
{
|
||||||
auto menu = Menu.addMenu(tr("Pin Group To..."));
|
auto menu = Menu->addMenu(tr("Pin Group To..."));
|
||||||
menu->setEnabled(AreaIsPinnable);
|
menu->setEnabled(AreaIsPinnable);
|
||||||
d->createAutoHideToAction(tr("Top"), SideBarTop, menu);
|
d->createAutoHideToAction(tr("Top"), SideBarTop, menu);
|
||||||
d->createAutoHideToAction(tr("Left"), SideBarLeft, menu);
|
d->createAutoHideToAction(tr("Left"), SideBarLeft, menu);
|
||||||
@@ -765,28 +819,27 @@ void CDockAreaTitleBar::contextMenuEvent(QContextMenuEvent* ev)
|
|||||||
d->createAutoHideToAction(tr("Bottom"), SideBarBottom, menu);
|
d->createAutoHideToAction(tr("Bottom"), SideBarBottom, menu);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Menu.addSeparator();
|
Menu->addSeparator();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isAutoHide)
|
if (isAutoHide)
|
||||||
{
|
{
|
||||||
Action = Menu.addAction(tr("Minimize"), this, SLOT(minimizeAutoHideContainer()));
|
Action = Menu->addAction(tr("Minimize"), this, SLOT(minimizeAutoHideContainer()));
|
||||||
Action = Menu.addAction(tr("Close"), this, SLOT(onAutoHideCloseActionTriggered()));
|
Action = Menu->addAction(tr("Close"), this, SLOT(onAutoHideCloseActionTriggered()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Action = Menu.addAction(isAutoHide ? tr("Close") : tr("Close Group"), this, SLOT(onCloseButtonClicked()));
|
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)
|
||||||
{
|
{
|
||||||
Action = Menu.addAction(tr("Close Other Groups"), d->DockArea, SLOT(closeOtherAreas()));
|
Action = Menu->addAction(tr("Close Other Groups"), d->DockArea, SLOT(closeOtherAreas()));
|
||||||
}
|
}
|
||||||
Menu.exec(ev->globalPos());
|
return Menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
void CDockAreaTitleBar::insertWidget(int index, QWidget *widget)
|
void CDockAreaTitleBar::insertWidget(int index, QWidget *widget)
|
||||||
{
|
{
|
||||||
@@ -849,17 +902,35 @@ QString CDockAreaTitleBar::titleBarButtonToolTip(TitleBarButton Button) const
|
|||||||
//============================================================================
|
//============================================================================
|
||||||
void CDockAreaTitleBar::showAutoHideControls(bool Show)
|
void CDockAreaTitleBar::showAutoHideControls(bool Show)
|
||||||
{
|
{
|
||||||
d->TabBar->setVisible(!Show); // Auto hide toolbar never has tabs
|
if (Show)
|
||||||
|
d->TabBar->setVisible(false); // Auto hide toolbar never has tabs
|
||||||
|
|
||||||
d->MinimizeButton->setVisible(Show);
|
d->MinimizeButton->setVisible(Show);
|
||||||
d->AutoHideTitleLabel->setVisible(Show);
|
if (!CDockManager::testConfigFlag(CDockManager::TabsAtBottom))
|
||||||
|
d->AutoHideTitleLabel->setVisible(Show);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
CTitleBarButton::CTitleBarButton(bool showInTitleBar, QWidget* parent)
|
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),
|
||||||
ShowInTitleBar(showInTitleBar),
|
ShowInTitleBar(showInTitleBar),
|
||||||
HideWhenDisabled(CDockManager::testConfigFlag(CDockManager::DockAreaHideDisabledButtons))
|
HideWhenDisabled(CDockManager::testConfigFlag(CDockManager::DockAreaHideDisabledButtons) && hideWhenDisabled),
|
||||||
|
TitleBarButtonId(ButtonId)
|
||||||
{
|
{
|
||||||
setFocusPolicy(Qt::NoFocus);
|
setFocusPolicy(Qt::NoFocus);
|
||||||
}
|
}
|
||||||
@@ -894,16 +965,47 @@ void CTitleBarButton::setShowInTitleBar(bool Show)
|
|||||||
//============================================================================
|
//============================================================================
|
||||||
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)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ class CDockAreaTabBar;
|
|||||||
class CDockAreaWidget;
|
class CDockAreaWidget;
|
||||||
struct DockAreaTitleBarPrivate;
|
struct DockAreaTitleBarPrivate;
|
||||||
class CElidingLabel;
|
class CElidingLabel;
|
||||||
|
class CDockAreaTitleBar;
|
||||||
|
|
||||||
using tTitleBarButton = QToolButton;
|
using tTitleBarButton = QToolButton;
|
||||||
|
|
||||||
@@ -59,10 +60,12 @@ class CTitleBarButton : public tTitleBarButton
|
|||||||
private:
|
private:
|
||||||
bool ShowInTitleBar = true;
|
bool ShowInTitleBar = true;
|
||||||
bool HideWhenDisabled = false;
|
bool HideWhenDisabled = false;
|
||||||
|
TitleBarButton TitleBarButtonId;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using Super = tTitleBarButton;
|
using Super = tTitleBarButton;
|
||||||
CTitleBarButton(bool ShowInTitleBar = true, QWidget* parent = nullptr);
|
CTitleBarButton(bool ShowInTitleBar, bool HideWhenDisabled, TitleBarButton ButtonId,
|
||||||
|
QWidget* parent = nullptr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adjust this visibility change request with our internal settings:
|
* Adjust this visibility change request with our internal settings:
|
||||||
@@ -74,6 +77,22 @@ public:
|
|||||||
*/
|
*/
|
||||||
void setShowInTitleBar(bool Show);
|
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:
|
protected:
|
||||||
/**
|
/**
|
||||||
* Handle EnabledChanged signal to set button invisible if the configured
|
* Handle EnabledChanged signal to set button invisible if the configured
|
||||||
@@ -133,6 +152,11 @@ protected:
|
|||||||
*/
|
*/
|
||||||
virtual void contextMenuEvent(QContextMenuEvent *event) override;
|
virtual void contextMenuEvent(QContextMenuEvent *event) override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle resize events
|
||||||
|
*/
|
||||||
|
virtual void resizeEvent(QResizeEvent *event) override;
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
/**
|
/**
|
||||||
* Call this slot to tell the title bar that it should update the tabs menu
|
* Call this slot to tell the title bar that it should update the tabs menu
|
||||||
@@ -152,7 +176,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Virtual Destructor
|
* Virtual Destructor
|
||||||
*/
|
*/
|
||||||
virtual ~CDockAreaTitleBar();
|
~CDockAreaTitleBar() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the pointer to the tabBar()
|
* Returns the pointer to the tabBar()
|
||||||
@@ -169,6 +193,11 @@ public:
|
|||||||
*/
|
*/
|
||||||
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
|
||||||
*/
|
*/
|
||||||
@@ -215,6 +244,25 @@ public:
|
|||||||
*/
|
*/
|
||||||
void showAutoHideControls(bool Show);
|
void showAutoHideControls(bool Show);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true, if the auto hide controls are visible
|
||||||
|
*/
|
||||||
|
bool isAutoHide() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fills the provided menu with standard entries. If a nullptr is passed, a
|
||||||
|
* new menu is created and filled with standard entries.
|
||||||
|
* This function is called from the actual version of contextMenuEvent, but
|
||||||
|
* can be called from any code. Caller is responsible of deleting the created
|
||||||
|
* object.
|
||||||
|
*
|
||||||
|
* @param menu The QMenu to fill with standard entries. If nullptr, a new
|
||||||
|
* QMenu will be created.
|
||||||
|
* @return The filled QMenu, either the provided one or a newly created one if
|
||||||
|
* nullptr was passed.
|
||||||
|
*/
|
||||||
|
virtual QMenu *buildContextMenu(QMenu *);
|
||||||
|
|
||||||
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
|
||||||
|
|||||||
@@ -52,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);}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -34,7 +34,6 @@
|
|||||||
|
|
||||||
#include <QStackedLayout>
|
#include <QStackedLayout>
|
||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
#include <QWheelEvent>
|
|
||||||
#include <QStyle>
|
#include <QStyle>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
@@ -81,7 +80,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;
|
||||||
|
|
||||||
@@ -180,14 +179,17 @@ public:
|
|||||||
parent->setUpdatesEnabled(false);
|
parent->setUpdatesEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto LayoutItem = m_ParentLayout->takeAt(1);
|
if (m_CurrentWidget)
|
||||||
if (LayoutItem)
|
|
||||||
{
|
{
|
||||||
LayoutItem->widget()->setParent(nullptr);
|
auto LayoutItem = m_ParentLayout->takeAt(1);
|
||||||
|
if (LayoutItem)
|
||||||
|
{
|
||||||
|
LayoutItem->widget()->setParent(nullptr);
|
||||||
|
}
|
||||||
|
delete LayoutItem;
|
||||||
}
|
}
|
||||||
delete LayoutItem;
|
|
||||||
|
|
||||||
m_ParentLayout->addWidget(next);
|
m_ParentLayout->insertWidget(1, next);
|
||||||
if (prev)
|
if (prev)
|
||||||
{
|
{
|
||||||
prev->hide();
|
prev->hide();
|
||||||
@@ -270,6 +272,14 @@ struct DockAreaWidgetPrivate
|
|||||||
*/
|
*/
|
||||||
DockAreaWidgetPrivate(CDockAreaWidget* _public);
|
DockAreaWidgetPrivate(CDockAreaWidget* _public);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convenience function to ease components factory access
|
||||||
|
*/
|
||||||
|
QSharedPointer<ads::CDockComponentsFactory> componentsFactory() const
|
||||||
|
{
|
||||||
|
return DockManager->componentsFactory();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the layout for top area with tabs and close button
|
* Creates the layout for top area with tabs and close button
|
||||||
*/
|
*/
|
||||||
@@ -355,6 +365,14 @@ void DockAreaWidgetPrivate::createTitleBar()
|
|||||||
{
|
{
|
||||||
TitleBar = componentsFactory()->createDockAreaTitleBar(_this);
|
TitleBar = componentsFactory()->createDockAreaTitleBar(_this);
|
||||||
Layout->addWidget(TitleBar);
|
Layout->addWidget(TitleBar);
|
||||||
|
if (CDockManager::testConfigFlag(CDockManager::TabsAtBottom))
|
||||||
|
{
|
||||||
|
// Title bar will be index 0, container widgets will be index 1,
|
||||||
|
// so tabs will always be at the end of the layout.
|
||||||
|
Layout->addWidget(tabBar());
|
||||||
|
tabBar()->setVisible(CDockManager::testConfigFlag(CDockManager::AlwaysShowTabs));
|
||||||
|
}
|
||||||
|
|
||||||
QObject::connect(tabBar(), &CDockAreaTabBar::tabCloseRequested, _this, &CDockAreaWidget::onTabCloseRequested);
|
QObject::connect(tabBar(), &CDockAreaTabBar::tabCloseRequested, _this, &CDockAreaWidget::onTabCloseRequested);
|
||||||
QObject::connect(TitleBar, &CDockAreaTitleBar::tabBarClicked, _this, &CDockAreaWidget::setCurrentIndex);
|
QObject::connect(TitleBar, &CDockAreaTitleBar::tabBarClicked, _this, &CDockAreaWidget::setCurrentIndex);
|
||||||
QObject::connect(tabBar(), &CDockAreaTabBar::tabMoved, _this, &CDockAreaWidget::reorderDockWidget);
|
QObject::connect(tabBar(), &CDockAreaTabBar::tabMoved, _this, &CDockAreaWidget::reorderDockWidget);
|
||||||
@@ -370,10 +388,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();
|
||||||
@@ -393,7 +422,7 @@ void DockAreaWidgetPrivate::updateTitleBarButtonVisibility(bool IsTopLevel)
|
|||||||
bool IsAutoHide = _this->isAutoHide();
|
bool IsAutoHide = _this->isAutoHide();
|
||||||
if (IsAutoHide)
|
if (IsAutoHide)
|
||||||
{
|
{
|
||||||
bool ShowCloseButton = CDockManager::autoHideConfigFlags().testFlag(CDockManager::AutoHideHasCloseButton);
|
bool ShowCloseButton = CDockManager::testAutoHideConfigFlag(CDockManager::AutoHideHasCloseButton);
|
||||||
TitleBar->button(TitleBarButtonClose)->setVisible(ShowCloseButton);
|
TitleBar->button(TitleBarButtonClose)->setVisible(ShowCloseButton);
|
||||||
TitleBar->button(TitleBarButtonAutoHide)->setVisible(true);
|
TitleBar->button(TitleBarButtonAutoHide)->setVisible(true);
|
||||||
TitleBar->button(TitleBarButtonUndock)->setVisible(false);
|
TitleBar->button(TitleBarButtonUndock)->setVisible(false);
|
||||||
@@ -410,7 +439,8 @@ void DockAreaWidgetPrivate::updateTitleBarButtonVisibility(bool IsTopLevel)
|
|||||||
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(TitleBarButtonAutoHide)->setVisible(ShowAutoHideButton);
|
||||||
TitleBar->button(TitleBarButtonUndock)->setVisible(true);
|
TitleBar->button(TitleBarButtonUndock)->setVisible(true);
|
||||||
TitleBar->button(TitleBarButtonTabsMenu)->setVisible(true);
|
TitleBar->button(TitleBarButtonTabsMenu)->setVisible(true);
|
||||||
}
|
}
|
||||||
@@ -430,6 +460,12 @@ CDockAreaWidget::CDockAreaWidget(CDockManager* DockManager, CDockContainerWidget
|
|||||||
|
|
||||||
d->createTitleBar();
|
d->createTitleBar();
|
||||||
d->ContentsLayout = new DockAreaLayout(d->Layout);
|
d->ContentsLayout = new DockAreaLayout(d->Layout);
|
||||||
|
|
||||||
|
if (CDockManager::testConfigFlag(CDockManager::UseNativeWindows))
|
||||||
|
{
|
||||||
|
winId();
|
||||||
|
}
|
||||||
|
|
||||||
if (d->DockManager)
|
if (d->DockManager)
|
||||||
{
|
{
|
||||||
Q_EMIT d->DockManager->dockAreaCreated(this);
|
Q_EMIT d->DockManager->dockAreaCreated(this);
|
||||||
@@ -573,8 +609,7 @@ void CDockAreaWidget::removeDockWidget(CDockWidget* DockWidget)
|
|||||||
{
|
{
|
||||||
if(CFloatingDockContainer* FloatingDockContainer = DockContainer->floatingWidget())
|
if(CFloatingDockContainer* FloatingDockContainer = DockContainer->floatingWidget())
|
||||||
{
|
{
|
||||||
FloatingDockContainer->hide();
|
FloatingDockContainer->finishDropOperation();
|
||||||
FloatingDockContainer->deleteLater();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -707,6 +742,7 @@ void CDockAreaWidget::setCurrentIndex(int index)
|
|||||||
TabBar->setCurrentIndex(index);
|
TabBar->setCurrentIndex(index);
|
||||||
d->ContentsLayout->setCurrentIndex(index);
|
d->ContentsLayout->setCurrentIndex(index);
|
||||||
d->ContentsLayout->currentWidget()->show();
|
d->ContentsLayout->currentWidget()->show();
|
||||||
|
d->TitleBar->autoHideTitleLabel()->setText(d->ContentsLayout->currentWidget()->windowTitle());
|
||||||
Q_EMIT currentChanged(index);
|
Q_EMIT currentChanged(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -756,7 +792,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;
|
||||||
}
|
}
|
||||||
@@ -772,7 +808,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));
|
||||||
}
|
}
|
||||||
@@ -786,7 +822,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;
|
||||||
}
|
}
|
||||||
@@ -809,7 +845,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)
|
||||||
{
|
{
|
||||||
@@ -854,11 +889,40 @@ void CDockAreaWidget::updateTitleBarVisibility()
|
|||||||
bool IsAutoHide = isAutoHide();
|
bool IsAutoHide = isAutoHide();
|
||||||
if (!CDockManager::testConfigFlag(CDockManager::AlwaysShowTabs))
|
if (!CDockManager::testConfigFlag(CDockManager::AlwaysShowTabs))
|
||||||
{
|
{
|
||||||
bool Hidden = Container->hasTopLevelDockWidget() && (Container->isFloating()
|
bool Hidden = false;
|
||||||
|| CDockManager::testConfigFlag(CDockManager::HideSingleCentralWidgetTitleBar));
|
if (!IsAutoHide) // Titlebar must always be visible when auto hidden so it can be dragged
|
||||||
Hidden |= (d->Flags.testFlag(HideSingleWidgetTitleBar) && openDockWidgetsCount() == 1);
|
{
|
||||||
Hidden &= !IsAutoHide; // Titlebar must always be visible when auto hidden so it can be dragged
|
if (Container->isFloating() || CDockManager::testConfigFlag(CDockManager::HideSingleCentralWidgetTitleBar))
|
||||||
|
{
|
||||||
|
// Always show title bar if it contains title bar actions
|
||||||
|
if (CDockWidget* TopLevelWidget = Container->topLevelDockWidget())
|
||||||
|
{
|
||||||
|
Hidden |= TopLevelWidget->titleBarActions().empty();
|
||||||
|
}
|
||||||
|
else if (CDockManager::testConfigFlag(CDockManager::TabsAtBottom))
|
||||||
|
{
|
||||||
|
Hidden = true;
|
||||||
|
|
||||||
|
for (CDockWidget* DockWidget : Container->openedDockWidgets())
|
||||||
|
{
|
||||||
|
if (!DockWidget->titleBarActions().empty())
|
||||||
|
{
|
||||||
|
Hidden = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!Hidden && d->Flags.testFlag(HideSingleWidgetTitleBar))
|
||||||
|
{
|
||||||
|
// Always show title bar if it contains title bar actions
|
||||||
|
auto DockWidgets = openedDockWidgets();
|
||||||
|
Hidden |= (DockWidgets.size() == 1) && DockWidgets.front()->titleBarActions().empty();
|
||||||
|
}
|
||||||
|
}
|
||||||
d->TitleBar->setVisible(!Hidden);
|
d->TitleBar->setVisible(!Hidden);
|
||||||
|
if (CDockManager::testConfigFlag(CDockManager::TabsAtBottom))
|
||||||
|
d->TitleBar->tabBar()->setVisible(openDockWidgetsCount() > 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isAutoHideFeatureEnabled())
|
if (isAutoHideFeatureEnabled())
|
||||||
@@ -869,6 +933,19 @@ void CDockAreaWidget::updateTitleBarVisibility()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
void CDockAreaWidget::updateWindowTitle()
|
||||||
|
{
|
||||||
|
auto currentWidget = d->ContentsLayout->currentWidget();
|
||||||
|
if (d->TitleBar && currentWidget)
|
||||||
|
{
|
||||||
|
d->TitleBar->autoHideTitleLabel()->setText(currentWidget->windowTitle());
|
||||||
|
}
|
||||||
|
|
||||||
|
markTitleBarMenuOutdated();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
void CDockAreaWidget::markTitleBarMenuOutdated()
|
void CDockAreaWidget::markTitleBarMenuOutdated()
|
||||||
{
|
{
|
||||||
@@ -1422,14 +1499,18 @@ QSize CDockAreaWidget::minimumSizeHint() const
|
|||||||
return Super::minimumSizeHint();
|
return Super::minimumSizeHint();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int extraHeight = 0;
|
||||||
if (d->TitleBar->isVisible())
|
if (d->TitleBar->isVisible())
|
||||||
{
|
{
|
||||||
return d->MinSizeHint + QSize(0, d->TitleBar->minimumSizeHint().height());
|
extraHeight += d->TitleBar->minimumSizeHint().height();
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (CDockManager::testConfigFlag(CDockManager::TabsAtBottom) && d->tabBar()->isVisible())
|
||||||
{
|
{
|
||||||
return d->MinSizeHint;
|
extraHeight += d->tabBar()->minimumSizeHint().height();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return d->MinSizeHint + QSize(0, extraHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,7 @@
|
|||||||
|
|
||||||
QT_FORWARD_DECLARE_CLASS(QXmlStreamWriter)
|
QT_FORWARD_DECLARE_CLASS(QXmlStreamWriter)
|
||||||
QT_FORWARD_DECLARE_CLASS(QAbstractButton)
|
QT_FORWARD_DECLARE_CLASS(QAbstractButton)
|
||||||
|
QT_FORWARD_DECLARE_CLASS(QMenu)
|
||||||
|
|
||||||
namespace ads
|
namespace ads
|
||||||
{
|
{
|
||||||
@@ -164,6 +165,11 @@ protected:
|
|||||||
*/
|
*/
|
||||||
void internalSetCurrentDockWidget(CDockWidget* DockWidget);
|
void internalSetCurrentDockWidget(CDockWidget* DockWidget);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Call this function to update the window title
|
||||||
|
*/
|
||||||
|
void updateWindowTitle();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Marks tabs menu to update
|
* Marks tabs menu to update
|
||||||
*/
|
*/
|
||||||
@@ -198,7 +204,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Virtual Destructor
|
* Virtual Destructor
|
||||||
*/
|
*/
|
||||||
virtual ~CDockAreaWidget();
|
~CDockAreaWidget() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the dock manager object this dock area belongs to
|
* Returns the dock manager object this dock area belongs to
|
||||||
|
|||||||
@@ -21,7 +21,8 @@
|
|||||||
|
|
||||||
namespace ads
|
namespace ads
|
||||||
{
|
{
|
||||||
static std::unique_ptr<CDockComponentsFactory> DefaultFactory(new CDockComponentsFactory());
|
|
||||||
|
static QSharedPointer<ads::CDockComponentsFactory> DefaultFactory;
|
||||||
|
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
@@ -52,9 +53,13 @@ CDockAreaTitleBar* CDockComponentsFactory::createDockAreaTitleBar(CDockAreaWidge
|
|||||||
|
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
const CDockComponentsFactory* CDockComponentsFactory::factory()
|
QSharedPointer<ads::CDockComponentsFactory> CDockComponentsFactory::factory()
|
||||||
{
|
{
|
||||||
return DefaultFactory.get();
|
if (!DefaultFactory)
|
||||||
|
{
|
||||||
|
DefaultFactory.reset(new CDockComponentsFactory());
|
||||||
|
}
|
||||||
|
return DefaultFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -70,6 +75,7 @@ void CDockComponentsFactory::resetDefaultFactory()
|
|||||||
{
|
{
|
||||||
DefaultFactory.reset(new CDockComponentsFactory());
|
DefaultFactory.reset(new CDockComponentsFactory());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace ads
|
} // namespace ads
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -66,9 +66,11 @@ public:
|
|||||||
virtual CDockAreaTitleBar* createDockAreaTitleBar(CDockAreaWidget* DockArea) const;
|
virtual CDockAreaTitleBar* createDockAreaTitleBar(CDockAreaWidget* DockArea) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the default components factory
|
* This returns the default dock components factory instance.
|
||||||
|
* If no components factory is assigned to a specific dock manager, this
|
||||||
|
* global factory instance will be used.
|
||||||
*/
|
*/
|
||||||
static const CDockComponentsFactory* factory();
|
static QSharedPointer<ads::CDockComponentsFactory> factory();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a new default factory for creation of GUI elements.
|
* Sets a new default factory for creation of GUI elements.
|
||||||
@@ -82,15 +84,6 @@ public:
|
|||||||
static void resetDefaultFactory();
|
static void resetDefaultFactory();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Convenience function to ease factory instance access
|
|
||||||
*/
|
|
||||||
inline const CDockComponentsFactory* componentsFactory()
|
|
||||||
{
|
|
||||||
return CDockComponentsFactory::factory();
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace ads
|
} // namespace ads
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ public:
|
|||||||
CDockContainerWidget* _this;
|
CDockContainerWidget* _this;
|
||||||
QPointer<CDockManager> DockManager;
|
QPointer<CDockManager> DockManager;
|
||||||
unsigned int zOrderIndex = 0;
|
unsigned int zOrderIndex = 0;
|
||||||
QList<CDockAreaWidget*> DockAreas;
|
QList<QPointer<CDockAreaWidget>> DockAreas;
|
||||||
QList<CAutoHideDockContainer*> AutoHideWidgets;
|
QList<CAutoHideDockContainer*> AutoHideWidgets;
|
||||||
QMap<SideBarLocation, CAutoHideSideBar*> SideTabBarWidgets;
|
QMap<SideBarLocation, CAutoHideSideBar*> SideTabBarWidgets;
|
||||||
QGridLayout* Layout = nullptr;
|
QGridLayout* Layout = nullptr;
|
||||||
@@ -299,7 +299,11 @@ public:
|
|||||||
VisibleDockAreaCount = 0;
|
VisibleDockAreaCount = 0;
|
||||||
for (auto DockArea : DockAreas)
|
for (auto DockArea : DockAreas)
|
||||||
{
|
{
|
||||||
VisibleDockAreaCount += DockArea->isHidden() ? 0 : 1;
|
if (!DockArea)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
VisibleDockAreaCount += (DockArea->isHidden() ? 0 : 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -903,6 +907,7 @@ void DockContainerWidgetPrivate::addDockAreasToList(const QList<CDockAreaWidget*
|
|||||||
{
|
{
|
||||||
DockArea->titleBarButton(TitleBarButtonClose)->setVisible(true);
|
DockArea->titleBarButton(TitleBarButtonClose)->setVisible(true);
|
||||||
DockArea->titleBarButton(TitleBarButtonAutoHide)->setVisible(true);
|
DockArea->titleBarButton(TitleBarButtonAutoHide)->setVisible(true);
|
||||||
|
DockArea->titleBarButton(TitleBarButtonUndock)->setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// We need to ensure, that the dock area title bar is visible. The title bar
|
// We need to ensure, that the dock area title bar is visible. The title bar
|
||||||
@@ -924,7 +929,10 @@ void DockContainerWidgetPrivate::addDockAreasToList(const QList<CDockAreaWidget*
|
|||||||
//============================================================================
|
//============================================================================
|
||||||
void DockContainerWidgetPrivate::appendDockAreas(const QList<CDockAreaWidget*> NewDockAreas)
|
void DockContainerWidgetPrivate::appendDockAreas(const QList<CDockAreaWidget*> NewDockAreas)
|
||||||
{
|
{
|
||||||
DockAreas.append(NewDockAreas);
|
for (auto *newDockArea : NewDockAreas)
|
||||||
|
{
|
||||||
|
DockAreas.append(newDockArea);
|
||||||
|
}
|
||||||
for (auto DockArea : NewDockAreas)
|
for (auto DockArea : NewDockAreas)
|
||||||
{
|
{
|
||||||
QObject::connect(DockArea,
|
QObject::connect(DockArea,
|
||||||
@@ -1565,9 +1573,21 @@ void CDockContainerWidget::removeDockArea(CDockAreaWidget* area)
|
|||||||
d->DockAreas.removeAll(area);
|
d->DockAreas.removeAll(area);
|
||||||
auto Splitter = area->parentSplitter();
|
auto Splitter = area->parentSplitter();
|
||||||
|
|
||||||
// Remove are from parent splitter and recursively hide tree of parent
|
// Remove area from parent splitter and recursively hide tree of parent
|
||||||
// splitters if it has no visible content
|
// splitters if it has no visible content.
|
||||||
area->setParent(nullptr);
|
// Use internalWinId() rather than testAttribute(WA_NativeWindow) because
|
||||||
|
// WA_NativeWindow is only set when a widget is *explicitly* made native
|
||||||
|
// (e.g. winId() called directly on it). Widgets that became native through
|
||||||
|
// propagation from a child calling winId() (e.g. a VTK/OpenGL widget) also
|
||||||
|
// hold a real native window handle but may not have WA_NativeWindow set.
|
||||||
|
// Setting the parent of such a native window to nullptr would make it an
|
||||||
|
// invisible top-level OS window, causing drawing artifacts. Reparent to
|
||||||
|
// the dock manager instead so the window stays off-screen but within the
|
||||||
|
// application's window hierarchy.
|
||||||
|
if (area->internalWinId())
|
||||||
|
area->setParent(d->DockManager);
|
||||||
|
else
|
||||||
|
area->setParent(nullptr);
|
||||||
internal::hideEmptyParentSplitters(Splitter);
|
internal::hideEmptyParentSplitters(Splitter);
|
||||||
|
|
||||||
// Remove this area from cached areas
|
// Remove this area from cached areas
|
||||||
@@ -1636,12 +1656,21 @@ emitAndExit:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
QList<QPointer<CDockAreaWidget>> CDockContainerWidget::removeAllDockAreas()
|
||||||
|
{
|
||||||
|
auto Result = d->DockAreas;
|
||||||
|
d->DockAreas.clear();
|
||||||
|
return Result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
CDockAreaWidget* CDockContainerWidget::dockAreaAt(const QPoint& GlobalPos) const
|
CDockAreaWidget* CDockContainerWidget::dockAreaAt(const QPoint& GlobalPos) const
|
||||||
{
|
{
|
||||||
for (const auto& DockArea : d->DockAreas)
|
for (const auto& DockArea : d->DockAreas)
|
||||||
{
|
{
|
||||||
if (DockArea->isVisible() && DockArea->rect().contains(DockArea->mapFromGlobal(GlobalPos)))
|
if (DockArea && DockArea->isVisible() && DockArea->rect().contains(DockArea->mapFromGlobal(GlobalPos)))
|
||||||
{
|
{
|
||||||
return DockArea;
|
return DockArea;
|
||||||
}
|
}
|
||||||
@@ -1678,7 +1707,7 @@ int CDockContainerWidget::visibleDockAreaCount() const
|
|||||||
int Result = 0;
|
int Result = 0;
|
||||||
for (auto DockArea : d->DockAreas)
|
for (auto DockArea : d->DockAreas)
|
||||||
{
|
{
|
||||||
Result += DockArea->isHidden() ? 0 : 1;
|
Result += (!DockArea || DockArea->isHidden()) ? 0 : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Result;
|
return Result;
|
||||||
@@ -1749,7 +1778,7 @@ void CDockContainerWidget::dropFloatingWidget(CFloatingDockContainer* FloatingWi
|
|||||||
if (Dropped)
|
if (Dropped)
|
||||||
{
|
{
|
||||||
// Fix https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/issues/351
|
// Fix https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/issues/351
|
||||||
FloatingWidget->hideAndDeleteLater();
|
FloatingWidget->finishDropOperation();
|
||||||
|
|
||||||
// If we dropped a floating widget with only one single dock widget, then we
|
// If we dropped a floating widget with only one single dock widget, then we
|
||||||
// drop a top level widget that changes from floating to docked now
|
// drop a top level widget that changes from floating to docked now
|
||||||
@@ -1802,7 +1831,7 @@ QList<CDockAreaWidget*> CDockContainerWidget::openedDockAreas() const
|
|||||||
QList<CDockAreaWidget*> Result;
|
QList<CDockAreaWidget*> Result;
|
||||||
for (auto DockArea : d->DockAreas)
|
for (auto DockArea : d->DockAreas)
|
||||||
{
|
{
|
||||||
if (!DockArea->isHidden())
|
if (DockArea && !DockArea->isHidden())
|
||||||
{
|
{
|
||||||
Result.append(DockArea);
|
Result.append(DockArea);
|
||||||
}
|
}
|
||||||
@@ -1818,7 +1847,7 @@ QList<CDockWidget*> CDockContainerWidget::openedDockWidgets() const
|
|||||||
QList<CDockWidget*> DockWidgetList;
|
QList<CDockWidget*> DockWidgetList;
|
||||||
for (auto DockArea : d->DockAreas)
|
for (auto DockArea : d->DockAreas)
|
||||||
{
|
{
|
||||||
if (!DockArea->isHidden())
|
if (DockArea && !DockArea->isHidden())
|
||||||
{
|
{
|
||||||
DockWidgetList.append(DockArea->openedDockWidgets());
|
DockWidgetList.append(DockArea->openedDockWidgets());
|
||||||
}
|
}
|
||||||
@@ -1833,7 +1862,7 @@ bool CDockContainerWidget::hasOpenDockAreas() const
|
|||||||
{
|
{
|
||||||
for (auto DockArea : d->DockAreas)
|
for (auto DockArea : d->DockAreas)
|
||||||
{
|
{
|
||||||
if (!DockArea->isHidden())
|
if (DockArea && !DockArea->isHidden())
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -2056,8 +2085,12 @@ CDockAreaWidget* CDockContainerWidget::topLevelDockArea() const
|
|||||||
QList<CDockWidget*> CDockContainerWidget::dockWidgets() const
|
QList<CDockWidget*> CDockContainerWidget::dockWidgets() const
|
||||||
{
|
{
|
||||||
QList<CDockWidget*> Result;
|
QList<CDockWidget*> Result;
|
||||||
for (const auto DockArea : d->DockAreas)
|
for (const auto& DockArea : d->DockAreas)
|
||||||
{
|
{
|
||||||
|
if (!DockArea)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
Result.append(DockArea->dockWidgets());
|
Result.append(DockArea->dockWidgets());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2088,8 +2121,12 @@ void CDockContainerWidget::removeAutoHideWidget(CAutoHideDockContainer* Autohide
|
|||||||
CDockWidget::DockWidgetFeatures CDockContainerWidget::features() const
|
CDockWidget::DockWidgetFeatures CDockContainerWidget::features() const
|
||||||
{
|
{
|
||||||
CDockWidget::DockWidgetFeatures Features(CDockWidget::AllDockWidgetFeatures);
|
CDockWidget::DockWidgetFeatures Features(CDockWidget::AllDockWidgetFeatures);
|
||||||
for (const auto DockArea : d->DockAreas)
|
for (const auto& DockArea : d->DockAreas)
|
||||||
{
|
{
|
||||||
|
if (!DockArea)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
Features &= DockArea->features();
|
Features &= DockArea->features();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2107,9 +2144,9 @@ CFloatingDockContainer* CDockContainerWidget::floatingWidget() const
|
|||||||
//============================================================================
|
//============================================================================
|
||||||
void CDockContainerWidget::closeOtherAreas(CDockAreaWidget* KeepOpenArea)
|
void CDockContainerWidget::closeOtherAreas(CDockAreaWidget* KeepOpenArea)
|
||||||
{
|
{
|
||||||
for (const auto DockArea : d->DockAreas)
|
for (const auto& DockArea : d->DockAreas)
|
||||||
{
|
{
|
||||||
if (DockArea == KeepOpenArea)
|
if (!DockArea || DockArea == KeepOpenArea)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -2180,6 +2217,17 @@ CDockManager* CDockContainerWidget::dockManager() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
void CDockContainerWidget::removeFromDockManager()
|
||||||
|
{
|
||||||
|
if (d->DockManager)
|
||||||
|
{
|
||||||
|
d->DockManager->removeDockContainer(this);
|
||||||
|
d->DockManager.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
void CDockContainerWidget::handleAutoHideWidgetEvent(QEvent* e, QWidget* w)
|
void CDockContainerWidget::handleAutoHideWidgetEvent(QEvent* e, QWidget* w)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ struct AutoHideDockContainerPrivate;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 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 tabified 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 contain a
|
* the main application window and all floating windows contain a
|
||||||
* DockContainerWidget instance.
|
* DockContainerWidget instance.
|
||||||
@@ -86,6 +86,9 @@ private:
|
|||||||
friend AutoHideDockContainerPrivate;
|
friend AutoHideDockContainerPrivate;
|
||||||
friend CAutoHideSideBar;
|
friend CAutoHideSideBar;
|
||||||
|
|
||||||
|
private Q_SLOTS:
|
||||||
|
void removeFromDockManager();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* Handles activation events to update zOrderIndex
|
* Handles activation events to update zOrderIndex
|
||||||
@@ -139,6 +142,11 @@ protected:
|
|||||||
*/
|
*/
|
||||||
void removeDockArea(CDockAreaWidget* area);
|
void removeDockArea(CDockAreaWidget* area);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove all dock areas and returns the list of removed dock areas
|
||||||
|
*/
|
||||||
|
QList<QPointer<CDockAreaWidget>> removeAllDockAreas();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Saves the state into the given stream
|
* Saves the state into the given stream
|
||||||
*/
|
*/
|
||||||
@@ -214,7 +222,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Virtual Destructor
|
* Virtual Destructor
|
||||||
*/
|
*/
|
||||||
virtual ~CDockContainerWidget();
|
~CDockContainerWidget() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds dockwidget into the given area.
|
* Adds dockwidget into the given area.
|
||||||
|
|||||||
@@ -115,6 +115,7 @@ DockFocusControllerPrivate::DockFocusControllerPrivate(
|
|||||||
//============================================================================
|
//============================================================================
|
||||||
void DockFocusControllerPrivate::updateDockWidgetFocus(CDockWidget* DockWidget)
|
void DockFocusControllerPrivate::updateDockWidgetFocus(CDockWidget* DockWidget)
|
||||||
{
|
{
|
||||||
|
if (!DockWidget) return;
|
||||||
if (!DockWidget->features().testFlag(CDockWidget::DockWidgetFocusable))
|
if (!DockWidget->features().testFlag(CDockWidget::DockWidgetFocusable))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@@ -422,6 +423,13 @@ CDockWidget* CDockFocusController::focusedDockWidget() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
CDockAreaWidget* CDockFocusController::focusedDockArea() const
|
||||||
|
{
|
||||||
|
return d->FocusedArea.data();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
void CDockFocusController::setDockWidgetTabPressed(bool Value)
|
void CDockFocusController::setDockWidgetTabPressed(bool Value)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -69,6 +69,12 @@ public:
|
|||||||
*/
|
*/
|
||||||
CDockWidget* focusedDockWidget() const;
|
CDockWidget* focusedDockWidget() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the dock area that contains the focusedDockWidget() or nullptr if
|
||||||
|
* the focused dock widget is not in this area.
|
||||||
|
*/
|
||||||
|
CDockAreaWidget* focusedDockArea() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Request focus highlighting for the given dock widget assigned to the tab
|
* Request focus highlighting for the given dock widget assigned to the tab
|
||||||
* given in Tab parameter
|
* given in Tab parameter
|
||||||
|
|||||||
@@ -41,6 +41,7 @@
|
|||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
#include <QDialog>
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QXmlStreamWriter>
|
#include <QXmlStreamWriter>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
@@ -48,6 +49,7 @@
|
|||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QWindow>
|
#include <QWindow>
|
||||||
#include <QWindowStateChangeEvent>
|
#include <QWindowStateChangeEvent>
|
||||||
|
#include <QVector>
|
||||||
|
|
||||||
#include "FloatingDockContainer.h"
|
#include "FloatingDockContainer.h"
|
||||||
#include "DockOverlay.h"
|
#include "DockOverlay.h"
|
||||||
@@ -59,6 +61,8 @@
|
|||||||
#include "DockAreaTitleBar.h"
|
#include "DockAreaTitleBar.h"
|
||||||
#include "DockFocusController.h"
|
#include "DockFocusController.h"
|
||||||
#include "DockSplitter.h"
|
#include "DockSplitter.h"
|
||||||
|
#include "DockComponentsFactory.h"
|
||||||
|
|
||||||
|
|
||||||
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
|
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
|
||||||
#include "linux/FloatingWidgetTitleBar.h"
|
#include "linux/FloatingWidgetTitleBar.h"
|
||||||
@@ -94,6 +98,7 @@ enum eStateFileVersion
|
|||||||
|
|
||||||
static CDockManager::ConfigFlags StaticConfigFlags = CDockManager::DefaultNonOpaqueConfig;
|
static CDockManager::ConfigFlags StaticConfigFlags = CDockManager::DefaultNonOpaqueConfig;
|
||||||
static CDockManager::AutoHideFlags StaticAutoHideConfigFlags; // auto hide feature is disabled by default
|
static CDockManager::AutoHideFlags StaticAutoHideConfigFlags; // auto hide feature is disabled by default
|
||||||
|
static QVector<QVariant> StaticConfigParams(CDockManager::ConfigParamCount);
|
||||||
|
|
||||||
static QString FloatingContainersTitle;
|
static QString FloatingContainersTitle;
|
||||||
|
|
||||||
@@ -103,8 +108,8 @@ static QString FloatingContainersTitle;
|
|||||||
struct DockManagerPrivate
|
struct DockManagerPrivate
|
||||||
{
|
{
|
||||||
CDockManager* _this;
|
CDockManager* _this;
|
||||||
QList<CFloatingDockContainer*> FloatingWidgets;
|
QList<QPointer<CFloatingDockContainer>> FloatingWidgets;
|
||||||
QList<CFloatingDockContainer*> HiddenFloatingWidgets;
|
QList<QPointer<CFloatingDockContainer>> HiddenFloatingWidgets;
|
||||||
QList<CDockContainerWidget*> Containers;
|
QList<CDockContainerWidget*> Containers;
|
||||||
CDockOverlay* ContainerOverlay;
|
CDockOverlay* ContainerOverlay;
|
||||||
CDockOverlay* DockAreaOverlay;
|
CDockOverlay* DockAreaOverlay;
|
||||||
@@ -122,6 +127,8 @@ struct DockManagerPrivate
|
|||||||
Qt::ToolButtonStyle ToolBarStyleFloating = Qt::ToolButtonTextUnderIcon;
|
Qt::ToolButtonStyle ToolBarStyleFloating = Qt::ToolButtonTextUnderIcon;
|
||||||
QSize ToolBarIconSizeDocked = QSize(16, 16);
|
QSize ToolBarIconSizeDocked = QSize(16, 16);
|
||||||
QSize ToolBarIconSizeFloating = QSize(24, 24);
|
QSize ToolBarIconSizeFloating = QSize(24, 24);
|
||||||
|
CDockWidget::DockWidgetFeatures LockedDockWidgetFeatures;
|
||||||
|
QSharedPointer<ads::CDockComponentsFactory> ComponentFactory {ads::CDockComponentsFactory::factory()};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Private data constructor
|
* Private data constructor
|
||||||
@@ -153,7 +160,10 @@ struct DockManagerPrivate
|
|||||||
// Hide updates of floating widgets from user
|
// Hide updates of floating widgets from user
|
||||||
for (auto FloatingWidget : FloatingWidgets)
|
for (auto FloatingWidget : FloatingWidgets)
|
||||||
{
|
{
|
||||||
FloatingWidget->hide();
|
if (FloatingWidget)
|
||||||
|
{
|
||||||
|
FloatingWidget->hide();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -193,6 +203,10 @@ DockManagerPrivate::DockManagerPrivate(CDockManager* _public) :
|
|||||||
//============================================================================
|
//============================================================================
|
||||||
void DockManagerPrivate::loadStylesheet()
|
void DockManagerPrivate::loadStylesheet()
|
||||||
{
|
{
|
||||||
|
if (CDockManager::testConfigFlag(CDockManager::DisableStylesheet))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
initResource();
|
initResource();
|
||||||
QString Result;
|
QString Result;
|
||||||
QString FileName = ":ads/stylesheets/";
|
QString FileName = ":ads/stylesheets/";
|
||||||
@@ -333,7 +347,8 @@ bool DockManagerPrivate::restoreStateFromXml(const QByteArray &state, int versi
|
|||||||
int FloatingWidgetIndex = DockContainerCount - 1;
|
int FloatingWidgetIndex = DockContainerCount - 1;
|
||||||
for (int i = FloatingWidgetIndex; i < FloatingWidgets.count(); ++i)
|
for (int i = FloatingWidgetIndex; i < FloatingWidgets.count(); ++i)
|
||||||
{
|
{
|
||||||
auto* floatingWidget = FloatingWidgets[i];
|
CFloatingDockContainer* floatingWidget = FloatingWidgets[i];
|
||||||
|
if (!floatingWidget) continue;
|
||||||
_this->removeDockContainer(floatingWidget->dockContainer());
|
_this->removeDockContainer(floatingWidget->dockContainer());
|
||||||
floatingWidget->deleteLater();
|
floatingWidget->deleteLater();
|
||||||
}
|
}
|
||||||
@@ -520,14 +535,45 @@ CDockManager::CDockManager(QWidget *parent) :
|
|||||||
window()->installEventFilter(this);
|
window()->installEventFilter(this);
|
||||||
|
|
||||||
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
|
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
|
||||||
connect(qApp, &QApplication::focusWindowChanged, [](QWindow* focusWindow)
|
connect(qApp, &QApplication::focusWindowChanged, this, [this](QWindow* focusWindow)
|
||||||
{
|
{
|
||||||
// bring modal dialogs to foreground to ensure that they are in front of any
|
if (!focusWindow)
|
||||||
// floating dock widget
|
|
||||||
if (focusWindow && focusWindow->isModal())
|
|
||||||
{
|
{
|
||||||
focusWindow->raise();
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto widget = QWidget::find(focusWindow->winId());
|
||||||
|
if (!widget)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the user clicks the main window or drags a floating widget or works with a
|
||||||
|
// modal dialog, then raise the main window, all floating widgets and the focus window
|
||||||
|
// itself to bring it into foreground of any other application.
|
||||||
|
bool raise = qobject_cast<QMainWindow*>(widget)
|
||||||
|
|| qobject_cast<ads::CFloatingDockContainer*>(widget);
|
||||||
|
if (auto dialog = qobject_cast<QDialog*>(widget))
|
||||||
|
{
|
||||||
|
raise |= dialog->isModal();
|
||||||
|
}
|
||||||
|
if (!raise)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this->raise();
|
||||||
|
for (auto FloatingWidget : d->FloatingWidgets)
|
||||||
|
{
|
||||||
|
if (FloatingWidget)
|
||||||
|
{
|
||||||
|
FloatingWidget->raise();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ensure that the dragged floating window is in front of the main application window
|
||||||
|
// and any other floating widget - this will also ensure that modal dialogs come to foreground
|
||||||
|
focusWindow->raise();
|
||||||
});
|
});
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -536,28 +582,73 @@ CDockManager::CDockManager(QWidget *parent) :
|
|||||||
CDockManager::~CDockManager()
|
CDockManager::~CDockManager()
|
||||||
{
|
{
|
||||||
// fix memory leaks, see https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/issues/307
|
// fix memory leaks, see https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/issues/307
|
||||||
std::vector<ads::CDockAreaWidget*> areas;
|
std::vector<QPointer<ads::CDockAreaWidget>> areas;
|
||||||
for ( int i = 0; i != dockAreaCount(); ++i )
|
for (int i = 0; i != dockAreaCount(); ++i)
|
||||||
{
|
{
|
||||||
areas.push_back( dockArea(i) );
|
areas.push_back( dockArea(i) );
|
||||||
}
|
}
|
||||||
for ( auto area : areas )
|
for ( auto area : areas )
|
||||||
{
|
{
|
||||||
for ( auto widget : area->dockWidgets() )
|
if (!area || area->dockManager() != this) continue;
|
||||||
delete widget;
|
|
||||||
|
|
||||||
delete area;
|
// QPointer delete safety - just in case some dock widget in destruction
|
||||||
}
|
// deletes another related/twin or child dock widget.
|
||||||
|
std::vector<QPointer<QWidget>> deleteWidgets;
|
||||||
|
for ( auto widget : area->dockWidgets() )
|
||||||
|
{
|
||||||
|
deleteWidgets.push_back(widget);
|
||||||
|
}
|
||||||
|
for ( auto ptrWdg : deleteWidgets)
|
||||||
|
{
|
||||||
|
delete ptrWdg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
auto FloatingWidgets = d->FloatingWidgets;
|
auto FloatingWidgets = d->FloatingWidgets;
|
||||||
for (auto FloatingWidget : FloatingWidgets)
|
for (auto FloatingWidget : FloatingWidgets)
|
||||||
{
|
{
|
||||||
|
FloatingWidget->deleteContent();
|
||||||
delete FloatingWidget;
|
delete FloatingWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Delete Dock Widgets before Areas so widgets can access them late (like dtor)
|
||||||
|
for ( auto area : areas )
|
||||||
|
{
|
||||||
|
delete area;
|
||||||
|
}
|
||||||
|
|
||||||
delete d;
|
delete d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
CDockWidget* CDockManager::createDockWidget(const QString &title, QWidget* parent)
|
||||||
|
{
|
||||||
|
return new CDockWidget(this, title, parent);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
QSharedPointer<ads::CDockComponentsFactory> CDockManager::componentsFactory() const
|
||||||
|
{
|
||||||
|
return d->ComponentFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
void CDockManager::setComponentsFactory(ads::CDockComponentsFactory* factory)
|
||||||
|
{
|
||||||
|
setComponentsFactory(QSharedPointer<ads::CDockComponentsFactory>(factory));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
void CDockManager::setComponentsFactory(QSharedPointer<ads::CDockComponentsFactory> factory)
|
||||||
|
{
|
||||||
|
d->ComponentFactory = factory;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
|
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
|
||||||
bool CDockManager::eventFilter(QObject *obj, QEvent *e)
|
bool CDockManager::eventFilter(QObject *obj, QEvent *e)
|
||||||
@@ -568,7 +659,7 @@ bool CDockManager::eventFilter(QObject *obj, QEvent *e)
|
|||||||
// Window always on top of the MainWindow.
|
// Window always on top of the MainWindow.
|
||||||
if (e->type() == QEvent::WindowActivate)
|
if (e->type() == QEvent::WindowActivate)
|
||||||
{
|
{
|
||||||
for (auto _window : floatingWidgets())
|
for (auto _window : d->FloatingWidgets)
|
||||||
{
|
{
|
||||||
if (!_window->isVisible() || window()->isMinimized())
|
if (!_window->isVisible() || window()->isMinimized())
|
||||||
{
|
{
|
||||||
@@ -590,7 +681,7 @@ bool CDockManager::eventFilter(QObject *obj, QEvent *e)
|
|||||||
}
|
}
|
||||||
else if (e->type() == QEvent::WindowDeactivate)
|
else if (e->type() == QEvent::WindowDeactivate)
|
||||||
{
|
{
|
||||||
for (auto _window : floatingWidgets())
|
for (auto _window : d->FloatingWidgets)
|
||||||
{
|
{
|
||||||
if (!_window->isVisible() || window()->isMinimized())
|
if (!_window->isVisible() || window()->isMinimized())
|
||||||
{
|
{
|
||||||
@@ -613,7 +704,7 @@ bool CDockManager::eventFilter(QObject *obj, QEvent *e)
|
|||||||
// Sync minimize with MainWindow
|
// Sync minimize with MainWindow
|
||||||
if (e->type() == QEvent::WindowStateChange)
|
if (e->type() == QEvent::WindowStateChange)
|
||||||
{
|
{
|
||||||
for (auto _window : floatingWidgets())
|
for (auto _window : d->FloatingWidgets)
|
||||||
{
|
{
|
||||||
if (! _window->isVisible())
|
if (! _window->isVisible())
|
||||||
{
|
{
|
||||||
@@ -681,7 +772,8 @@ void CDockManager::registerFloatingWidget(CFloatingDockContainer* FloatingWidget
|
|||||||
//============================================================================
|
//============================================================================
|
||||||
void CDockManager::removeFloatingWidget(CFloatingDockContainer* FloatingWidget)
|
void CDockManager::removeFloatingWidget(CFloatingDockContainer* FloatingWidget)
|
||||||
{
|
{
|
||||||
d->FloatingWidgets.removeAll(FloatingWidget);
|
int removed = d->FloatingWidgets.removeAll(FloatingWidget);
|
||||||
|
Q_ASSERT(removed == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
@@ -696,7 +788,8 @@ void CDockManager::removeDockContainer(CDockContainerWidget* DockContainer)
|
|||||||
{
|
{
|
||||||
if (this != DockContainer)
|
if (this != DockContainer)
|
||||||
{
|
{
|
||||||
d->Containers.removeAll(DockContainer);
|
int removed = d->Containers.removeAll(DockContainer);
|
||||||
|
Q_ASSERT(removed == 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -725,7 +818,12 @@ const QList<CDockContainerWidget*> CDockManager::dockContainers() const
|
|||||||
//============================================================================
|
//============================================================================
|
||||||
const QList<CFloatingDockContainer*> CDockManager::floatingWidgets() const
|
const QList<CFloatingDockContainer*> CDockManager::floatingWidgets() const
|
||||||
{
|
{
|
||||||
return d->FloatingWidgets;
|
QList<CFloatingDockContainer*> res;
|
||||||
|
for (auto &fl : d->FloatingWidgets)
|
||||||
|
{
|
||||||
|
if (fl) res.append(fl);
|
||||||
|
}
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1125,7 +1223,7 @@ QAction* CDockManager::addToggleViewActionToMenu(QAction* ToggleViewAction,
|
|||||||
bool AlphabeticallySorted = (MenuAlphabeticallySorted == d->MenuInsertionOrder);
|
bool AlphabeticallySorted = (MenuAlphabeticallySorted == d->MenuInsertionOrder);
|
||||||
if (!Group.isEmpty())
|
if (!Group.isEmpty())
|
||||||
{
|
{
|
||||||
QMenu* GroupMenu = d->ViewMenuGroups.value(Group, 0);
|
QMenu* GroupMenu = d->ViewMenuGroups.value(Group, nullptr);
|
||||||
if (!GroupMenu)
|
if (!GroupMenu)
|
||||||
{
|
{
|
||||||
GroupMenu = new QMenu(Group, this);
|
GroupMenu = new QMenu(Group, this);
|
||||||
@@ -1422,6 +1520,57 @@ QSize CDockManager::dockWidgetToolBarIconSize(CDockWidget::eState State) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
void CDockManager::lockDockWidgetFeaturesGlobally(CDockWidget::DockWidgetFeatures Value)
|
||||||
|
{
|
||||||
|
// Limit the features to CDockWidget::GloballyLockableFeatures
|
||||||
|
Value &= CDockWidget::GloballyLockableFeatures;
|
||||||
|
if (d->LockedDockWidgetFeatures == Value)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
d->LockedDockWidgetFeatures = Value;
|
||||||
|
// Call the notifyFeaturesChanged() function for all dock widgets to update
|
||||||
|
// the state of the close and detach buttons
|
||||||
|
for (auto DockWidget : d->DockWidgetsMap)
|
||||||
|
{
|
||||||
|
DockWidget->notifyFeaturesChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
CDockWidget::DockWidgetFeatures CDockManager::globallyLockedDockWidgetFeatures() const
|
||||||
|
{
|
||||||
|
return d->LockedDockWidgetFeatures;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
void CDockManager::setConfigParam(CDockManager::eConfigParam Param, QVariant Value)
|
||||||
|
{
|
||||||
|
StaticConfigParams[Param] = Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
QVariant CDockManager::configParam(eConfigParam Param, QVariant Default)
|
||||||
|
{
|
||||||
|
return StaticConfigParams[Param].isValid() ? StaticConfigParams[Param] : Default;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
void CDockManager::raise()
|
||||||
|
{
|
||||||
|
if (parentWidget())
|
||||||
|
{
|
||||||
|
parentWidget()->raise();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace ads
|
} // namespace ads
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -64,8 +64,13 @@ struct AutoHideTabPrivate;
|
|||||||
* of the docking system. The dock manager uses an internal stylesheet to
|
* of the docking system. The dock manager uses an internal stylesheet to
|
||||||
* style its components like splitters, tabs and buttons. If you want to
|
* style its components like splitters, tabs and buttons. If you want to
|
||||||
* disable this stylesheet because your application uses its own,
|
* disable this stylesheet because your application uses its own,
|
||||||
* just call the function for settings the stylesheet with an empty
|
* you can either set the DisableStylesheet config flag before creating
|
||||||
* string.
|
* the dock manager:
|
||||||
|
* \code
|
||||||
|
* CDockManager::setConfigFlag(CDockManager::DisableStylesheet, true);
|
||||||
|
* \endcode
|
||||||
|
* Or call the function for settings the stylesheet with an empty string
|
||||||
|
* after creating the dock manager:
|
||||||
* \code
|
* \code
|
||||||
* DockManager->setStyleSheet("");
|
* DockManager->setStyleSheet("");
|
||||||
* \endcode
|
* \endcode
|
||||||
@@ -215,6 +220,11 @@ public:
|
|||||||
MiddleMouseButtonClosesTab = 0x2000000, //! If the flag is set, the user can use the mouse middle button to close the tab under the mouse
|
MiddleMouseButtonClosesTab = 0x2000000, //! If the flag is set, the user can use the mouse middle button to close the tab under the mouse
|
||||||
DisableTabTextEliding = 0x4000000, //! Set this flag to disable eliding of tab texts in dock area tabs
|
DisableTabTextEliding = 0x4000000, //! Set this flag to disable eliding of tab texts in dock area tabs
|
||||||
ShowTabTextOnlyForActiveTab =0x8000000, //! Set this flag to show label texts in dock area tabs only for active tabs
|
ShowTabTextOnlyForActiveTab =0x8000000, //! Set this flag to show label texts in dock area tabs only for active tabs
|
||||||
|
DoubleClickUndocksWidget = 0x10000000, //!< If the flag is set, a double click on a tab undocks the widget
|
||||||
|
TabsAtBottom = 0x20000000, //!< If the flag is set, tabs will be shown at the bottom instead of in the title bar.
|
||||||
|
UseNativeWindows = 0x40000000, //!< If the flag is set, windows for the dock and area widgets will be native.
|
||||||
|
DisableStylesheet = 0x80000000, //!< If the flag is set, the dock manager will not apply the default stylesheet
|
||||||
|
|
||||||
|
|
||||||
DefaultDockAreaButtons = DockAreaHasCloseButton
|
DefaultDockAreaButtons = DockAreaHasCloseButton
|
||||||
| DockAreaHasUndockButton
|
| DockAreaHasUndockButton
|
||||||
@@ -223,7 +233,8 @@ public:
|
|||||||
DefaultBaseConfig = DefaultDockAreaButtons
|
DefaultBaseConfig = DefaultDockAreaButtons
|
||||||
| ActiveTabHasCloseButton
|
| ActiveTabHasCloseButton
|
||||||
| XmlCompressionEnabled
|
| XmlCompressionEnabled
|
||||||
| FloatingContainerHasWidgetTitle, ///< default base configuration settings
|
| FloatingContainerHasWidgetTitle
|
||||||
|
| DoubleClickUndocksWidget, ///< default base configuration settings
|
||||||
|
|
||||||
DefaultOpaqueConfig = DefaultBaseConfig
|
DefaultOpaqueConfig = DefaultBaseConfig
|
||||||
| OpaqueSplitterResize
|
| OpaqueSplitterResize
|
||||||
@@ -254,14 +265,26 @@ public:
|
|||||||
AutoHideCloseButtonCollapsesDock = 0x40, ///< Close button of an auto hide container collapses the dock instead of hiding it completely
|
AutoHideCloseButtonCollapsesDock = 0x40, ///< Close button of an auto hide container collapses the dock instead of hiding it completely
|
||||||
AutoHideHasCloseButton = 0x80, //< If the flag is set an auto hide title bar has a close button
|
AutoHideHasCloseButton = 0x80, //< If the flag is set an auto hide title bar has a close button
|
||||||
AutoHideHasMinimizeButton = 0x100, ///< if this flag is set, the auto hide title bar has a minimize button to collapse the dock widget
|
AutoHideHasMinimizeButton = 0x100, ///< if this flag is set, the auto hide title bar has a minimize button to collapse the dock widget
|
||||||
|
AutoHideOpenOnDragHover = 0x200, ///< if this flag is set, dragging hover the tab bar will open the dock
|
||||||
|
AutoHideCloseOnOutsideMouseClick = 0x400, ///< if this flag is set, the auto hide dock container will collapse if the user clicks outside of the container, if not set, the auto hide container can be closed only via click on sidebar tab
|
||||||
|
|
||||||
DefaultAutoHideConfig = AutoHideFeatureEnabled
|
DefaultAutoHideConfig = AutoHideFeatureEnabled
|
||||||
| DockAreaHasAutoHideButton
|
| DockAreaHasAutoHideButton
|
||||||
| AutoHideHasMinimizeButton
|
| AutoHideHasMinimizeButton
|
||||||
|
| AutoHideCloseOnOutsideMouseClick
|
||||||
|
|
||||||
};
|
};
|
||||||
Q_DECLARE_FLAGS(AutoHideFlags, eAutoHideFlag)
|
Q_DECLARE_FLAGS(AutoHideFlags, eAutoHideFlag)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Global configuration parameters that you can set via setConfigParam()
|
||||||
|
*/
|
||||||
|
enum eConfigParam
|
||||||
|
{
|
||||||
|
AutoHideOpenOnDragHoverDelay_ms, ///< Delay in ms before the dock opens on drag hover if AutoHideOpenOnDragHover flag is set
|
||||||
|
ConfigParamCount // just a delimiter to count number of config params
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default Constructor.
|
* Default Constructor.
|
||||||
@@ -277,6 +300,39 @@ public:
|
|||||||
*/
|
*/
|
||||||
virtual ~CDockManager() override;
|
virtual ~CDockManager() override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new dock widget with the specified title and optional parent
|
||||||
|
* widget.
|
||||||
|
*
|
||||||
|
* The new dock widget will be managed by the dock manager, and its lifetime
|
||||||
|
* will be tied to the dock manager. If a parent widget is provided, the dock
|
||||||
|
* widget will be created as a child of the parent widget. If no parent widget
|
||||||
|
* is provided, the dock widget will be created as a top-level widget.
|
||||||
|
*
|
||||||
|
* @param title The title of the dock widget.
|
||||||
|
* @param parent The parent widget, if any. Defaults to nullptr.
|
||||||
|
* @return Returns a pointer to the created CDockWidget.
|
||||||
|
*/
|
||||||
|
CDockWidget *createDockWidget(const QString &title, QWidget* parent = nullptr);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the dock manager specific factory for creating components of
|
||||||
|
* fock widgets
|
||||||
|
*/
|
||||||
|
QSharedPointer<ads::CDockComponentsFactory> componentsFactory() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets a custom factory for creating components of dock widgets.
|
||||||
|
* The pointer is stored internally into a shared pointer so you should not
|
||||||
|
* delete the given factory object as long as it is used by the dock manager.
|
||||||
|
*/
|
||||||
|
void setComponentsFactory(ads::CDockComponentsFactory* Factory);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets a custom factory for creating components of dock widgets.
|
||||||
|
*/
|
||||||
|
void setComponentsFactory(QSharedPointer<ads::CDockComponentsFactory>);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function returns the global configuration flags
|
* This function returns the global configuration flags
|
||||||
*/
|
*/
|
||||||
@@ -323,6 +379,17 @@ public:
|
|||||||
*/
|
*/
|
||||||
static bool testAutoHideConfigFlag(eAutoHideFlag Flag);
|
static bool testAutoHideConfigFlag(eAutoHideFlag Flag);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the value for the given config parameter
|
||||||
|
*/
|
||||||
|
static void setConfigParam(eConfigParam Param, QVariant Value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the value for the given config parameter or the default value
|
||||||
|
* if the parameter is not set.
|
||||||
|
*/
|
||||||
|
static QVariant configParam(eConfigParam Param, QVariant Default);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the global icon provider.
|
* Returns the global icon provider.
|
||||||
* The icon provider enables the use of custom icons in case using
|
* The icon provider enables the use of custom icons in case using
|
||||||
@@ -660,6 +727,38 @@ public:
|
|||||||
*/
|
*/
|
||||||
QSize dockWidgetToolBarIconSize(CDockWidget::eState State) const;
|
QSize dockWidgetToolBarIconSize(CDockWidget::eState State) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns all dock widget features that are globally locked by the dock
|
||||||
|
* manager.
|
||||||
|
* Globally locked features are removed from the features of all dock
|
||||||
|
* widgets.
|
||||||
|
*/
|
||||||
|
CDockWidget::DockWidgetFeatures globallyLockedDockWidgetFeatures() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Globally Lock features of all dock widgets to "freeze" the current
|
||||||
|
* workspace layout.
|
||||||
|
* For example, it is now possible to lock the workspace to avoid
|
||||||
|
* accidentally dragging a docked view. Locking wasn’t possible before.
|
||||||
|
* So, users had to manually dock it back to the desired place after
|
||||||
|
* each accidental undock.
|
||||||
|
* You can use a combination of the following feature flags:
|
||||||
|
* - CDockWidget::DockWidgetClosable
|
||||||
|
* - CDockWidget::DockWidgetMovable
|
||||||
|
* - CDockWidget::DockWidgetFloatable
|
||||||
|
* - CDockWidget::DockWidgetPinable
|
||||||
|
*
|
||||||
|
* To clear the locked features, you can use CDockWidget::NoDockWidgetFeatures
|
||||||
|
* The following code shows how to lock and unlock dock widget features
|
||||||
|
* globally.
|
||||||
|
*
|
||||||
|
* \code
|
||||||
|
* DockManager->lockDockWidgetFeaturesGlobally();
|
||||||
|
* DockManager->lockDockWidgetFeaturesGlobally(CDockWidget::NoDockWidgetFeatures);
|
||||||
|
* \code
|
||||||
|
*/
|
||||||
|
void lockDockWidgetFeaturesGlobally(CDockWidget::DockWidgetFeatures Features = CDockWidget::GloballyLockableFeatures);
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
/**
|
/**
|
||||||
* Opens the perspective with the given name.
|
* Opens the perspective with the given name.
|
||||||
@@ -679,6 +778,12 @@ public Q_SLOTS:
|
|||||||
*/
|
*/
|
||||||
void hideManagerAndFloatingWidgets();
|
void hideManagerAndFloatingWidgets();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calls raise() for the widget that hosts this dock manager.
|
||||||
|
* This will bring the widget in front of any other application that is running
|
||||||
|
*/
|
||||||
|
void raise();
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
/**
|
/**
|
||||||
* This signal is emitted if the list of perspectives changed.
|
* This signal is emitted if the list of perspectives changed.
|
||||||
|
|||||||
@@ -80,8 +80,8 @@ struct DockWidgetPrivate
|
|||||||
QWidget* Widget = nullptr;
|
QWidget* Widget = nullptr;
|
||||||
CDockWidgetTab* TabWidget = nullptr;
|
CDockWidgetTab* TabWidget = nullptr;
|
||||||
CDockWidget::DockWidgetFeatures Features = CDockWidget::DefaultDockWidgetFeatures;
|
CDockWidget::DockWidgetFeatures Features = CDockWidget::DefaultDockWidgetFeatures;
|
||||||
CDockManager* DockManager = nullptr;
|
QPointer<CDockManager> DockManager;
|
||||||
CDockAreaWidget* DockArea = nullptr;
|
QPointer<CDockAreaWidget> DockArea;
|
||||||
QAction* ToggleViewAction = nullptr;
|
QAction* ToggleViewAction = nullptr;
|
||||||
bool Closed = false;
|
bool Closed = false;
|
||||||
QScrollArea* ScrollArea = nullptr;
|
QScrollArea* ScrollArea = nullptr;
|
||||||
@@ -96,12 +96,21 @@ struct DockWidgetPrivate
|
|||||||
WidgetFactory* Factory = nullptr;
|
WidgetFactory* Factory = nullptr;
|
||||||
QPointer<CAutoHideTab> SideTabWidget;
|
QPointer<CAutoHideTab> SideTabWidget;
|
||||||
CDockWidget::eToolBarStyleSource ToolBarStyleSource = CDockWidget::ToolBarStyleFromDockManager;
|
CDockWidget::eToolBarStyleSource ToolBarStyleSource = CDockWidget::ToolBarStyleFromDockManager;
|
||||||
|
SideBarLocation PreferredAutoHideSideBarLocation = SideBarNone;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Private data constructor
|
* Private data constructor
|
||||||
*/
|
*/
|
||||||
DockWidgetPrivate(CDockWidget* _public);
|
DockWidgetPrivate(CDockWidget* _public);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convenience function to ease components factory access
|
||||||
|
*/
|
||||||
|
QSharedPointer<ads::CDockComponentsFactory> componentsFactory() const
|
||||||
|
{
|
||||||
|
return DockManager ? DockManager->componentsFactory() : CDockComponentsFactory::factory();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show dock widget
|
* Show dock widget
|
||||||
*/
|
*/
|
||||||
@@ -271,7 +280,10 @@ void DockWidgetPrivate::closeAutoHideDockWidgetsIfNeeded()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!DockContainer->openedDockWidgets().isEmpty())
|
// If the dock container is the dock manager, or if it is not empty, then we
|
||||||
|
// don't need to do anything
|
||||||
|
if ((DockContainer == _this->dockManager())
|
||||||
|
|| !DockContainer->openedDockWidgets().isEmpty())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -355,9 +367,17 @@ void DockWidgetPrivate::setToolBarStyleFromDockManager()
|
|||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
CDockWidget::CDockWidget(const QString &title, QWidget *parent) :
|
CDockWidget::CDockWidget(const QString &title, QWidget *parent) :
|
||||||
QFrame(parent),
|
CDockWidget(nullptr, title, parent)
|
||||||
d(new DockWidgetPrivate(this))
|
|
||||||
{
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
CDockWidget::CDockWidget(CDockManager *manager, const QString &title, QWidget* parent)
|
||||||
|
: QFrame(parent),
|
||||||
|
d(new DockWidgetPrivate(this))
|
||||||
|
{
|
||||||
|
d->DockManager = manager;
|
||||||
d->Layout = new QBoxLayout(QBoxLayout::TopToBottom);
|
d->Layout = new QBoxLayout(QBoxLayout::TopToBottom);
|
||||||
d->Layout->setContentsMargins(0, 0, 0, 0);
|
d->Layout->setContentsMargins(0, 0, 0, 0);
|
||||||
d->Layout->setSpacing(0);
|
d->Layout->setSpacing(0);
|
||||||
@@ -365,7 +385,7 @@ CDockWidget::CDockWidget(const QString &title, QWidget *parent) :
|
|||||||
setWindowTitle(title);
|
setWindowTitle(title);
|
||||||
setObjectName(title);
|
setObjectName(title);
|
||||||
|
|
||||||
d->TabWidget = componentsFactory()->createDockWidgetTab(this);
|
d->TabWidget = d->componentsFactory()->createDockWidgetTab(this);
|
||||||
|
|
||||||
d->ToggleViewAction = new QAction(title, this);
|
d->ToggleViewAction = new QAction(title, this);
|
||||||
d->ToggleViewAction->setCheckable(true);
|
d->ToggleViewAction->setCheckable(true);
|
||||||
@@ -377,12 +397,18 @@ CDockWidget::CDockWidget(const QString &title, QWidget *parent) :
|
|||||||
{
|
{
|
||||||
setFocusPolicy(Qt::ClickFocus);
|
setFocusPolicy(Qt::ClickFocus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (CDockManager::testConfigFlag(CDockManager::UseNativeWindows))
|
||||||
|
{
|
||||||
|
winId();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
CDockWidget::~CDockWidget()
|
CDockWidget::~CDockWidget()
|
||||||
{
|
{
|
||||||
ADS_PRINT("~CDockWidget()");
|
ADS_PRINT("~CDockWidget(): " << this->windowTitle());
|
||||||
delete d;
|
delete d;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -511,10 +537,19 @@ void CDockWidget::setFeatures(DockWidgetFeatures features)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
d->Features = features;
|
d->Features = features;
|
||||||
|
notifyFeaturesChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
void CDockWidget::notifyFeaturesChanged()
|
||||||
|
{
|
||||||
Q_EMIT featuresChanged(d->Features);
|
Q_EMIT featuresChanged(d->Features);
|
||||||
d->TabWidget->onDockWidgetFeaturesChanged();
|
d->TabWidget->onDockWidgetFeaturesChanged();
|
||||||
if(CDockAreaWidget* DockArea = dockAreaWidget())
|
if(CDockAreaWidget* DockArea = dockAreaWidget())
|
||||||
|
{
|
||||||
DockArea->onDockWidgetFeaturesChanged();
|
DockArea->onDockWidgetFeaturesChanged();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -530,7 +565,14 @@ void CDockWidget::setFeature(DockWidgetFeature flag, bool on)
|
|||||||
//============================================================================
|
//============================================================================
|
||||||
CDockWidget::DockWidgetFeatures CDockWidget::features() const
|
CDockWidget::DockWidgetFeatures CDockWidget::features() const
|
||||||
{
|
{
|
||||||
return d->Features;
|
if (d->DockManager)
|
||||||
|
{
|
||||||
|
return d->Features &~ d->DockManager->globallyLockedDockWidgetFeatures();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return d->Features;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -566,7 +608,7 @@ CDockContainerWidget* CDockWidget::dockContainer() const
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -613,6 +655,20 @@ SideBarLocation CDockWidget::autoHideLocation() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
void CDockWidget::setPreferredAutoHideSideBarLocation(SideBarLocation Location)
|
||||||
|
{
|
||||||
|
d->PreferredAutoHideSideBarLocation = Location;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
SideBarLocation CDockWidget::preferredAutoHideSideBarLocation() const
|
||||||
|
{
|
||||||
|
return d->PreferredAutoHideSideBarLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
bool CDockWidget::isFloating() const
|
bool CDockWidget::isFloating() const
|
||||||
{
|
{
|
||||||
@@ -805,9 +861,9 @@ void CDockWidget::saveState(QXmlStreamWriter& s) const
|
|||||||
void CDockWidget::flagAsUnassigned()
|
void CDockWidget::flagAsUnassigned()
|
||||||
{
|
{
|
||||||
d->Closed = true;
|
d->Closed = true;
|
||||||
setParent(d->DockManager);
|
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
setDockArea(nullptr);
|
setDockArea(nullptr);
|
||||||
|
setParent(d->DockManager);
|
||||||
tabWidget()->setParent(this);
|
tabWidget()->setParent(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -842,7 +898,7 @@ bool CDockWidget::event(QEvent *e)
|
|||||||
}
|
}
|
||||||
if (d->DockArea)
|
if (d->DockArea)
|
||||||
{
|
{
|
||||||
d->DockArea->markTitleBarMenuOutdated();//update tabs menu
|
d->DockArea->updateWindowTitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
auto FloatingWidget = floatingDockContainer();
|
auto FloatingWidget = floatingDockContainer();
|
||||||
@@ -1296,7 +1352,15 @@ void CDockWidget::setAutoHide(bool Enable, SideBarLocation Location, int TabInde
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto area = (SideBarNone == Location) ? DockArea->calculateSideTabBarArea() : Location;
|
auto area = Location;
|
||||||
|
if (SideBarNone == area && d->PreferredAutoHideSideBarLocation != SideBarNone)
|
||||||
|
{
|
||||||
|
area = d->PreferredAutoHideSideBarLocation;
|
||||||
|
}
|
||||||
|
else if (SideBarNone == area)
|
||||||
|
{
|
||||||
|
area = DockArea->calculateSideTabBarArea();
|
||||||
|
}
|
||||||
dockContainer()->createAndSetupAutoHideContainer(area, this, TabIndex);
|
dockContainer()->createAndSetupAutoHideContainer(area, this, TabIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -165,6 +165,7 @@ public:
|
|||||||
DefaultDockWidgetFeatures = DockWidgetClosable | DockWidgetMovable | DockWidgetFloatable | DockWidgetFocusable | DockWidgetPinnable,
|
DefaultDockWidgetFeatures = DockWidgetClosable | DockWidgetMovable | DockWidgetFloatable | DockWidgetFocusable | DockWidgetPinnable,
|
||||||
AllDockWidgetFeatures = DefaultDockWidgetFeatures | DockWidgetDeleteOnClose | CustomCloseHandling,
|
AllDockWidgetFeatures = DefaultDockWidgetFeatures | DockWidgetDeleteOnClose | CustomCloseHandling,
|
||||||
DockWidgetAlwaysCloseAndDelete = DockWidgetForceCloseWithArea | DockWidgetDeleteOnClose,
|
DockWidgetAlwaysCloseAndDelete = DockWidgetForceCloseWithArea | DockWidgetDeleteOnClose,
|
||||||
|
GloballyLockableFeatures = DockWidgetClosable | DockWidgetMovable | DockWidgetFloatable | DockWidgetPinnable,
|
||||||
NoDockWidgetFeatures = 0x000
|
NoDockWidgetFeatures = 0x000
|
||||||
};
|
};
|
||||||
Q_DECLARE_FLAGS(DockWidgetFeatures, DockWidgetFeature)
|
Q_DECLARE_FLAGS(DockWidgetFeatures, DockWidgetFeature)
|
||||||
@@ -255,13 +256,40 @@ public:
|
|||||||
* during runtime, you need to set a unique object name explicitly
|
* during runtime, you need to set a unique object name explicitly
|
||||||
* by calling setObjectName() after construction.
|
* by calling setObjectName() after construction.
|
||||||
* Use the layoutFlags to configure the layout of the dock widget.
|
* Use the layoutFlags to configure the layout of the dock widget.
|
||||||
|
* \note If you would like to use custom TabWidget implementations, you need
|
||||||
|
* to use the constructor with the CDockManager argument.
|
||||||
*/
|
*/
|
||||||
CDockWidget(const QString &title, QWidget* parent = 0);
|
Q_DECL_DEPRECATED explicit CDockWidget(const QString &title, QWidget* parent = nullptr);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This constructor creates a dock widget for the given dock manager with the
|
||||||
|
* provided title.
|
||||||
|
*
|
||||||
|
* @param manager Pointer to the dock manager that owns the dock widget.
|
||||||
|
* @param title The title is the text that is shown in the window title when
|
||||||
|
* the dock widget is floating and it is the title that is shown in the
|
||||||
|
* titlebar or the tab of this dock widget if it is tabified.
|
||||||
|
* @param parent Pointer to the parent widget, defaults to nullptr.
|
||||||
|
*
|
||||||
|
* @note The object name of the dock widget is also set to the title. The
|
||||||
|
* object name is required by the dock manager to properly save and restore
|
||||||
|
* the state of the dock widget. That means, the title needs to be unique. If
|
||||||
|
* the title is not unique or if you would like to change the title during
|
||||||
|
* runtime, you need to set a unique object name explicitly by calling
|
||||||
|
* setObjectName() after construction. Use the layoutFlags to configure the
|
||||||
|
* layout of the dock widget.
|
||||||
|
*
|
||||||
|
* @note this constructor is preferred over the two argument version, especially
|
||||||
|
* when custom factories are in use. Indeed, it will use the Dock Manager factory,
|
||||||
|
* and not the default factory. For this reason, the original constructor should
|
||||||
|
* be deprecated in favour of this version.
|
||||||
|
*/
|
||||||
|
CDockWidget(CDockManager *manager, const QString &title, QWidget* parent = nullptr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Virtual Destructor
|
* Virtual Destructor
|
||||||
*/
|
*/
|
||||||
virtual ~CDockWidget();
|
~CDockWidget() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* We return a fixed minimum size hint or the size hint of the content
|
* We return a fixed minimum size hint or the size hint of the content
|
||||||
@@ -336,6 +364,11 @@ public:
|
|||||||
*/
|
*/
|
||||||
DockWidgetFeatures features() const;
|
DockWidgetFeatures features() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Triggers notification of feature change signals and functions
|
||||||
|
*/
|
||||||
|
void notifyFeaturesChanged();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the dock manager that manages the dock widget or 0 if the widget
|
* Returns the dock manager that manages the dock widget or 0 if the widget
|
||||||
* has not been assigned to any dock manager yet
|
* has not been assigned to any dock manager yet
|
||||||
@@ -389,6 +422,22 @@ public:
|
|||||||
*/
|
*/
|
||||||
SideBarLocation autoHideLocation() const;
|
SideBarLocation autoHideLocation() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the preferred auto-hide sidebar location for this dock widget.
|
||||||
|
* When set to a value other than SideBarNone, the pin button will place
|
||||||
|
* this widget in the specified sidebar instead of using geometry-based
|
||||||
|
* detection. When unpinning, widgets with the same preferred location
|
||||||
|
* will be merged as tabs in the same dock area.
|
||||||
|
* Set to SideBarNone (default) to use the original geometry-based behavior.
|
||||||
|
*/
|
||||||
|
void setPreferredAutoHideSideBarLocation(SideBarLocation Location);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the preferred auto-hide sidebar location, or SideBarNone
|
||||||
|
* if no preference is set (geometry-based detection will be used).
|
||||||
|
*/
|
||||||
|
SideBarLocation preferredAutoHideSideBarLocation() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This property holds whether the dock widget is floating.
|
* This property holds whether the dock widget is floating.
|
||||||
* A dock widget is only floating, if it is the one and only widget inside
|
* A dock widget is only floating, if it is the one and only widget inside
|
||||||
|
|||||||
@@ -50,13 +50,11 @@
|
|||||||
#include "FloatingDockContainer.h"
|
#include "FloatingDockContainer.h"
|
||||||
#include "DockOverlay.h"
|
#include "DockOverlay.h"
|
||||||
#include "DockManager.h"
|
#include "DockManager.h"
|
||||||
#include "IconProvider.h"
|
|
||||||
#include "DockFocusController.h"
|
#include "DockFocusController.h"
|
||||||
|
|
||||||
|
|
||||||
namespace ads
|
namespace ads
|
||||||
{
|
{
|
||||||
static const char* const LocationProperty = "Location";
|
|
||||||
using tTabLabel = CElidingLabel;
|
using tTabLabel = CElidingLabel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -171,7 +169,7 @@ struct DockWidgetTabPrivate
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto w = new CFloatingDragPreview(Widget);
|
auto w = new CFloatingDragPreview(Widget);
|
||||||
_this->connect(w, &CFloatingDragPreview::draggingCanceled, [=]()
|
_this->connect(w, &CFloatingDragPreview::draggingCanceled, [this]()
|
||||||
{
|
{
|
||||||
DragState = DraggingInactive;
|
DragState = DraggingInactive;
|
||||||
});
|
});
|
||||||
@@ -225,7 +223,7 @@ struct DockWidgetTabPrivate
|
|||||||
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, &CDockWidgetTab::onAutoHideToActionClicked);
|
QObject::connect(Action, &QAction::triggered, _this, &CDockWidgetTab::onAutoHideToActionClicked);
|
||||||
return Action;
|
return Action;
|
||||||
}
|
}
|
||||||
@@ -530,26 +528,35 @@ void CDockWidgetTab::contextMenuEvent(QContextMenuEvent* ev)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto Menu = buildContextMenu(nullptr);
|
||||||
d->saveDragStartMousePosition(ev->globalPos());
|
d->saveDragStartMousePosition(ev->globalPos());
|
||||||
|
Menu->exec(ev->globalPos());
|
||||||
|
}
|
||||||
|
|
||||||
|
QMenu* CDockWidgetTab::buildContextMenu(QMenu *Menu)
|
||||||
|
{
|
||||||
|
if (Menu == nullptr) {
|
||||||
|
Menu = new QMenu(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
ADS_PRINT("CDockWidgetTab::buildContextMenu");
|
||||||
const bool isFloatable = d->DockWidget->features().testFlag(CDockWidget::DockWidgetFloatable);
|
const bool isFloatable = d->DockWidget->features().testFlag(CDockWidget::DockWidgetFloatable);
|
||||||
const bool isNotOnlyTabInContainer = !d->DockArea->dockContainer()->hasTopLevelDockWidget();
|
|
||||||
const bool isTopLevelArea = d->DockArea->isTopLevelArea();
|
const bool isTopLevelArea = d->DockArea->isTopLevelArea();
|
||||||
const bool isDetachable = isFloatable && isNotOnlyTabInContainer;
|
const bool isFloating = d->DockWidget->isFloating();
|
||||||
|
const bool isDetachable = isFloatable && !isFloating;
|
||||||
QAction* Action;
|
QAction* Action;
|
||||||
QMenu Menu(this);
|
|
||||||
|
|
||||||
if (!isTopLevelArea)
|
if (!(isTopLevelArea && isFloating))
|
||||||
{
|
{
|
||||||
Action = Menu.addAction(tr("Detach"), this, SLOT(detachDockWidget()));
|
Action = Menu->addAction(tr("Detach"), this, SLOT(detachDockWidget()));
|
||||||
Action->setEnabled(isDetachable);
|
Action->setEnabled(isDetachable);
|
||||||
if (CDockManager::testAutoHideConfigFlag(CDockManager::AutoHideFeatureEnabled))
|
if (CDockManager::testAutoHideConfigFlag(CDockManager::AutoHideFeatureEnabled))
|
||||||
{
|
{
|
||||||
Action = Menu.addAction(tr("Pin"), this, SLOT(autoHideDockWidget()));
|
Action = Menu->addAction(tr("Pin"), this, SLOT(autoHideDockWidget()));
|
||||||
auto IsPinnable = d->DockWidget->features().testFlag(CDockWidget::DockWidgetPinnable);
|
auto IsPinnable = d->DockWidget->features().testFlag(CDockWidget::DockWidgetPinnable);
|
||||||
Action->setEnabled(IsPinnable);
|
Action->setEnabled(IsPinnable);
|
||||||
|
|
||||||
auto menu = Menu.addMenu(tr("Pin To..."));
|
auto menu = Menu->addMenu(tr("Pin To..."));
|
||||||
menu->setEnabled(IsPinnable);
|
menu->setEnabled(IsPinnable);
|
||||||
d->createAutoHideToAction(tr("Top"), SideBarTop, menu);
|
d->createAutoHideToAction(tr("Top"), SideBarTop, menu);
|
||||||
d->createAutoHideToAction(tr("Left"), SideBarLeft, menu);
|
d->createAutoHideToAction(tr("Left"), SideBarLeft, menu);
|
||||||
@@ -558,17 +565,16 @@ void CDockWidgetTab::contextMenuEvent(QContextMenuEvent* ev)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Menu.addSeparator();
|
Menu->addSeparator();
|
||||||
Action = Menu.addAction(tr("Close"), this, SIGNAL(closeRequested()));
|
Action = Menu->addAction(tr("Close"), this, SIGNAL(closeRequested()));
|
||||||
Action->setEnabled(isClosable());
|
Action->setEnabled(isClosable());
|
||||||
if (d->DockArea->openDockWidgetsCount() > 1)
|
if (d->DockArea->openDockWidgetsCount() > 1)
|
||||||
{
|
{
|
||||||
Action = Menu.addAction(tr("Close Others"), this, SIGNAL(closeOtherTabsRequested()));
|
Menu->addAction(tr("Close Others"), this, SIGNAL(closeOtherTabsRequested()));
|
||||||
}
|
}
|
||||||
Menu.exec(ev->globalPos());
|
|
||||||
|
return Menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
bool CDockWidgetTab::isActiveTab() const
|
bool CDockWidgetTab::isActiveTab() const
|
||||||
{
|
{
|
||||||
@@ -593,9 +599,9 @@ void CDockWidgetTab::setActiveTab(bool active)
|
|||||||
if (CDockManager::testConfigFlag(CDockManager::FocusHighlighting) && !d->DockWidget->dockManager()->isRestoringState())
|
if (CDockManager::testConfigFlag(CDockManager::FocusHighlighting) && !d->DockWidget->dockManager()->isRestoringState())
|
||||||
{
|
{
|
||||||
bool UpdateFocusStyle = false;
|
bool UpdateFocusStyle = false;
|
||||||
if (active && !hasFocus())
|
// Update the focus only, if this the dock area of this tab is the focused dock area
|
||||||
|
if (active && !hasFocus() && (d->focusController()->focusedDockArea() == this->dockAreaWidget()))
|
||||||
{
|
{
|
||||||
//setFocus(Qt::OtherFocusReason);
|
|
||||||
d->focusController()->setDockWidgetTabFocused(this);
|
d->focusController()->setDockWidgetTabFocused(this);
|
||||||
UpdateFocusStyle = true;
|
UpdateFocusStyle = true;
|
||||||
}
|
}
|
||||||
@@ -693,7 +699,7 @@ QString CDockWidgetTab::text() const
|
|||||||
//============================================================================
|
//============================================================================
|
||||||
void CDockWidgetTab::mouseDoubleClickEvent(QMouseEvent *event)
|
void CDockWidgetTab::mouseDoubleClickEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
if (event->button() == Qt::LeftButton)
|
if (event->button() == Qt::LeftButton && CDockManager::testConfigFlag(CDockManager::DoubleClickUndocksWidget))
|
||||||
{
|
{
|
||||||
// If this is the last dock area in a dock container it does not make
|
// 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
|
// sense to move it to a new floating widget and leave this one
|
||||||
@@ -764,7 +770,7 @@ void CDockWidgetTab::autoHideDockWidget()
|
|||||||
//===========================================================================
|
//===========================================================================
|
||||||
void CDockWidgetTab::onAutoHideToActionClicked()
|
void CDockWidgetTab::onAutoHideToActionClicked()
|
||||||
{
|
{
|
||||||
int Location = sender()->property(LocationProperty).toInt();
|
int Location = sender()->property(internal::LocationProperty).toInt();
|
||||||
d->DockWidget->toggleAutoHide((SideBarLocation)Location);
|
d->DockWidget->toggleAutoHide((SideBarLocation)Location);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -790,6 +796,13 @@ bool CDockWidgetTab::event(QEvent *e)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
eDragState CDockWidgetTab::dragState() const
|
||||||
|
{
|
||||||
|
return d->DragState;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
void CDockWidgetTab::onDockWidgetFeaturesChanged()
|
void CDockWidgetTab::onDockWidgetFeaturesChanged()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -35,6 +35,8 @@
|
|||||||
|
|
||||||
#include "ads_globals.h"
|
#include "ads_globals.h"
|
||||||
|
|
||||||
|
QT_FORWARD_DECLARE_CLASS(QMenu)
|
||||||
|
|
||||||
namespace ads
|
namespace ads
|
||||||
{
|
{
|
||||||
class CDockWidget;
|
class CDockWidget;
|
||||||
@@ -84,12 +86,12 @@ public:
|
|||||||
* param[in] DockWidget The dock widget this title bar belongs to
|
* param[in] DockWidget The dock widget this title bar belongs to
|
||||||
* param[in] parent The parent widget of this title bar
|
* param[in] parent The parent widget of this title bar
|
||||||
*/
|
*/
|
||||||
CDockWidgetTab(CDockWidget* DockWidget, QWidget* parent = 0);
|
CDockWidgetTab(CDockWidget* DockWidget, QWidget* parent = nullptr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Virtual Destructor
|
* Virtual Destructor
|
||||||
*/
|
*/
|
||||||
virtual ~CDockWidgetTab();
|
~CDockWidgetTab() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true, if this is the active tab
|
* Returns true, if this is the active tab
|
||||||
@@ -178,6 +180,26 @@ public:
|
|||||||
*/
|
*/
|
||||||
void setIconSize(const QSize& Size);
|
void setIconSize(const QSize& Size);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the current drag state of this tab.
|
||||||
|
* Use this function to determine if the tab is currently being dragged
|
||||||
|
*/
|
||||||
|
eDragState dragState() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fills the provided menu with standard entries. If a nullptr is passed, a
|
||||||
|
* new menu is created and filled with standard entries.
|
||||||
|
* This function is called from the actual version of contextMenuEvent, but
|
||||||
|
* can be called from any code. Caller is responsible of deleting the created
|
||||||
|
* object.
|
||||||
|
*
|
||||||
|
* @param menu The QMenu to fill with standard entries. If nullptr, a new
|
||||||
|
* QMenu will be created.
|
||||||
|
* @return The filled QMenu, either the provided one or a newly created one if
|
||||||
|
* nullptr was passed.
|
||||||
|
*/
|
||||||
|
virtual QMenu *buildContextMenu(QMenu *);
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
virtual void setVisible(bool visible) override;
|
virtual void setVisible(bool visible) override;
|
||||||
|
|
||||||
|
|||||||
@@ -58,8 +58,8 @@ protected:
|
|||||||
public:
|
public:
|
||||||
using Super = QLabel;
|
using Super = QLabel;
|
||||||
|
|
||||||
CElidingLabel(QWidget* parent = 0, Qt::WindowFlags f = Qt::WindowFlags ());
|
CElidingLabel(QWidget* parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags ());
|
||||||
CElidingLabel(const QString& text, QWidget* parent = 0, Qt::WindowFlags f = Qt::WindowFlags ());
|
CElidingLabel(const QString& text, QWidget* parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags ());
|
||||||
virtual ~CElidingLabel();
|
virtual ~CElidingLabel();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -357,7 +357,7 @@ static const char* windowsMessageString(int MessageId)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static unsigned int zOrderCounter = 0;
|
static unsigned int zOrderCounterFloating = 0;
|
||||||
/**
|
/**
|
||||||
* Private data class of CFloatingDockContainer class (pimpl)
|
* Private data class of CFloatingDockContainer class (pimpl)
|
||||||
*/
|
*/
|
||||||
@@ -365,7 +365,7 @@ struct FloatingDockContainerPrivate
|
|||||||
{
|
{
|
||||||
CFloatingDockContainer *_this;
|
CFloatingDockContainer *_this;
|
||||||
CDockContainerWidget *DockContainer;
|
CDockContainerWidget *DockContainer;
|
||||||
unsigned int zOrderIndex = ++zOrderCounter;
|
unsigned int zOrderIndex = ++zOrderCounterFloating;
|
||||||
QPointer<CDockManager> DockManager;
|
QPointer<CDockManager> DockManager;
|
||||||
eDragState DraggingState = DraggingInactive;
|
eDragState DraggingState = DraggingInactive;
|
||||||
QPoint DragStartMousePosition;
|
QPoint DragStartMousePosition;
|
||||||
@@ -374,6 +374,7 @@ struct FloatingDockContainerPrivate
|
|||||||
QPoint DragStartPos;
|
QPoint DragStartPos;
|
||||||
bool Hiding = false;
|
bool Hiding = false;
|
||||||
bool AutoHideChildren = true;
|
bool AutoHideChildren = true;
|
||||||
|
bool HideContentOnNextHide = false;
|
||||||
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
|
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
|
||||||
QWidget* MouseEventHandler = nullptr;
|
QWidget* MouseEventHandler = nullptr;
|
||||||
CFloatingWidgetTitleBar* TitleBar = nullptr;
|
CFloatingWidgetTitleBar* TitleBar = nullptr;
|
||||||
@@ -459,7 +460,7 @@ struct FloatingDockContainerPrivate
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_this->setWindowIcon(QApplication::windowIcon());
|
_this->setWindowIcon(CurrentWidget->windowIcon());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -499,6 +500,9 @@ void FloatingDockContainerPrivate::titleMouseReleaseEvent()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DockManager will be unlinked from this within DropContainer->dropFloatingWidget
|
||||||
|
const auto OriginalDockManager = this->DockManager.data();
|
||||||
|
|
||||||
if (DockManager->dockAreaOverlay()->dropAreaUnderCursor() != InvalidDockWidgetArea
|
if (DockManager->dockAreaOverlay()->dropAreaUnderCursor() != InvalidDockWidgetArea
|
||||||
|| DockManager->containerOverlay()->dropAreaUnderCursor() != InvalidDockWidgetArea)
|
|| DockManager->containerOverlay()->dropAreaUnderCursor() != InvalidDockWidgetArea)
|
||||||
{
|
{
|
||||||
@@ -532,8 +536,8 @@ void FloatingDockContainerPrivate::titleMouseReleaseEvent()
|
|||||||
DropContainer->dropFloatingWidget(_this, QCursor::pos());
|
DropContainer->dropFloatingWidget(_this, QCursor::pos());
|
||||||
}
|
}
|
||||||
|
|
||||||
DockManager->containerOverlay()->hideOverlay();
|
OriginalDockManager->containerOverlay()->hideOverlay();
|
||||||
DockManager->dockAreaOverlay()->hideOverlay();
|
OriginalDockManager->dockAreaOverlay()->hideOverlay();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -728,6 +732,11 @@ CFloatingDockContainer::CFloatingDockContainer(CDockManager *DockManager) :
|
|||||||
l->addWidget(d->DockContainer);
|
l->addWidget(d->DockContainer);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (CDockManager::testConfigFlag(CDockManager::UseNativeWindows))
|
||||||
|
{
|
||||||
|
winId();
|
||||||
|
}
|
||||||
|
|
||||||
DockManager->registerFloatingWidget(this);
|
DockManager->registerFloatingWidget(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -760,6 +769,7 @@ CFloatingDockContainer::CFloatingDockContainer(CDockWidget *DockWidget) :
|
|||||||
d->DockManager->notifyWidgetOrAreaRelocation(DockWidget);
|
d->DockManager->notifyWidgetOrAreaRelocation(DockWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
CFloatingDockContainer::~CFloatingDockContainer()
|
CFloatingDockContainer::~CFloatingDockContainer()
|
||||||
{
|
{
|
||||||
@@ -771,6 +781,36 @@ CFloatingDockContainer::~CFloatingDockContainer()
|
|||||||
delete d;
|
delete d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
void CFloatingDockContainer::deleteContent()
|
||||||
|
{
|
||||||
|
std::vector<QPointer<ads::CDockAreaWidget>> areas;
|
||||||
|
for (int i = 0; i != dockContainer()->dockAreaCount(); ++i)
|
||||||
|
{
|
||||||
|
areas.push_back( dockContainer()->dockArea(i) );
|
||||||
|
}
|
||||||
|
for (auto area : areas)
|
||||||
|
{
|
||||||
|
if (!area)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// QPointer delete safety - just in case some dock widget in destruction
|
||||||
|
// deletes another related/twin or child dock widget.
|
||||||
|
std::vector<QPointer<QWidget>> deleteWidgets;
|
||||||
|
for (auto widget : area->dockWidgets())
|
||||||
|
{
|
||||||
|
deleteWidgets.push_back(widget);
|
||||||
|
}
|
||||||
|
for (auto ptrWdg : deleteWidgets)
|
||||||
|
{
|
||||||
|
delete ptrWdg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
CDockContainerWidget* CFloatingDockContainer::dockContainer() const
|
CDockContainerWidget* CFloatingDockContainer::dockContainer() const
|
||||||
{
|
{
|
||||||
@@ -787,7 +827,7 @@ void CFloatingDockContainer::changeEvent(QEvent *event)
|
|||||||
if (isActiveWindow())
|
if (isActiveWindow())
|
||||||
{
|
{
|
||||||
ADS_PRINT("FloatingWidget::changeEvent QEvent::ActivationChange ");
|
ADS_PRINT("FloatingWidget::changeEvent QEvent::ActivationChange ");
|
||||||
d->zOrderIndex = ++zOrderCounter;
|
d->zOrderIndex = ++zOrderCounterFloating;
|
||||||
|
|
||||||
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
|
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
|
||||||
if (d->DraggingState == DraggingFloatingWidget)
|
if (d->DraggingState == DraggingFloatingWidget)
|
||||||
@@ -814,6 +854,12 @@ void CFloatingDockContainer::changeEvent(QEvent *event)
|
|||||||
this->showMaximized();
|
this->showMaximized();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
|
||||||
|
if (d->TitleBar)
|
||||||
|
{
|
||||||
|
d->TitleBar->setVisible(!(isFloating() && isFullScreen()));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -917,6 +963,15 @@ void CFloatingDockContainer::closeEvent(QCloseEvent *event)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// New bug (QWebEngineView reload side effect):
|
||||||
|
// when a WebEngine-based dock is tabified into a floating container, the
|
||||||
|
// embedded native/web process can trigger delayed hide/show cycles on the
|
||||||
|
// floating window. If every non-spontaneous hide propagates to
|
||||||
|
// DockWidget->toggleView(false), unrelated tabs are marked closed and seem
|
||||||
|
// to "disappear". We therefore arm HideContentOnNextHide only for the
|
||||||
|
// explicit close path.
|
||||||
|
d->HideContentOnNextHide = true;
|
||||||
|
|
||||||
// In Qt version after 5.9.2 there seems to be a bug that causes the
|
// In Qt version after 5.9.2 there seems to be a bug that causes the
|
||||||
// QWidget::event() function to not receive any NonClientArea mouse
|
// QWidget::event() function to not receive any NonClientArea mouse
|
||||||
// events anymore after a close/show cycle. The bug is reported here:
|
// events anymore after a close/show cycle. The bug is reported here:
|
||||||
@@ -944,6 +999,15 @@ void CFloatingDockContainer::hideEvent(QHideEvent *event)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Only a close operation should propagate hide->toggleView(false) to
|
||||||
|
// child dock widgets. Generic hide/show cycles (e.g. from platform or
|
||||||
|
// embedded native content) must not change dock open/closed state.
|
||||||
|
if (!d->HideContentOnNextHide)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
d->HideContentOnNextHide = false;
|
||||||
|
|
||||||
if ( d->AutoHideChildren )
|
if ( d->AutoHideChildren )
|
||||||
{
|
{
|
||||||
d->Hiding = true;
|
d->Hiding = true;
|
||||||
@@ -1142,7 +1206,7 @@ QList<CDockWidget*> CFloatingDockContainer::dockWidgets() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
void CFloatingDockContainer::hideAndDeleteLater()
|
void CFloatingDockContainer::finishDropOperation()
|
||||||
{
|
{
|
||||||
// Widget has been redocked, so it must be hidden right way (see
|
// Widget has been redocked, so it must be hidden right way (see
|
||||||
// https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/issues/351)
|
// https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/issues/351)
|
||||||
@@ -1150,12 +1214,18 @@ void CFloatingDockContainer::hideAndDeleteLater()
|
|||||||
// dock widgets that shall not be toggled hidden.
|
// dock widgets that shall not be toggled hidden.
|
||||||
d->AutoHideChildren = false;
|
d->AutoHideChildren = false;
|
||||||
hide();
|
hide();
|
||||||
|
// The floating widget will be deleted now. Ensure, that the destructor
|
||||||
|
// of the floating widget does not delete any dock areas that have been
|
||||||
|
// moved to a new container - simply remove all dock areas before deleting
|
||||||
|
// the floating widget
|
||||||
|
d->DockContainer->removeAllDockAreas();
|
||||||
deleteLater();
|
deleteLater();
|
||||||
if (d->DockManager)
|
if (d->DockManager)
|
||||||
{
|
{
|
||||||
d->DockManager->removeFloatingWidget(this);
|
d->DockManager->removeFloatingWidget(this);
|
||||||
d->DockManager->removeDockContainer(this->dockContainer());
|
d->DockManager.clear();
|
||||||
}
|
}
|
||||||
|
this->dockContainer()->removeFromDockManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
@@ -1295,7 +1365,8 @@ void CFloatingDockContainer::onMaximizeRequest()
|
|||||||
//============================================================================
|
//============================================================================
|
||||||
void CFloatingDockContainer::showNormal(bool fixGeometry)
|
void CFloatingDockContainer::showNormal(bool fixGeometry)
|
||||||
{
|
{
|
||||||
if (windowState() == Qt::WindowMaximized)
|
if ( (windowState() & Qt::WindowMaximized) != 0 ||
|
||||||
|
(windowState() & Qt::WindowFullScreen) != 0)
|
||||||
{
|
{
|
||||||
QRect oldNormal = normalGeometry();
|
QRect oldNormal = normalGeometry();
|
||||||
Super::showNormal();
|
Super::showNormal();
|
||||||
|
|||||||
@@ -131,21 +131,19 @@ protected:
|
|||||||
virtual void startFloating(const QPoint& DragStartMousePos, const QSize& Size,
|
virtual void startFloating(const QPoint& DragStartMousePos, const QSize& Size,
|
||||||
eDragState DragState, QWidget* MouseEventHandler) override;
|
eDragState DragState, QWidget* MouseEventHandler) override;
|
||||||
|
|
||||||
/**
|
|
||||||
* Call this function to start dragging the floating widget
|
|
||||||
*/
|
|
||||||
void startDragging(const QPoint& DragStartMousePos, const QSize& Size,
|
|
||||||
QWidget* MouseEventHandler)
|
|
||||||
{
|
|
||||||
startFloating(DragStartMousePos, Size, DraggingFloatingWidget, MouseEventHandler);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call this function if you explicitly want to signal that dragging has
|
* Call this function if you explicitly want to signal that dragging has
|
||||||
* finished
|
* finished
|
||||||
*/
|
*/
|
||||||
virtual void finishDragging() override;
|
virtual void finishDragging() override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function deletes all dock widgets in it.
|
||||||
|
* This functions should be called only from dock manager in its
|
||||||
|
* destructor before deleting the floating widget
|
||||||
|
*/
|
||||||
|
void deleteContent();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call this function if you just want to initialize the position
|
* Call this function if you just want to initialize the position
|
||||||
* and size of the floating widget
|
* and size of the floating widget
|
||||||
@@ -222,13 +220,22 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Virtual Destructor
|
* Virtual Destructor
|
||||||
*/
|
*/
|
||||||
virtual ~CFloatingDockContainer();
|
~CFloatingDockContainer() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Access function for the internal dock container
|
* Access function for the internal dock container
|
||||||
*/
|
*/
|
||||||
CDockContainerWidget* dockContainer() const;
|
CDockContainerWidget* dockContainer() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Call this function to start dragging the floating widget
|
||||||
|
*/
|
||||||
|
void startDragging(const QPoint& DragStartMousePos, const QSize& Size,
|
||||||
|
QWidget* MouseEventHandler)
|
||||||
|
{
|
||||||
|
startFloating(DragStartMousePos, Size, DraggingFloatingWidget, MouseEventHandler);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function returns true, if it can be closed.
|
* This function returns true, if it can be closed.
|
||||||
* It can be closed, if all dock widgets in all dock areas can be closed
|
* It can be closed, if all dock widgets in all dock areas can be closed
|
||||||
@@ -258,9 +265,9 @@ public:
|
|||||||
QList<CDockWidget*> dockWidgets() const;
|
QList<CDockWidget*> dockWidgets() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function hides the floating bar instantely and delete it later.
|
* This function hides the floating widget instantly and delete it later.
|
||||||
*/
|
*/
|
||||||
void hideAndDeleteLater();
|
void finishDropOperation();
|
||||||
|
|
||||||
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
|
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ xcb_atom_t xcb_get_atom(const char *name)
|
|||||||
}
|
}
|
||||||
xcb_connection_t *connection = x11_connection();
|
xcb_connection_t *connection = x11_connection();
|
||||||
xcb_intern_atom_cookie_t request = xcb_intern_atom(connection, 1, strlen(name), name);
|
xcb_intern_atom_cookie_t request = xcb_intern_atom(connection, 1, strlen(name), name);
|
||||||
xcb_intern_atom_reply_t *reply = xcb_intern_atom_reply(connection, request, NULL);
|
xcb_intern_atom_reply_t *reply = xcb_intern_atom_reply(connection, request, nullptr);
|
||||||
if (!reply)
|
if (!reply)
|
||||||
{
|
{
|
||||||
return XCB_ATOM_NONE;
|
return XCB_ATOM_NONE;
|
||||||
@@ -283,7 +283,7 @@ QString detectWindowManagerX11()
|
|||||||
}
|
}
|
||||||
if(sup_windows.length() == 0)
|
if(sup_windows.length() == 0)
|
||||||
{
|
{
|
||||||
ADS_PRINT("Failed to get the supporting window on non EWMH comform WM.");
|
ADS_PRINT("Failed to get the supporting window on non EWMH conform WM.");
|
||||||
return "UNKNOWN";
|
return "UNKNOWN";
|
||||||
}
|
}
|
||||||
support_win = sup_windows[0];
|
support_win = sup_windows[0];
|
||||||
|
|||||||