Compare commits
365 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ab4869a0e1 | ||
|
|
adf5793ccd | ||
|
|
31e26c2c1c | ||
|
|
de05ddd203 | ||
|
|
03a8eaa44f | ||
|
|
48e79f12a7 | ||
|
|
89aa3d5251 | ||
|
|
87b0596ebc | ||
|
|
a08857804a | ||
|
|
dbca6d79cf | ||
|
|
a24221c002 | ||
|
|
5f89dd0465 | ||
|
|
0b82ff30fe | ||
|
|
130b0de646 | ||
|
|
b5b251dffb | ||
|
|
0c44accb44 | ||
|
|
bbdf0ef29d | ||
|
|
401e8cf492 | ||
|
|
83cdc69fc8 | ||
|
|
1e3af06bb0 | ||
|
|
2c8abee668 | ||
|
|
5af7492b67 | ||
|
|
8d1465a81f | ||
|
|
5ead4684f5 | ||
|
|
fc91502162 | ||
|
|
3a99bdcfb4 | ||
|
|
487e23e190 | ||
|
|
511132ee4f | ||
|
|
edc89555bc | ||
|
|
ad30211dae | ||
|
|
48406da6ea | ||
|
|
aff0bd6e25 | ||
|
|
3969d28d92 | ||
|
|
b39cd2d81b | ||
|
|
0e8e563654 | ||
|
|
2f041a0eed | ||
|
|
ffa0105d3e | ||
|
|
6179832a2b | ||
|
|
13853573ea | ||
|
|
b6b4c626e8 | ||
|
|
bd41ec1627 | ||
|
|
b54dab7df2 | ||
|
|
e66ef604a7 | ||
|
|
e03674fd4b | ||
|
|
3f69fedd1f | ||
|
|
a614e3cc3d | ||
|
|
ebde50b492 | ||
|
|
2a6bd306cb | ||
|
|
8a27a5596b | ||
|
|
f835ffd978 | ||
|
|
97215705f5 | ||
|
|
6ee97e64d7 | ||
|
|
a1c4812619 | ||
|
|
b0c8edbd82 | ||
|
|
a4190ecbf0 | ||
|
|
d8c6efaada | ||
|
|
0312682e07 | ||
|
|
8d14068df7 | ||
|
|
fe1d9a493f | ||
|
|
e55ad49db8 | ||
|
|
018ce2001e | ||
|
|
c8fe4c46dd | ||
|
|
1781fa671d | ||
|
|
75910e910e | ||
|
|
899e06be1c | ||
|
|
66687dc8b6 | ||
|
|
b8fe620276 | ||
|
|
1a50ea9892 | ||
|
|
0a096869fe | ||
|
|
44dc76bd19 | ||
|
|
aedbaec497 | ||
|
|
04aa622111 | ||
|
|
3564229482 | ||
|
|
637db7f4f9 | ||
|
|
f6d3d6d34a | ||
|
|
92369bdb26 | ||
|
|
8f95447108 | ||
|
|
0e3c3bab45 | ||
|
|
3a5c965306 | ||
|
|
0c88457037 | ||
|
|
46fa22dc6a | ||
|
|
f3d32399e5 | ||
|
|
b320bb17d1 | ||
|
|
81afe2d3cb | ||
|
|
5fad43377b | ||
|
|
f543318232 | ||
|
|
ab385a782a | ||
|
|
c370875128 | ||
|
|
1c261515db | ||
|
|
37cbae84ca | ||
|
|
f5759716b4 | ||
|
|
f645fe725a | ||
|
|
fdedd7d92a | ||
|
|
044a43d793 | ||
|
|
6846c96146 | ||
|
|
8fe9461872 | ||
|
|
fbde4edcd2 | ||
|
|
68742681f7 | ||
|
|
bbb3f99bc3 | ||
|
|
e0f6f3013f | ||
|
|
6eb497fb64 | ||
|
|
ae15757765 | ||
|
|
be294b4867 | ||
|
|
70738f7549 | ||
|
|
42dc529ce1 | ||
|
|
65058d3a48 | ||
|
|
48c4106b7f | ||
|
|
175b48569f | ||
|
|
89c6abb5ce | ||
|
|
55f23799bc | ||
|
|
646211cc4c | ||
|
|
423bab9954 | ||
|
|
831d90ebf5 | ||
|
|
abdc0dc0dd | ||
|
|
175c836c93 | ||
|
|
76304172ab | ||
|
|
0eb3978aee | ||
|
|
73f42d55ca | ||
|
|
059a055483 | ||
|
|
dcf1ee393e | ||
|
|
04aecb3693 | ||
|
|
533d174abc | ||
|
|
48fb999bd0 | ||
|
|
5443e5f998 | ||
|
|
543d226ba3 | ||
|
|
03b1848b43 | ||
|
|
05ab8d2067 | ||
|
|
c28a27c81c | ||
|
|
1b42048135 | ||
|
|
bfe6b9bd26 | ||
|
|
08a8cee1c6 | ||
|
|
835a532e75 | ||
|
|
d383ade03c | ||
|
|
6d9c4cee02 | ||
|
|
a565239c4a | ||
|
|
ba69f3e6b9 | ||
|
|
14c29f695c | ||
|
|
703a9b3e12 | ||
|
|
0eca1b0433 | ||
|
|
691c9683ce | ||
|
|
1a11e5ddcd | ||
|
|
a4d281dbb6 | ||
|
|
8361f90dce | ||
|
|
04b4ff8b4b | ||
|
|
121248c3c5 | ||
|
|
c44d0c87e3 | ||
|
|
c6cf9487ba | ||
|
|
c78cc17730 | ||
|
|
81a0234b05 | ||
|
|
f72a8568c5 | ||
|
|
11aec65967 | ||
|
|
40636d1e05 | ||
|
|
75841415a3 | ||
|
|
edc799bc54 | ||
|
|
1d0b20337f | ||
|
|
4a6d2d3514 | ||
|
|
8443414ae3 | ||
|
|
81c99745d4 | ||
|
|
d6831caea4 | ||
|
|
aa25e1fd56 | ||
|
|
0459aff34f | ||
|
|
aeb0a27401 | ||
|
|
50e3ef3dd8 | ||
|
|
9974256d71 | ||
|
|
8cf4134125 | ||
|
|
ef5b22c616 | ||
|
|
42161c807a | ||
|
|
acfc96f57c | ||
|
|
e6e83d5775 | ||
|
|
5b2bc2297b | ||
|
|
2de3e7e3be | ||
|
|
0d242297ff | ||
|
|
e2080b5cfc | ||
|
|
679fa81f6d | ||
|
|
6d0f14e1a5 | ||
|
|
281127c2c3 | ||
|
|
8e621f1f20 | ||
|
|
0948f73bf8 | ||
|
|
4bc1a18db2 | ||
|
|
80eb628ea3 | ||
|
|
d811915a0c | ||
|
|
0225563b46 | ||
|
|
da20405a6a | ||
|
|
ace6d69695 | ||
|
|
7baf0f90e8 | ||
|
|
2ad92ce958 | ||
|
|
50c4a8ed48 | ||
|
|
59d6a64098 | ||
|
|
3de877fe56 | ||
|
|
e2cebd9dcf | ||
|
|
58744408f0 | ||
|
|
e36655a7ab | ||
|
|
ffed6a9c5f | ||
|
|
38d8e6aa25 | ||
|
|
c109ef836a | ||
|
|
caa1a9f330 | ||
|
|
e71884b23d | ||
|
|
d04c386948 | ||
|
|
6a25de327c | ||
|
|
e63d1b1683 | ||
|
|
fa2ab356e1 | ||
|
|
80f92e5697 | ||
|
|
0c13402516 | ||
|
|
97e3d72566 | ||
|
|
682aaf66eb | ||
|
|
c939df73fa | ||
|
|
fdf169ce9a | ||
|
|
4b730a4949 | ||
|
|
788c357cc0 | ||
|
|
e3844b8d6c | ||
|
|
ff3fcdcacd | ||
|
|
a9268e6bf7 | ||
|
|
0227bd1786 | ||
|
|
227037e42a | ||
|
|
cd495a14ec | ||
|
|
312a8cf500 | ||
|
|
2fc8bbe9c9 | ||
|
|
f5c4b26aab | ||
|
|
c4d2d72e92 | ||
|
|
f90f0b0427 | ||
|
|
d360b4ced2 | ||
|
|
f074ea9d67 | ||
|
|
2e8137ad85 | ||
|
|
a65b1bdcaf | ||
|
|
4041aa72cc | ||
|
|
4d2de7bb2a | ||
|
|
bcb7118710 | ||
|
|
45390506dd | ||
|
|
f58a3d4401 | ||
|
|
a3e979a8ad | ||
|
|
adb72737e8 | ||
|
|
e626a7e302 | ||
|
|
8b6df4aaa5 | ||
|
|
ccf8ea9d1e | ||
|
|
dfb8543aee | ||
|
|
277e06627b | ||
|
|
ea9b39a9dd | ||
|
|
1848ffa35a | ||
|
|
c53be0e97d | ||
|
|
ae999f132e | ||
|
|
9aa958e8b0 | ||
|
|
5652c8440e | ||
|
|
26f4c9b049 | ||
|
|
ce11fa9d10 | ||
|
|
6a393955cd | ||
|
|
6b5f364864 | ||
|
|
333d2920db | ||
|
|
25eb02d07c | ||
|
|
3b2f940efa | ||
|
|
9dcbe91f02 | ||
|
|
4da810ba7c | ||
|
|
819f1effc5 | ||
|
|
ba94ef3493 | ||
|
|
36bcbded54 | ||
|
|
0127fd89a3 | ||
|
|
eee9ebb41d | ||
|
|
79cb889d83 | ||
|
|
cdb8926673 | ||
|
|
b3307d81ca | ||
|
|
40374178c9 | ||
|
|
516465aefb | ||
|
|
e760d3e967 | ||
|
|
c5333a2414 | ||
|
|
0d406ece7c | ||
|
|
7c03b1b936 | ||
|
|
427b5a0be0 | ||
|
|
3011c0c030 | ||
|
|
b8b6db632c | ||
|
|
04ca4ae674 | ||
|
|
3a0c2a3113 | ||
|
|
789f78354a | ||
|
|
14f5426299 | ||
|
|
d418d92ef4 | ||
|
|
726d73b2c2 | ||
|
|
115e67edc4 | ||
|
|
4a8b5dd7ab | ||
|
|
4c75168152 | ||
|
|
64a2024513 | ||
|
|
056e1ef947 | ||
|
|
a9965bf6dc | ||
|
|
f54869fbf7 | ||
|
|
835a20f03f | ||
|
|
aa7976dac6 | ||
|
|
067338ef23 | ||
|
|
b7e7c0ccc3 | ||
|
|
cb18bc0d91 | ||
|
|
07464ce05c | ||
|
|
62ce9dca5d | ||
|
|
985d164cd1 | ||
|
|
0c9a1ee3f2 | ||
|
|
0bd20883df | ||
|
|
1d8a1e9bb8 | ||
|
|
3adabaec81 | ||
|
|
5695d0d305 | ||
|
|
f1792820e1 | ||
|
|
e091be0b76 | ||
|
|
e4c5eac146 | ||
|
|
cbd2fcb0d3 | ||
|
|
47029190dc | ||
|
|
80aee638c9 | ||
|
|
cdc863e962 | ||
|
|
ef855e3843 | ||
|
|
842d417e8d | ||
|
|
52a64350e6 | ||
|
|
79831d482b | ||
|
|
a4fbaf413b | ||
|
|
b982947cf4 | ||
|
|
bc2ac48eab | ||
|
|
ddbdb83821 | ||
|
|
85626c9a21 | ||
|
|
8bf8309949 | ||
|
|
528f48e6d1 | ||
|
|
28dfcc2a62 | ||
|
|
0bfa2eb88e | ||
|
|
27bbe9f7f5 | ||
|
|
92dbcec7c0 | ||
|
|
2be2f2bc6f | ||
|
|
a083d778bd | ||
|
|
d4770a7d41 | ||
|
|
37365caf8e | ||
|
|
3f5bfc3139 | ||
|
|
4ac7291831 | ||
|
|
b5e9096387 | ||
|
|
19c8e9ffcc | ||
|
|
6a815a836c | ||
|
|
277d3fffe4 | ||
|
|
9502e7bf6c | ||
|
|
8aae6bf70b | ||
|
|
a668fe2f73 | ||
|
|
12bb7b73e9 | ||
|
|
dbf90a4233 | ||
|
|
19331ebe2b | ||
|
|
16a149b436 | ||
|
|
1f995299f0 | ||
|
|
7a17aba42d | ||
|
|
9fe1dd6a88 | ||
|
|
7c2d1891a2 | ||
|
|
998fe9fa11 | ||
|
|
28dc374fc2 | ||
|
|
1b6e449b4a | ||
|
|
0e88467f94 | ||
|
|
d0f4ce3248 | ||
|
|
542618fd4e | ||
|
|
661d0c4356 | ||
|
|
dceaa155c4 | ||
|
|
c541f2c69b | ||
|
|
37d305e50d | ||
|
|
4adef2b774 | ||
|
|
1c2383f8eb | ||
|
|
6c687d28de | ||
|
|
708add3ff5 | ||
|
|
e85b4167bd | ||
|
|
59c783831a | ||
|
|
4cb1931ace | ||
|
|
fe10b570d3 | ||
|
|
f3c5d51380 | ||
|
|
34cb2ae917 | ||
|
|
8cc9cc25ad | ||
|
|
c90fb9413c | ||
|
|
dec170ed24 | ||
|
|
3ffbbfb6d0 | ||
|
|
e8332575f8 | ||
|
|
8c12d912b4 | ||
|
|
fd28f0f751 | ||
|
|
3f09d5c6ea |
@@ -1,36 +1,28 @@
|
||||
version: '2.3.2.{build}'
|
||||
version: '{build}'
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
|
||||
image: Visual Studio 2015
|
||||
clone_depth: 1
|
||||
image: Visual Studio 2017
|
||||
|
||||
environment:
|
||||
global:
|
||||
# Appveyor doesn't have Qt 12 yet
|
||||
LatestLTSQtVersion: 5.9
|
||||
LatestQtVersion: 5.11
|
||||
LatestQtVersion: 5.13
|
||||
matrix:
|
||||
# Latest version of Qt, dll, 64bit, MSVC 2015, qmake
|
||||
- QT5: C:\Qt\%LatestQtVersion%\msvc2015_64
|
||||
COMPILER: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC
|
||||
targetPlatform: amd64
|
||||
use_mingw: "false"
|
||||
use_static: "false"
|
||||
use_cmake: "false"
|
||||
# 32 bit builds
|
||||
# MSVC 2015 builds
|
||||
# Dynamic Library builds
|
||||
# LTS version of Qt, dll, 32bit, MSVC 2015, qmake
|
||||
- QT5: C:\Qt\%LatestLTSQtVersion%\msvc2015
|
||||
COMPILER: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC
|
||||
- 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\%LatestLTSQtVersion%\msvc2015
|
||||
COMPILER: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC
|
||||
- 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"
|
||||
@@ -38,15 +30,15 @@ environment:
|
||||
# end Dynamic Library builds
|
||||
# Static Library builds
|
||||
# LTS version of Qt, static, 32bit, MSVC 2015, qmake
|
||||
- QT5: C:\Qt\%LatestLTSQtVersion%\msvc2015
|
||||
COMPILER: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC
|
||||
- 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\%LatestLTSQtVersion%\msvc2015
|
||||
COMPILER: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC
|
||||
- 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"
|
||||
@@ -56,15 +48,15 @@ environment:
|
||||
# MinGW builds
|
||||
# Dynamic Library builds
|
||||
# LTS version of Qt, dll, 32bit, MinGW, qmake
|
||||
- QT5: C:\Qt\%LatestLTSQtVersion%\mingw53_32
|
||||
COMPILER: C:\Qt\Tools\mingw530_32
|
||||
- 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\%LatestLTSQtVersion%\mingw53_32
|
||||
COMPILER: C:\Qt\Tools\mingw530_32
|
||||
- QT5: C:\Qt\%LatestQtVersion%\mingw73_32
|
||||
COMPILER: C:\Qt\Tools\mingw730_32
|
||||
targetPlatform: x86
|
||||
use_mingw: "true"
|
||||
use_static: "false"
|
||||
@@ -72,15 +64,15 @@ environment:
|
||||
# end Dynamic Library builds
|
||||
# Static Library builds
|
||||
# LTS version of Qt, static, 32bit, MinGW, qmake
|
||||
- QT5: C:\Qt\%LatestLTSQtVersion%\mingw53_32
|
||||
COMPILER: C:\Qt\Tools\mingw530_32
|
||||
- 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\%LatestLTSQtVersion%\mingw53_32
|
||||
COMPILER: C:\Qt\Tools\mingw530_32
|
||||
- QT5: C:\Qt\%LatestQtVersion%\mingw73_32
|
||||
COMPILER: C:\Qt\Tools\mingw730_32
|
||||
targetPlatform: x86
|
||||
use_mingw: "true"
|
||||
use_static: "true"
|
||||
@@ -92,15 +84,15 @@ environment:
|
||||
# MSVC 2015 builds
|
||||
# Dynamic Library builds
|
||||
# LTS version of Qt, dll, 64bit, MSVC 2015, qmake
|
||||
- QT5: C:\Qt\%LatestLTSQtVersion%\msvc2015_64
|
||||
COMPILER: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC
|
||||
- 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\%LatestLTSQtVersion%\msvc2015_64
|
||||
COMPILER: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC
|
||||
- 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"
|
||||
@@ -108,15 +100,15 @@ environment:
|
||||
# end Dynamic Library builds
|
||||
# Static Library builds
|
||||
# LTS version of Qt, static, 64bit, MSVC 2015, qmake
|
||||
- QT5: C:\Qt\%LatestLTSQtVersion%\msvc2015_64
|
||||
COMPILER: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC
|
||||
- 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\%LatestLTSQtVersion%\msvc2015_64
|
||||
COMPILER: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC
|
||||
- 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"
|
||||
@@ -129,10 +121,9 @@ matrix:
|
||||
fast_finish: true
|
||||
|
||||
before_build:
|
||||
- set PATH=%COMPILER%\bin;%QT5%\bin;%PATH%
|
||||
- set originalWD=%CD%
|
||||
- call "%QT5%\bin\qtenv2.bat"
|
||||
- cd %originalWD%
|
||||
- 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")
|
||||
@@ -140,8 +131,8 @@ before_build:
|
||||
- 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 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 .
|
||||
|
||||
359
.cproject
@@ -1,359 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
|
||||
<storageModule moduleId="org.eclipse.cdt.core.settings">
|
||||
<cconfiguration id="cdt.managedbuild.toolchain.gnu.mingw.base.1119687795">
|
||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.toolchain.gnu.mingw.base.1119687795" moduleId="org.eclipse.cdt.core.settings" name="Default">
|
||||
<externalSettings/>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<configuration artifactName="${ProjName}" buildProperties="" description="" id="cdt.managedbuild.toolchain.gnu.mingw.base.1119687795" name="Default" parent="org.eclipse.cdt.build.core.emptycfg">
|
||||
<folderInfo id="cdt.managedbuild.toolchain.gnu.mingw.base.1119687795.1949777584" name="/" resourcePath="">
|
||||
<toolChain id="cdt.managedbuild.toolchain.gnu.mingw.base.88699815" name="MinGW GCC" superClass="cdt.managedbuild.toolchain.gnu.mingw.base">
|
||||
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.PE" id="cdt.managedbuild.target.gnu.platform.mingw.base.519267520" name="Debug Platform" osList="win32" superClass="cdt.managedbuild.target.gnu.platform.mingw.base"/>
|
||||
<builder id="cdt.managedbuild.toolchain.gnu.mingw.base.1119687795.1200539104" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
|
||||
<tool id="cdt.managedbuild.tool.gnu.assembler.mingw.base.1438677059" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.mingw.base">
|
||||
<option id="gnu.both.asm.option.include.paths.403127333" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/QtAdvancedDockingSystem/demo}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/QtAdvancedDockingSystem/src}""/>
|
||||
<listOptionValue builtIn="false" value=""${QTDIR}/include""/>
|
||||
<listOptionValue builtIn="false" value=""${QTDIR}/include/QtCore""/>
|
||||
<listOptionValue builtIn="false" value=""${QTDIR}/include/QtWidgets""/>
|
||||
</option>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.1249325593" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.archiver.mingw.base.933824900" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.mingw.base"/>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.base.1947822681" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.base">
|
||||
<option id="gnu.cpp.compiler.option.include.paths.349616932" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/QtAdvancedDockingSystem/src}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/QtAdvancedDockingSystem/demo}""/>
|
||||
<listOptionValue builtIn="false" value=""${QTDIR}/include""/>
|
||||
<listOptionValue builtIn="false" value=""${QTDIR}/include/QtCore""/>
|
||||
<listOptionValue builtIn="false" value=""${QTDIR}/include/QtWidgets""/>
|
||||
</option>
|
||||
<option id="gnu.cpp.compiler.option.preprocessor.def.56223209" name="Defined symbols (-D)" superClass="gnu.cpp.compiler.option.preprocessor.def" useByScannerDiscovery="false"/>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1318830536" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.c.compiler.mingw.base.389117097" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.mingw.base">
|
||||
<option id="gnu.c.compiler.option.include.paths.1871729602" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/QtAdvancedDockingSystem/demo}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/QtAdvancedDockingSystem/src}""/>
|
||||
<listOptionValue builtIn="false" value=""${QTDIR}/include""/>
|
||||
<listOptionValue builtIn="false" value=""${QTDIR}/include/QtCore""/>
|
||||
<listOptionValue builtIn="false" value=""${QTDIR}/include/QtWidgets""/>
|
||||
</option>
|
||||
<option id="gnu.c.compiler.option.preprocessor.def.symbols.806805509" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" useByScannerDiscovery="false"/>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1568363924" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.c.linker.mingw.base.1734874312" name="MinGW C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.mingw.base"/>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.mingw.base.985493173" name="MinGW C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.mingw.base">
|
||||
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.266071128" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
|
||||
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
|
||||
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
|
||||
</inputType>
|
||||
</tool>
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
</cconfiguration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<project id="QtAdvancedDockingSystem.null.1346550114" name="QtAdvancedDockingSystem"/>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
|
||||
<storageModule moduleId="refreshScope"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets">
|
||||
<buildTargets>
|
||||
<target name="Build all" path=" build" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>mingw32-make</buildCommand>
|
||||
<buildArguments>-j</buildArguments>
|
||||
<buildTarget>all</buildTarget>
|
||||
<stopOnError>false</stopOnError>
|
||||
<useDefaultCommand>false</useDefaultCommand>
|
||||
<runAllBuilders>false</runAllBuilders>
|
||||
</target>
|
||||
<target name="Clean" path=" build" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments/>
|
||||
<buildTarget>clean</buildTarget>
|
||||
<stopOnError>false</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>false</runAllBuilders>
|
||||
</target>
|
||||
<target name="Debug Build" path=" build" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>mingw32-make</buildCommand>
|
||||
<buildArguments>-j6</buildArguments>
|
||||
<buildTarget>debug</buildTarget>
|
||||
<stopOnError>false</stopOnError>
|
||||
<useDefaultCommand>false</useDefaultCommand>
|
||||
<runAllBuilders>false</runAllBuilders>
|
||||
</target>
|
||||
<target name="qmake" path=" build" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>qmake</buildCommand>
|
||||
<buildArguments>-recursive ../ads.pro</buildArguments>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>false</useDefaultCommand>
|
||||
<runAllBuilders>false</runAllBuilders>
|
||||
</target>
|
||||
<target name="Release Build" path=" build" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>mingw32-make</buildCommand>
|
||||
<buildArguments>-j4</buildArguments>
|
||||
<buildTarget>release</buildTarget>
|
||||
<stopOnError>false</stopOnError>
|
||||
<useDefaultCommand>false</useDefaultCommand>
|
||||
<runAllBuilders>false</runAllBuilders>
|
||||
</target>
|
||||
<target name="Build all" path=" build/src" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>mingw32-make</buildCommand>
|
||||
<buildArguments>-j</buildArguments>
|
||||
<buildTarget>all</buildTarget>
|
||||
<stopOnError>false</stopOnError>
|
||||
<useDefaultCommand>false</useDefaultCommand>
|
||||
<runAllBuilders>false</runAllBuilders>
|
||||
</target>
|
||||
<target name="Clean" path=" build/src" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildTarget>clean</buildTarget>
|
||||
<stopOnError>false</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>false</runAllBuilders>
|
||||
</target>
|
||||
<target name="Debug Build" path=" build/src" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>mingw32-make</buildCommand>
|
||||
<buildArguments>-j6</buildArguments>
|
||||
<buildTarget>debug</buildTarget>
|
||||
<stopOnError>false</stopOnError>
|
||||
<useDefaultCommand>false</useDefaultCommand>
|
||||
<runAllBuilders>false</runAllBuilders>
|
||||
</target>
|
||||
<target name="qmake" path=" build/src" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>qmake</buildCommand>
|
||||
<buildArguments>-recursive ../../src/src.pro</buildArguments>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>false</useDefaultCommand>
|
||||
<runAllBuilders>false</runAllBuilders>
|
||||
</target>
|
||||
<target name="Release Build" path=" build/src" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>mingw32-make</buildCommand>
|
||||
<buildArguments>-j4</buildArguments>
|
||||
<buildTarget>release</buildTarget>
|
||||
<stopOnError>false</stopOnError>
|
||||
<useDefaultCommand>false</useDefaultCommand>
|
||||
<runAllBuilders>false</runAllBuilders>
|
||||
</target>
|
||||
<target name="Build all" path=" build/example" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>mingw32-make</buildCommand>
|
||||
<buildArguments>-j</buildArguments>
|
||||
<buildTarget>all</buildTarget>
|
||||
<stopOnError>false</stopOnError>
|
||||
<useDefaultCommand>false</useDefaultCommand>
|
||||
<runAllBuilders>false</runAllBuilders>
|
||||
</target>
|
||||
<target name="Clean" path=" build/example" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments/>
|
||||
<buildTarget>clean</buildTarget>
|
||||
<stopOnError>false</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>false</runAllBuilders>
|
||||
</target>
|
||||
<target name="Debug Build" path=" build/example" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>mingw32-make</buildCommand>
|
||||
<buildArguments>-j6</buildArguments>
|
||||
<buildTarget>debug</buildTarget>
|
||||
<stopOnError>false</stopOnError>
|
||||
<useDefaultCommand>false</useDefaultCommand>
|
||||
<runAllBuilders>false</runAllBuilders>
|
||||
</target>
|
||||
<target name="qmake" path=" build/example" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>qmake</buildCommand>
|
||||
<buildArguments>-recursive ../../example/example.pro</buildArguments>
|
||||
<buildTarget/>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>false</useDefaultCommand>
|
||||
<runAllBuilders>false</runAllBuilders>
|
||||
</target>
|
||||
<target name="Release Build" path=" build/example" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>mingw32-make</buildCommand>
|
||||
<buildArguments>-j4</buildArguments>
|
||||
<buildTarget>release</buildTarget>
|
||||
<stopOnError>false</stopOnError>
|
||||
<useDefaultCommand>false</useDefaultCommand>
|
||||
<runAllBuilders>false</runAllBuilders>
|
||||
</target>
|
||||
<target name="Build all" path=" build/demo" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>mingw32-make</buildCommand>
|
||||
<buildArguments>-j</buildArguments>
|
||||
<buildTarget>all</buildTarget>
|
||||
<stopOnError>false</stopOnError>
|
||||
<useDefaultCommand>false</useDefaultCommand>
|
||||
<runAllBuilders>false</runAllBuilders>
|
||||
</target>
|
||||
<target name="Clean" path=" build/demo" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildTarget>clean</buildTarget>
|
||||
<stopOnError>false</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>false</runAllBuilders>
|
||||
</target>
|
||||
<target name="Debug Build" path=" build/demo" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>mingw32-make</buildCommand>
|
||||
<buildArguments>-j6</buildArguments>
|
||||
<buildTarget>debug</buildTarget>
|
||||
<stopOnError>false</stopOnError>
|
||||
<useDefaultCommand>false</useDefaultCommand>
|
||||
<runAllBuilders>false</runAllBuilders>
|
||||
</target>
|
||||
<target name="qmake" path=" build/demo" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>qmake</buildCommand>
|
||||
<buildArguments>-recursive ../../demo/demo.pro</buildArguments>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>false</useDefaultCommand>
|
||||
<runAllBuilders>false</runAllBuilders>
|
||||
</target>
|
||||
<target name="Release Build" path=" build/demo" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>mingw32-make</buildCommand>
|
||||
<buildArguments>-j4</buildArguments>
|
||||
<buildTarget>release</buildTarget>
|
||||
<stopOnError>false</stopOnError>
|
||||
<useDefaultCommand>false</useDefaultCommand>
|
||||
<runAllBuilders>false</runAllBuilders>
|
||||
</target>
|
||||
<target name="Build all" path=" build/AdvancedDockingSystemDemo" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>mingw32-make</buildCommand>
|
||||
<buildArguments>-j</buildArguments>
|
||||
<buildTarget>all</buildTarget>
|
||||
<stopOnError>false</stopOnError>
|
||||
<useDefaultCommand>false</useDefaultCommand>
|
||||
<runAllBuilders>false</runAllBuilders>
|
||||
</target>
|
||||
<target name="Clean" path=" build/AdvancedDockingSystemDemo" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments/>
|
||||
<buildTarget>clean</buildTarget>
|
||||
<stopOnError>false</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>false</runAllBuilders>
|
||||
</target>
|
||||
<target name="Debug Build" path=" build/AdvancedDockingSystemDemo" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>mingw32-make</buildCommand>
|
||||
<buildArguments>-j6</buildArguments>
|
||||
<buildTarget>debug</buildTarget>
|
||||
<stopOnError>false</stopOnError>
|
||||
<useDefaultCommand>false</useDefaultCommand>
|
||||
<runAllBuilders>false</runAllBuilders>
|
||||
</target>
|
||||
<target name="qmake" path=" build/AdvancedDockingSystemDemo" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>qmake</buildCommand>
|
||||
<buildArguments>-recursive ../../AdvancedDockingSystemDemo/AdvancedDockingSystemDemo.pro</buildArguments>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>false</useDefaultCommand>
|
||||
<runAllBuilders>false</runAllBuilders>
|
||||
</target>
|
||||
<target name="Release Build" path=" build/AdvancedDockingSystemDemo" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>mingw32-make</buildCommand>
|
||||
<buildArguments>-j4</buildArguments>
|
||||
<buildTarget>release</buildTarget>
|
||||
<stopOnError>false</stopOnError>
|
||||
<useDefaultCommand>false</useDefaultCommand>
|
||||
<runAllBuilders>false</runAllBuilders>
|
||||
</target>
|
||||
<target name="Build all" path=" build/AdvancedDockingSystemDemo_v2" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>mingw32-make</buildCommand>
|
||||
<buildArguments>-j</buildArguments>
|
||||
<buildTarget>all</buildTarget>
|
||||
<stopOnError>false</stopOnError>
|
||||
<useDefaultCommand>false</useDefaultCommand>
|
||||
<runAllBuilders>false</runAllBuilders>
|
||||
</target>
|
||||
<target name="Clean" path=" build/AdvancedDockingSystemDemo_v2" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments/>
|
||||
<buildTarget>clean</buildTarget>
|
||||
<stopOnError>false</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>false</runAllBuilders>
|
||||
</target>
|
||||
<target name="Debug Build" path=" build/AdvancedDockingSystemDemo_v2" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>mingw32-make</buildCommand>
|
||||
<buildArguments>-j6</buildArguments>
|
||||
<buildTarget>debug</buildTarget>
|
||||
<stopOnError>false</stopOnError>
|
||||
<useDefaultCommand>false</useDefaultCommand>
|
||||
<runAllBuilders>false</runAllBuilders>
|
||||
</target>
|
||||
<target name="qmake" path=" build/AdvancedDockingSystemDemo_v2" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>qmake</buildCommand>
|
||||
<buildArguments>-recursive ../../AdvancedDockingSystemDemo_v2/AdvancedDockingSystemDemo_v2.pro</buildArguments>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>false</useDefaultCommand>
|
||||
<runAllBuilders>false</runAllBuilders>
|
||||
</target>
|
||||
<target name="Release Build" path=" build/AdvancedDockingSystemDemo_v2" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>mingw32-make</buildCommand>
|
||||
<buildArguments>-j4</buildArguments>
|
||||
<buildTarget>release</buildTarget>
|
||||
<stopOnError>false</stopOnError>
|
||||
<useDefaultCommand>false</useDefaultCommand>
|
||||
<runAllBuilders>false</runAllBuilders>
|
||||
</target>
|
||||
<target name="Build all" path=" build/AdvancedDockingSystem" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>mingw32-make</buildCommand>
|
||||
<buildArguments>-j</buildArguments>
|
||||
<buildTarget>all</buildTarget>
|
||||
<stopOnError>false</stopOnError>
|
||||
<useDefaultCommand>false</useDefaultCommand>
|
||||
<runAllBuilders>false</runAllBuilders>
|
||||
</target>
|
||||
<target name="Clean" path=" build/AdvancedDockingSystem" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments/>
|
||||
<buildTarget>clean</buildTarget>
|
||||
<stopOnError>false</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>false</runAllBuilders>
|
||||
</target>
|
||||
<target name="Debug Build" path=" build/AdvancedDockingSystem" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>mingw32-make</buildCommand>
|
||||
<buildArguments>-j6</buildArguments>
|
||||
<buildTarget>debug</buildTarget>
|
||||
<stopOnError>false</stopOnError>
|
||||
<useDefaultCommand>false</useDefaultCommand>
|
||||
<runAllBuilders>false</runAllBuilders>
|
||||
</target>
|
||||
<target name="qmake" path=" build/AdvancedDockingSystem" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>qmake</buildCommand>
|
||||
<buildArguments>-recursive ../../AdvancedDockingSystem/src.pro</buildArguments>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>false</useDefaultCommand>
|
||||
<runAllBuilders>false</runAllBuilders>
|
||||
</target>
|
||||
<target name="Release Build" path=" build/AdvancedDockingSystem" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>mingw32-make</buildCommand>
|
||||
<buildArguments>-j4</buildArguments>
|
||||
<buildTarget>release</buildTarget>
|
||||
<stopOnError>false</stopOnError>
|
||||
<useDefaultCommand>false</useDefaultCommand>
|
||||
<runAllBuilders>false</runAllBuilders>
|
||||
</target>
|
||||
</buildTargets>
|
||||
</storageModule>
|
||||
<storageModule moduleId="scannerConfiguration">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.mingw.base.1119687795;cdt.managedbuild.toolchain.gnu.mingw.base.1119687795.1949777584;cdt.managedbuild.tool.gnu.cpp.compiler.mingw.base.1947822681;cdt.managedbuild.tool.gnu.cpp.compiler.input.1318830536">
|
||||
<autodiscovery enabled="false" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"/>
|
||||
</scannerConfigBuildInfo>
|
||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.mingw.base.1119687795;cdt.managedbuild.toolchain.gnu.mingw.base.1119687795.1949777584;cdt.managedbuild.tool.gnu.c.compiler.mingw.base.389117097;cdt.managedbuild.tool.gnu.c.compiler.input.1568363924">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||
</scannerConfigBuildInfo>
|
||||
</storageModule>
|
||||
</cproject>
|
||||
3
.github/workflows/linux-builds.yml
vendored
@@ -6,7 +6,7 @@ jobs:
|
||||
build:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, ubuntu-18.04, ubuntu-16.04]
|
||||
os: [ubuntu-latest, ubuntu-20.04, ubuntu-18.04]
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
@@ -16,6 +16,7 @@ jobs:
|
||||
run: |
|
||||
sudo apt-get update --fix-missing
|
||||
sudo apt-get install qt5-default
|
||||
sudo apt-get install qtbase5-private-dev
|
||||
- name: qmake
|
||||
run: qmake
|
||||
- name: make
|
||||
|
||||
367
.gitignore
vendored
@@ -17,3 +17,370 @@ Makefile
|
||||
*.pyd
|
||||
__pycache__
|
||||
PyQtAds/rc.py
|
||||
/.cproject
|
||||
|
||||
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
##
|
||||
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
||||
|
||||
# User-specific files
|
||||
*.rsuser
|
||||
*.suo
|
||||
*.user
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
|
||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||
*.userprefs
|
||||
|
||||
# Mono auto generated files
|
||||
mono_crash.*
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
x64/
|
||||
x86/
|
||||
[Ww][Ii][Nn]32/
|
||||
[Aa][Rr][Mm]/
|
||||
[Aa][Rr][Mm]64/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
[Ll]og/
|
||||
[Ll]ogs/
|
||||
|
||||
# Visual Studio 2015/2017 cache/options directory
|
||||
.vs/
|
||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||
#wwwroot/
|
||||
|
||||
# Visual Studio 2017 auto generated files
|
||||
Generated\ Files/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
# NUnit
|
||||
*.VisualState.xml
|
||||
TestResult.xml
|
||||
nunit-*.xml
|
||||
|
||||
# Build Results of an ATL Project
|
||||
[Dd]ebugPS/
|
||||
[Rr]eleasePS/
|
||||
dlldata.c
|
||||
|
||||
# Benchmark Results
|
||||
BenchmarkDotNet.Artifacts/
|
||||
|
||||
# .NET Core
|
||||
project.lock.json
|
||||
project.fragment.lock.json
|
||||
artifacts/
|
||||
|
||||
# ASP.NET Scaffolding
|
||||
ScaffoldingReadMe.txt
|
||||
|
||||
# StyleCop
|
||||
StyleCopReport.xml
|
||||
|
||||
# Files built by Visual Studio
|
||||
*_i.c
|
||||
*_p.c
|
||||
*_h.h
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.iobj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.ipdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*_wpftmp.csproj
|
||||
*.log
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.svclog
|
||||
*.scc
|
||||
|
||||
# Chutzpah Test files
|
||||
_Chutzpah*
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opendb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
*.VC.db
|
||||
*.VC.VC.opendb
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
*.sap
|
||||
|
||||
# Visual Studio Trace Files
|
||||
*.e2e
|
||||
|
||||
# TFS 2012 Local Workspace
|
||||
$tf/
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
*.DotSettings.user
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# AxoCover is a Code Coverage Tool
|
||||
.axoCover/*
|
||||
!.axoCover/settings.json
|
||||
|
||||
# Coverlet is a free, cross platform Code Coverage Tool
|
||||
coverage*[.json, .xml, .info]
|
||||
|
||||
# Visual Studio code coverage results
|
||||
*.coverage
|
||||
*.coveragexml
|
||||
|
||||
# NCrunch
|
||||
_NCrunch_*
|
||||
.*crunch*.local.xml
|
||||
nCrunchTemp_*
|
||||
|
||||
# MightyMoose
|
||||
*.mm.*
|
||||
AutoTest.Net/
|
||||
|
||||
# Web workbench (sass)
|
||||
.sass-cache/
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.[Pp]ublish.xml
|
||||
*.azurePubxml
|
||||
# Note: Comment the next line if you want to checkin your web deploy settings,
|
||||
# but database connection strings (with potential passwords) will be unencrypted
|
||||
*.pubxml
|
||||
*.publishproj
|
||||
|
||||
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||
# in these scripts will be unencrypted
|
||||
PublishScripts/
|
||||
|
||||
# NuGet Packages
|
||||
*.nupkg
|
||||
# NuGet Symbol Packages
|
||||
*.snupkg
|
||||
# The packages folder can be ignored because of Package Restore
|
||||
**/[Pp]ackages/*
|
||||
# except build/, which is used as an MSBuild target.
|
||||
!**/[Pp]ackages/build/
|
||||
# Uncomment if necessary however generally it will be regenerated when needed
|
||||
#!**/[Pp]ackages/repositories.config
|
||||
# NuGet v3's project.json files produces more ignorable files
|
||||
*.nuget.props
|
||||
*.nuget.targets
|
||||
|
||||
# Microsoft Azure Build Output
|
||||
csx/
|
||||
*.build.csdef
|
||||
|
||||
# Microsoft Azure Emulator
|
||||
ecf/
|
||||
rcf/
|
||||
|
||||
# Windows Store app package directories and files
|
||||
AppPackages/
|
||||
BundleArtifacts/
|
||||
Package.StoreAssociation.xml
|
||||
_pkginfo.txt
|
||||
*.appx
|
||||
*.appxbundle
|
||||
*.appxupload
|
||||
|
||||
# Visual Studio cache files
|
||||
# files ending in .cache can be ignored
|
||||
*.[Cc]ache
|
||||
# but keep track of directories ending in .cache
|
||||
!?*.[Cc]ache/
|
||||
|
||||
# Others
|
||||
ClientBin/
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.dbproj.schemaview
|
||||
*.jfm
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
orleans.codegen.cs
|
||||
|
||||
# Including strong name files can present a security risk
|
||||
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
||||
#*.snk
|
||||
|
||||
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||
#bower_components/
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file
|
||||
# to a newer Visual Studio version. Backup files are not needed,
|
||||
# because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
ServiceFabricBackup/
|
||||
*.rptproj.bak
|
||||
|
||||
# SQL Server files
|
||||
*.mdf
|
||||
*.ldf
|
||||
*.ndf
|
||||
|
||||
# Business Intelligence projects
|
||||
*.rdl.data
|
||||
*.bim.layout
|
||||
*.bim_*.settings
|
||||
*.rptproj.rsuser
|
||||
*- [Bb]ackup.rdl
|
||||
*- [Bb]ackup ([0-9]).rdl
|
||||
*- [Bb]ackup ([0-9][0-9]).rdl
|
||||
|
||||
# Microsoft Fakes
|
||||
FakesAssemblies/
|
||||
|
||||
# GhostDoc plugin setting file
|
||||
*.GhostDoc.xml
|
||||
|
||||
# Node.js Tools for Visual Studio
|
||||
.ntvs_analysis.dat
|
||||
node_modules/
|
||||
|
||||
# Visual Studio 6 build log
|
||||
*.plg
|
||||
|
||||
# Visual Studio 6 workspace options file
|
||||
*.opt
|
||||
|
||||
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
||||
*.vbw
|
||||
|
||||
# Visual Studio LightSwitch build output
|
||||
**/*.HTMLClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/ModelManifest.xml
|
||||
**/*.Server/GeneratedArtifacts
|
||||
**/*.Server/ModelManifest.xml
|
||||
_Pvt_Extensions
|
||||
|
||||
# Paket dependency manager
|
||||
.paket/paket.exe
|
||||
paket-files/
|
||||
|
||||
# FAKE - F# Make
|
||||
.fake/
|
||||
|
||||
# CodeRush personal settings
|
||||
.cr/personal
|
||||
|
||||
# Python Tools for Visual Studio (PTVS)
|
||||
__pycache__/
|
||||
*.pyc
|
||||
|
||||
# Cake - Uncomment if you are using it
|
||||
# tools/**
|
||||
# !tools/packages.config
|
||||
|
||||
# Tabs Studio
|
||||
*.tss
|
||||
|
||||
# Telerik's JustMock configuration file
|
||||
*.jmconfig
|
||||
|
||||
# BizTalk build output
|
||||
*.btp.cs
|
||||
*.btm.cs
|
||||
*.odx.cs
|
||||
*.xsd.cs
|
||||
|
||||
# OpenCover UI analysis results
|
||||
OpenCover/
|
||||
|
||||
# Azure Stream Analytics local run output
|
||||
ASALocalRun/
|
||||
|
||||
# MSBuild Binary and Structured Log
|
||||
*.binlog
|
||||
|
||||
# NVidia Nsight GPU debugger configuration file
|
||||
*.nvuser
|
||||
|
||||
# MFractors (Xamarin productivity tool) working folder
|
||||
.mfractor/
|
||||
|
||||
# Local History for Visual Studio
|
||||
.localhistory/
|
||||
|
||||
# BeatPulse healthcheck temp database
|
||||
healthchecksdb
|
||||
|
||||
# Backup folder for Package Reference Convert tool in Visual Studio 2017
|
||||
MigrationBackup/
|
||||
|
||||
# Ionide (cross platform F# VS Code tools) working folder
|
||||
.ionide/
|
||||
|
||||
# Fody - auto-generated XML schema
|
||||
FodyWeavers.xsd
|
||||
/ build
|
||||
/Settings.ini
|
||||
.vscode/settings.json
|
||||
/.settings
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<project>
|
||||
<configuration id="cdt.managedbuild.toolchain.gnu.mingw.base.1119687795" name="Default">
|
||||
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
|
||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetectorMinGW" ref="shared-provider"/>
|
||||
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
||||
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuildCommandParser" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser" keep-relative-paths="false" name="CDT GCC Build Output Parser" parameter="(g?cc)|([gc]\+\+)|(clang)" prefer-non-shared="true"/>
|
||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||
</extension>
|
||||
</configuration>
|
||||
</project>
|
||||
144
.travis.yml
@@ -2,9 +2,6 @@ language: cpp
|
||||
# gcc is clang on mac
|
||||
compiler: gcc
|
||||
|
||||
git:
|
||||
depth: 1
|
||||
|
||||
matrix:
|
||||
fast_finish: true
|
||||
include:
|
||||
@@ -21,74 +18,152 @@ matrix:
|
||||
packages:
|
||||
- qt55base
|
||||
- qt55tools
|
||||
- gcc-6
|
||||
- g++-6
|
||||
- libc6-i386
|
||||
- gcc-9
|
||||
- g++-9
|
||||
script:
|
||||
- PATH="/opt/qt55/bin:$PATH"
|
||||
- CXX="g++-6"
|
||||
- CC="gcc-6"
|
||||
- CXX="g++-9"
|
||||
- CC="gcc-9"
|
||||
- qt55-env.sh
|
||||
- qmake
|
||||
- make
|
||||
- make install
|
||||
- name: Ubuntu qmake dll
|
||||
os: linux
|
||||
dist: xenial
|
||||
dist: bionic
|
||||
group: stable
|
||||
services:
|
||||
- xvfb
|
||||
compiler: gcc
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- sourceline: 'ppa:beineri/opt-qt-5.12.0-xenial'
|
||||
- sourceline: 'ppa:beineri/opt-qt-5.14.2-bionic'
|
||||
update: true
|
||||
packages:
|
||||
- qt512base
|
||||
- qt512tools
|
||||
- gcc-6
|
||||
- g++-6
|
||||
- qt514base
|
||||
- qt514tools
|
||||
- gcc-9
|
||||
- g++-9
|
||||
- libc6-i386
|
||||
- libgl-dev
|
||||
- libgl1-mesa-dev
|
||||
- mesa-common-dev
|
||||
script:
|
||||
- PATH="/opt/qt512/bin:$PATH"
|
||||
- CXX="g++-6"
|
||||
- CC="gcc-6"
|
||||
- qt512-env.sh
|
||||
- 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: xenial
|
||||
dist: bionic
|
||||
group: stable
|
||||
addons:
|
||||
services:
|
||||
- xvfb
|
||||
compiler: gcc
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- sourceline: 'ppa:beineri/opt-qt-5.12.0-xenial'
|
||||
- sourceline: 'ppa:beineri/opt-qt-5.14.2-bionic'
|
||||
update: true
|
||||
packages:
|
||||
- qt512base
|
||||
- qt512tools
|
||||
- gcc-6
|
||||
- g++-6
|
||||
- qt514base
|
||||
- qt514tools
|
||||
- gcc-9
|
||||
- g++-9
|
||||
- libc6-i386
|
||||
- libgl-dev
|
||||
- libgl1-mesa-dev
|
||||
- mesa-common-dev
|
||||
script:
|
||||
- PATH="/opt/qt512/bin:$PATH"
|
||||
- CXX="g++-6"
|
||||
- CC="gcc-6"
|
||||
- qt512-env.sh
|
||||
- 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: xcode10.1
|
||||
osx_image: xcode11.3
|
||||
compiler: clang
|
||||
addons:
|
||||
homebrew:
|
||||
packages:
|
||||
@@ -107,7 +182,8 @@ matrix:
|
||||
- cmake --build . --target install
|
||||
- name: macOS CMake static
|
||||
os: osx
|
||||
osx_image: xcode10.1
|
||||
osx_image: xcode11.3
|
||||
compiler: clang
|
||||
addons:
|
||||
homebrew:
|
||||
packages:
|
||||
@@ -126,7 +202,8 @@ matrix:
|
||||
- cmake --build . --target install
|
||||
- name: macOS qmake dll
|
||||
os: osx
|
||||
osx_image: xcode10.1
|
||||
osx_image: xcode11.3
|
||||
compiler: clang
|
||||
addons:
|
||||
homebrew:
|
||||
packages:
|
||||
@@ -139,7 +216,8 @@ matrix:
|
||||
- make install
|
||||
- name: macOS qmake static
|
||||
os: osx
|
||||
osx_image: xcode10.1
|
||||
osx_image: xcode11.3
|
||||
compiler: clang
|
||||
addons:
|
||||
homebrew:
|
||||
packages:
|
||||
|
||||
129
CMakeLists.txt
@@ -1,129 +1,22 @@
|
||||
cmake_minimum_required(VERSION 3.3)
|
||||
set(ads_VERSION "2.3.2")
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
project(QtAdvancedDockingSystem VERSION ${ads_VERSION})
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH})
|
||||
include(GetGitRevisionDescription)
|
||||
git_describe(GitTagVersion --tags)
|
||||
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]+\\.([0-9]+).*" "\\1" VERSION_PATCH "${GitTagVersion}")
|
||||
set(VERSION_SHORT "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
|
||||
project(QtADS LANGUAGES CXX VERSION ${VERSION_SHORT})
|
||||
option(BUILD_STATIC "Build the static library" OFF)
|
||||
option(BUILD_EXAMPLES "Build the examples" ON)
|
||||
set(REQUIRED_QT_VERSION 5.5.0)
|
||||
find_package(Qt5Core ${REQUIRED_QT_VERSION} REQUIRED)
|
||||
find_package(Qt5Gui ${REQUIRED_QT_VERSION} REQUIRED)
|
||||
find_package(Qt5Widgets ${REQUIRED_QT_VERSION} REQUIRED)
|
||||
message(STATUS "Found Qt ${Qt5Core_VERSION}")
|
||||
set(ads_INCLUDE ${ads_INCLUDE} ${Qt5Core_INCLUDE_DIRS})
|
||||
set(ads_INCLUDE ${ads_INCLUDE} "${CMAKE_CURRENT_SOURCE_DIR}/src")
|
||||
set(ads_LIBS ${ads_LIBS} ${Qt5Core_LIBRARIES})
|
||||
set(ads_COMPILE_DEFINE ${ads_COMPILE_DEFINE} ${Qt5Core_COMPILE_DEFINITIONS})
|
||||
set(ads_LIBS ${ads_LIBS} ${Qt5Gui_LIBRARIES})
|
||||
set(ads_INCLUDE ${ads_INCLUDE} ${Qt5Gui_INCLUDE_DIRS})
|
||||
set(ads_COMPILE_DEFINE ${ads_COMPILE_DEFINE} ${Qt5Gui_COMPILE_DEFINITIONS})
|
||||
set(ads_LIBS ${ads_LIBS} ${Qt5Widgets_LIBRARIES})
|
||||
set(ads_INCLUDE ${ads_INCLUDE} ${Qt5Widgets_INCLUDE_DIRS})
|
||||
set(ads_COMPILE_DEFINE ${ads_COMPILE_DEFINE} ${Qt5Widgets_COMPILE_DEFINITIONS})
|
||||
if(BUILD_STATIC)
|
||||
set(CMAKE_STATIC_LIBRARY_SUFFIX "_static${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
||||
endif()
|
||||
set(ads_SRCS
|
||||
src/ads_globals.cpp
|
||||
src/DockAreaTabBar.cpp
|
||||
src/DockAreaTitleBar.cpp
|
||||
src/DockAreaWidget.cpp
|
||||
src/DockContainerWidget.cpp
|
||||
src/DockManager.cpp
|
||||
src/DockOverlay.cpp
|
||||
src/DockSplitter.cpp
|
||||
src/DockWidget.cpp
|
||||
src/DockWidgetTab.cpp
|
||||
src/DockingStateReader.cpp
|
||||
src/ElidingLabel.cpp
|
||||
src/FloatingDockContainer.cpp
|
||||
src/FloatingDragPreview.cpp
|
||||
src/IconProvider.cpp
|
||||
src/DockComponentsFactory.cpp
|
||||
src/ads.qrc
|
||||
src/linux/FloatingWidgetTitleBar.cpp
|
||||
)
|
||||
set(ads_INSTALL_INCLUDE
|
||||
src/ads_globals.h
|
||||
src/DockAreaTabBar.h
|
||||
src/DockAreaTitleBar.h
|
||||
src/DockAreaWidget.h
|
||||
src/DockContainerWidget.h
|
||||
src/DockManager.h
|
||||
src/DockOverlay.h
|
||||
src/DockSplitter.h
|
||||
src/DockWidget.h
|
||||
src/DockWidgetTab.h
|
||||
src/DockingStateReader.h
|
||||
src/ElidingLabel.h
|
||||
src/FloatingDockContainer.h
|
||||
src/FloatingDragPreview.h
|
||||
src/IconProvider.h
|
||||
src/DockComponentsFactory.h
|
||||
src/linux/FloatingWidgetTitleBar.h
|
||||
)
|
||||
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "4")
|
||||
set(ads_PlatformDir "x86")
|
||||
else()
|
||||
set(ads_PlatformDir "x64")
|
||||
endif()
|
||||
if(BUILD_STATIC)
|
||||
add_library(qtadvanceddocking STATIC ${ads_SRCS})
|
||||
target_compile_definitions(qtadvanceddocking PUBLIC ADS_STATIC)
|
||||
else()
|
||||
add_library(qtadvanceddocking SHARED ${ads_SRCS})
|
||||
set(ads_COMPILE_DEFINE ${ads_COMPILE_DEFINE} ADS_SHARED_EXPORT)
|
||||
endif()
|
||||
install(FILES ${ads_INSTALL_INCLUDE}
|
||||
DESTINATION include
|
||||
COMPONENT headers
|
||||
)
|
||||
install(FILES
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/LICENSE"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/gnu-lgpl-v2.1.md"
|
||||
DESTINATION license
|
||||
COMPONENT license
|
||||
)
|
||||
install(TARGETS qtadvanceddocking
|
||||
EXPORT adsTargets
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib
|
||||
INCLUDES DESTINATION include
|
||||
)
|
||||
|
||||
include(CMakePackageConfigHelpers)
|
||||
write_basic_package_version_file("adsConfigVersion.cmake"
|
||||
VERSION ${ads_VERSION}
|
||||
COMPATIBILITY SameMajorVersion
|
||||
)
|
||||
install(EXPORT adsTargets
|
||||
FILE adsTargets.cmake
|
||||
NAMESPACE ads::
|
||||
DESTINATION lib/cmake/ads
|
||||
)
|
||||
install(FILES "adsConfig.cmake" "${CMAKE_BINARY_DIR}/adsConfigVersion.cmake"
|
||||
DESTINATION lib/cmake/ads
|
||||
)
|
||||
|
||||
target_include_directories(qtadvanceddocking PUBLIC
|
||||
"$<BUILD_INTERFACE:${ads_INCLUDE}>"
|
||||
$<INSTALL_INTERFACE:include>
|
||||
)
|
||||
target_link_libraries(qtadvanceddocking PUBLIC ${ads_LIBS})
|
||||
target_compile_definitions(qtadvanceddocking PRIVATE ${ads_COMPILE_DEFINE})
|
||||
set_target_properties(qtadvanceddocking PROPERTIES
|
||||
VERSION ${ads_VERSION}
|
||||
EXPORT_NAME "QtAdvancedDockingSystem"
|
||||
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"
|
||||
)
|
||||
add_subdirectory(src)
|
||||
if(BUILD_EXAMPLES)
|
||||
add_subdirectory(example)
|
||||
add_subdirectory(examples)
|
||||
add_subdirectory(demo)
|
||||
endif()
|
||||
|
||||
|
||||
242
README.md
@@ -1,53 +1,87 @@
|
||||
# Advanced Docking System for Qt
|
||||
|
||||
[](https://travis-ci.org/githubuser0xFFFF/Qt-Advanced-Docking-System)
|
||||
[](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)
|
||||
[](gnu-lgpl-v2.1.md)
|
||||
|
||||
Qt Advanced Docking System lets you create customizable layouts using a full
|
||||
featured window docking system similar to what is found in many popular
|
||||
integrated development environments (IDEs) such as Visual Studio.
|
||||
[What's new](https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/releases/latest) •
|
||||
[Documentation](doc/user-guide.md)
|
||||
|
||||
Qt Advanced Docking System lets you create customizable layouts using a full
|
||||
featured window docking system similar to what is found in many popular
|
||||
integrated development environments (IDEs) such as Visual Studio.
|
||||
|
||||
[](https://www.youtube.com/watch?v=7pdNfafg3Qc)
|
||||
|
||||
Everything is implemented with standard Qt functionality without any
|
||||
platform specific code. Basic usage of QWidgets and QLayouts and using basic
|
||||
styles as much as possible.
|
||||
## New and Noteworthy
|
||||
|
||||
This work is based on and inspired by the
|
||||
[Advanced Docking System for Qt](https://github.com/mfreiholz/Qt-Advanced-Docking-System)
|
||||
from Manuel Freiholz. I did an almost complete rewrite of his code to improve
|
||||
code quality, readibility and to fix all issues from the issue tracker
|
||||
of his docking system project.
|
||||
The [release 3.7](https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/releases/tag/3.7.0)
|
||||
adds the following features:
|
||||
|
||||
- support for **Qt6.**
|
||||
- support for [empty dock area](doc/user-guide.md#empty-dock-area)
|
||||
|
||||
The [release 3.6](https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/releases/tag/3.6.0)
|
||||
adds some nice new features:
|
||||
|
||||
- support for [central widget](doc/user-guide.md#central-widget) concept
|
||||
|
||||

|
||||
|
||||
- support for [native floating widgets](doc/user-guide.md#floatingcontainerforcenativetitlebar-linux-only) on Linux
|
||||
|
||||

|
||||
|
||||
Both features are contributions from ADS users. Read the [documentation](doc/user-guide.md)
|
||||
to learn more about both new features.
|
||||
|
||||
The [release 3.5](https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/releases/tag/3.5.0)
|
||||
adds the new [focus highlighting](doc/user-guide.md#focushighlighting) feature.
|
||||
This optional feature enables highlighting of the focused dock widget like you
|
||||
know it from Visual Studio.
|
||||
|
||||

|
||||
|
||||
[learn more...](doc/user-guide.md#focushighlighting)
|
||||
|
||||
## Features
|
||||
|
||||
### Overview
|
||||
|
||||
- [Advanced Docking System for Qt](#advanced-docking-system-for-qt)
|
||||
- [Features](#features)
|
||||
- [Overview](#overview)
|
||||
- [Docking everywhere - no central widget](#docking-everywhere---no-central-widget)
|
||||
- [Docking inside floating windows](#docking-inside-floating-windows)
|
||||
- [Grouped dragging](#grouped-dragging)
|
||||
- [Perspectives for fast switching of the complete main window layout](#perspectives-for-fast-switching-of-the-complete-main-window-layout)
|
||||
- [Opaque and non-opaque splitter resizing](#opaque-and-non-opaque-splitter-resizing)
|
||||
- [Opaque and non-opaque undocking](#opaque-and-non-opaque-undocking)
|
||||
- [Tab-menu for easy handling of many tabbed dock widgets](#tab-menu-for-easy-handling-of-many-tabbed-dock-widgets)
|
||||
- [Many different ways to detach dock widgets](#many-different-ways-to-detach-dock-widgets)
|
||||
- [Supports deletion of dynamically created dock widgets](#supports-deletion-of-dynamically-created-dock-widgets)
|
||||
- [Tested Compatible Environments](#tested-compatible-environments)
|
||||
- [Windows](#windows)
|
||||
- [macOS](#macos)
|
||||
- [Linux](#linux)
|
||||
- [Build](#build)
|
||||
- [Getting started / Example](#getting-started--example)
|
||||
- [Developers](#developers)
|
||||
- [License information](#license-information)
|
||||
- [Alternative Docking System Implementations](#alternative-docking-system-implementations)
|
||||
- [KDDockWidgets](#kddockwidgets)
|
||||
- [QtitanDocking](#qtitandocking)
|
||||
- [Donation](#donation)
|
||||
- [New and Noteworthy](#new-and-noteworthy)
|
||||
- [Features](#features)
|
||||
- [Overview](#overview)
|
||||
- [Docking everywhere - no central widget](#docking-everywhere---no-central-widget)
|
||||
- [Docking inside floating windows](#docking-inside-floating-windows)
|
||||
- [Grouped dragging](#grouped-dragging)
|
||||
- [Perspectives for fast switching of the complete main window layout](#perspectives-for-fast-switching-of-the-complete-main-window-layout)
|
||||
- [Opaque and non-opaque splitter resizing](#opaque-and-non-opaque-splitter-resizing)
|
||||
- [Opaque and non-opaque undocking](#opaque-and-non-opaque-undocking)
|
||||
- [Tab-menu for easy handling of many tabbed dock widgets](#tab-menu-for-easy-handling-of-many-tabbed-dock-widgets)
|
||||
- [Many different ways to detach dock widgets](#many-different-ways-to-detach-dock-widgets)
|
||||
- [Supports deletion of dynamically created dock widgets](#supports-deletion-of-dynamically-created-dock-widgets)
|
||||
- [Python PyQt5 Bindings](#python-pyqt5-bindings)
|
||||
- [Tested Compatible Environments](#tested-compatible-environments)
|
||||
- [Supported Qt Versions](#supported-qt-versions)
|
||||
- [Windows](#windows)
|
||||
- [macOS](#macos)
|
||||
- [Linux](#linux)
|
||||
- [Build](#build)
|
||||
- [Getting started / Example](#getting-started--example)
|
||||
- [Developers](#developers)
|
||||
- [License information](#license-information)
|
||||
- [Alternative Docking System Implementations](#alternative-docking-system-implementations)
|
||||
- [KDDockWidgets](#kddockwidgets)
|
||||
- [QtitanDocking](#qtitandocking)
|
||||
- [Donation](#donation)
|
||||
- [Showcase](#showcase)
|
||||
- [Qt Creator IDE](#qt-creator-ide)
|
||||
- [Qt Design Studio](#qt-design-studio)
|
||||
- [QmixElements](#qmixelements)
|
||||
- [ezEditor](#ezeditor)
|
||||
- [D-Tect X](#d-tect-x)
|
||||
- [HiveWE](#hivewe)
|
||||
- [Ramses Composer](#ramses-composer)
|
||||
|
||||
### Docking everywhere - no central widget
|
||||
|
||||
@@ -55,8 +89,8 @@ There is no central widget like in the Qt docking system. You can dock on every
|
||||
border of the main window or you can dock into each dock area - so you are
|
||||
free to dock almost everywhere.
|
||||
|
||||
\
|
||||
\
|
||||

|
||||
|
||||

|
||||
|
||||
### Docking inside floating windows
|
||||
@@ -64,8 +98,8 @@ free to dock almost everywhere.
|
||||
There is no difference between the main window and a floating window. Docking
|
||||
into floating windows is supported.
|
||||
|
||||
\
|
||||
\
|
||||

|
||||
|
||||

|
||||
|
||||
### Grouped dragging
|
||||
@@ -74,8 +108,8 @@ When dragging the titlebar of a dock, all the tabs that are tabbed with it are
|
||||
going to be dragged. So you can move complete groups of tabbed widgets into
|
||||
a floating widget or from one dock area to another one.
|
||||
|
||||
\
|
||||
\
|
||||

|
||||
|
||||

|
||||
|
||||
### Perspectives for fast switching of the complete main window layout
|
||||
@@ -86,13 +120,13 @@ perspective to make your own custom perspective. Later you can simply
|
||||
select a perspective from the perspective list to quickly switch the complete
|
||||
main window layout.
|
||||
|
||||
\
|
||||
\
|
||||

|
||||
|
||||

|
||||
|
||||
### Opaque and non-opaque splitter resizing
|
||||
|
||||
The advanced docking system uses standard QSplitters as resize separators and thus supports opaque and non-opaque resizing functionality of QSplitter. In some rare cases, for very complex widgets or on slow machines resizing via separator on the fly may cause flicking and glaring of rendered content inside a widget. The global dock manager flag `OpaqueSplitterResize` configures the resizing behaviour of the splitters. If this flag is set, then widgets are resized dynamically (opaquely) while interactively moving the splitters.
|
||||
The advanced docking system uses standard QSplitters as resize separators and thus supports opaque and non-opaque resizing functionality of QSplitter. In some rare cases, for very complex widgets or on slow machines resizing via separator on the fly may cause flicking and glaring of rendered content inside a widget. The global dock manager flag `OpaqueSplitterResize` configures the resizing behaviour of the splitters. If this flag is set, then widgets are resized dynamically (opaquely) while interactively moving the splitters.
|
||||
|
||||

|
||||
|
||||
@@ -129,8 +163,26 @@ You can detach dock widgets and also dock areas in the following ways:
|
||||
|
||||
Normally clicking the close button of a dock widget will just hide the widget and the user can show it again using the toggleView() action of the dock widget. This is meant for user interfaces with a static amount of widgets. But the advanced docking system also supports dynamic dock widgets that will get deleted on close. If you set the dock widget flag `DockWidgetDeleteOnClose` for a certain dock widget, then it will be deleted as soon as you close this dock widget. This enables the implementation of user interfaces with dynamically created editors, like in word processing applications or source code development tools.
|
||||
|
||||
### Python PyQt5 Bindings
|
||||
|
||||

|
||||
|
||||
The Advanced Docking System comes with a complete Python integration based on
|
||||
PyQt5 bindings. The package is available via [conda-forge](https://github.com/conda-forge/pyqtads-feedstock). The python integration has been contributed to this project
|
||||
by the following people:
|
||||
|
||||
- [n-elie](https://github.com/n-elie)
|
||||
- [Hugo Slepicka](https://github.com/hhslepicka)
|
||||
- [K Lauer](https://github.com/klauer)
|
||||
|
||||
Latest working version: [3.5.2](https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/releases/tag/3.5.2)
|
||||
|
||||
## Tested Compatible Environments
|
||||
|
||||
### Supported Qt Versions
|
||||
|
||||
The library supports **Qt5** and **Qt6**.
|
||||
|
||||
### Windows
|
||||
|
||||
Windows 10 [](https://ci.appveyor.com/project/githubuser0xFFFF/qt-advanced-docking-system/branch/master)
|
||||
@@ -147,20 +199,34 @@ The application can be compiled for macOS. A user reported, that the library wor
|
||||
|
||||
### Linux
|
||||
|
||||
Ubuntu [](https://travis-ci.org/githubuser0xFFFF/Qt-Advanced-Docking-System)
|
||||
[](https://travis-ci.org/githubuser0xFFFF/Qt-Advanced-Docking-System)
|
||||
[](https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/actions?query=workflow%3Alinux-builds)
|
||||
|
||||
The application can be compiled for Linux and has been developed and tested with **Kubuntu 18.04** and **Kubuntu 19.10**.
|
||||
Unfortunately, there is no such thing as a Linux operating system. Linux is a heterogeneous environment with a variety of different distributions. So it is not possible to support "Linux" like this is possible for Windows. It is only possible to support and test a small subset of Linux distributions. The library can be compiled for and has been developed and tested with the following Linux distributions:
|
||||
|
||||
- **Kubuntu 18.04 and 19.10**
|
||||
- **Ubuntu 18.04, 19.10 and 20.04**
|
||||
|
||||
There are some requirements for the Linux distribution that have to be met:
|
||||
|
||||
- an X server that supports ARGB visuals and a compositing window manager. This is required to display the translucent dock overlays ([https://doc.qt.io/qt-5/qwidget.html#creating-translucent-windows](https://doc.qt.io/qt-5/qwidget.html#creating-translucent-windows)). If your Linux distribution does not support this, or if you disable this feature, you will very likely see issue [#95](https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/issues/95).
|
||||
- Wayland is not properly supported by Qt yet. If you use Wayland, then you should set the session type to x11: `XDG_SESSION_TYPE=x11 ./AdvancedDockingSystemDemo`. You will find more details about this in issue [#288](https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/issues/288).
|
||||
|
||||
Screenshot Kubuntu:
|
||||

|
||||
|
||||
and with **Ubuntu 19.10**
|
||||
|
||||
Screenshot Ubuntu:
|
||||

|
||||
|
||||
## Build
|
||||
|
||||
Open the `ads.pro` with QtCreator and start the build, that's it.
|
||||
The Linux build requires private header files. Make sure that they are installed:
|
||||
|
||||
```bash
|
||||
sudo apt install qtbase5-private-dev
|
||||
```
|
||||
|
||||
Open the `ads.pro` file with QtCreator and start the build, that's it.
|
||||
You can run the demo project and test it yourself.
|
||||
|
||||
## Getting started / Example
|
||||
@@ -240,7 +306,13 @@ MainWindow::~MainWindow()
|
||||
## Developers
|
||||
|
||||
- Uwe Kindler, Project Maintainer
|
||||
- Manuel Freiholz
|
||||
- Manuel Freiholz
|
||||
|
||||
This work is based on and inspired by the
|
||||
[Advanced Docking System for Qt](https://github.com/mfreiholz/Qt-Advanced-Docking-System)
|
||||
from Manuel Freiholz. I did an almost complete rewrite of his code to improve
|
||||
code quality, readibility and to fix all issues from the issue tracker
|
||||
of his docking system project.
|
||||
|
||||
## License information
|
||||
|
||||
@@ -273,3 +345,71 @@ If this project help you reduce time to develop or if you just like it, you can
|
||||
<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=85R64TMMSY9T6">
|
||||
<img src="doc/donate.png" alt="Donate with PayPal" width="160"/>
|
||||
</a>
|
||||
|
||||
## Showcase
|
||||
|
||||
### [Qt Creator IDE](https://www.qt.io/development-tools)
|
||||
|
||||
From version 4.12 on, Qt Creator uses the Advanced Docking Framework for its
|
||||
Qt Quick Designer. This improves the usability when using multiple screens.
|
||||
|
||||

|
||||
|
||||
### [Qt Design Studio](https://www.qt.io/ui-design-tools)
|
||||
|
||||
Taken from the [Qt Blog](https://www.qt.io/blog/qt-design-studio-1.5-beta-released):
|
||||
|
||||
> The most obvious change in [Qt Design Studio 1.5](https://www.qt.io/blog/qt-design-studio-1.5-beta-released) is the integration of dock widgets using the Qt Advanced Docking System. This allows the user to fully customize the workspace and also to undock any view into its own top level window. This especially improves the usability when using multiple screens.
|
||||
|
||||
[](https://youtu.be/za9KBWcFXEw?t=84)
|
||||
|
||||
### [QmixElements](https://www.cetoni.com/products/qmixelements/)
|
||||
|
||||
The QmixElements software from [CETONI](https://www.cetoni.com) is a comprehensive,
|
||||
plugin-based and modular laboratory automation software for controlling CETONI devices using a joint graphical user interface. The software features a powerful script system to automate processes. This [blog post](https://www.cetoni.com/blog/qmixelements-advanced-docking-system/) gives a nice overview about the use of the Qt
|
||||
Advanced Docking System in the QmixElements sofware.
|
||||
|
||||

|
||||
|
||||
### [ezEditor](https://github.com/ezEngine/ezEngine)
|
||||
|
||||
The ezEditor is a full blown graphical editor used for editing scenes and
|
||||
importing and authoring assets for the [ezEngine](https://github.com/ezEngine/ezEngine) -
|
||||
an open source C++ game engine in active development.
|
||||
|
||||

|
||||
|
||||
### [D-Tect X](https://www.duerr-ndt.com/products/ndt-software/d-tect-xray-inspection-software.html)
|
||||
|
||||
D-Tect X is a X-ray inspection software for industrial radiography. It is a state-of-the-art 64-bit application which supports GPU (Graphics Processing Unit) acceleration and takes full advantage of computers with multiple CPU cores. A large set of tools assist the user in image analysis and evaluation. Thanks to the Qt Advanced Docking System the flexible and intuitive user interface can be completely customized to each user’s preference.
|
||||
|
||||
[learn more...](https://www.duerr-ndt.com/products/ndt-software/d-tect-xray-inspection-software.html)
|
||||
|
||||

|
||||
|
||||
### [HiveWE](https://github.com/stijnherfst/HiveWE)
|
||||
|
||||
HiveWE is a Warcraft III world editor. It focusses on speed and ease of use,
|
||||
especially for large maps where the regular World Editor is often too slow and clunky.
|
||||
It has a JASS editor with syntax hightlighting, tabs, code completion and more.
|
||||
The JASS editor uses the Qt Advanced Docking System for the management and layout
|
||||
of the open editor windows.
|
||||
|
||||
[learn more...](https://github.com/stijnherfst/HiveWE)
|
||||
|
||||

|
||||
|
||||
### [Ramses Composer](https://github.com/GENIVI/ramses-composer)
|
||||
|
||||
Ramses Composer is the authoring tool for the open source [RAMSES](https://github.com/GENIVI/ramses)
|
||||
rendering ecosystem.
|
||||
|
||||
Ramses is a low-level rendering engine which is optimized for embedded hardware
|
||||
mobile devices, automotive ECUs, IoT electronics. Ramses was initially developed
|
||||
at the BMW Group and open-sourced in 2018 as part of a collaboration initiative
|
||||
with the Genivi Alliance. It is an important part of the BMW infotainment cluster
|
||||
and digital portfolio.
|
||||
|
||||
[learn more...](https://github.com/GENIVI/ramses-composer)
|
||||
|
||||

|
||||
|
||||
25
ads.pri
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
CONFIG(debug, debug|release){
|
||||
win32 {
|
||||
versionAtLeast(QT_VERSION, 5.15.0) {
|
||||
LIBS += -lqtadvanceddocking
|
||||
}
|
||||
else {
|
||||
LIBS += -lqtadvanceddockingd
|
||||
}
|
||||
}
|
||||
else:mac {
|
||||
LIBS += -lqtadvanceddocking_debug
|
||||
}
|
||||
else {
|
||||
LIBS += -lqtadvanceddocking
|
||||
}
|
||||
}
|
||||
else{
|
||||
LIBS += -lqtadvanceddocking
|
||||
}
|
||||
|
||||
|
||||
unix:!macx {
|
||||
LIBS += -lxcb
|
||||
}
|
||||
4
ads.pro
@@ -3,7 +3,7 @@ TEMPLATE = subdirs
|
||||
SUBDIRS = \
|
||||
src \
|
||||
demo \
|
||||
example
|
||||
examples
|
||||
|
||||
demo.depends = src
|
||||
example.depends = src
|
||||
examples.depends = src
|
||||
|
||||
172
cmake/modules/GetGitRevisionDescription.cmake
Normal file
@@ -0,0 +1,172 @@
|
||||
# - Returns a version string from Git
|
||||
#
|
||||
# These functions force a re-configure on each git commit so that you can
|
||||
# trust the values of the variables in your build system.
|
||||
#
|
||||
# get_git_head_revision(<refspecvar> <hashvar> [<additional arguments to git describe> ...])
|
||||
#
|
||||
# Returns the refspec and sha hash of the current head revision
|
||||
#
|
||||
# git_describe(<var> [<additional arguments to git describe> ...])
|
||||
#
|
||||
# Returns the results of git describe on the source tree, and adjusting
|
||||
# the output so that it tests false if an error occurs.
|
||||
#
|
||||
# git_get_exact_tag(<var> [<additional arguments to git describe> ...])
|
||||
#
|
||||
# Returns the results of git describe --exact-match on the source tree,
|
||||
# and adjusting the output so that it tests false if there was no exact
|
||||
# matching tag.
|
||||
#
|
||||
# git_local_changes(<var>)
|
||||
#
|
||||
# Returns either "CLEAN" or "DIRTY" with respect to uncommitted changes.
|
||||
# Uses the return code of "git diff-index --quiet HEAD --".
|
||||
# Does not regard untracked files.
|
||||
#
|
||||
# Requires CMake 2.6 or newer (uses the 'function' command)
|
||||
#
|
||||
# Original Author:
|
||||
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
|
||||
# http://academic.cleardefinition.com
|
||||
# Iowa State University HCI Graduate Program/VRAC
|
||||
#
|
||||
# Copyright Iowa State University 2009-2010.
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE_1_0.txt or copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
if(__get_git_revision_description)
|
||||
return()
|
||||
endif()
|
||||
set(__get_git_revision_description YES)
|
||||
|
||||
# We must run the following at "include" time, not at function call time,
|
||||
# to find the path to this module rather than the path to a calling list file
|
||||
get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH)
|
||||
|
||||
function(get_git_head_revision _refspecvar _hashvar)
|
||||
set(GIT_PARENT_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
set(GIT_DIR "${GIT_PARENT_DIR}/.git")
|
||||
while(NOT EXISTS "${GIT_DIR}") # .git dir not found, search parent directories
|
||||
set(GIT_PREVIOUS_PARENT "${GIT_PARENT_DIR}")
|
||||
get_filename_component(GIT_PARENT_DIR ${GIT_PARENT_DIR} PATH)
|
||||
if(GIT_PARENT_DIR STREQUAL GIT_PREVIOUS_PARENT)
|
||||
# We have reached the root directory, we are not in git
|
||||
set(${_refspecvar} "GITDIR-NOTFOUND" PARENT_SCOPE)
|
||||
set(${_hashvar} "GITDIR-NOTFOUND" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
set(GIT_DIR "${GIT_PARENT_DIR}/.git")
|
||||
endwhile()
|
||||
# check if this is a submodule
|
||||
if(NOT IS_DIRECTORY ${GIT_DIR})
|
||||
file(READ ${GIT_DIR} submodule)
|
||||
string(REGEX REPLACE "gitdir: (.*)\n$" "\\1" GIT_DIR_RELATIVE ${submodule})
|
||||
get_filename_component(SUBMODULE_DIR ${GIT_DIR} PATH)
|
||||
get_filename_component(GIT_DIR ${SUBMODULE_DIR}/${GIT_DIR_RELATIVE} ABSOLUTE)
|
||||
endif()
|
||||
if(NOT IS_DIRECTORY "${GIT_DIR}")
|
||||
file(READ ${GIT_DIR} worktree)
|
||||
string(REGEX REPLACE "gitdir: (.*)worktrees(.*)\n$" "\\1" GIT_DIR ${worktree})
|
||||
endif()
|
||||
set(GIT_DATA "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/git-data")
|
||||
if(NOT EXISTS "${GIT_DATA}")
|
||||
file(MAKE_DIRECTORY "${GIT_DATA}")
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS "${GIT_DIR}/HEAD")
|
||||
return()
|
||||
endif()
|
||||
set(HEAD_FILE "${GIT_DATA}/HEAD")
|
||||
configure_file("${GIT_DIR}/HEAD" "${HEAD_FILE}" COPYONLY)
|
||||
|
||||
configure_file("${_gitdescmoddir}/GetGitRevisionDescription.cmake.in"
|
||||
"${GIT_DATA}/grabRef.cmake"
|
||||
@ONLY)
|
||||
include("${GIT_DATA}/grabRef.cmake")
|
||||
|
||||
set(${_refspecvar} "${HEAD_REF}" PARENT_SCOPE)
|
||||
set(${_hashvar} "${HEAD_HASH}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(git_describe _var)
|
||||
if(NOT GIT_FOUND)
|
||||
find_package(Git QUIET)
|
||||
endif()
|
||||
get_git_head_revision(refspec hash)
|
||||
if(NOT GIT_FOUND)
|
||||
set(${_var} "GIT-NOTFOUND" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
if(NOT hash)
|
||||
set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# TODO sanitize
|
||||
#if((${ARGN}" MATCHES "&&") OR
|
||||
# (ARGN MATCHES "||") OR
|
||||
# (ARGN MATCHES "\\;"))
|
||||
# message("Please report the following error to the project!")
|
||||
# message(FATAL_ERROR "Looks like someone's doing something nefarious with git_describe! Passed arguments ${ARGN}")
|
||||
#endif()
|
||||
|
||||
#message(STATUS "Arguments to execute_process: ${ARGN}")
|
||||
|
||||
execute_process(COMMAND
|
||||
"${GIT_EXECUTABLE}"
|
||||
describe
|
||||
${hash}
|
||||
${ARGN}
|
||||
WORKING_DIRECTORY
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
RESULT_VARIABLE
|
||||
res
|
||||
OUTPUT_VARIABLE
|
||||
out
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if(NOT res EQUAL 0)
|
||||
set(out "${out}-${res}-NOTFOUND")
|
||||
endif()
|
||||
|
||||
set(${_var} "${out}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(git_get_exact_tag _var)
|
||||
git_describe(out --exact-match ${ARGN})
|
||||
set(${_var} "${out}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(git_local_changes _var)
|
||||
if(NOT GIT_FOUND)
|
||||
find_package(Git QUIET)
|
||||
endif()
|
||||
get_git_head_revision(refspec hash)
|
||||
if(NOT GIT_FOUND)
|
||||
set(${_var} "GIT-NOTFOUND" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
if(NOT hash)
|
||||
set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
execute_process(COMMAND
|
||||
"${GIT_EXECUTABLE}"
|
||||
diff-index --quiet HEAD --
|
||||
WORKING_DIRECTORY
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
RESULT_VARIABLE
|
||||
res
|
||||
OUTPUT_VARIABLE
|
||||
out
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if(res EQUAL 0)
|
||||
set(${_var} "CLEAN" PARENT_SCOPE)
|
||||
else()
|
||||
set(${_var} "DIRTY" PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
41
cmake/modules/GetGitRevisionDescription.cmake.in
Normal file
@@ -0,0 +1,41 @@
|
||||
#
|
||||
# Internal file for GetGitRevisionDescription.cmake
|
||||
#
|
||||
# Requires CMake 2.6 or newer (uses the 'function' command)
|
||||
#
|
||||
# Original Author:
|
||||
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
|
||||
# http://academic.cleardefinition.com
|
||||
# Iowa State University HCI Graduate Program/VRAC
|
||||
#
|
||||
# Copyright Iowa State University 2009-2010.
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE_1_0.txt or copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
set(HEAD_HASH)
|
||||
|
||||
file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024)
|
||||
|
||||
string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS)
|
||||
if(HEAD_CONTENTS MATCHES "ref")
|
||||
# named branch
|
||||
string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}")
|
||||
if(EXISTS "@GIT_DIR@/${HEAD_REF}")
|
||||
configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY)
|
||||
else()
|
||||
configure_file("@GIT_DIR@/packed-refs" "@GIT_DATA@/packed-refs" COPYONLY)
|
||||
file(READ "@GIT_DATA@/packed-refs" PACKED_REFS)
|
||||
if(${PACKED_REFS} MATCHES "([0-9a-z]*) ${HEAD_REF}")
|
||||
set(HEAD_HASH "${CMAKE_MATCH_1}")
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
# detached HEAD
|
||||
configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY)
|
||||
endif()
|
||||
|
||||
if(NOT HEAD_HASH)
|
||||
file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024)
|
||||
string(STRIP "${HEAD_HASH}" HEAD_HASH)
|
||||
endif()
|
||||
316
demo.py
@@ -1,316 +0,0 @@
|
||||
import datetime
|
||||
import logging
|
||||
|
||||
from PyQt5.QtCore import (QCoreApplication, QDir, Qt, QSettings, QSignalBlocker,
|
||||
QRect)
|
||||
from PyQt5.QtGui import QGuiApplication
|
||||
from PyQt5.QtWidgets import (QCalendarWidget, QFileSystemModel, QFrame, QLabel,
|
||||
QMenu, QTreeView, QAction, QWidgetAction,
|
||||
QComboBox, QStyle, QSizePolicy, QInputDialog)
|
||||
|
||||
from PyQt5 import QtWidgets
|
||||
|
||||
from PyQtAds import QtAds
|
||||
|
||||
|
||||
class _State:
|
||||
label_count = 0
|
||||
calendar_count = 0
|
||||
file_system_count = 0
|
||||
|
||||
|
||||
def create_long_text_label_dock_widget(view_menu: QMenu) -> QtAds.CDockWidget:
|
||||
'''
|
||||
Create long text label dock widget
|
||||
|
||||
Parameters
|
||||
----------
|
||||
view_menu : QMenu
|
||||
|
||||
Returns
|
||||
-------
|
||||
value : QtAds.CDockWidget
|
||||
'''
|
||||
label = QLabel()
|
||||
label.setWordWrap(True)
|
||||
label.setAlignment(Qt.AlignTop | Qt.AlignLeft)
|
||||
label.setText('''\
|
||||
Label {} {} - Lorem ipsum dolor sit amet, consectetuer
|
||||
adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum
|
||||
sociis natoque penatibus et magnis dis parturient montes, nascetur
|
||||
ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium
|
||||
quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla
|
||||
vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut,
|
||||
imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis
|
||||
pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi.
|
||||
Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu,
|
||||
consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra
|
||||
quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet.
|
||||
'''.format(_State.label_count, str(datetime.datetime.now())))
|
||||
_State.label_count += 1
|
||||
|
||||
dock_widget = QtAds.CDockWidget("Label {}".format(_State.label_count))
|
||||
dock_widget.setWidget(label)
|
||||
|
||||
view_menu.addAction(dock_widget.toggleViewAction())
|
||||
return dock_widget
|
||||
|
||||
|
||||
def create_calendar_dock_widget(view_menu: QMenu) -> QtAds.CDockWidget:
|
||||
'''
|
||||
Create calendar dock widget
|
||||
|
||||
Parameters
|
||||
----------
|
||||
view_menu : QMenu
|
||||
|
||||
Returns
|
||||
-------
|
||||
value : QtAds.CDockWidget
|
||||
'''
|
||||
widget = QCalendarWidget()
|
||||
|
||||
dock_widget = QtAds.CDockWidget("Calendar {}".format(_State.calendar_count))
|
||||
_State.calendar_count += 1
|
||||
dock_widget.setWidget(widget)
|
||||
dock_widget.setToggleViewActionMode(QtAds.CDockWidget.ActionModeShow)
|
||||
view_menu.addAction(dock_widget.toggleViewAction())
|
||||
return dock_widget
|
||||
|
||||
|
||||
def create_file_system_tree_dock_widget(view_menu: QMenu) -> QtAds.CDockWidget:
|
||||
'''
|
||||
Create file system tree dock widget
|
||||
|
||||
Parameters
|
||||
----------
|
||||
view_menu : QMenu
|
||||
|
||||
Returns
|
||||
-------
|
||||
value : QtAds.CDockWidget
|
||||
'''
|
||||
widget = QTreeView()
|
||||
widget.setFrameShape(QFrame.NoFrame)
|
||||
|
||||
m = QFileSystemModel(widget)
|
||||
m.setRootPath(QDir.currentPath())
|
||||
widget.setModel(m)
|
||||
|
||||
dock_widget = QtAds.CDockWidget("Filesystem {}".format(_State.file_system_count))
|
||||
_State.file_system_count += 1
|
||||
dock_widget.setWidget(widget)
|
||||
view_menu.addAction(dock_widget.toggleViewAction())
|
||||
return dock_widget
|
||||
|
||||
|
||||
class MainWindow(QtWidgets.QMainWindow):
|
||||
save_perspective_action: QAction
|
||||
perspective_list_action: QWidgetAction
|
||||
perspective_combo_box: QComboBox
|
||||
dock_manager: QtAds.CDockManager
|
||||
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
self.save_perspective_action = None
|
||||
self.perspective_list_action = None
|
||||
self.perspective_combo_box = None
|
||||
self.dock_manager = None
|
||||
|
||||
self.setup_ui()
|
||||
|
||||
self.dock_manager = QtAds.CDockManager(self)
|
||||
self.perspective_combo_box.activated[str].connect(self.dock_manager.openPerspective)
|
||||
self.create_content()
|
||||
self.resize(800, 600)
|
||||
self.restore_state()
|
||||
self.restore_perspectives()
|
||||
|
||||
def setup_ui(self):
|
||||
self.setObjectName("MainWindow")
|
||||
self.resize(400, 300)
|
||||
self.setDockOptions(QtWidgets.QMainWindow.AllowTabbedDocks)
|
||||
self.centralWidget = QtWidgets.QWidget(self)
|
||||
self.centralWidget.setObjectName("centralWidget")
|
||||
self.setCentralWidget(self.centralWidget)
|
||||
self.status_bar = QtWidgets.QStatusBar(self)
|
||||
self.status_bar.setObjectName("statusBar")
|
||||
self.setStatusBar(self.status_bar)
|
||||
self.menu_bar = QtWidgets.QMenuBar(self)
|
||||
self.menu_bar.setGeometry(QRect(0, 0, 400, 21))
|
||||
self.menu_bar.setObjectName("menuBar")
|
||||
self.menu_file = QtWidgets.QMenu(self.menu_bar)
|
||||
self.menu_file.setObjectName("menuFile")
|
||||
self.menu_view = QtWidgets.QMenu(self.menu_bar)
|
||||
self.menu_view.setObjectName("menuView")
|
||||
self.menu_about = QtWidgets.QMenu(self.menu_bar)
|
||||
self.menu_about.setObjectName("menuAbout")
|
||||
self.setMenuBar(self.menu_bar)
|
||||
self.tool_bar = QtWidgets.QToolBar(self)
|
||||
self.tool_bar.setObjectName("toolBar")
|
||||
self.addToolBar(Qt.TopToolBarArea, self.tool_bar)
|
||||
self.action_exit = QtWidgets.QAction(self)
|
||||
self.action_exit.setObjectName("actionExit")
|
||||
self.action_save_state = QtWidgets.QAction(self)
|
||||
self.action_save_state.setObjectName("actionSaveState")
|
||||
self.action_save_state.triggered.connect(self.saveState)
|
||||
|
||||
self.action_restore_state = QtWidgets.QAction(self)
|
||||
self.action_restore_state.setObjectName("actionRestoreState")
|
||||
self.action_restore_state.triggered.connect(self.restore_state)
|
||||
|
||||
self.menu_file.addAction(self.action_exit)
|
||||
self.menu_file.addAction(self.action_save_state)
|
||||
self.menu_file.addAction(self.action_restore_state)
|
||||
self.menu_bar.addAction(self.menu_file.menuAction())
|
||||
self.menu_bar.addAction(self.menu_view.menuAction())
|
||||
self.menu_bar.addAction(self.menu_about.menuAction())
|
||||
|
||||
self.setWindowTitle("MainWindow")
|
||||
self.menu_file.setTitle("File")
|
||||
self.menu_view.setTitle("View")
|
||||
self.menu_about.setTitle("About")
|
||||
self.tool_bar.setWindowTitle("toolBar")
|
||||
self.action_exit.setText("Exit")
|
||||
self.action_save_state.setText("Save State")
|
||||
self.action_restore_state.setText("Restore State")
|
||||
self.create_actions()
|
||||
|
||||
def create_actions(self):
|
||||
'''
|
||||
Creates the toolbar actions
|
||||
'''
|
||||
self.tool_bar.addAction(self.action_save_state)
|
||||
self.action_save_state.setIcon(self.style().standardIcon(QStyle.SP_DialogSaveButton))
|
||||
self.tool_bar.addAction(self.action_restore_state)
|
||||
self.action_restore_state.setIcon(self.style().standardIcon(QStyle.SP_DialogOpenButton))
|
||||
self.save_perspective_action = QAction("Save Perspective", self)
|
||||
self.save_perspective_action.triggered.connect(self.save_perspective)
|
||||
|
||||
self.perspective_list_action = QWidgetAction(self)
|
||||
self.perspective_combo_box = QComboBox(self)
|
||||
self.perspective_combo_box.setSizeAdjustPolicy(QComboBox.AdjustToContents)
|
||||
self.perspective_combo_box.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
|
||||
self.perspective_list_action.setDefaultWidget(self.perspective_combo_box)
|
||||
self.tool_bar.addSeparator()
|
||||
self.tool_bar.addAction(self.perspective_list_action)
|
||||
self.tool_bar.addAction(self.save_perspective_action)
|
||||
|
||||
def create_content(self):
|
||||
'''
|
||||
Fill the dock manager with dock widgets
|
||||
'''
|
||||
# Test container docking
|
||||
view_menu = self.menu_view
|
||||
dock_widget = create_calendar_dock_widget(view_menu)
|
||||
dock_widget.setIcon(self.style().standardIcon(QStyle.SP_DialogOpenButton))
|
||||
dock_widget.setFeature(QtAds.CDockWidget.DockWidgetClosable, False)
|
||||
self.dock_manager.addDockWidget(QtAds.LeftDockWidgetArea, dock_widget)
|
||||
self.dock_manager.addDockWidget(QtAds.LeftDockWidgetArea, create_long_text_label_dock_widget(view_menu))
|
||||
file_system_widget = create_file_system_tree_dock_widget(view_menu)
|
||||
tool_bar = file_system_widget.createDefaultToolBar()
|
||||
tool_bar.addAction(self.action_save_state)
|
||||
tool_bar.addAction(self.action_restore_state)
|
||||
self.dock_manager.addDockWidget(QtAds.BottomDockWidgetArea, file_system_widget)
|
||||
file_system_widget = create_file_system_tree_dock_widget(view_menu)
|
||||
tool_bar = file_system_widget.createDefaultToolBar()
|
||||
tool_bar.addAction(self.action_save_state)
|
||||
tool_bar.addAction(self.action_restore_state)
|
||||
file_system_widget.setFeature(QtAds.CDockWidget.DockWidgetMovable, False)
|
||||
top_dock_area = self.dock_manager.addDockWidget(QtAds.TopDockWidgetArea, file_system_widget)
|
||||
dock_widget = create_calendar_dock_widget(view_menu)
|
||||
dock_widget.setFeature(QtAds.CDockWidget.DockWidgetClosable, False)
|
||||
dock_widget.setTabToolTip("Tab ToolTip\nHodie est dies magna")
|
||||
self.dock_manager.addDockWidget(QtAds.CenterDockWidgetArea, dock_widget, top_dock_area)
|
||||
|
||||
# Test dock area docking
|
||||
right_dock_area = self.dock_manager.addDockWidget(
|
||||
QtAds.RightDockWidgetArea,
|
||||
create_long_text_label_dock_widget(view_menu), top_dock_area)
|
||||
self.dock_manager.addDockWidget(
|
||||
QtAds.TopDockWidgetArea,
|
||||
create_long_text_label_dock_widget(view_menu), right_dock_area)
|
||||
|
||||
bottom_dock_area = self.dock_manager.addDockWidget(
|
||||
QtAds.BottomDockWidgetArea,
|
||||
create_long_text_label_dock_widget(view_menu), right_dock_area)
|
||||
|
||||
self.dock_manager.addDockWidget(
|
||||
QtAds.RightDockWidgetArea,
|
||||
create_long_text_label_dock_widget(view_menu), right_dock_area)
|
||||
self.dock_manager.addDockWidget(
|
||||
QtAds.CenterDockWidgetArea,
|
||||
create_long_text_label_dock_widget(view_menu), bottom_dock_area)
|
||||
|
||||
def save_state(self):
|
||||
'''
|
||||
Saves the dock manager state and the main window geometry
|
||||
'''
|
||||
settings = QSettings("Settings.ini", QSettings.IniFormat)
|
||||
settings.setValue("mainWindow/Geometry", self.saveGeometry())
|
||||
settings.setValue("mainWindow/State", self.saveState())
|
||||
settings.setValue("mainWindow/DockingState", self.dock_manager.saveState())
|
||||
|
||||
def save_perspectives(self):
|
||||
'''
|
||||
Save the list of perspectives
|
||||
'''
|
||||
settings = QSettings("Settings.ini", QSettings.IniFormat)
|
||||
self.dock_manager.savePerspectives(settings)
|
||||
|
||||
def restore_state(self):
|
||||
'''
|
||||
Restores the dock manager state
|
||||
'''
|
||||
settings = QSettings("Settings.ini", QSettings.IniFormat)
|
||||
geom = settings.value("mainWindow/Geometry")
|
||||
if geom is not None:
|
||||
self.restoreGeometry(geom)
|
||||
|
||||
state = settings.value("mainWindow/State")
|
||||
if state is not None:
|
||||
self.restoreState(state)
|
||||
|
||||
state = settings.value("mainWindow/DockingState")
|
||||
if state is not None:
|
||||
self.dock_manager.restore_state(state)
|
||||
|
||||
def restore_perspectives(self):
|
||||
'''
|
||||
Restore the perspective listo of the dock manager
|
||||
'''
|
||||
settings = QSettings("Settings.ini", QSettings.IniFormat)
|
||||
self.dock_manager.loadPerspectives(settings)
|
||||
self.perspective_combo_box.clear()
|
||||
self.perspective_combo_box.addItems(self.dock_manager.perspectiveNames())
|
||||
|
||||
def save_perspective(self):
|
||||
perspective_name, ok = QInputDialog.getText(self, 'Save perspective', 'Enter unique name:')
|
||||
if ok and perspective_name:
|
||||
self.dock_manager.addPerspective(perspective_name)
|
||||
_ = QSignalBlocker(self.perspective_combo_box)
|
||||
self.perspective_combo_box.clear()
|
||||
self.perspective_combo_box.addItems(self.dock_manager.perspectiveNames())
|
||||
self.perspective_combo_box.setCurrentText(perspective_name)
|
||||
self.save_perspectives()
|
||||
|
||||
|
||||
def main(app_):
|
||||
main_window = MainWindow()
|
||||
main_window.show()
|
||||
state = main_window.dock_manager.saveState()
|
||||
# print('This is what the saved state looks like in XML:')
|
||||
# print(str(state, 'utf-8'))
|
||||
# print()
|
||||
# main_window.dock_manager.restore_state(state)
|
||||
return main_window
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
# logging.basicConfig(level='DEBUG')
|
||||
QCoreApplication.setAttribute(Qt.AA_UseHighDpiPixmaps)
|
||||
QGuiApplication.setAttribute(Qt.AA_EnableHighDpiScaling)
|
||||
app = QtWidgets.QApplication([])
|
||||
window = main(app)
|
||||
window.show()
|
||||
app.exec_()
|
||||
@@ -1,54 +1,43 @@
|
||||
cmake_minimum_required(VERSION 3.3)
|
||||
set (CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
project(ads_demo VERSION "1.0")
|
||||
set(REQUIRED_QT_VERSION 5.5.0)
|
||||
find_package(Qt5Core ${REQUIRED_QT_VERSION} REQUIRED)
|
||||
find_package(Qt5Gui ${REQUIRED_QT_VERSION} REQUIRED)
|
||||
find_package(Qt5Widgets ${REQUIRED_QT_VERSION} REQUIRED)
|
||||
set(ads_demo_LIBS ${ads_demo_LIBS} ${Qt5Core_LIBRARIES})
|
||||
set(ads_demo_INCLUDE ${ads_demo_INCLUDE} ${Qt5Core_INCLUDE_DIRS})
|
||||
set(ads_demo_COMPILE_DEFINE ${ads_demo_COMPILE_DEFINE} ${Qt5Core_COMPILE_DEFINITIONS} )
|
||||
set(ads_demo_LIBS ${ads_demo_LIBS} ${Qt5Gui_LIBRARIES})
|
||||
set(ads_demo_INCLUDE ${ads_demo_INCLUDE} ${Qt5Gui_INCLUDE_DIRS})
|
||||
set(ads_demo_COMPILE_DEFINE ${ads_demo_COMPILE_DEFINE} ${Qt5Gui_COMPILE_DEFINITIONS})
|
||||
set(ads_demo_LIBS ${ads_demo_LIBS} ${Qt5Widgets_LIBRARIES})
|
||||
set(ads_demo_INCLUDE ${ads_demo_INCLUDE} ${Qt5Widgets_INCLUDE_DIRS})
|
||||
set(ads_demo_COMPILE_DEFINE ${ads_demo_COMPILE_DEFINE} ${Qt5Widgets_COMPILE_DEFINITIONS})
|
||||
if(WIN32)
|
||||
find_package(Qt5AxContainer ${REQUIRED_QT_VERSION} REQUIRED)
|
||||
set(ads_demo_LIBS ${ads_demo_LIBS} ${Qt5AxContainer_LIBRARIES})
|
||||
set(ads_demo_INCLUDE ${ads_demo_INCLUDE} ${Qt5AxContainer_INCLUDE_DIRS})
|
||||
set(ads_demo_COMPILE_DEFINE ${ads_demo_COMPILE_DEFINE} ${Qt5AxContainer_COMPILE_DEFINITIONS})
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
project(ads_demo VERSION ${VERSION_SHORT})
|
||||
|
||||
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED)
|
||||
find_package(Qt${QT_VERSION_MAJOR} 5.5 COMPONENTS Core Gui Widgets REQUIRED)
|
||||
if(WIN32 AND QT_VERSION_MAJOR LESS 6)
|
||||
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS AxContainer REQUIRED)
|
||||
endif()
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
set(ads_demo_SRCS
|
||||
main.cpp
|
||||
MainWindow.cpp
|
||||
mainwindow.ui
|
||||
StatusDialog.cpp
|
||||
StatusDialog.ui
|
||||
demo.qrc
|
||||
)
|
||||
add_executable(AdvancedDockingSystemDemo WIN32 ${ads_demo_SRCS})
|
||||
if(BUILD_STATIC)
|
||||
set(ads_demo_DEFINE ${ads_demo_DEFINE} ADS_STATIC)
|
||||
target_include_directories(AdvancedDockingSystemDemo PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../src")
|
||||
target_link_libraries(AdvancedDockingSystemDemo PUBLIC Qt${QT_VERSION_MAJOR}::Core
|
||||
Qt${QT_VERSION_MAJOR}::Gui
|
||||
Qt${QT_VERSION_MAJOR}::Widgets)
|
||||
if(WIN32 AND QT_VERSION_MAJOR LESS 6)
|
||||
target_link_libraries(AdvancedDockingSystemDemo PUBLIC Qt${QT_VERSION_MAJOR}::AxContainer)
|
||||
endif()
|
||||
add_dependencies(AdvancedDockingSystemDemo qtadvanceddocking)
|
||||
target_include_directories(AdvancedDockingSystemDemo PUBLIC
|
||||
$<BUILD_INTERFACE:${ads_demo_INCLUDE}>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
)
|
||||
target_include_directories(AdvancedDockingSystemDemo PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../src" ${ads_demo_INCLUDE})
|
||||
target_link_libraries(AdvancedDockingSystemDemo PRIVATE qtadvanceddocking ${ads_demo_LIBS})
|
||||
target_compile_definitions(AdvancedDockingSystemDemo PRIVATE ${ads_demo_DEFINE})
|
||||
target_link_libraries(AdvancedDockingSystemDemo PRIVATE qtadvanceddocking)
|
||||
set_target_properties(AdvancedDockingSystemDemo PROPERTIES
|
||||
VERSION "1.0"
|
||||
SOVERSION 1
|
||||
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 Demo"
|
||||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib"
|
||||
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib"
|
||||
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/bin"
|
||||
)
|
||||
#if(BUILD_STATIC)
|
||||
# target_compile_definitions(AdvancedDockingSystemDemo PRIVATE ADS_STATIC)
|
||||
#endif()
|
||||
|
||||
|
||||
@@ -58,11 +58,15 @@
|
||||
#include <QMessageBox>
|
||||
#include <QMenu>
|
||||
#include <QToolButton>
|
||||
#include <QToolBar>
|
||||
#include <QPointer>
|
||||
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
#include <QAxWidget>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <QMap>
|
||||
#include <QElapsedTimer>
|
||||
@@ -74,36 +78,8 @@
|
||||
#include "DockAreaTabBar.h"
|
||||
#include "FloatingDockContainer.h"
|
||||
#include "DockComponentsFactory.h"
|
||||
|
||||
|
||||
|
||||
//============================================================================
|
||||
static ads::CDockWidget* createLongTextLabelDockWidget(QMenu* ViewMenu)
|
||||
{
|
||||
static int LabelCount = 0;
|
||||
QLabel* l = new QLabel();
|
||||
l->setWordWrap(true);
|
||||
l->setAlignment(Qt::AlignTop | Qt::AlignLeft);
|
||||
l->setText(QString("Label %1 %2 - Lorem ipsum dolor sit amet, consectetuer adipiscing elit. "
|
||||
"Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque "
|
||||
"penatibus et magnis dis parturient montes, nascetur ridiculus mus. "
|
||||
"Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. "
|
||||
"Nulla consequat massa quis enim. Donec pede justo, fringilla vel, "
|
||||
"aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, "
|
||||
"imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede "
|
||||
"mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum "
|
||||
"semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, "
|
||||
"porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, "
|
||||
"dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla "
|
||||
"ut metus varius laoreet.")
|
||||
.arg(LabelCount)
|
||||
.arg(QTime::currentTime().toString("hh:mm:ss:zzz")));
|
||||
|
||||
ads::CDockWidget* DockWidget = new ads::CDockWidget(QString("Label %1").arg(LabelCount++));
|
||||
DockWidget->setWidget(l);
|
||||
ViewMenu->addAction(DockWidget->toggleViewAction());
|
||||
return DockWidget;
|
||||
}
|
||||
#include "StatusDialog.h"
|
||||
#include "DockSplitter.h"
|
||||
|
||||
|
||||
/**
|
||||
@@ -137,7 +113,7 @@ static void appendFeaturStringToWindowTitle(ads::CDockWidget* DockWidget)
|
||||
static QIcon svgIcon(const QString& File)
|
||||
{
|
||||
// This is a workaround, because in item views SVG icons are not
|
||||
// properly scaled an look blurry or pixelate
|
||||
// properly scaled and look blurry or pixelate
|
||||
QIcon SvgIcon(File);
|
||||
SvgIcon.addPixmap(SvgIcon.pixmap(92));
|
||||
return SvgIcon;
|
||||
@@ -163,105 +139,23 @@ public:
|
||||
};
|
||||
|
||||
|
||||
//============================================================================
|
||||
static ads::CDockWidget* createCalendarDockWidget(QMenu* ViewMenu)
|
||||
|
||||
//===========================================================================
|
||||
/**
|
||||
* Custom QTableWidget with a minimum size hint to test CDockWidget
|
||||
* setMinimumSizeHintMode() function of CDockWidget
|
||||
*/
|
||||
class CMinSizeTableWidget : public QTableWidget
|
||||
{
|
||||
static int CalendarCount = 0;
|
||||
QCalendarWidget* w = new QCalendarWidget();
|
||||
ads::CDockWidget* DockWidget = new ads::CDockWidget(QString("Calendar %1").arg(CalendarCount++));
|
||||
DockWidget->setWidget(w);
|
||||
DockWidget->setToggleViewActionMode(ads::CDockWidget::ActionModeShow);
|
||||
DockWidget->setIcon(svgIcon(":/adsdemo/images/date_range.svg"));
|
||||
ViewMenu->addAction(DockWidget->toggleViewAction());
|
||||
return DockWidget;
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
static ads::CDockWidget* createFileSystemTreeDockWidget(QMenu* ViewMenu)
|
||||
{
|
||||
static int FileSystemCount = 0;
|
||||
QTreeView* w = new QTreeView();
|
||||
w->setFrameShape(QFrame::NoFrame);
|
||||
QFileSystemModel* m = new QFileSystemModel(w);
|
||||
m->setRootPath(QDir::currentPath());
|
||||
w->setModel(m);
|
||||
ads::CDockWidget* DockWidget = new ads::CDockWidget(QString("Filesystem %1")
|
||||
.arg(FileSystemCount++));
|
||||
DockWidget->setWidget(w);
|
||||
ViewMenu->addAction(DockWidget->toggleViewAction());
|
||||
return DockWidget;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
static ads::CDockWidget* createEditorWidget(QMenu* ViewMenu)
|
||||
{
|
||||
static int EditorCount = 0;
|
||||
QPlainTextEdit* w = new QPlainTextEdit();
|
||||
w->setPlaceholderText("This is an editor. If you close the editor, it will be "
|
||||
"deleted. Enter your text here.");
|
||||
w->setStyleSheet("border: none");
|
||||
ads::CDockWidget* DockWidget = new ads::CDockWidget(QString("Editor %1").arg(EditorCount++));
|
||||
DockWidget->setWidget(w);
|
||||
DockWidget->setIcon(svgIcon(":/adsdemo/images/edit.svg"));
|
||||
DockWidget->setFeature(ads::CDockWidget::CustomCloseHandling, true);
|
||||
ViewMenu->addAction(DockWidget->toggleViewAction());
|
||||
|
||||
QMenu* OptionsMenu = new QMenu(DockWidget);
|
||||
OptionsMenu->setTitle(QObject::tr("Options"));
|
||||
OptionsMenu->setToolTip(OptionsMenu->title());
|
||||
OptionsMenu->setIcon(svgIcon(":/adsdemo/images/custom-menu-button.svg"));
|
||||
auto MenuAction = OptionsMenu->menuAction();
|
||||
// The object name of the action will be set for the QToolButton that
|
||||
// is created in the dock area title bar. You can use this name for CSS
|
||||
// styling
|
||||
MenuAction->setObjectName("optionsMenu");
|
||||
DockWidget->setTitleBarActions({OptionsMenu->menuAction()});
|
||||
auto a = OptionsMenu->addAction(QObject::tr("Clear Editor"));
|
||||
w->connect(a, SIGNAL(triggered()), SLOT(clear()));
|
||||
|
||||
return DockWidget;
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
static ads::CDockWidget* createTableWidget(QMenu* ViewMenu)
|
||||
{
|
||||
static int TableCount = 0;
|
||||
QTableWidget* w = new QTableWidget();
|
||||
ads::CDockWidget* DockWidget = new ads::CDockWidget(QString("Table %1").arg(TableCount++));
|
||||
static int colCount = 5;
|
||||
static int rowCount = 30;
|
||||
w->setColumnCount(colCount);
|
||||
w->setRowCount(rowCount);
|
||||
for (int col = 0; col < colCount; ++col)
|
||||
public:
|
||||
using QTableWidget::QTableWidget;
|
||||
virtual QSize minimumSizeHint() const override
|
||||
{
|
||||
w->setHorizontalHeaderItem(col, new QTableWidgetItem(QString("Col %1").arg(col+1)));
|
||||
for (int row = 0; row < rowCount; ++row)
|
||||
{
|
||||
w->setItem(row, col, new QTableWidgetItem(QString("T %1-%2").arg(row + 1).arg(col+1)));
|
||||
}
|
||||
return QSize(300, 100);
|
||||
}
|
||||
DockWidget->setWidget(w);
|
||||
DockWidget->setIcon(svgIcon(":/adsdemo/images/grid_on.svg"));
|
||||
ViewMenu->addAction(DockWidget->toggleViewAction());
|
||||
return DockWidget;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
//============================================================================
|
||||
static ads::CDockWidget* createActiveXWidget(QMenu* ViewMenu, QWidget* parent = nullptr)
|
||||
{
|
||||
static int ActiveXCount = 0;
|
||||
QAxWidget* w = new QAxWidget("{6bf52a52-394a-11d3-b153-00c04f79faa6}", parent);
|
||||
ads::CDockWidget* DockWidget = new ads::CDockWidget(QString("Active X %1").arg(ActiveXCount++));
|
||||
DockWidget->setWidget(w);
|
||||
ViewMenu->addAction(DockWidget->toggleViewAction());
|
||||
return DockWidget;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
//============================================================================
|
||||
/**
|
||||
@@ -275,6 +169,9 @@ struct MainWindowPrivate
|
||||
QWidgetAction* PerspectiveListAction = nullptr;
|
||||
QComboBox* PerspectiveComboBox = nullptr;
|
||||
ads::CDockManager* DockManager = nullptr;
|
||||
ads::CDockWidget* WindowTitleTestDockWidget = nullptr;
|
||||
QPointer<ads::CDockWidget> LastDockedEditor;
|
||||
QPointer<ads::CDockWidget> LastCreatedFloatingEditor;
|
||||
|
||||
MainWindowPrivate(CMainWindow* _public) : _this(_public) {}
|
||||
|
||||
@@ -307,17 +204,184 @@ struct MainWindowPrivate
|
||||
* Restore the perspective listo of the dock manager
|
||||
*/
|
||||
void restorePerspectives();
|
||||
|
||||
/**
|
||||
* Creates a dock widget with a file system tree view
|
||||
*/
|
||||
ads::CDockWidget* createFileSystemTreeDockWidget()
|
||||
{
|
||||
static int FileSystemCount = 0;
|
||||
QTreeView* w = new QTreeView();
|
||||
w->setFrameShape(QFrame::NoFrame);
|
||||
QFileSystemModel* m = new QFileSystemModel(w);
|
||||
m->setRootPath(QDir::currentPath());
|
||||
w->setModel(m);
|
||||
ads::CDockWidget* DockWidget = new ads::CDockWidget(QString("Filesystem %1")
|
||||
.arg(FileSystemCount++));
|
||||
DockWidget->setWidget(w);
|
||||
ui.menuView->addAction(DockWidget->toggleViewAction());
|
||||
// We disable focus to test focus highlighting if the dock widget content
|
||||
// does not support focus
|
||||
w->setFocusPolicy(Qt::NoFocus);
|
||||
auto ToolBar = DockWidget->createDefaultToolBar();
|
||||
ToolBar->addAction(ui.actionSaveState);
|
||||
ToolBar->addAction(ui.actionRestoreState);
|
||||
return DockWidget;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a dock widget with a QCalendarWidget
|
||||
*/
|
||||
ads::CDockWidget* createCalendarDockWidget()
|
||||
{
|
||||
static int CalendarCount = 0;
|
||||
QCalendarWidget* w = new QCalendarWidget();
|
||||
ads::CDockWidget* DockWidget = new ads::CDockWidget(QString("Calendar %1").arg(CalendarCount++));
|
||||
// The following lines are for testing the setWidget() and takeWidget()
|
||||
// functionality
|
||||
DockWidget->setWidget(w);
|
||||
DockWidget->setWidget(w); // what happens if we set a widget if a widget is already set
|
||||
DockWidget->takeWidget(); // we remove the widget
|
||||
DockWidget->setWidget(w); // and set the widget again - there should be no error
|
||||
DockWidget->setToggleViewActionMode(ads::CDockWidget::ActionModeShow);
|
||||
DockWidget->setIcon(svgIcon(":/adsdemo/images/date_range.svg"));
|
||||
ui.menuView->addAction(DockWidget->toggleViewAction());
|
||||
auto ToolBar = DockWidget->createDefaultToolBar();
|
||||
ToolBar->addAction(ui.actionSaveState);
|
||||
ToolBar->addAction(ui.actionRestoreState);
|
||||
return DockWidget;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create dock widget with a text label
|
||||
*/
|
||||
ads::CDockWidget* createLongTextLabelDockWidget()
|
||||
{
|
||||
static int LabelCount = 0;
|
||||
QLabel* l = new QLabel();
|
||||
l->setWordWrap(true);
|
||||
l->setAlignment(Qt::AlignTop | Qt::AlignLeft);
|
||||
l->setText(QString("Label %1 %2 - Lorem ipsum dolor sit amet, consectetuer adipiscing elit. "
|
||||
"Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque "
|
||||
"penatibus et magnis dis parturient montes, nascetur ridiculus mus. "
|
||||
"Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. "
|
||||
"Nulla consequat massa quis enim. Donec pede justo, fringilla vel, "
|
||||
"aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, "
|
||||
"imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede "
|
||||
"mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum "
|
||||
"semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, "
|
||||
"porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, "
|
||||
"dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla "
|
||||
"ut metus varius laoreet.")
|
||||
.arg(LabelCount)
|
||||
.arg(QTime::currentTime().toString("hh:mm:ss:zzz")));
|
||||
|
||||
ads::CDockWidget* DockWidget = new ads::CDockWidget(QString("Label %1").arg(LabelCount++));
|
||||
DockWidget->setWidget(l);
|
||||
ui.menuView->addAction(DockWidget->toggleViewAction());
|
||||
return DockWidget;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates as imple editor widget
|
||||
*/
|
||||
ads::CDockWidget* createEditorWidget()
|
||||
{
|
||||
static int EditorCount = 0;
|
||||
QPlainTextEdit* w = new QPlainTextEdit();
|
||||
w->setPlaceholderText("This is an editor. If you close the editor, it will be "
|
||||
"deleted. Enter your text here.");
|
||||
w->setStyleSheet("border: none");
|
||||
ads::CDockWidget* DockWidget = new ads::CDockWidget(QString("Editor %1").arg(EditorCount++));
|
||||
DockWidget->setWidget(w);
|
||||
DockWidget->setIcon(svgIcon(":/adsdemo/images/edit.svg"));
|
||||
DockWidget->setFeature(ads::CDockWidget::CustomCloseHandling, true);
|
||||
ui.menuView->addAction(DockWidget->toggleViewAction());
|
||||
|
||||
QMenu* OptionsMenu = new QMenu(DockWidget);
|
||||
OptionsMenu->setTitle(QObject::tr("Options"));
|
||||
OptionsMenu->setToolTip(OptionsMenu->title());
|
||||
OptionsMenu->setIcon(svgIcon(":/adsdemo/images/custom-menu-button.svg"));
|
||||
auto MenuAction = OptionsMenu->menuAction();
|
||||
// The object name of the action will be set for the QToolButton that
|
||||
// is created in the dock area title bar. You can use this name for CSS
|
||||
// styling
|
||||
MenuAction->setObjectName("optionsMenu");
|
||||
DockWidget->setTitleBarActions({OptionsMenu->menuAction()});
|
||||
auto a = OptionsMenu->addAction(QObject::tr("Clear Editor"));
|
||||
w->connect(a, SIGNAL(triggered()), SLOT(clear()));
|
||||
|
||||
return DockWidget;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a table widget
|
||||
*/
|
||||
ads::CDockWidget* createTableWidget()
|
||||
{
|
||||
static int TableCount = 0;
|
||||
auto w = new CMinSizeTableWidget();
|
||||
ads::CDockWidget* DockWidget = new ads::CDockWidget(QString("Table %1").arg(TableCount++));
|
||||
static int colCount = 5;
|
||||
static int rowCount = 30;
|
||||
w->setColumnCount(colCount);
|
||||
w->setRowCount(rowCount);
|
||||
for (int col = 0; col < colCount; ++col)
|
||||
{
|
||||
w->setHorizontalHeaderItem(col, new QTableWidgetItem(QString("Col %1").arg(col+1)));
|
||||
for (int row = 0; row < rowCount; ++row)
|
||||
{
|
||||
w->setItem(row, col, new QTableWidgetItem(QString("T %1-%2").arg(row + 1).arg(col+1)));
|
||||
}
|
||||
}
|
||||
DockWidget->setWidget(w);
|
||||
DockWidget->setIcon(svgIcon(":/adsdemo/images/grid_on.svg"));
|
||||
DockWidget->setMinimumSizeHintMode(ads::CDockWidget::MinimumSizeHintFromContent);
|
||||
auto ToolBar = DockWidget->createDefaultToolBar();
|
||||
auto Action = ToolBar->addAction(svgIcon(":/adsdemo/images/fullscreen.svg"), "Toggle Fullscreen");
|
||||
QObject::connect(Action, &QAction::triggered, [=]()
|
||||
{
|
||||
if (DockWidget->isFullScreen())
|
||||
{
|
||||
DockWidget->showNormal();
|
||||
}
|
||||
else
|
||||
{
|
||||
DockWidget->showFullScreen();
|
||||
}
|
||||
});
|
||||
ui.menuView->addAction(DockWidget->toggleViewAction());
|
||||
return DockWidget;
|
||||
}
|
||||
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
/**
|
||||
* Creates an ActiveX widget on windows
|
||||
*/
|
||||
ads::CDockWidget* createActiveXWidget(QWidget* parent = nullptr)
|
||||
{
|
||||
static int ActiveXCount = 0;
|
||||
QAxWidget* w = new QAxWidget("{6bf52a52-394a-11d3-b153-00c04f79faa6}", parent);
|
||||
ads::CDockWidget* DockWidget = new ads::CDockWidget(QString("Active X %1").arg(ActiveXCount++));
|
||||
DockWidget->setWidget(w);
|
||||
ui.menuView->addAction(DockWidget->toggleViewAction());
|
||||
return DockWidget;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
//============================================================================
|
||||
void MainWindowPrivate::createContent()
|
||||
{
|
||||
// Test container docking
|
||||
QMenu* ViewMenu = ui.menuView;
|
||||
auto DockWidget = createCalendarDockWidget(ViewMenu);
|
||||
auto DockWidget = createCalendarDockWidget();
|
||||
DockWidget->setFeature(ads::CDockWidget::DockWidgetClosable, false);
|
||||
DockWidget->setFeature(ads::CDockWidget::DockWidgetMovable, false);
|
||||
DockWidget->setFeature(ads::CDockWidget::DockWidgetFloatable, false);
|
||||
auto SpecialDockArea = DockManager->addDockWidget(ads::LeftDockWidgetArea, DockWidget);
|
||||
|
||||
// For this Special Dock Area we want to avoid dropping on the center of it (i.e. we don't want this widget to be ever tabbified):
|
||||
@@ -326,19 +390,16 @@ void MainWindowPrivate::createContent()
|
||||
//SpecialDockArea->setAllowedAreas({ads::LeftDockWidgetArea, ads::RightDockWidgetArea}); // just for testing
|
||||
}
|
||||
|
||||
DockManager->addDockWidget(ads::LeftDockWidgetArea, createLongTextLabelDockWidget(ViewMenu));
|
||||
auto FileSystemWidget = createFileSystemTreeDockWidget(ViewMenu);
|
||||
auto ToolBar = FileSystemWidget->createDefaultToolBar();
|
||||
ToolBar->addAction(ui.actionSaveState);
|
||||
ToolBar->addAction(ui.actionRestoreState);
|
||||
DockWidget = createLongTextLabelDockWidget();
|
||||
WindowTitleTestDockWidget = DockWidget;
|
||||
DockWidget->setFeature(ads::CDockWidget::DockWidgetFocusable, false);
|
||||
DockManager->addDockWidget(ads::LeftDockWidgetArea, DockWidget);
|
||||
auto FileSystemWidget = createFileSystemTreeDockWidget();
|
||||
FileSystemWidget->setFeature(ads::CDockWidget::DockWidgetFloatable, false);
|
||||
appendFeaturStringToWindowTitle(FileSystemWidget);
|
||||
DockManager->addDockWidget(ads::BottomDockWidgetArea, FileSystemWidget);
|
||||
|
||||
FileSystemWidget = createFileSystemTreeDockWidget(ViewMenu);
|
||||
ToolBar = FileSystemWidget->createDefaultToolBar();
|
||||
ToolBar->addAction(ui.actionSaveState);
|
||||
ToolBar->addAction(ui.actionRestoreState);
|
||||
FileSystemWidget = createFileSystemTreeDockWidget();
|
||||
FileSystemWidget->setFeature(ads::CDockWidget::DockWidgetMovable, false);
|
||||
FileSystemWidget->setFeature(ads::CDockWidget::DockWidgetFloatable, false);
|
||||
appendFeaturStringToWindowTitle(FileSystemWidget);
|
||||
@@ -346,16 +407,32 @@ void MainWindowPrivate::createContent()
|
||||
// Test custom factory - we inject a help button into the title bar
|
||||
ads::CDockComponentsFactory::setFactory(new CCustomComponentsFactory());
|
||||
auto TopDockArea = DockManager->addDockWidget(ads::TopDockWidgetArea, FileSystemWidget);
|
||||
// Uncomment the next line if you would like to test the
|
||||
// HideSingleWidgetTitleBar functionality
|
||||
// TopDockArea->setDockAreaFlag(ads::CDockAreaWidget::HideSingleWidgetTitleBar, true);
|
||||
ads::CDockComponentsFactory::resetDefaultFactory();
|
||||
|
||||
// We create a calendar widget and clear all flags to prevent the dock area
|
||||
// from closing
|
||||
DockWidget = createCalendarDockWidget(ViewMenu);
|
||||
DockWidget->setFeature(ads::CDockWidget::DockWidgetClosable, false);
|
||||
DockWidget->setFeature(ads::CDockWidget::DockWidgetMovable, false);
|
||||
DockWidget->setFeature(ads::CDockWidget::DockWidgetFloatable, false);
|
||||
DockWidget = createCalendarDockWidget();
|
||||
DockWidget->setTabToolTip(QString("Tab ToolTip\nHodie est dies magna"));
|
||||
auto DockArea = DockManager->addDockWidget(ads::CenterDockWidgetArea, DockWidget, TopDockArea);
|
||||
// Now we create a action to test resizing of DockArea widget
|
||||
auto Action = ui.menuTests->addAction(QString("Resize %1").arg(DockWidget->windowTitle()));
|
||||
QObject::connect(Action, &QAction::triggered, [DockArea]()
|
||||
{
|
||||
// Resizing only works, if the Splitter is visible and has a valid
|
||||
// sizes
|
||||
auto Splitter = ads::internal::findParent<ads::CDockSplitter*>(DockArea);
|
||||
if (!Splitter)
|
||||
{
|
||||
return;
|
||||
}
|
||||
// We change the sizes of the splitter that contains the Calendar 1 widget
|
||||
// to resize the dock widget
|
||||
int Width = Splitter->width();
|
||||
Splitter->setSizes({Width * 2/3, Width * 1/3});
|
||||
});
|
||||
|
||||
// Now we add a custom button to the dock area title bar that will create
|
||||
// new editor widgets when clicked
|
||||
@@ -363,32 +440,40 @@ void MainWindowPrivate::createContent()
|
||||
CustomButton->setToolTip(QObject::tr("Create Editor"));
|
||||
CustomButton->setIcon(svgIcon(":/adsdemo/images/plus.svg"));
|
||||
CustomButton->setAutoRaise(true);
|
||||
|
||||
auto TitleBar = DockArea->titleBar();
|
||||
int Index = TitleBar->indexOf(TitleBar->tabBar());
|
||||
TitleBar->insertWidget(Index + 1, CustomButton);
|
||||
QObject::connect(CustomButton, &QToolButton::clicked, [=]()
|
||||
{
|
||||
auto DockWidget = createEditorWidget(ui.menuView);
|
||||
auto DockWidget = createEditorWidget();
|
||||
DockWidget->setFeature(ads::CDockWidget::DockWidgetDeleteOnClose, true);
|
||||
DockManager->addDockWidgetTabToArea(DockWidget, DockArea);
|
||||
_this->connect(DockWidget, SIGNAL(closeRequested()), SLOT(onEditorCloseRequested()));
|
||||
});
|
||||
|
||||
// Test dock area docking
|
||||
auto RighDockArea = DockManager->addDockWidget(ads::RightDockWidgetArea, createLongTextLabelDockWidget(ViewMenu), TopDockArea);
|
||||
DockManager->addDockWidget(ads::TopDockWidgetArea, createLongTextLabelDockWidget(ViewMenu), RighDockArea);
|
||||
auto BottomDockArea = DockManager->addDockWidget(ads::BottomDockWidgetArea, createLongTextLabelDockWidget(ViewMenu), RighDockArea);
|
||||
DockManager->addDockWidget(ads::CenterDockWidgetArea, createLongTextLabelDockWidget(ViewMenu), RighDockArea);
|
||||
DockManager->addDockWidget(ads::CenterDockWidgetArea, createLongTextLabelDockWidget(ViewMenu), BottomDockArea);
|
||||
auto RighDockArea = DockManager->addDockWidget(ads::RightDockWidgetArea, createLongTextLabelDockWidget(), TopDockArea);
|
||||
DockManager->addDockWidget(ads::TopDockWidgetArea, createLongTextLabelDockWidget(), RighDockArea);
|
||||
auto BottomDockArea = DockManager->addDockWidget(ads::BottomDockWidgetArea, createLongTextLabelDockWidget(), RighDockArea);
|
||||
DockManager->addDockWidget(ads::CenterDockWidgetArea, createLongTextLabelDockWidget(), RighDockArea);
|
||||
DockManager->addDockWidget(ads::CenterDockWidgetArea, createLongTextLabelDockWidget(), BottomDockArea);
|
||||
|
||||
auto Action = ui.menuView->addAction(QString("Set %1 floating").arg(DockWidget->windowTitle()));
|
||||
Action = ui.menuTests->addAction(QString("Set %1 Floating").arg(DockWidget->windowTitle()));
|
||||
DockWidget->connect(Action, SIGNAL(triggered()), SLOT(setFloating()));
|
||||
Action = ui.menuTests->addAction(QString("Set %1 As Current Tab").arg(DockWidget->windowTitle()));
|
||||
DockWidget->connect(Action, SIGNAL(triggered()), SLOT(setAsCurrentTab()));
|
||||
Action = ui.menuTests->addAction(QString("Raise %1").arg(DockWidget->windowTitle()));
|
||||
DockWidget->connect(Action, SIGNAL(triggered()), SLOT(raise()));
|
||||
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
if (!DockManager->configFlags().testFlag(ads::CDockManager::OpaqueUndocking))
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
if (!ads::CDockManager::testConfigFlag(ads::CDockManager::OpaqueUndocking))
|
||||
{
|
||||
DockManager->addDockWidget(ads::CenterDockWidgetArea, createActiveXWidget(ViewMenu), RighDockArea);
|
||||
DockManager->addDockWidget(ads::CenterDockWidgetArea, createActiveXWidget(), RighDockArea);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
for (auto DockWidget : DockManager->dockWidgetsMap())
|
||||
@@ -420,15 +505,33 @@ void MainWindowPrivate::createActions()
|
||||
ui.toolBar->addAction(PerspectiveListAction);
|
||||
ui.toolBar->addAction(SavePerspectiveAction);
|
||||
|
||||
QAction* a = ui.toolBar->addAction("Create Editor");
|
||||
QAction* a = ui.toolBar->addAction("Create Floating Editor");
|
||||
a->setProperty("Floating", true);
|
||||
a->setToolTip("Creates floating dynamic dockable editor windows that are deleted on close");
|
||||
a->setIcon(svgIcon(":/adsdemo/images/note_add.svg"));
|
||||
_this->connect(a, SIGNAL(triggered()), SLOT(createEditor()));
|
||||
ui.menuTests->addAction(a);
|
||||
|
||||
a = ui.toolBar->addAction("Create Table");
|
||||
a = ui.toolBar->addAction("Create Docked Editor");
|
||||
a->setProperty("Floating", false);
|
||||
a->setToolTip("Creates a docked editor windows that are deleted on close");
|
||||
a->setIcon(svgIcon(":/adsdemo/images/docked_editor.svg"));
|
||||
_this->connect(a, SIGNAL(triggered()), SLOT(createEditor()));
|
||||
ui.menuTests->addAction(a);
|
||||
|
||||
a = ui.toolBar->addAction("Create Floating Table");
|
||||
a->setToolTip("Creates floating dynamic dockable table with millions of entries");
|
||||
a->setIcon(svgIcon(":/adsdemo/images/grid_on.svg"));
|
||||
_this->connect(a, SIGNAL(triggered()), SLOT(createTable()));
|
||||
ui.menuTests->addAction(a);
|
||||
|
||||
ui.menuTests->addSeparator();
|
||||
a = ui.menuTests->addAction("Show Status Dialog");
|
||||
_this->connect(a, SIGNAL(triggered()), SLOT(showStatusDialog()));
|
||||
|
||||
a = ui.menuTests->addAction("Toggle Label 0 Window Title");
|
||||
_this->connect(a, SIGNAL(triggered()), SLOT(toggleDockWidgetWindowTitle()));
|
||||
ui.menuTests->addSeparator();
|
||||
}
|
||||
|
||||
|
||||
@@ -479,7 +582,7 @@ CMainWindow::CMainWindow(QWidget *parent) :
|
||||
{
|
||||
using namespace ads;
|
||||
d->ui.setupUi(this);
|
||||
|
||||
setWindowTitle(QApplication::instance()->applicationName());
|
||||
d->createActions();
|
||||
|
||||
// uncomment the following line if the tab close button should be
|
||||
@@ -515,15 +618,32 @@ CMainWindow::CMainWindow(QWidget *parent) :
|
||||
// uncomment the following line if you want floating container to show active dock widget's icon instead of always showing application icon
|
||||
//CDockManager::setConfigFlag(CDockManager::FloatingContainerHasWidgetIcon, true);
|
||||
|
||||
// uncomment the following line if you want a central widget in the main dock container (the dock manager) without a titlebar
|
||||
// If you enable this code, you can test it in the demo with the Calendar 0
|
||||
// dock widget.
|
||||
// CDockManager::setConfigFlag(CDockManager::HideSingleCentralWidgetTitleBar, true);
|
||||
|
||||
// uncomment the following line to enable focus highlighting of the dock
|
||||
// widget that has the focus
|
||||
CDockManager::setConfigFlag(CDockManager::FocusHighlighting, true);
|
||||
|
||||
// uncomment if you would like to enable an equal distribution of the
|
||||
// available size of a splitter to all contained dock widgets
|
||||
// CDockManager::setConfigFlag(CDockManager::EqualSplitOnInsertion, true);
|
||||
|
||||
// uncomment if you would like to close tabs with the middle mouse button, web browser style
|
||||
// CDockManager::setConfigFlag(CDockManager::MiddleMouseButtonClosesTab, true);
|
||||
|
||||
// Now create the dock manager and its content
|
||||
d->DockManager = new CDockManager(this);
|
||||
|
||||
// uncomment the following line to have the old style where the dock
|
||||
// area close button closes the active tab
|
||||
// CDockManager::setConfigFlags({CDockManager::DockAreaHasCloseButton
|
||||
// | CDockManager::DockAreaCloseButtonClosesTab});
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
connect(d->PerspectiveComboBox, SIGNAL(activated(const QString&)),
|
||||
d->DockManager, SLOT(openPerspective(const QString&)));
|
||||
#else
|
||||
connect(d->PerspectiveComboBox, SIGNAL(textActivated(const QString&)),
|
||||
d->DockManager, SLOT(openPerspective(const QString&)));
|
||||
#endif
|
||||
|
||||
d->createContent();
|
||||
// Default window geometry - center on screen
|
||||
@@ -549,6 +669,9 @@ CMainWindow::~CMainWindow()
|
||||
void CMainWindow::closeEvent(QCloseEvent* event)
|
||||
{
|
||||
d->saveState();
|
||||
// Delete dock manager here to delete all floating widgets. This ensures
|
||||
// that all top level windows of the dock manager are properly closed
|
||||
d->DockManager->deleteLater();
|
||||
QMainWindow::closeEvent(event);
|
||||
}
|
||||
|
||||
@@ -604,24 +727,59 @@ void CMainWindow::onViewToggled(bool Open)
|
||||
//============================================================================
|
||||
void CMainWindow::onViewVisibilityChanged(bool Visible)
|
||||
{
|
||||
Q_UNUSED(Visible);
|
||||
auto DockWidget = qobject_cast<ads::CDockWidget*>(sender());
|
||||
if (!DockWidget)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
qDebug() << DockWidget->objectName() << " visibilityChanged(" << Visible << ")";
|
||||
//qDebug() << DockWidget->objectName() << " visibilityChanged(" << Visible << ")";
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
void CMainWindow::createEditor()
|
||||
{
|
||||
auto DockWidget = createEditorWidget(d->ui.menuView);
|
||||
QObject* Sender = sender();
|
||||
QVariant vFloating = Sender->property("Floating");
|
||||
bool Floating = vFloating.isValid() ? vFloating.toBool() : true;
|
||||
auto DockWidget = d->createEditorWidget();
|
||||
DockWidget->setFeature(ads::CDockWidget::DockWidgetDeleteOnClose, true);
|
||||
auto FloatingWidget = d->DockManager->addDockWidgetFloating(DockWidget);
|
||||
FloatingWidget->move(QPoint(20, 20));
|
||||
DockWidget->setFeature(ads::CDockWidget::DockWidgetForceCloseWithArea, true);
|
||||
connect(DockWidget, SIGNAL(closeRequested()), SLOT(onEditorCloseRequested()));
|
||||
|
||||
if (Floating)
|
||||
{
|
||||
auto FloatingWidget = d->DockManager->addDockWidgetFloating(DockWidget);
|
||||
FloatingWidget->move(QPoint(20, 20));
|
||||
d->LastCreatedFloatingEditor = DockWidget;
|
||||
d->LastDockedEditor.clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
ads::CDockAreaWidget* EditorArea = d->LastDockedEditor ? d->LastDockedEditor->dockAreaWidget() : nullptr;
|
||||
if (EditorArea)
|
||||
{
|
||||
std::cout << "DockAreaCount before: " << EditorArea->dockContainer()->dockAreaCount() << std::endl;
|
||||
d->DockManager->setConfigFlag(ads::CDockManager::EqualSplitOnInsertion, true);
|
||||
d->DockManager->addDockWidget(ads::RightDockWidgetArea, DockWidget, EditorArea);
|
||||
std::cout << "DockAreaCount after: " << DockWidget->dockContainer()->dockAreaCount() << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (d->LastCreatedFloatingEditor)
|
||||
{
|
||||
std::cout << "LastCreated" << std::endl;
|
||||
d->DockManager->addDockWidget(ads::RightDockWidgetArea, DockWidget, d->LastCreatedFloatingEditor->dockAreaWidget());
|
||||
}
|
||||
else
|
||||
{
|
||||
d->DockManager->addDockWidget(ads::TopDockWidgetArea, DockWidget);
|
||||
}
|
||||
}
|
||||
d->LastDockedEditor = DockWidget;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -642,9 +800,34 @@ void CMainWindow::onEditorCloseRequested()
|
||||
//============================================================================
|
||||
void CMainWindow::createTable()
|
||||
{
|
||||
auto DockWidget = createTableWidget(d->ui.menuView);
|
||||
auto DockWidget = d->createTableWidget();
|
||||
DockWidget->setFeature(ads::CDockWidget::DockWidgetDeleteOnClose, true);
|
||||
auto FloatingWidget = d->DockManager->addDockWidgetFloating(DockWidget);
|
||||
FloatingWidget->move(QPoint(40, 40));
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
void CMainWindow::showStatusDialog()
|
||||
{
|
||||
CStatusDialog Dialog(d->DockManager);
|
||||
Dialog.exec();
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
void CMainWindow::toggleDockWidgetWindowTitle()
|
||||
{
|
||||
QString Title = d->WindowTitleTestDockWidget->windowTitle();
|
||||
int i = Title.indexOf(" (Test)");
|
||||
if (-1 == i)
|
||||
{
|
||||
Title += " (Test)";
|
||||
}
|
||||
else
|
||||
{
|
||||
Title = Title.left(i);
|
||||
}
|
||||
d->WindowTitleTestDockWidget->setWindowTitle(Title);
|
||||
}
|
||||
|
||||
|
||||
@@ -63,6 +63,8 @@ private slots:
|
||||
void createEditor();
|
||||
void createTable();
|
||||
void onEditorCloseRequested();
|
||||
void showStatusDialog();
|
||||
void toggleDockWidgetWindowTitle();
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
||||
|
||||
88
demo/StatusDialog.cpp
Normal file
@@ -0,0 +1,88 @@
|
||||
//============================================================================
|
||||
/// \file StatusDialog.cpp
|
||||
/// \author Uwe Kindler
|
||||
/// \date 13.04.2020
|
||||
/// \brief Implementation of CStatusDialog class
|
||||
//============================================================================
|
||||
|
||||
//============================================================================
|
||||
// INCLUDES
|
||||
//============================================================================
|
||||
#include "StatusDialog.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "DockManager.h"
|
||||
#include "DockWidget.h"
|
||||
#include "ui_StatusDialog.h"
|
||||
|
||||
/**
|
||||
* Private data class of CStatusDialog class (pimpl)
|
||||
*/
|
||||
struct StatusDialogPrivate
|
||||
{
|
||||
CStatusDialog *_this;
|
||||
Ui::CStatusDialogClass ui;
|
||||
ads::CDockManager* DockManager;
|
||||
QMap<QString, ads::CDockWidget*> DockWidgets;
|
||||
|
||||
/**
|
||||
* Private data constructor
|
||||
*/
|
||||
StatusDialogPrivate(CStatusDialog *_public);
|
||||
};
|
||||
// struct StatusDialogPrivate
|
||||
|
||||
//============================================================================
|
||||
StatusDialogPrivate::StatusDialogPrivate(CStatusDialog *_public) :
|
||||
_this(_public)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
CStatusDialog::CStatusDialog(ads::CDockManager* DockManager) :
|
||||
QDialog(DockManager),
|
||||
d(new StatusDialogPrivate(this))
|
||||
{
|
||||
d->ui.setupUi(this);
|
||||
d->DockManager = DockManager;
|
||||
d->DockWidgets = DockManager->dockWidgetsMap();
|
||||
|
||||
for (auto it = d->DockWidgets.begin(); it != d->DockWidgets.end(); ++it)
|
||||
{
|
||||
QVariant vDockWidget = QVariant::fromValue(it.value());
|
||||
d->ui.dockWidgetsComboBox->addItem(it.key(), vDockWidget);
|
||||
}
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
CStatusDialog::~CStatusDialog()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
void CStatusDialog::on_dockWidgetsComboBox_currentIndexChanged(int index)
|
||||
{
|
||||
if (index < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
auto vDockWidget = d->ui.dockWidgetsComboBox->currentData();
|
||||
auto DockWidget = vDockWidget.value<ads::CDockWidget*>();
|
||||
d->ui.isClosedCheckBox->setChecked(DockWidget->isClosed());
|
||||
d->ui.isFloatingCheckBox->setChecked(DockWidget->isFloating());
|
||||
d->ui.tabbedCheckBox->setChecked(DockWidget->isTabbed());
|
||||
d->ui.isCurrentTabCheckBox->setChecked(DockWidget->isCurrentTab());
|
||||
d->ui.closableCheckBox->setChecked(DockWidget->features().testFlag(ads::CDockWidget::DockWidgetClosable));
|
||||
d->ui.movableCheckBox->setChecked(DockWidget->features().testFlag(ads::CDockWidget::DockWidgetMovable));
|
||||
d->ui.floatableCheckBox->setChecked(DockWidget->features().testFlag(ads::CDockWidget::DockWidgetFloatable));
|
||||
d->ui.deleteOnCloseCheckBox->setChecked(DockWidget->features().testFlag(ads::CDockWidget::DockWidgetDeleteOnClose));
|
||||
d->ui.customCloseHandlingCheckBox->setChecked(DockWidget->features().testFlag(ads::CDockWidget::CustomCloseHandling));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// EOF StatusDialog.cpp
|
||||
47
demo/StatusDialog.h
Normal file
@@ -0,0 +1,47 @@
|
||||
#ifndef StatusDialogH
|
||||
#define StatusDialogH
|
||||
//============================================================================
|
||||
/// \file StatusDialog.h
|
||||
/// \author Uwe Kindler
|
||||
/// \date 13.04.2020
|
||||
/// \brief Declaration of CStatusDialog class
|
||||
//============================================================================
|
||||
|
||||
//============================================================================
|
||||
// INCLUDES
|
||||
//============================================================================
|
||||
#include <QDialog>
|
||||
|
||||
namespace ads {class CDockManager;}
|
||||
struct StatusDialogPrivate;
|
||||
|
||||
/**
|
||||
* Displays status info about dock widgets
|
||||
*/
|
||||
class CStatusDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
StatusDialogPrivate* d; ///< private data (pimpl)
|
||||
friend struct StatusDialogPrivate;
|
||||
|
||||
private slots:
|
||||
void on_dockWidgetsComboBox_currentIndexChanged(int index);
|
||||
|
||||
protected:
|
||||
public:
|
||||
using Super = QDialog;
|
||||
/**
|
||||
* Default Constructor
|
||||
*/
|
||||
CStatusDialog(ads::CDockManager* parent);
|
||||
|
||||
/**
|
||||
* Virtual Destructor
|
||||
*/
|
||||
virtual ~CStatusDialog();
|
||||
}; // class StatusDialog
|
||||
|
||||
// namespace namespace_name
|
||||
//-----------------------------------------------------------------------------
|
||||
#endif // StatusDialogH
|
||||
146
demo/StatusDialog.ui
Normal file
@@ -0,0 +1,146 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CStatusDialogClass</class>
|
||||
<widget class="QDialog" name="CStatusDialogClass">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>357</width>
|
||||
<height>331</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dock Widget Status</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetFixedSize</enum>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="dockWidgetLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Dock Widget:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="dockWidgetsComboBox">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>300</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="statusGroupBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Status</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="isClosedCheckBox">
|
||||
<property name="text">
|
||||
<string>closed</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="isFloatingCheckBox">
|
||||
<property name="text">
|
||||
<string>floating</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="tabbedCheckBox">
|
||||
<property name="text">
|
||||
<string>tabbed</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="isCurrentTabCheckBox">
|
||||
<property name="text">
|
||||
<string>is current tab</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="flagsGroupBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Feature Flags</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="closableCheckBox">
|
||||
<property name="text">
|
||||
<string>DockWidgetClosable</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="movableCheckBox">
|
||||
<property name="text">
|
||||
<string>DockWidgetMovable</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="floatableCheckBox">
|
||||
<property name="text">
|
||||
<string>DockWidgetFloatable</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="deleteOnCloseCheckBox">
|
||||
<property name="text">
|
||||
<string>DockWidgetDeleteOnClose</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="customCloseHandlingCheckBox">
|
||||
<property name="text">
|
||||
<string>CustomCloseHandling</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -4,8 +4,12 @@ TARGET = AdvancedDockingSystemDemo
|
||||
DESTDIR = $${ADS_OUT_ROOT}/lib
|
||||
QT += core gui widgets
|
||||
|
||||
win32 {
|
||||
QT += axcontainer
|
||||
include(../ads.pri)
|
||||
|
||||
lessThan(QT_MAJOR_VERSION, 6) {
|
||||
win32 {
|
||||
QT += axcontainer
|
||||
}
|
||||
}
|
||||
|
||||
CONFIG += c++14
|
||||
@@ -18,34 +22,22 @@ adsBuildStatic {
|
||||
|
||||
SOURCES += \
|
||||
main.cpp \
|
||||
MainWindow.cpp
|
||||
MainWindow.cpp \
|
||||
StatusDialog.cpp
|
||||
|
||||
HEADERS += \
|
||||
MainWindow.h
|
||||
MainWindow.h \
|
||||
StatusDialog.h
|
||||
|
||||
FORMS += \
|
||||
mainwindow.ui
|
||||
mainwindow.ui \
|
||||
StatusDialog.ui
|
||||
|
||||
RESOURCES += demo.qrc
|
||||
|
||||
|
||||
LIBS += -L$${ADS_OUT_ROOT}/lib
|
||||
|
||||
# Dependency: AdvancedDockingSystem (shared)
|
||||
CONFIG(debug, debug|release){
|
||||
win32 {
|
||||
LIBS += -lqtadvanceddockingd
|
||||
}
|
||||
else:mac {
|
||||
LIBS += -lqtadvanceddocking_debug
|
||||
}
|
||||
else {
|
||||
LIBS += -lqtadvanceddocking
|
||||
}
|
||||
}
|
||||
else{
|
||||
LIBS += -lqtadvanceddocking
|
||||
}
|
||||
|
||||
INCLUDEPATH += ../src
|
||||
DEPENDPATH += ../src
|
||||
|
||||
@@ -13,5 +13,9 @@
|
||||
<file>app.css</file>
|
||||
<file>images/plus.svg</file>
|
||||
<file>images/help_outline.svg</file>
|
||||
<file>images/fullscreen.svg</file>
|
||||
<file>images/create_floating_editor.svg</file>
|
||||
<file>images/create_floating_table.svg</file>
|
||||
<file>images/docked_editor.svg</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
80
demo/images/create_floating_editor.svg
Normal file
@@ -0,0 +1,80 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
version="1.1"
|
||||
viewBox="0,0,1024,1024"
|
||||
id="svg2562"
|
||||
sodipodi:docname="create_floating_editor.svg"
|
||||
inkscape:version="0.92.4 (5da689c313, 2019-01-14)">
|
||||
<metadata
|
||||
id="metadata2568">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<defs
|
||||
id="defs2566" />
|
||||
<sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1017"
|
||||
id="namedview2564"
|
||||
showgrid="false"
|
||||
inkscape:zoom="0.23046875"
|
||||
inkscape:cx="512"
|
||||
inkscape:cy="512"
|
||||
inkscape:window-x="-8"
|
||||
inkscape:window-y="-8"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg2562" />
|
||||
<desc
|
||||
id="desc2556">note_add 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
|
||||
style="mix-blend-mode:normal;fill:#03b8e5;fill-rule:nonzero"
|
||||
id="g2560"
|
||||
transform="matrix(0.73242903,0,0,0.73242903,136.99634,136.99634)">
|
||||
<path
|
||||
d="m 853.33,341.33 v 512 c 0,46.93 -38.4,85.34 -85.33,85.34 H 255.57 c -46.93,0 -84.9,-38.41 -84.9,-85.34 l 0.42,-682.66 c 0,-46.93 37.98,-85.34 84.91,-85.34 h 341.33 z m -170.66,256 h -128 v -128 h -85.34 v 128 h -128 v 85.34 h 128 v 128 h 85.34 v -128 h 128 z M 789.33,384 554.67,149.33 V 384 Z"
|
||||
id="path2558"
|
||||
inkscape:connector-curvature="0" />
|
||||
</g>
|
||||
<path
|
||||
style="mix-blend-mode:normal;fill:#03b8e5;fill-rule:nonzero"
|
||||
d="M 426.6699,917.33988 512.4297,1024 597.3301,917.33988 Z"
|
||||
id="path3115"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
style="mix-blend-mode:normal;fill:#03b8e5;fill-rule:nonzero"
|
||||
d="M 426.6699,106.66012 512.4297,0 597.3301,106.66012 Z"
|
||||
id="path3115-7"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
style="mix-blend-mode:normal;fill:#03b8e5;fill-rule:nonzero"
|
||||
d="M 917.33988,426.6699 1024,512.4297 917.33988,597.3301 Z"
|
||||
id="path3115-7-9"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
style="mix-blend-mode:normal;fill:#03b8e5;fill-rule:nonzero"
|
||||
d="M 106.66016,426.6699 0,512.4297 106.66016,597.3301 Z"
|
||||
id="path3115-7-9-4"
|
||||
inkscape:connector-curvature="0" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 3.0 KiB |
80
demo/images/create_floating_table.svg
Normal file
@@ -0,0 +1,80 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
version="1.1"
|
||||
viewBox="0,0,1024,1024"
|
||||
id="svg2562"
|
||||
sodipodi:docname="create_floating_table.svg"
|
||||
inkscape:version="0.92.4 (5da689c313, 2019-01-14)">
|
||||
<metadata
|
||||
id="metadata2568">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<defs
|
||||
id="defs2566" />
|
||||
<sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1017"
|
||||
id="namedview2564"
|
||||
showgrid="false"
|
||||
inkscape:zoom="0.23046875"
|
||||
inkscape:cx="512"
|
||||
inkscape:cy="512"
|
||||
inkscape:window-x="-8"
|
||||
inkscape:window-y="-8"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg2562" />
|
||||
<desc
|
||||
id="desc2556">note_add icon - Licensed under Apache License v2.0 (http://www.apache.org/licenses/LICENSE-2.0) - Created with Iconfu.com - Derivative work of Material icons (Copyright Google Inc.)</desc>
|
||||
<path
|
||||
style="mix-blend-mode:normal;fill:#03b8e5;fill-rule:nonzero"
|
||||
d="M 426.6699,917.33988 512.4297,1024 597.3301,917.33988 Z"
|
||||
id="path3115"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
style="mix-blend-mode:normal;fill:#03b8e5;fill-rule:nonzero"
|
||||
d="M 426.6699,106.66012 512.4297,0 597.3301,106.66012 Z"
|
||||
id="path3115-7"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
style="mix-blend-mode:normal;fill:#03b8e5;fill-rule:nonzero"
|
||||
d="M 917.33988,426.6699 1024,512.4297 917.33988,597.3301 Z"
|
||||
id="path3115-7-9"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
style="mix-blend-mode:normal;fill:#03b8e5;fill-rule:nonzero"
|
||||
d="M 106.66016,426.6699 0,512.4297 106.66016,597.3301 Z"
|
||||
id="path3115-7-9-4"
|
||||
inkscape:connector-curvature="0" />
|
||||
<g
|
||||
id="g3198"
|
||||
style="mix-blend-mode:normal;fill:#03b8e5;fill-rule:nonzero"
|
||||
transform="matrix(0.73241615,0,0,0.73241615,137.00293,137.00293)">
|
||||
<path
|
||||
id="path3196"
|
||||
d="m 938.67,170.67 v 682.66 c 0,46.93 -38.41,85.34 -85.34,85.34 H 170.67 c -46.93,0 -85.34,-38.41 -85.34,-85.34 V 170.67 c 0,-46.93 38.41,-85.34 85.34,-85.34 h 682.66 c 46.93,0 85.34,38.41 85.34,85.34 z m -597.34,0 H 170.67 v 170.66 h 170.66 z m 0,512 H 170.67 v 170.66 h 170.66 z m 0,-256 H 170.67 v 170.66 h 170.66 z m 256,-256 H 426.67 v 170.66 h 170.66 z m 256,0 H 682.67 v 170.66 h 170.66 z m -256,512 H 426.67 v 170.66 h 170.66 z m 0,-256 H 426.67 v 170.66 h 170.66 z m 256,256 H 682.67 v 170.66 h 170.66 z m 0,-256 H 682.67 v 170.66 h 170.66 z"
|
||||
inkscape:connector-curvature="0" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 3.2 KiB |
6
demo/images/docked_editor.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>chrome_reader_mode 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="M981.33,256v554.67c0,46.93 -38.4,85.33 -85.33,85.33h-768c-46.93,0 -85.33,-38.4 -85.33,-85.33v-554.67c0,-46.93 38.4,-85.33 85.33,-85.33h768c46.93,0 85.33,38.4 85.33,85.33zM896,256h-384v554.67h384zM554.67,512h298.66v64h-298.66zM554.67,405.33h298.66v64h-298.66zM554.67,618.67h298.66v64h-298.66z"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 717 B |
6
demo/images/fullscreen.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>settings_overscan 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="M981.33,213.33v597.34c0,46.93 -38.4,85.33 -85.33,85.33h-768c-46.93,0 -85.33,-38.4 -85.33,-85.33v-597.34c0,-46.93 38.4,-85.33 85.33,-85.33h768c46.93,0 85.33,38.4 85.33,85.33zM896,212.91h-768v598.18h768zM256,597.33l-106.67,-84.9l106.67,-85.76zM597.33,341.33h-170.66l85.76,-106.66zM874.67,512.43l-106.67,84.9v-170.66zM512.43,789.33l-85.76,-106.66h170.66z"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 776 B |
@@ -35,12 +35,15 @@ void myMessageOutput(QtMsgType type, const QMessageLogContext &context, const QS
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||
#if QT_VERSION >= 0x050600
|
||||
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
#endif
|
||||
#endif
|
||||
std::shared_ptr<int> b;
|
||||
QApplication a(argc, argv);
|
||||
a.setApplicationName("Advanced Docking System Demo");
|
||||
a.setQuitOnLastWindowClosed(true);
|
||||
|
||||
QFile StyleSheetFile(":/adsdemo/app.css");
|
||||
|
||||
613
demo/main.py
Normal file
@@ -0,0 +1,613 @@
|
||||
import datetime
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
|
||||
from PyQt5 import uic
|
||||
from PyQt5.QtCore import (QCoreApplication, QDir, Qt, QSettings, QSignalBlocker,
|
||||
QRect, QPoint, qDebug, qInstallMessageHandler,
|
||||
QtDebugMsg, QtInfoMsg, QtWarningMsg,
|
||||
QtCriticalMsg, QtFatalMsg, QSize)
|
||||
from PyQt5.QtGui import (QGuiApplication, QIcon, QCloseEvent)
|
||||
from PyQt5.QtWidgets import (QCalendarWidget, QFileSystemModel, QFrame, QLabel,
|
||||
QMenu, QTreeView, QAction, QWidgetAction,
|
||||
QComboBox, QStyle, QSizePolicy, QInputDialog, QMenu,
|
||||
QToolButton, QWidget, QPlainTextEdit,
|
||||
QTableWidget, QTableWidgetItem, QApplication,
|
||||
QMessageBox)
|
||||
try:
|
||||
from PyQt5.QAxContainer import QAxWidget
|
||||
except ImportError:
|
||||
ACTIVEX_AVAILABLE = False
|
||||
else:
|
||||
ACTIVEX_AVAILABLE = True
|
||||
|
||||
from PyQtAds import QtAds
|
||||
|
||||
import rc # pyrcc5 demo.qrc -o rc.py
|
||||
from status_dialog import CStatusDialog
|
||||
|
||||
UI_FILE = os.path.join(os.path.dirname(__file__), 'mainwindow.ui')
|
||||
MainWindowUI, MainWindowBase = uic.loadUiType(UI_FILE)
|
||||
|
||||
|
||||
class _State:
|
||||
label_count = 0
|
||||
calendar_count = 0
|
||||
file_system_count = 0
|
||||
editor_count = 0
|
||||
table_count = 0
|
||||
activex_count = 0
|
||||
|
||||
|
||||
def features_string(dock_widget: QtAds.CDockWidget) -> str:
|
||||
'''Function returns a features string with closable (c), movable (m) and floatable (f)
|
||||
features. i.e. The following string is for a not closable but movable and floatable
|
||||
widget: c- m+ f+'''
|
||||
|
||||
f = dock_widget.features()
|
||||
closable = f & QtAds.CDockWidget.DockWidgetClosable
|
||||
movable = f & QtAds.CDockWidget.DockWidgetMovable
|
||||
floatable = f & QtAds.CDockWidget.DockWidgetFloatable
|
||||
|
||||
return "c{} m{} f{}".format("+" if closable else "-",
|
||||
"+" if movable else "-",
|
||||
"+" if floatable else "-")
|
||||
|
||||
|
||||
def append_feature_string_to_window_title(dock_widget: QtAds.CDockWidget):
|
||||
'''Appends the string returned by features_string() to the window title of
|
||||
the given DockWidget'''
|
||||
|
||||
dock_widget.setWindowTitle(dock_widget.windowTitle() + " ({})".format(features_string(dock_widget)))
|
||||
|
||||
|
||||
def svg_icon(filename: str):
|
||||
'''Helper function to create an SVG icon'''
|
||||
# This is a workaround, because because in item views SVG icons are not
|
||||
# properly scaled and look blurry or pixelate
|
||||
icon = QIcon(filename)
|
||||
icon.addPixmap(icon.pixmap(92))
|
||||
return icon
|
||||
|
||||
|
||||
class CMinSizeTableWidget(QTableWidget):
|
||||
"""Custom QTableWidget with a minimum size hint to test CDockWidget
|
||||
setMinimumSizeHintMode() function of CDockWidget"""
|
||||
|
||||
def minimumSizeHint(self) -> QSize:
|
||||
return QSize(300, 100)
|
||||
|
||||
|
||||
class CCustomComponentsFactory(QtAds.CDockComponentsFactory):
|
||||
|
||||
def createDockAreaTitleBar(self, dock_area: QtAds.CDockAreaWidget) -> QtAds.CDockAreaTitleBar:
|
||||
title_bar = QtAds.CDockAreaTitleBar(dock_area)
|
||||
custom_button = QToolButton(dock_area)
|
||||
custom_button.setToolTip("Help")
|
||||
custom_button.setIcon(svg_icon(":/adsdemo/images/help_outline.svg"))
|
||||
custom_button.setAutoRaise(True)
|
||||
index = title_bar.indexOf(title_bar.button(QtAds.TitleBarButtonTabsMenu))
|
||||
title_bar.insertWidget(index + 1, custom_button)
|
||||
return title_bar
|
||||
|
||||
|
||||
class MainWindow(MainWindowUI, MainWindowBase):
|
||||
save_perspective_action: QAction
|
||||
perspective_list_action: QWidgetAction
|
||||
perspective_combo_box: QComboBox
|
||||
dock_manager: QtAds.CDockManager
|
||||
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
self.save_perspective_action = None
|
||||
self.perspective_list_action = None
|
||||
self.perspective_combo_box = None
|
||||
self.dock_manager = None
|
||||
self.window_title_test_dock_widget = None
|
||||
self.last_docked_editor = None
|
||||
|
||||
self.setupUi(self)
|
||||
self.create_actions()
|
||||
|
||||
# uncomment the following line if the tab close button should be
|
||||
# a QToolButton instead of a QPushButton
|
||||
# QtAds.CDockManager.setConfigFlags(QtAds.CDockManager.configFlags() | QtAds.CDockManager.TabCloseButtonIsToolButton)
|
||||
|
||||
# uncomment the following line if you want to use opaque undocking and
|
||||
# opaque splitter resizing
|
||||
#QtAds.CDockManager.setConfigFlags(QtAds.CDockManager.DefaultOpaqueConfig)
|
||||
|
||||
# uncomment the following line if you want a fixed tab width that does
|
||||
# not change if the visibility of the close button changes
|
||||
#QtAds.CDockManager.setConfigFlag(QtAds.CDockManager.RetainTabSizeWhenCloseButtonHidden, True)
|
||||
|
||||
# uncomment the following line if you don't want close button on DockArea's title bar
|
||||
#QtAds.CDockManager.setConfigFlag(QtAds.CDockManager.DockAreaHasCloseButton, False)
|
||||
|
||||
# uncomment the following line if you don't want undock button on DockArea's title bar
|
||||
#QtAds.CDockManager.setConfigFlag(QtAds.CDockManager.DockAreaHasUndockButton, False)
|
||||
|
||||
# uncomment the following line if you don't want tabs menu button on DockArea's title bar
|
||||
#QtAds.CDockManager.setConfigFlag(QtAds.CDockManager.DockAreaHasTabsMenuButton, False)
|
||||
|
||||
# uncomment the following line if you don't want disabled buttons to appear on DockArea's title bar
|
||||
#QtAds.CDockManager.setConfigFlag(QtAds.CDockManager.DockAreaHideDisabledButtons, True)
|
||||
|
||||
# uncomment the following line if you want to show tabs menu button on DockArea's title bar only when there are more than one tab and at least of them has elided title
|
||||
#QtAds.CDockManager.setConfigFlag(QtAds.CDockManager.DockAreaDynamicTabsMenuButtonVisibility, True)
|
||||
|
||||
# uncomment the following line if you want floating container to always show application title instead of active dock widget's title
|
||||
#QtAds.CDockManager.setConfigFlag(QtAds.CDockManager.FloatingContainerHasWidgetTitle, False)
|
||||
|
||||
# uncomment the following line if you want floating container to show active dock widget's icon instead of always showing application icon
|
||||
#QtAds.CDockManager.setConfigFlag(QtAds.CDockManager.FloatingContainerHasWidgetIcon, True)
|
||||
|
||||
# uncomment the following line if you want a central widget in the main dock container (the dock manager) without a titlebar
|
||||
# If you enable this code, you can test it in the demo with the Calendar 0
|
||||
# dock widget.
|
||||
#QtAds.CDockManager.setConfigFlag(QtAds.CDockManager.HideSingleCentralWidgetTitleBar, True)
|
||||
|
||||
# uncomment the following line to enable focus highlighting of the dock
|
||||
# widget that has the focus
|
||||
QtAds.CDockManager.setConfigFlag(QtAds.CDockManager.FocusHighlighting, True)
|
||||
|
||||
# uncomment if you would like to enable an equal distribution of the
|
||||
# available size of a splitter to all contained dock widgets
|
||||
# QtAds.CDockManager.setConfigFlag(QtAds.CDockManager.EqualSplitOnInsertion, True)
|
||||
|
||||
# Now create the dock manager and its content
|
||||
self.dock_manager = QtAds.CDockManager(self)
|
||||
|
||||
# Uncomment the following line to have the old style where the dock
|
||||
# area close button closes the active tab
|
||||
# QtAds.CDockManager.setConfigFlags(QtAds.CDockManager.DockAreaHasCloseButton
|
||||
# | QtAds.CDockManager.DockAreaCloseButtonClosesTab)
|
||||
self.perspective_combo_box.activated[str].connect(self.dock_manager.openPerspective)
|
||||
|
||||
self.create_content()
|
||||
# Default window geometry - center on screen
|
||||
self.resize(1280, 720)
|
||||
self.setGeometry(QStyle.alignedRect(
|
||||
Qt.LeftToRight, Qt.AlignCenter, self.frameSize(),
|
||||
QGuiApplication.primaryScreen().availableGeometry()))
|
||||
|
||||
# self.restore_state()
|
||||
self.restore_perspectives()
|
||||
|
||||
def create_content(self):
|
||||
# Test container docking
|
||||
dock_widget = self.create_calendar_dock_widget()
|
||||
dock_widget.setFeature(QtAds.CDockWidget.DockWidgetClosable, False)
|
||||
special_dock_area = self.dock_manager.addDockWidget(QtAds.LeftDockWidgetArea, dock_widget)
|
||||
|
||||
# For this Special Dock Area we want to avoid dropping on the center of it (i.e. we don't want this widget to be ever tabbified):
|
||||
special_dock_area.setAllowedAreas(QtAds.OuterDockAreas)
|
||||
# special_dock_area.setAllowedAreas(QtAds.LeftDockWidgetArea | QtAds.RightDockWidgetArea) # just for testing
|
||||
|
||||
dock_widget = self.create_long_text_label_dock_widget()
|
||||
self.window_title_test_dock_widget = dock_widget
|
||||
dock_widget.setFeature(QtAds.CDockWidget.DockWidgetFocusable, False)
|
||||
self.dock_manager.addDockWidget(QtAds.LeftDockWidgetArea, dock_widget)
|
||||
file_system_widget = self.create_file_system_tree_dock_widget()
|
||||
tool_bar = file_system_widget.createDefaultToolBar()
|
||||
tool_bar.addAction(self.actionSaveState)
|
||||
tool_bar.addAction(self.actionRestoreState)
|
||||
file_system_widget.setFeature(QtAds.CDockWidget.DockWidgetFloatable, False)
|
||||
append_feature_string_to_window_title(file_system_widget)
|
||||
self.dock_manager.addDockWidget(QtAds.BottomDockWidgetArea, file_system_widget)
|
||||
|
||||
file_system_widget = self.create_file_system_tree_dock_widget()
|
||||
file_system_widget.setFeature(QtAds.CDockWidget.DockWidgetMovable, False)
|
||||
file_system_widget.setFeature(QtAds.CDockWidget.DockWidgetFloatable, False)
|
||||
append_feature_string_to_window_title(file_system_widget)
|
||||
|
||||
# Test custom factory - we inject a help button into the title bar
|
||||
QtAds.CDockComponentsFactory.setFactory(CCustomComponentsFactory())
|
||||
top_dock_area = self.dock_manager.addDockWidget(QtAds.TopDockWidgetArea, file_system_widget)
|
||||
# Uncomment the next line if you would like to test the
|
||||
# HideSingleWidgetTitleBar functionality
|
||||
# top_dock_area.setDockAreaFlag(QtAds.CDockAreaWidget.HideSingleWidgetTitleBar, True)
|
||||
QtAds.CDockComponentsFactory.resetDefaultFactory()
|
||||
|
||||
# We create a calendar widget and clear all flags to prevent the dock area
|
||||
# from closing
|
||||
dock_widget = self.create_calendar_dock_widget()
|
||||
dock_widget.setTabToolTip("Tab ToolTip\nHodie est dies magna")
|
||||
dock_area = self.dock_manager.addDockWidget(QtAds.CenterDockWidgetArea, dock_widget, top_dock_area)
|
||||
# Now we create a action to test resizing of DockArea widget
|
||||
action = self.menuTests.addAction("Resize {}".format(dock_widget.windowTitle()))
|
||||
def action_triggered():
|
||||
splitter = QtAds.internal.findParent(QtAds.CDockSplitter, dock_area)
|
||||
if not splitter:
|
||||
return
|
||||
# We change the sizes of the splitter that contains the Calendar 1 widget
|
||||
# to resize the dock widget
|
||||
width = splitter.width()
|
||||
splitter.setSizes([width * 2/3, width * 1/3])
|
||||
action.triggered.connect(action_triggered)
|
||||
|
||||
# Now we add a custom button to the dock area title bar that will create
|
||||
# new editor widgets when clicked
|
||||
custom_button = QToolButton(dock_area)
|
||||
custom_button.setToolTip("Create Editor")
|
||||
custom_button.setIcon(svg_icon(":/adsdemo/images/plus.svg"))
|
||||
custom_button.setAutoRaise(True)
|
||||
|
||||
title_bar = dock_area.titleBar()
|
||||
index = title_bar.indexOf(title_bar.tabBar())
|
||||
title_bar.insertWidget(index + 1, custom_button)
|
||||
def on_button_clicked():
|
||||
dock_widget = self.create_editor_widget()
|
||||
dock_widget.setFeature(QtAds.CDockWidget.DockWidgetDeleteOnClose, True)
|
||||
self.dock_manager.addDockWidgetTabToArea(dock_widget, dock_area)
|
||||
dock_widget.closeRequested.connect(self.on_editor_close_requested)
|
||||
custom_button.clicked.connect(on_button_clicked)
|
||||
|
||||
# Test dock area docking
|
||||
right_dock_area = self.dock_manager.addDockWidget(
|
||||
QtAds.RightDockWidgetArea,
|
||||
self.create_long_text_label_dock_widget(), top_dock_area)
|
||||
self.dock_manager.addDockWidget(
|
||||
QtAds.TopDockWidgetArea,
|
||||
self.create_long_text_label_dock_widget(), right_dock_area)
|
||||
|
||||
bottom_dock_area = self.dock_manager.addDockWidget(
|
||||
QtAds.BottomDockWidgetArea,
|
||||
self.create_long_text_label_dock_widget(), right_dock_area)
|
||||
|
||||
self.dock_manager.addDockWidget(
|
||||
QtAds.CenterDockWidgetArea,
|
||||
self.create_long_text_label_dock_widget(), right_dock_area)
|
||||
self.dock_manager.addDockWidget(
|
||||
QtAds.CenterDockWidgetArea,
|
||||
self.create_long_text_label_dock_widget(), bottom_dock_area)
|
||||
|
||||
|
||||
action = self.menuTests.addAction("Set {} Floating".format(dock_widget.windowTitle()))
|
||||
action.triggered.connect(dock_widget.setFloating)
|
||||
action = self.menuTests.addAction("Set {} As Current Tab".format(dock_widget.windowTitle()))
|
||||
action.triggered.connect(dock_widget.setAsCurrentTab)
|
||||
action = self.menuTests.addAction("Raise {}".format(dock_widget.windowTitle()))
|
||||
action.triggered.connect(dock_widget.raise_)
|
||||
|
||||
if ACTIVEX_AVAILABLE:
|
||||
flags = self.dock_manager.configFlags()
|
||||
if flags & QtAds.CDockManager.OpaqueUndocking:
|
||||
self.dock_manager.addDockWidget(QtAds.CenterDockWidgetArea,
|
||||
self.create_activex_widget(), right_dock_area)
|
||||
|
||||
for dock_widget in self.dock_manager.dockWidgetsMap().values():
|
||||
dock_widget.viewToggled.connect(self.on_view_toggled)
|
||||
dock_widget.visibilityChanged.connect(self.on_view_visibility_changed)
|
||||
|
||||
def create_actions(self):
|
||||
self.toolBar.addAction(self.actionSaveState)
|
||||
self.toolBar.setToolButtonStyle(Qt.ToolButtonTextUnderIcon)
|
||||
self.actionSaveState.setIcon(svg_icon(":/adsdemo/images/save.svg"))
|
||||
self.toolBar.addAction(self.actionRestoreState)
|
||||
self.actionRestoreState.setIcon(svg_icon(":/adsdemo/images/restore.svg"))
|
||||
|
||||
self.save_perspective_action = QAction("Create Perspective", self)
|
||||
self.save_perspective_action.setIcon(svg_icon(":/adsdemo/images/picture_in_picture.svg"))
|
||||
self.save_perspective_action.triggered.connect(self.save_perspective)
|
||||
self.perspective_list_action = QWidgetAction(self)
|
||||
self.perspective_combo_box = QComboBox(self)
|
||||
self.perspective_combo_box.setSizeAdjustPolicy(QComboBox.AdjustToContents)
|
||||
self.perspective_combo_box.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
|
||||
self.perspective_list_action.setDefaultWidget(self.perspective_combo_box)
|
||||
self.toolBar.addSeparator()
|
||||
self.toolBar.addAction(self.perspective_list_action)
|
||||
self.toolBar.addAction(self.save_perspective_action)
|
||||
|
||||
a = self.toolBar.addAction("Create Floating Editor")
|
||||
a.setProperty("Floating", True)
|
||||
a.setToolTip("Creates floating dynamic dockable editor windows that are deleted on close")
|
||||
a.setIcon(svg_icon(":/adsdemo/images/note_add.svg"))
|
||||
a.triggered.connect(self.create_editor)
|
||||
self.menuTests.addAction(a)
|
||||
|
||||
a = self.toolBar.addAction("Create Docked Editor")
|
||||
a.setProperty("Floating", False)
|
||||
a.setToolTip("Creates a docked editor windows that are deleted on close")
|
||||
a.setIcon(svg_icon(":/adsdemo/images/docked_editor.svg"))
|
||||
a.triggered.connect(self.create_editor)
|
||||
self.menuTests.addAction(a)
|
||||
|
||||
a = self.toolBar.addAction("Create Floating Table")
|
||||
a.setToolTip("Creates floating dynamic dockable table with millions of entries")
|
||||
a.setIcon(svg_icon(":/adsdemo/images/grid_on.svg"))
|
||||
a.triggered.connect(self.create_table)
|
||||
self.menuTests.addAction(a)
|
||||
|
||||
self.menuTests.addSeparator()
|
||||
a = self.menuTests.addAction("Show Status Dialog")
|
||||
a.triggered.connect(self.show_status_dialog)
|
||||
self.menuTests.addSeparator()
|
||||
|
||||
def closeEvent(self, event: QCloseEvent):
|
||||
self.save_state()
|
||||
self.dock_manager.deleteLater()
|
||||
super().closeEvent(event)
|
||||
|
||||
def on_actionSaveState_triggered(self, state: bool):
|
||||
qDebug("MainWindow::on_action_save_state_triggered")
|
||||
self.save_state()
|
||||
|
||||
def on_actionRestoreState_triggered(self, state: bool):
|
||||
qDebug("MainWindow::on_action_restore_state_triggered")
|
||||
self.restore_state()
|
||||
|
||||
def save_perspective(self):
|
||||
perspective_name, ok = QInputDialog.getText(self, "Save perspective",
|
||||
"Enter unique name:")
|
||||
|
||||
if ok and perspective_name:
|
||||
self.dock_manager.addPerspective(perspective_name)
|
||||
_ = QSignalBlocker(self.perspective_combo_box)
|
||||
self.perspective_combo_box.clear()
|
||||
self.perspective_combo_box.addItems(self.dock_manager.perspectiveNames())
|
||||
self.perspective_combo_box.setCurrentText(perspective_name)
|
||||
|
||||
self.save_perspectives()
|
||||
|
||||
def on_view_toggled(self, open: bool):
|
||||
dock_widget = self.sender()
|
||||
if dock_widget is None:
|
||||
return
|
||||
|
||||
qDebug("{} view_toggled({})".format(dock_widget.objectName(), open))
|
||||
|
||||
def on_view_visibility_changed(self, visible: bool):
|
||||
dock_widget = self.sender()
|
||||
if dock_widget is None:
|
||||
return
|
||||
|
||||
# qDebug("{} visibility_changed({})".format(dock_widget.objectName(), visible))
|
||||
|
||||
def create_editor(self):
|
||||
sender = self.sender()
|
||||
floating = sender.property("Floating")
|
||||
dock_widget = self.create_editor_widget()
|
||||
dock_widget.setFeature(QtAds.CDockWidget.DockWidgetDeleteOnClose, True)
|
||||
dock_widget.setFeature(QtAds.CDockWidget.DockWidgetForceCloseWithArea, True)
|
||||
dock_widget.closeRequested.connect(self.on_editor_close_requested)
|
||||
|
||||
if floating:
|
||||
floating_widget = self.dock_manager.addDockWidgetFloating(dock_widget)
|
||||
floating_widget.move(QPoint(20, 20))
|
||||
else:
|
||||
editor_area = self.last_docked_editor.dockAreaWidget() if self.last_docked_editor is not None else None
|
||||
if editor_area is not None:
|
||||
self.dock_manager.setConfigFlag(QtAds.CDockManager.EqualSplitOnInsertion, True)
|
||||
self.dock_manager.addDockWidget(QtAds.RightDockWidgetArea, dock_widget, editor_area)
|
||||
else:
|
||||
self.dock_manager.addDockWidget(QtAds.TopDockWidgetArea, dock_widget)
|
||||
self.last_docked_editor = dock_widget
|
||||
|
||||
def on_editor_close_requested(self):
|
||||
dock_widget = self.sender()
|
||||
result = QMessageBox.question(self, "Close Editor",
|
||||
"Editor {} contains unsaved changes? Would you like to close it?".format(dock_widget.windowTitle()))
|
||||
if result == QMessageBox.Yes:
|
||||
dock_widget.closeDockWidget()
|
||||
|
||||
def create_table(self):
|
||||
dock_widget = self.create_table_widget()
|
||||
dock_widget.setFeature(QtAds.CDockWidget.DockWidgetDeleteOnClose, True)
|
||||
floating_widget = self.dock_manager.addDockWidgetFloating(dock_widget)
|
||||
floating_widget.move(QPoint(40, 40))
|
||||
|
||||
def show_status_dialog(self):
|
||||
dialog = CStatusDialog(self.dock_manager)
|
||||
dialog.exec_()
|
||||
|
||||
|
||||
def toggle_dock_widget_window_title(self):
|
||||
title = self.window_title_test_dock_widget.windowTitle()
|
||||
i = title.find(" (Test) ")
|
||||
if i == -1:
|
||||
title += " (Test) "
|
||||
else:
|
||||
title = title[i]
|
||||
self.window_title_test_dock_widget.setWindowTitle(title)
|
||||
|
||||
def save_state(self):
|
||||
'''
|
||||
Saves the dock manager state and the main window geometry
|
||||
'''
|
||||
settings = QSettings("Settings.ini", QSettings.IniFormat)
|
||||
settings.setValue("mainWindow/Geometry", self.saveGeometry())
|
||||
settings.setValue("mainWindow/State", self.saveState())
|
||||
settings.setValue("mainWindow/DockingState", self.dock_manager.saveState())
|
||||
|
||||
def restore_state(self):
|
||||
'''
|
||||
Restores the dock manager state
|
||||
'''
|
||||
settings = QSettings("Settings.ini", QSettings.IniFormat)
|
||||
geom = settings.value("mainWindow/Geometry")
|
||||
if geom is not None:
|
||||
self.restoreGeometry(geom)
|
||||
|
||||
state = settings.value("mainWindow/State")
|
||||
if state is not None:
|
||||
self.restoreState(state)
|
||||
|
||||
state = settings.value("mainWindow/DockingState")
|
||||
if state is not None:
|
||||
self.dock_manager.restore_state(state)
|
||||
|
||||
def save_perspectives(self):
|
||||
'''
|
||||
Save the list of perspectives
|
||||
'''
|
||||
settings = QSettings("Settings.ini", QSettings.IniFormat)
|
||||
self.dock_manager.savePerspectives(settings)
|
||||
|
||||
def restore_perspectives(self):
|
||||
'''
|
||||
Restore the perspective listo of the dock manager
|
||||
'''
|
||||
settings = QSettings("Settings.ini", QSettings.IniFormat)
|
||||
self.dock_manager.loadPerspectives(settings)
|
||||
self.perspective_combo_box.clear()
|
||||
self.perspective_combo_box.addItems(self.dock_manager.perspectiveNames())
|
||||
|
||||
def save_perspective(self):
|
||||
perspective_name, ok = QInputDialog.getText(self, 'Save perspective', 'Enter unique name:')
|
||||
if ok and perspective_name:
|
||||
self.dock_manager.addPerspective(perspective_name)
|
||||
_ = QSignalBlocker(self.perspective_combo_box)
|
||||
self.perspective_combo_box.clear()
|
||||
self.perspective_combo_box.addItems(self.dock_manager.perspectiveNames())
|
||||
self.perspective_combo_box.setCurrentText(perspective_name)
|
||||
self.save_perspectives()
|
||||
|
||||
def create_long_text_label_dock_widget(self) -> QtAds.CDockWidget:
|
||||
label = QLabel()
|
||||
label.setWordWrap(True)
|
||||
label.setAlignment(Qt.AlignTop | Qt.AlignLeft)
|
||||
label.setText('''Label {} {} - Lorem ipsum dolor sit amet, consectetuer
|
||||
adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum
|
||||
sociis natoque penatibus et magnis dis parturient montes, nascetur
|
||||
ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium
|
||||
quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla
|
||||
vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut,
|
||||
imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis
|
||||
pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi.
|
||||
Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu,
|
||||
consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra
|
||||
quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet.
|
||||
'''.format(_State.label_count, datetime.datetime.now().strftime("%H:%M:%S:%f")))
|
||||
dock_widget = QtAds.CDockWidget("Label {}".format(_State.label_count))
|
||||
_State.label_count += 1
|
||||
dock_widget.setWidget(label)
|
||||
|
||||
self.menuView.addAction(dock_widget.toggleViewAction())
|
||||
return dock_widget
|
||||
|
||||
def create_calendar_dock_widget(self) -> QtAds.CDockWidget:
|
||||
widget = QCalendarWidget()
|
||||
|
||||
dock_widget = QtAds.CDockWidget("Calendar {}".format(_State.calendar_count))
|
||||
_State.calendar_count += 1
|
||||
# The following lines are for testing the setWidget() and takeWidget()
|
||||
# functionality
|
||||
dock_widget.setWidget(widget)
|
||||
dock_widget.setWidget(widget) # what happens if we set a widget if a widget is already set
|
||||
dock_widget.takeWidget() # we remove the widget
|
||||
dock_widget.setWidget(widget) # and set the widget again - there should be no error
|
||||
dock_widget.setToggleViewActionMode(QtAds.CDockWidget.ActionModeShow)
|
||||
dock_widget.setIcon(svg_icon(":/adsdemo/images/date_range.svg"))
|
||||
self.menuView.addAction(dock_widget.toggleViewAction())
|
||||
return dock_widget
|
||||
|
||||
def create_file_system_tree_dock_widget(self) -> QtAds.CDockWidget:
|
||||
widget = QTreeView()
|
||||
widget.setFrameShape(QFrame.NoFrame)
|
||||
|
||||
m = QFileSystemModel(widget)
|
||||
m.setRootPath(QDir.currentPath())
|
||||
widget.setModel(m)
|
||||
|
||||
dock_widget = QtAds.CDockWidget("Filesystem {}".format(_State.file_system_count))
|
||||
_State.file_system_count += 1
|
||||
dock_widget.setWidget(widget)
|
||||
self.menuView.addAction(dock_widget.toggleViewAction())
|
||||
return dock_widget
|
||||
|
||||
def create_editor_widget(self) -> QtAds.CDockWidget:
|
||||
widget = QPlainTextEdit()
|
||||
widget.setPlaceholderText("This is an editor. If you close the editor, it will be "
|
||||
"deleted. Enter your text here.")
|
||||
widget.setStyleSheet("border: none")
|
||||
dock_widget = QtAds.CDockWidget("Editor {}".format(_State.editor_count))
|
||||
_State.editor_count += 1
|
||||
dock_widget.setWidget(widget)
|
||||
dock_widget.setIcon(svg_icon(":/adsdemo/images/edit.svg"))
|
||||
dock_widget.setFeature(QtAds.CDockWidget.CustomCloseHandling, True)
|
||||
self.menuView.addAction(dock_widget.toggleViewAction())
|
||||
|
||||
options_menu = QMenu(dock_widget)
|
||||
options_menu.setTitle("Options")
|
||||
options_menu.setToolTip(options_menu.title())
|
||||
options_menu.setIcon(svg_icon(":/adsdemo/images/custom-menu-button.svg"))
|
||||
menu_action = options_menu.menuAction()
|
||||
# The object name of the action will be set for the QToolButton that
|
||||
# is created in the dock area title bar. You can use this name for CSS
|
||||
# styling
|
||||
menu_action.setObjectName("options_menu")
|
||||
dock_widget.setTitleBarActions([options_menu.menuAction()])
|
||||
a = options_menu.addAction("Clear Editor")
|
||||
a.triggered.connect(widget.clear)
|
||||
|
||||
return dock_widget
|
||||
|
||||
|
||||
def create_table_widget(self) -> QtAds.CDockWidget:
|
||||
widget = CMinSizeTableWidget()
|
||||
dock_widget = QtAds.CDockWidget("Table {}".format(_State.table_count))
|
||||
_State.table_count += 1
|
||||
COLCOUNT = 5
|
||||
ROWCOUNT = 30
|
||||
widget.setColumnCount(COLCOUNT)
|
||||
widget.setRowCount(ROWCOUNT)
|
||||
for col in range(ROWCOUNT):
|
||||
widget.setHorizontalHeaderItem(col, QTableWidgetItem("Col {}".format(col + 1)))
|
||||
for row in range(ROWCOUNT):
|
||||
widget.setItem(row, col, QTableWidgetItem("T {:}-{:}".format(row + 1, col + 1)))
|
||||
|
||||
dock_widget.setWidget(widget)
|
||||
dock_widget.setIcon(svg_icon(":/adsdemo/images/grid_on.svg"))
|
||||
dock_widget.setMinimumSizeHintMode(QtAds.CDockWidget.MinimumSizeHintFromContent)
|
||||
toolbar = dock_widget.createDefaultToolBar()
|
||||
action = toolbar.addAction(svg_icon(":/adsdemo/images/fullscreen.svg"), "Toggle Fullscreen")
|
||||
|
||||
def on_toggle_fullscreen():
|
||||
if dock_widget.isFullScreen():
|
||||
dock_widget.showNormal()
|
||||
else:
|
||||
dock_widget.showFullScreen()
|
||||
|
||||
action.triggered.connect(on_toggle_fullscreen)
|
||||
self.menuView.addAction(dock_widget.toggleViewAction())
|
||||
return dock_widget
|
||||
|
||||
def create_activex_widget(self, parent: QWidget = None) -> QtAds.CDockWidget:
|
||||
widget = QAxWidget("{6bf52a52-394a-11d3-b153-00c04f79faa6}", parent)
|
||||
dock_widget = QtAds.CDockWidget("Active X {}".format(_State.activex_count))
|
||||
_State.activex_count += 1
|
||||
dock_widget.setWidget(widget)
|
||||
self.menuView.addAction(dock_widget.toggleViewAction())
|
||||
return dock_widget
|
||||
|
||||
|
||||
def my_message_output(type, context, msg):
|
||||
if type == QtDebugMsg:
|
||||
print("Debug: {} ({}:{}, {})".format(msg, context.file, context.line, context.function))
|
||||
elif type == QtInfoMsg:
|
||||
print("Info: {} ({}:{}, {})".format(msg, context.file, context.line, context.function))
|
||||
elif type == QtWarningMsg:
|
||||
print("Warning: {} ({}:{}, {})".format(msg, context.file, context.line, context.function))
|
||||
elif type == QtCriticalMsg:
|
||||
print("Critical: {} ({}:{}, {})".format(msg, context.file, context.line, context.function))
|
||||
elif type == QtFatalMsg:
|
||||
print("Fatal: {} ({}:{}, {})".format(msg, context.file, context.line, context.function))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
QCoreApplication.setAttribute(Qt.AA_UseHighDpiPixmaps)
|
||||
QGuiApplication.setAttribute(Qt.AA_EnableHighDpiScaling)
|
||||
app = QApplication(sys.argv)
|
||||
app.setQuitOnLastWindowClosed(True)
|
||||
|
||||
with open(os.path.join(os.path.dirname(__file__), "app.css"), "r") as style_sheet_file:
|
||||
app.setStyleSheet(style_sheet_file.read())
|
||||
|
||||
qInstallMessageHandler(my_message_output)
|
||||
qDebug("Message handler test")
|
||||
|
||||
mw = MainWindow()
|
||||
mw.show()
|
||||
app.exec_()
|
||||
@@ -31,7 +31,6 @@
|
||||
<property name="title">
|
||||
<string>File</string>
|
||||
</property>
|
||||
<addaction name="actionExit"/>
|
||||
<addaction name="actionSaveState"/>
|
||||
<addaction name="actionRestoreState"/>
|
||||
</widget>
|
||||
@@ -45,8 +44,14 @@
|
||||
<string>About</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuTests">
|
||||
<property name="title">
|
||||
<string>Tests</string>
|
||||
</property>
|
||||
</widget>
|
||||
<addaction name="menuFile"/>
|
||||
<addaction name="menuView"/>
|
||||
<addaction name="menuTests"/>
|
||||
<addaction name="menuAbout"/>
|
||||
</widget>
|
||||
<widget class="QToolBar" name="toolBar">
|
||||
|
||||
38
demo/status_dialog.py
Normal file
@@ -0,0 +1,38 @@
|
||||
import os
|
||||
import sys
|
||||
|
||||
from PyQt5 import uic
|
||||
from PyQtAds import QtAds
|
||||
|
||||
UI_FILE = os.path.join(os.path.dirname(__file__), 'StatusDialog.ui')
|
||||
StatusDialogUI, StatusDialogBase = uic.loadUiType(UI_FILE)
|
||||
|
||||
class CStatusDialog(StatusDialogUI, StatusDialogBase):
|
||||
|
||||
def __init__(self, dock_manager: QtAds.CDockManager, parent=None):
|
||||
super().__init__(parent)
|
||||
|
||||
self.setupUi(self)
|
||||
|
||||
self.dock_manager = dock_manager
|
||||
self.dock_widgets = self.dock_manager.dockWidgetsMap()
|
||||
|
||||
for key, widget in self.dock_widgets.items():
|
||||
self.dockWidgetsComboBox.addItem(key, widget)
|
||||
|
||||
def on_dockWidgetsComboBox_currentIndexChanged(self, index: int):
|
||||
if not isinstance(index, int):
|
||||
return
|
||||
if index < 0:
|
||||
return
|
||||
|
||||
dock_widget = self.dockWidgetsComboBox.currentData()
|
||||
self.isClosedCheckBox.setChecked(dock_widget.isClosed())
|
||||
self.isFloatingCheckBox.setChecked(dock_widget.isFloating())
|
||||
self.tabbedCheckBox.setChecked(dock_widget.isTabbed())
|
||||
self.isCurrentTabCheckBox.setChecked(dock_widget.isCurrentTab())
|
||||
self.closableCheckBox.setChecked(dock_widget.features() & QtAds.CDockWidget.DockWidgetClosable)
|
||||
self.movableCheckBox.setChecked(dock_widget.features() & QtAds.CDockWidget.DockWidgetMovable)
|
||||
self.floatableCheckBox.setChecked(dock_widget.features() & QtAds.CDockWidget.DockWidgetFloatable)
|
||||
self.deleteOnCloseCheckBox.setChecked(dock_widget.features() & QtAds.CDockWidget.DockWidgetDeleteOnClose)
|
||||
self.customCloseHandlingCheckBox.setChecked(dock_widget.features() & QtAds.CDockWidget.CustomCloseHandling)
|
||||
@@ -14,18 +14,17 @@ styles as much as possible.
|
||||
|
||||
### Overview
|
||||
|
||||
- [Advanced Docking System for Qt](#advanced-docking-system-for-qt)
|
||||
- [Features](#features)
|
||||
- [Overview](#overview)
|
||||
- [Docking everywhere - no central widget](#docking-everywhere---no-central-widget)
|
||||
- [Docking inside floating windows](#docking-inside-floating-windows)
|
||||
- [Grouped dragging](#grouped-dragging)
|
||||
- [Perspectives for fast switching of the complete main window layout](#perspectives-for-fast-switching-of-the-complete-main-window-layout)
|
||||
- [Opaque and non-opaque splitter resizing](#opaque-and-non-opaque-splitter-resizing)
|
||||
- [Opaque and non-opaque undocking](#opaque-and-non-opaque-undocking)
|
||||
- [Tab-menu for easy handling of many tabbed dock widgets](#tab-menu-for-easy-handling-of-many-tabbed-dock-widgets)
|
||||
- [Many different ways to detach dock widgets](#many-different-ways-to-detach-dock-widgets)
|
||||
- [Supports deletion of dynamically created dock widgets](#supports-deletion-of-dynamically-created-dock-widgets)
|
||||
- [Features](#features)
|
||||
- [Overview](#overview)
|
||||
- [Docking everywhere - no central widget](#docking-everywhere---no-central-widget)
|
||||
- [Docking inside floating windows](#docking-inside-floating-windows)
|
||||
- [Grouped dragging](#grouped-dragging)
|
||||
- [Perspectives for fast switching of the complete main window layout](#perspectives-for-fast-switching-of-the-complete-main-window-layout)
|
||||
- [Opaque and non-opaque splitter resizing](#opaque-and-non-opaque-splitter-resizing)
|
||||
- [Opaque and non-opaque undocking](#opaque-and-non-opaque-undocking)
|
||||
- [Tab-menu for easy handling of many tabbed dock widgets](#tab-menu-for-easy-handling-of-many-tabbed-dock-widgets)
|
||||
- [Many different ways to detach dock widgets](#many-different-ways-to-detach-dock-widgets)
|
||||
- [Supports deletion of dynamically created dock widgets](#supports-deletion-of-dynamically-created-dock-widgets)
|
||||
|
||||
### Docking everywhere - no central widget
|
||||
|
||||
@@ -33,8 +32,8 @@ There is no central widget like in the Qt docking system. You can dock on every
|
||||
border of the main window or you can dock into each dock area - so you are
|
||||
free to dock almost everywhere.
|
||||
|
||||
\
|
||||
\
|
||||

|
||||
|
||||

|
||||
|
||||
### Docking inside floating windows
|
||||
@@ -42,8 +41,8 @@ free to dock almost everywhere.
|
||||
There is no difference between the main window and a floating window. Docking
|
||||
into floating windows is supported.
|
||||
|
||||
\
|
||||
\
|
||||

|
||||
|
||||

|
||||
|
||||
### Grouped dragging
|
||||
@@ -52,8 +51,8 @@ When dragging the titlebar of a dock, all the tabs that are tabbed with it are
|
||||
going to be dragged. So you can move complete groups of tabbed widgets into
|
||||
a floating widget or from one dock area to another one.
|
||||
|
||||
\
|
||||
\
|
||||

|
||||
|
||||

|
||||
|
||||
### Perspectives for fast switching of the complete main window layout
|
||||
@@ -64,8 +63,8 @@ perspective to make your own custom perspective. Later you can simply
|
||||
select a perspective from the perspective list to quickly switch the complete
|
||||
main window layout.
|
||||
|
||||
\
|
||||
\
|
||||

|
||||
|
||||

|
||||
|
||||
### Opaque and non-opaque splitter resizing
|
||||
|
||||
BIN
doc/central_widget.gif
Normal file
|
After Width: | Height: | Size: 572 KiB |
BIN
doc/cfg_flag_ActiveTabHasCloseButton_false.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
doc/cfg_flag_ActiveTabHasCloseButton_true.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
doc/cfg_flag_AllTabsHaveCloseButton_true.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
doc/cfg_flag_AlwaysShowTabs_false_true.png
Normal file
|
After Width: | Height: | Size: 6.2 KiB |
|
After Width: | Height: | Size: 8.0 KiB |
|
After Width: | Height: | Size: 7.9 KiB |
BIN
doc/cfg_flag_DockAreaHasCloseButton_false.png
Normal file
|
After Width: | Height: | Size: 9.0 KiB |
BIN
doc/cfg_flag_DockAreaHasCloseButton_true.png
Normal file
|
After Width: | Height: | Size: 9.0 KiB |
BIN
doc/cfg_flag_DockAreaHasTabsMenuButton_false_true.png
Normal file
|
After Width: | Height: | Size: 9.6 KiB |
BIN
doc/cfg_flag_DockAreaHasUndockButton_false_true.png
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
doc/cfg_flag_DockAreaHideDisabledButtons_false.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
doc/cfg_flag_DockAreaHideDisabledButtons_true.png
Normal file
|
After Width: | Height: | Size: 8.3 KiB |
BIN
doc/cfg_flag_DragPreviewHasWindowFrame_true.png
Normal file
|
After Width: | Height: | Size: 20 KiB |
BIN
doc/cfg_flag_DragPreviewShowsContentPixmap_false.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
doc/cfg_flag_DragPreviewShowsContentPixmap_true.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
doc/cfg_flag_EqualSplitOnInsertion_false.png
Normal file
|
After Width: | Height: | Size: 5.2 KiB |
BIN
doc/cfg_flag_EqualSplitOnInsertion_true.png
Normal file
|
After Width: | Height: | Size: 5.1 KiB |
BIN
doc/cfg_flag_FloatingContainerForceNativeTitleBar_false.png
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
doc/cfg_flag_FloatingContainerForceNativeTitleBar_true.png
Normal file
|
After Width: | Height: | Size: 9.3 KiB |
BIN
doc/cfg_flag_FloatingContainerHasWidgetIcon_false.png
Normal file
|
After Width: | Height: | Size: 5.4 KiB |
BIN
doc/cfg_flag_FloatingContainerHasWidgetIcon_true.png
Normal file
|
After Width: | Height: | Size: 5.4 KiB |
BIN
doc/cfg_flag_FloatingContainerHasWidgetTitle_false.png
Normal file
|
After Width: | Height: | Size: 5.7 KiB |
BIN
doc/cfg_flag_FloatingContainerHasWidgetTitle_true.png
Normal file
|
After Width: | Height: | Size: 5.4 KiB |
BIN
doc/cfg_flag_FocusHighlighting.gif
Normal file
|
After Width: | Height: | Size: 158 KiB |
BIN
doc/cfg_flag_HideSingleCentralWidgetTitleBar_false.png
Normal file
|
After Width: | Height: | Size: 7.5 KiB |
BIN
doc/cfg_flag_HideSingleCentralWidgetTitleBar_true.png
Normal file
|
After Width: | Height: | Size: 5.6 KiB |
BIN
doc/cfg_flag_RetainTabSizeWhenCloseButtonHidden_true.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
doc/dynamic_drag_preview.gif
Normal file
|
After Width: | Height: | Size: 763 KiB |
BIN
doc/non_opaque_undocking.gif
Normal file
|
After Width: | Height: | Size: 312 KiB |
BIN
doc/opaque_undocking.gif
Normal file
|
After Width: | Height: | Size: 503 KiB |
BIN
doc/python_logo.png
Normal file
|
After Width: | Height: | Size: 35 KiB |
BIN
doc/showcase_d-tect-x.jpg
Normal file
|
After Width: | Height: | Size: 97 KiB |
BIN
doc/showcase_ezEngine_editor.png
Normal file
|
After Width: | Height: | Size: 385 KiB |
BIN
doc/showcase_hivewe.png
Normal file
|
After Width: | Height: | Size: 208 KiB |
BIN
doc/showcase_qmix_elements.png
Normal file
|
After Width: | Height: | Size: 539 KiB |
BIN
doc/showcase_qt_design_studio.png
Normal file
|
After Width: | Height: | Size: 157 KiB |
BIN
doc/showcase_qt_design_studio_video.png
Normal file
|
After Width: | Height: | Size: 816 KiB |
BIN
doc/showcase_qtcreator.png
Normal file
|
After Width: | Height: | Size: 98 KiB |
BIN
doc/showcase_ramses_composer.png
Normal file
|
After Width: | Height: | Size: 450 KiB |
552
doc/user-guide.md
Normal file
@@ -0,0 +1,552 @@
|
||||
# User Guide
|
||||
|
||||
- [Configuration Flags](#configuration-flags)
|
||||
- [Setting Configuration Flags](#setting-configuration-flags)
|
||||
- [`ActiveTabHasCloseButton`](#activetabhasclosebutton)
|
||||
- [`DockAreaHasCloseButton`](#dockareahasclosebutton)
|
||||
- [`DockAreaCloseButtonClosesTab`](#dockareaclosebuttonclosestab)
|
||||
- [`OpaqueSplitterResize`](#opaquesplitterresize)
|
||||
- [`XmlAutoFormattingEnabled`](#xmlautoformattingenabled)
|
||||
- [`XmlCompressionEnabled`](#xmlcompressionenabled)
|
||||
- [`TabCloseButtonIsToolButton`](#tabclosebuttonistoolbutton)
|
||||
- [`AllTabsHaveCloseButton`](#alltabshaveclosebutton)
|
||||
- [`RetainTabSizeWhenCloseButtonHidden`](#retaintabsizewhenclosebuttonhidden)
|
||||
- [`OpaqueUndocking`](#opaqueundocking)
|
||||
- [`DragPreviewIsDynamic`](#dragpreviewisdynamic)
|
||||
- [`DragPreviewShowsContentPixmap`](#dragpreviewshowscontentpixmap)
|
||||
- [`DragPreviewHasWindowFrame`](#dragpreviewhaswindowframe)
|
||||
- [`AlwaysShowTabs`](#alwaysshowtabs)
|
||||
- [`DockAreaHasUndockButton`](#dockareahasundockbutton)
|
||||
- [`DockAreaHasTabsMenuButton`](#dockareahastabsmenubutton)
|
||||
- [`DockAreaHideDisabledButtons`](#dockareahidedisabledbuttons)
|
||||
- [`DockAreaDynamicTabsMenuButtonVisibility`](#dockareadynamictabsmenubuttonvisibility)
|
||||
- [`FloatingContainerHasWidgetTitle`](#floatingcontainerhaswidgettitle)
|
||||
- [`FloatingContainerHasWidgetIcon`](#floatingcontainerhaswidgeticon)
|
||||
- [`HideSingleCentralWidgetTitleBar`](#hidesinglecentralwidgettitlebar)
|
||||
- [`FocusHighlighting`](#focushighlighting)
|
||||
- [`EqualSplitOnInsertion`](#equalsplitoninsertion)
|
||||
- [`FloatingContainerForceNativeTitleBar` (Linux only)](#floatingcontainerforcenativetitlebar-linux-only)
|
||||
- [`FloatingContainerForceQWidgetTitleBar` (Linux only)](#floatingcontainerforceqwidgettitlebar-linux-only)
|
||||
- [Central Widget](#central-widget)
|
||||
- [Empty Dock Area](#empty-dock-area)
|
||||
- [Custom Close Handling](#custom-close-handling)
|
||||
- [Styling](#styling)
|
||||
- [Disabling the Internal Style Sheet](#disabling-the-internal-style-sheet)
|
||||
|
||||
## Configuration Flags
|
||||
|
||||
The Advanced Docking System has a number of global configuration options to
|
||||
configure the design and the functionality of the docking system. Eachs
|
||||
configuration will be explained in detail in the following sections.
|
||||
|
||||
### Setting Configuration Flags
|
||||
|
||||
You should set the configuration flags before you create the dock manager
|
||||
instance. That means, setting the configurations flags is the first thing
|
||||
you do, if you use the library.
|
||||
|
||||
```c++
|
||||
CDockManager::setConfigFlags(CDockManager::DefaultOpaqueConfig);
|
||||
CDockManager::setConfigFlag(CDockManager::RetainTabSizeWhenCloseButtonHidden, true);
|
||||
...
|
||||
d->DockManager = new CDockManager(this);
|
||||
```
|
||||
|
||||
If you set the configurations flags, you can set individual flags using the
|
||||
function `CDockManager::setConfigFlag` or you can set all flags using
|
||||
the function `CDockManager::setConfigFlags`. Instead of settings all
|
||||
flags individualy, it is better to pick a predefined set of configuration
|
||||
flags and then modify individual flags. The following predefined
|
||||
configurations are avilable
|
||||
|
||||
- `DefaultNonOpaqueConfig` - uses non opaque splitter resizing and non opaque docking
|
||||
- `DefaultOpaqueConfig` - uses opaque splitter resizing and opaque docking
|
||||
|
||||
Pick one of those predefined configurations and then modify the following
|
||||
configurations flags to adjust the docking system to your needs.
|
||||
|
||||
### `ActiveTabHasCloseButton`
|
||||
|
||||
If this flag is set (default configuration), the active tab in a tab area has
|
||||
a close button.
|
||||
|
||||

|
||||
|
||||
If this flag is cleared, the active tab has no close button. You can combine
|
||||
this with the flag `DockAreaCloseButtonClosesTab` to use the close button
|
||||
of the dock are to close the single tabs.
|
||||
|
||||

|
||||
|
||||
### `DockAreaHasCloseButton`
|
||||
|
||||
If the flag is set (default configuration) each dock area has a close button.
|
||||
|
||||

|
||||
|
||||
If this flag is cleared, dock areas do not have a close button.
|
||||
|
||||

|
||||
|
||||
### `DockAreaCloseButtonClosesTab`
|
||||
|
||||
If the flag is set, the dock area close button closes the active tab,
|
||||
if not set, it closes the complete dock area (default).
|
||||
|
||||
### `OpaqueSplitterResize`
|
||||
|
||||
The advanced docking system uses standard `QSplitters` as resize separators and thus supports opaque and non-opaque resizing functionality of `QSplitter`. In some rare cases, for very complex widgets or on slow machines resizing via separator on the fly may cause flicking and glaring of rendered content inside a widget. This global dock manager flag configures the resizing behaviour of the splitters. If this flag is set, then widgets are resized dynamically (opaquely) while interactively moving the splitters. If you select the predefined configuration `DefaultOpaqueConfig`, then this is the configured behaviour.
|
||||
|
||||

|
||||
|
||||
If this flag is cleared, the widget resizing is deferred until the mouse button is released - this is some kind of lazy resizing separator. If you select the predefined
|
||||
configuration `DefaultNonOpaqueConfig`, then this is the configured behaviour.
|
||||
|
||||

|
||||
|
||||
### `XmlAutoFormattingEnabled`
|
||||
|
||||
If enabled, the XML writer automatically adds line-breaks and indentation to
|
||||
empty sections between elements (ignorable whitespace). This is used, when
|
||||
the current state or perspective is saved. It is disabled by default.
|
||||
|
||||
### `XmlCompressionEnabled`
|
||||
|
||||
If enabled, the XML output will be compressed and is not human readable anymore.
|
||||
This ie enabled by default to minimize the size of the saved data.
|
||||
|
||||
### `TabCloseButtonIsToolButton`
|
||||
|
||||
If enabled the tab close buttons will be `QToolButtons` instead of `QPushButtons` -
|
||||
disabled by default. Normally the default configuration should be ok but if your
|
||||
application requires `QToolButtons` instead of `QPushButtons` for styling reasons
|
||||
or for any other reasons, then you can enable this flag.
|
||||
|
||||
### `AllTabsHaveCloseButton`
|
||||
|
||||
If this flag is set, then all tabs that are closable show a close button. The
|
||||
advantage of this setting is that the size of the tabs does not change and the
|
||||
user can immediately close each tab. The disadvantage is that all tabs take up
|
||||
more space.
|
||||
|
||||

|
||||
|
||||
If this flas is cleared, then only the active tab has a close button (default)
|
||||
and therefore the tabs need less space.
|
||||
|
||||

|
||||
|
||||
### `RetainTabSizeWhenCloseButtonHidden`
|
||||
|
||||
If this flag is set, the space for the close button is reserved even if the
|
||||
close button is not visible. This flag is disabled by default. If this flag
|
||||
is disabled, the tab size dynamically changes if the close button is
|
||||
visible / hidden in a tab. If this flag is enabled, the tab size always remains
|
||||
constant, that means, if enabled, the tabs need more space.
|
||||
|
||||

|
||||
|
||||
### `OpaqueUndocking`
|
||||
|
||||
If this flag is set, opaque undocking is active. That means, as soon as you drag a dock widget or a dock area with a number of dock widgets it will be undocked and moved into a floating widget and then the floating widget will be dragged around. That means undocking will take place immediatelly. You can compare this with opaque splitter resizing.
|
||||
|
||||

|
||||
|
||||
If you would like to test opaque undocking, you should set the pedefined config
|
||||
flags `CDockManager::DefaultOpaqueConfig`.
|
||||
|
||||
```c++
|
||||
CDockManager::setConfigFlags(CDockManager::DefaultOpaqueConfig);
|
||||
```
|
||||
|
||||
If this flag is cleared (default), then non-opaque undocking is active. In this mode, undocking is more like a standard drag and drop operation. That means, the dragged dock widget or dock area is not undocked immediatelly. Instead, a drag preview widget is created and dragged around to indicate the future position of the dock widget or dock area. The actual dock operation is only executed when the mouse button is released. That makes it possible, to cancel an active drag operation with the escape key.
|
||||
|
||||

|
||||
|
||||
The drag preview widget can be configured by a number of global dock manager flags:
|
||||
|
||||
- `DragPreviewIsDynamic`
|
||||
- `DragPreviewShowsContentPixmap`
|
||||
- `DragPreviewHasWindowFrame`
|
||||
|
||||
Non-opaque undocking is enabled by default. If you would like to enable it
|
||||
explicitely, you can do this by setting the predefined configuration flags
|
||||
`CDockManager::DefaultNonOpaqueConfig`.
|
||||
|
||||
```c++
|
||||
CDockManager::setConfigFlags(CDockManager::DefaultNonOpaqueConfig);
|
||||
```
|
||||
|
||||
### `DragPreviewIsDynamic`
|
||||
|
||||
If non-opaque undocking is enabled, this flag defines the behavior of the drag
|
||||
preview window. If this flag is enabled, then it will give the user the
|
||||
impression, that the floating drag preview is dynamically adjusted to the drop
|
||||
area. In order to give the perfect impression, you should disable the flags
|
||||
`DragPreviewShowsContentPixmap` and `DragPreviewHasWindowFrame`.
|
||||
|
||||
```c++
|
||||
CDockManager::setConfigFlag(CDockManager::DragPreviewIsDynamic, true);
|
||||
CDockManager::setConfigFlag(CDockManager::DragPreviewShowsContentPixmap, false);
|
||||
CDockManager::setConfigFlag(CDockManager::DragPreviewHasWindowFrame, false);
|
||||
```
|
||||
|
||||

|
||||
|
||||
### `DragPreviewShowsContentPixmap`
|
||||
|
||||
If non-opaque undocking is enabled, the created drag preview window shows a
|
||||
copy of the content of the dock widget / dock are that is dragged, if this
|
||||
flag is enabled (default).
|
||||
|
||||

|
||||
|
||||
If this flag is disabled, the drag preview is only a transparent `QRubberBand`
|
||||
like window without any content.
|
||||
|
||||

|
||||
|
||||
### `DragPreviewHasWindowFrame`
|
||||
|
||||
If non-opaque undocking is enabled, then this flag configures if the drag
|
||||
preview is frameless (default) or looks like a real window. If it is enabled,
|
||||
then the drag preview is a transparent window with a system window frame.
|
||||
|
||||

|
||||
|
||||
### `AlwaysShowTabs`
|
||||
|
||||
If this option is enabled, the tab of a dock widget is always displayed - even
|
||||
if it is the only visible dock widget in a floating widget. In the image below
|
||||
on the left side, the flag is disabled (default) and on the right side it is
|
||||
enabled.
|
||||
|
||||

|
||||
|
||||
### `DockAreaHasUndockButton`
|
||||
|
||||
If the flag is set (default) each dock area has an undock button (right
|
||||
image). If the flag is cleared, a dock area has no undock button (left image)
|
||||
|
||||

|
||||
|
||||
### `DockAreaHasTabsMenuButton`
|
||||
|
||||
Tabs are a good way to quickly switch between dockwidgets in a dockarea.
|
||||
However, if the number of dockwidgets in a dockarea is too large, this may affect
|
||||
the usability of the tab bar. To keep track in this situation, you can use the
|
||||
tab menu. The menu allows you to quickly select the dockwidget you want to
|
||||
activate from a drop down menu. This flag shows / hides the tabs menu button
|
||||
in the dock area title bar. On the left side, the tabs menu button flag
|
||||
is cleared.
|
||||
|
||||

|
||||
|
||||
### `DockAreaHideDisabledButtons`
|
||||
|
||||
If certain flags of a dock widget are disabled, like `DockWidgetClosable` or
|
||||
`DockWidgetFloatable`, then the corresponding dock area buttons like close
|
||||
button or detach button are disabled (greyed out). This is the default
|
||||
setting.
|
||||
|
||||

|
||||
|
||||
If the flag is set, disabled dock area buttons will not appear on the toolbar at
|
||||
all - they are hidden.
|
||||
|
||||

|
||||
|
||||
### `DockAreaDynamicTabsMenuButtonVisibility`
|
||||
|
||||
If this flag is cleared, the the tabs menu button is always visible. This is
|
||||
the default setting. If the flag is set, the tabs menu button will be shown
|
||||
only when it is required - that means, if the tabs are elided.
|
||||
|
||||

|
||||
|
||||
If the tabs are not elided, the tabs menu button is hidden.
|
||||
|
||||

|
||||
|
||||
### `FloatingContainerHasWidgetTitle`
|
||||
|
||||
If set (default), the floating widget window title reflects the title of the
|
||||
current dock widget.
|
||||
|
||||

|
||||
|
||||
otherwise it displays application name as window title.
|
||||
|
||||

|
||||
|
||||
### `FloatingContainerHasWidgetIcon`
|
||||
|
||||
If set, the floating widget icon reflects the icon of the current dock widget
|
||||
|
||||

|
||||
|
||||
otherwise (default setting) it displays application icon.
|
||||
|
||||

|
||||
|
||||
### `HideSingleCentralWidgetTitleBar`
|
||||
|
||||
If there is only one single visible dock widget in the main dock container (the dock manager)
|
||||
and if this flag is set, then the titlebar of this dock widget will be hidden.
|
||||
This only makes sense for non draggable and non floatable dock widgets and enables
|
||||
the creation of some kind of "central" static widget. Because the titlebar is
|
||||
hidden, it is not possible to drag out the central widget to make it floating
|
||||
or to close it via the close button.
|
||||
|
||||

|
||||
|
||||
The Advanced Docking System is meant for applications without a static central
|
||||
widget and normally does not know anything about a central static widget.
|
||||
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.
|
||||
|
||||

|
||||
|
||||
### `FocusHighlighting`
|
||||
|
||||
If this is enabled, the docking system is able to highlight the tab and the
|
||||
components of a dock area with a different style (i.e. a different color).
|
||||
This option is disabled by default and needs to be enabled explicitely
|
||||
because it adds some overhead. The dock manager needs to react on focus
|
||||
changes and dock widget dragging to highlight the right dock widget. You should
|
||||
enable it only, if you really need it for your application.
|
||||
|
||||
If the feature is enabled, you can also connect to the new dock manager
|
||||
signal `focusedDockWidgetChanged(CDockWidget* old, CDockWidget* now)` to
|
||||
react on focus changes and to prepare the content of the focused dock
|
||||
widget.
|
||||
|
||||
You can click into the tab, the titlebar or the content of a dock widget
|
||||
to focus it.
|
||||
|
||||

|
||||
|
||||
For the focused dock widget and dock widget tab, the property `focused` will
|
||||
be set to true and you can use this property to style the focused dock
|
||||
widget differently. The picture above uses the following styling:
|
||||
|
||||
```css
|
||||
/* Color the tab with the nhighlight color */
|
||||
ads--CDockWidgetTab[focused="true"]
|
||||
{
|
||||
background: palette(highlight);
|
||||
border-color: palette(highlight);
|
||||
}
|
||||
|
||||
/* Use a different colored close button icon to match the test color */
|
||||
ads--CDockWidgetTab[focused="true"] > #tabCloseButton
|
||||
{
|
||||
qproperty-icon: url(:/ads/images/close-button-focused.svg)
|
||||
}
|
||||
|
||||
/* Make a hovered focused close button a little bit lighter */
|
||||
ads--CDockWidgetTab[focused="true"] > #tabCloseButton:hover
|
||||
{
|
||||
background: rgba(255, 255, 255, 48);
|
||||
}
|
||||
|
||||
/* Make a pressed focused close button even more lighter */
|
||||
ads--CDockWidgetTab[focused="true"] > #tabCloseButton:pressed
|
||||
{
|
||||
background: rgba(255, 255, 255, 92);
|
||||
}
|
||||
|
||||
/* Use a different color for the tab label */
|
||||
ads--CDockWidgetTab[focused="true"] QLabel
|
||||
{
|
||||
color: palette(light);
|
||||
}
|
||||
|
||||
/* Paint a nice solid line for the whole title bar to create the illusion
|
||||
of an active tab */
|
||||
ads--CDockAreaWidget[focused="true"] ads--CDockAreaTitleBar
|
||||
{
|
||||
background: transparent;
|
||||
border-bottom: 2px solid palette(highlight);
|
||||
padding-bottom: 0px;
|
||||
}
|
||||
```
|
||||
|
||||
If you have a content widget that does not support focussing for some reason
|
||||
(like `QVTKOpenGLStereoWidget` from the [VTK library](https://github.com/Kitware/VTK)),
|
||||
then you can manually switch the focus by reacting on mouse events. The
|
||||
following code shows, how to install en event filter on the `QVTKOpenGLStereoWidget`
|
||||
to properly switch the focus on `QEvent::MouseButtonPress`:
|
||||
|
||||
```c++
|
||||
static ads::CDockWidget* createVTK2DWindow(QMenu* ViewMenu, QObject* EventFilter)
|
||||
{
|
||||
QVTKOpenGLStereoWidget* qvtkOpenGLStereoWidget = new QVTKOpenGLStereoWidget;
|
||||
ads::CDockWidget* DockWidget = new ads::CDockWidget("2D Window");
|
||||
DockWidget->setWidget(qvtkOpenGLStereoWidget);
|
||||
qvtkOpenGLStereoWidget->installEventFilter(EventFilter);
|
||||
qvtkOpenGLStereoWidget->setProperty("DockWidget", QVariant::fromValue(DockWidget));
|
||||
return DockWidget;
|
||||
}
|
||||
```
|
||||
|
||||
Now we can use the event filter function to react on mouse events and then
|
||||
use the dock manager function `setDockWidgetFocused()` to switch the focus:
|
||||
|
||||
```c++
|
||||
bool CMainWindow::eventFilter(QObject *watched, QEvent *event)
|
||||
{
|
||||
if (event->type() == QEvent::MouseButtonPress)
|
||||
{
|
||||
QVTKOpenGLStereoWidget* vtkWidget = qobject_cast<QVTKOpenGLStereoWidget*>(watched);
|
||||
auto vDockWidget = vtkWidget->property("DockWidget");
|
||||
ads::CDockWidget* DockWidget = nullptr;
|
||||
if (vDockWidget.isValid())
|
||||
{
|
||||
DockWidget = qvariant_cast<ads::CDockWidget*>(vDockWidget);
|
||||
}
|
||||
|
||||
if (DockWidget)
|
||||
{
|
||||
d->DockManager->setDockWidgetFocused(DockWidget);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
```
|
||||
|
||||
### `EqualSplitOnInsertion`
|
||||
|
||||
This flag configures how the space is distributed if a new dock widget is
|
||||
inserted into an existing dock area. The flag is disabled by default. If 3
|
||||
dock widgets are inserted with the following code
|
||||
|
||||
```c++
|
||||
d->DockManager->addDockWidget(ads::RightDockWidgetArea, DockWidget, EditorArea);
|
||||
```
|
||||
|
||||
then this is the result, if the flag is disabled:
|
||||
|
||||

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

|
||||
|
||||
|
||||
### `FloatingContainerForceNativeTitleBar` (Linux only)
|
||||
|
||||
Since release 3.6 the library supports native title bars and window decorations
|
||||
for floating widgets on Linux (thanks to a user contribution).
|
||||
Native title bars and window decorations are supported by most Linux window
|
||||
managers, such as Compiz or Xfwm. Some window managers like KWin do not properly
|
||||
support this feature. Native floating widgets look better because of the native
|
||||
styling and the support all window manager features like snapping to window
|
||||
borders or maximizing. The library tries to detect the window manager during
|
||||
runtime and activates native window decorations if possible:
|
||||
|
||||

|
||||
|
||||
If you would like to overwrite this autodetection, then you can activate this
|
||||
flag to force native window titlebars. You can overwrite autodetection and this
|
||||
flag, if you set the environment variable `ADS_UseNativeTitle` to 0 or 1.
|
||||
|
||||
### `FloatingContainerForceQWidgetTitleBar` (Linux only)
|
||||
|
||||
If your window manager (i.e. KWin) does not properly support native floating
|
||||
windows, the docking library falls back to QWidget based floating widget
|
||||
title bars.
|
||||
|
||||

|
||||
|
||||
If you would like to overwrite autodetection, then you can activate this flag
|
||||
to force QWidget based title bars. You can overwrite autodetection and this
|
||||
flag, if you set the environment variable `ADS_UseNativeTitle` to 0 or 1.
|
||||
|
||||
## Central Widget
|
||||
|
||||
The Advanced Docking System has been developed to overcome the limitations of
|
||||
the native Qt docking system with its central widget concept. This was the
|
||||
reason that until version 3.6 of the library, there was no support for such
|
||||
thing like a central widget. Thanks to the contribution of a user the library
|
||||
now supports a central widget.
|
||||
|
||||
In the Advanced Docking System a central widget is a docking widget that is
|
||||
neither closable nor movable or floatable. A central widget has no title bar
|
||||
and so it is not possible for the user to hide, close or drag the central
|
||||
widget. If there is a central widget, then also the distribution of the sizes
|
||||
for the dock widgets around the central widget is different:
|
||||
|
||||
- **no central widget (default)** - on resizing the available space is
|
||||
distributed to all dock widgets - the size of all dock widgets
|
||||
shrinks or grows
|
||||
- **with central widget** - on resizing only the central widget is resized - the
|
||||
dock widgets around the central widget keep their size (see the animation below)
|
||||
|
||||

|
||||
|
||||
To set a central widget, you just need to pass your central dock widget
|
||||
to the dock manager `setCentralWidget` function:
|
||||
|
||||
```c++
|
||||
auto* CentralDockArea = DockManager->setCentralWidget(CentralDockWidget);
|
||||
```
|
||||
|
||||
See the `centralwidget` example to learn how it works.
|
||||
|
||||
> ##### Note
|
||||
> The central widget needs to be the first dock widget that is added to the
|
||||
> dock manager. The function does not work and returns a `nullptr` if there
|
||||
> are already other dock widgets registered. So `setCentralWidget` should be
|
||||
> the first function that you call when adding dock widgets.
|
||||
|
||||
## Empty Dock Area
|
||||
|
||||
Some applications require a fixed DockArea that is always visible, even if it
|
||||
does not contain any DockWidgets. I.e. the DockArea is in this case a kind
|
||||
of central widget that is always visible (see this
|
||||
[issue](https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/issues/199)).
|
||||
|
||||
Since version 3.7.1 the advanced docking system supports this feature. The
|
||||
`emptydockarea` example shows how this can be implemented with the library. You
|
||||
just need to create a dock widget and set the feature flag `CDockWidget::NoTab`.
|
||||
This permanently hides the tab widget of this area and removes it from the tab
|
||||
menu. For this special dock widget you should also disable all other features
|
||||
(movable, closable and floatable) to prevent closing and moving of this widget.
|
||||
If you use the `CDockManager::setCentralWidget` function like in the example
|
||||
code below, then you don't need to disable these features because this is done
|
||||
in the `setCentralWidget` function.
|
||||
|
||||
```c++
|
||||
QLabel* label = new QLabel();
|
||||
label->setText("This is a DockArea which is always visible, even if it does not contain any DockWidgets.");
|
||||
label->setAlignment(Qt::AlignCenter);
|
||||
CDockWidget* CentralDockWidget = new CDockWidget("CentralWidget");
|
||||
CentralDockWidget->setWidget(label);
|
||||
CentralDockWidget->setFeature(ads::CDockWidget::NoTab, true);// set the flag before adding the widget to dock manager
|
||||
auto* CentralDockArea = DockManager->setCentralWidget(CentralDockWidget);
|
||||
```
|
||||
|
||||
## Custom Close Handling
|
||||
|
||||
Normally clicking the close button of a dock widget will just hide the widget and the user can show it again using the `toggleView()` action of the dock widget. This is meant for user interfaces with a static amount of widgets. But the advanced docking system also supports dynamic dock widgets that will get deleted on close. If you set the dock widget flag `DockWidgetDeleteOnClose` for a certain dock widget, then it will be deleted as soon as you close this dock widget. This enables the implementation of user interfaces with dynamically created editors, like in word processing applications or source code development tools.
|
||||
|
||||
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.
|
||||
|
||||
## 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
|
||||
icons are styleable this way.
|
||||
|
||||
### Disabling the Internal Style Sheet
|
||||
|
||||
The dock manager uses an internal stylesheet to style its components. That
|
||||
means, the style that you see in the demo application comes from the
|
||||
internal stylesheets that you will find in `src/stylesheets` folder. If you want
|
||||
to disable this internal stylesheet because your application uses its own,
|
||||
just call the function for settings the stylesheet with an empty string.
|
||||
|
||||
```c++
|
||||
DockManager->setStyleSheet("");
|
||||
```
|
||||
@@ -1,46 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.3)
|
||||
set (CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
project(ads_example VERSION "1.0")
|
||||
set(REQUIRED_QT_VERSION 5.5.0)
|
||||
find_package(Qt5Core ${REQUIRED_QT_VERSION} REQUIRED)
|
||||
find_package(Qt5Gui ${REQUIRED_QT_VERSION} REQUIRED)
|
||||
find_package(Qt5Widgets ${REQUIRED_QT_VERSION} REQUIRED)
|
||||
set(ads_example_LIBS ${ads_example_LIBS} ${Qt5Core_LIBRARIES})
|
||||
set(ads_example_INCLUDE ${ads_example_INCLUDE} ${Qt5Core_INCLUDE_DIRS})
|
||||
set(ads_example_COMPILE_DEFINE ${ads_example_COMPILE_DEFINE} ${Qt5Core_COMPILE_DEFINITIONS} )
|
||||
set(ads_example_LIBS ${ads_example_LIBS} ${Qt5Gui_LIBRARIES})
|
||||
set(ads_example_INCLUDE ${ads_example_INCLUDE} ${Qt5Gui_INCLUDE_DIRS})
|
||||
set(ads_example_COMPILE_DEFINE ${ads_example_COMPILE_DEFINE} ${Qt5Gui_COMPILE_DEFINITIONS})
|
||||
set(ads_example_LIBS ${ads_example_LIBS} ${Qt5Widgets_LIBRARIES})
|
||||
set(ads_example_INCLUDE ${ads_example_INCLUDE} ${Qt5Widgets_INCLUDE_DIRS})
|
||||
set(ads_example_COMPILE_DEFINE ${ads_example_COMPILE_DEFINE} ${Qt5Widgets_COMPILE_DEFINITIONS})
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
set(ads_example_SRCS
|
||||
main.cpp
|
||||
MainWindow.cpp
|
||||
MainWindow.ui
|
||||
)
|
||||
add_executable(Example1 WIN32 ${ads_example_SRCS})
|
||||
if(BUILD_STATIC)
|
||||
set(ads_example_DEFINE ${ads_example_DEFINE} ADS_STATIC)
|
||||
endif()
|
||||
add_dependencies(Example1 qtadvanceddocking)
|
||||
target_include_directories(Example1 PUBLIC
|
||||
$<BUILD_INTERFACE:${ads_example_INCLUDE}>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
)
|
||||
target_include_directories(Example1 PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../src" ${ads_example_INCLUDE})
|
||||
target_link_libraries(Example1 PRIVATE qtadvanceddocking ${ads_example_LIBS})
|
||||
target_compile_definitions(Example1 PRIVATE ${ads_example_DEFINE})
|
||||
set_target_properties(Example1 PROPERTIES
|
||||
VERSION "1.0"
|
||||
SOVERSION 1
|
||||
EXPORT_NAME "Qt Advanced Docking System 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"
|
||||
)
|
||||
@@ -1,47 +0,0 @@
|
||||
ADS_OUT_ROOT = $${OUT_PWD}/..
|
||||
|
||||
QT += core gui widgets
|
||||
|
||||
TARGET = Example1
|
||||
DESTDIR = $${ADS_OUT_ROOT}/lib
|
||||
TEMPLATE = app
|
||||
CONFIG += c++14
|
||||
CONFIG += debug_and_release
|
||||
adsBuildStatic {
|
||||
DEFINES += ADS_STATIC
|
||||
}
|
||||
|
||||
DEFINES += QT_DEPRECATED_WARNINGS
|
||||
|
||||
SOURCES += \
|
||||
main.cpp \
|
||||
MainWindow.cpp
|
||||
|
||||
HEADERS += \
|
||||
MainWindow.h
|
||||
|
||||
FORMS += \
|
||||
MainWindow.ui
|
||||
|
||||
|
||||
LIBS += -L$${ADS_OUT_ROOT}/lib
|
||||
|
||||
# Dependency: AdvancedDockingSystem (shared)
|
||||
CONFIG(debug, debug|release){
|
||||
win32 {
|
||||
LIBS += -lqtadvanceddockingd
|
||||
}
|
||||
else:mac {
|
||||
LIBS += -lqtadvanceddocking_debug
|
||||
}
|
||||
else {
|
||||
LIBS += -lqtadvanceddocking
|
||||
}
|
||||
}
|
||||
else{
|
||||
LIBS += -lqtadvanceddocking
|
||||
}
|
||||
|
||||
INCLUDEPATH += ../src
|
||||
DEPENDPATH += ../src
|
||||
|
||||
8
examples/CMakeLists.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
project(QtADSExamples LANGUAGES CXX VERSION ${VERSION_SHORT})
|
||||
add_subdirectory(simple)
|
||||
add_subdirectory(sidebar)
|
||||
add_subdirectory(deleteonclose)
|
||||
add_subdirectory(centralwidget)
|
||||
add_subdirectory(emptydockarea)
|
||||
add_subdirectory(dockindock)
|
||||
28
examples/centralwidget/CMakeLists.txt
Normal file
@@ -0,0 +1,28 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
project(ads_example_centralwidget VERSION ${VERSION_SHORT})
|
||||
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED)
|
||||
find_package(Qt${QT_VERSION_MAJOR} 5.5 COMPONENTS Core Gui Widgets REQUIRED)
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
add_executable(CentralWidgetExample WIN32
|
||||
main.cpp
|
||||
mainwindow.cpp
|
||||
mainwindow.ui
|
||||
)
|
||||
target_include_directories(CentralWidgetExample PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../src")
|
||||
target_link_libraries(CentralWidgetExample PRIVATE qtadvanceddocking)
|
||||
target_link_libraries(CentralWidgetExample PUBLIC Qt${QT_VERSION_MAJOR}::Core
|
||||
Qt${QT_VERSION_MAJOR}::Gui
|
||||
Qt${QT_VERSION_MAJOR}::Widgets)
|
||||
set_target_properties(CentralWidgetExample PROPERTIES
|
||||
AUTOMOC ON
|
||||
AUTORCC ON
|
||||
AUTOUIC ON
|
||||
CXX_STANDARD 14
|
||||
CXX_STANDARD_REQUIRED ON
|
||||
CXX_EXTENSIONS OFF
|
||||
VERSION ${VERSION_SHORT}
|
||||
EXPORT_NAME "Qt Advanced Docking System Central Widget Example"
|
||||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib"
|
||||
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib"
|
||||
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/bin"
|
||||
)
|
||||
34
examples/centralwidget/centralwidget.pro
Normal file
@@ -0,0 +1,34 @@
|
||||
ADS_OUT_ROOT = $${OUT_PWD}/../..
|
||||
|
||||
QT += core gui widgets
|
||||
|
||||
TARGET = CentralWidgetExample
|
||||
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/centralwidget/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();
|
||||
}
|
||||
106
examples/centralwidget/main.py
Normal file
@@ -0,0 +1,106 @@
|
||||
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)
|
||||
|
||||
from PyQtAds import 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)
|
||||
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)
|
||||
|
||||
# create other dock widgets
|
||||
table = QTableWidget()
|
||||
table.setColumnCount(3)
|
||||
table.setRowCount(10)
|
||||
table_dock_widget = QtAds.CDockWidget("Table 1")
|
||||
table_dock_widget.setWidget(table)
|
||||
table_dock_widget.setMinimumSizeHintMode(QtAds.CDockWidget.MinimumSizeHintFromDockWidget)
|
||||
table_dock_widget.resize(250, 150)
|
||||
table_dock_widget.setMinimumSize(200, 150)
|
||||
table_area = self.dock_manager.addDockWidget(QtAds.DockWidgetArea.LeftDockWidgetArea, table_dock_widget)
|
||||
self.menuView.addAction(table_dock_widget.toggleViewAction())
|
||||
|
||||
table = QTableWidget()
|
||||
table.setColumnCount(5)
|
||||
table.setRowCount(1020)
|
||||
table_dock_widget = QtAds.CDockWidget("Table 2")
|
||||
table_dock_widget.setWidget(table)
|
||||
table_dock_widget.setMinimumSizeHintMode(QtAds.CDockWidget.MinimumSizeHintFromDockWidget)
|
||||
table_dock_widget.resize(250, 150)
|
||||
table_dock_widget.setMinimumSize(200, 150)
|
||||
table_area = self.dock_manager.addDockWidget(QtAds.DockWidgetArea.BottomDockWidgetArea, table_dock_widget, table_area)
|
||||
self.menuView.addAction(table_dock_widget.toggleViewAction())
|
||||
|
||||
properties_table = QTableWidget()
|
||||
properties_table.setColumnCount(3)
|
||||
properties_table.setRowCount(10)
|
||||
properties_dock_widget = QtAds.CDockWidget("Properties")
|
||||
properties_dock_widget.setWidget(properties_table)
|
||||
properties_dock_widget.setMinimumSizeHintMode(QtAds.CDockWidget.MinimumSizeHintFromDockWidget)
|
||||
properties_dock_widget.resize(250, 150)
|
||||
properties_dock_widget.setMinimumSize(200, 150)
|
||||
self.dock_manager.addDockWidget(QtAds.DockWidgetArea.RightDockWidgetArea, properties_dock_widget, central_dock_area)
|
||||
self.menuView.addAction(properties_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_()
|
||||
133
examples/centralwidget/mainwindow.cpp
Normal file
@@ -0,0 +1,133 @@
|
||||
#include "mainwindow.h"
|
||||
|
||||
#include "ui_mainwindow.h"
|
||||
|
||||
#include <QWidgetAction>
|
||||
#include <QLabel>
|
||||
#include <QCalendarWidget>
|
||||
#include <QTreeView>
|
||||
#include <QFileSystemModel>
|
||||
#include <QTableWidget>
|
||||
#include <QHBoxLayout>
|
||||
#include <QRadioButton>
|
||||
#include <QPushButton>
|
||||
#include <QInputDialog>
|
||||
#include <QFileDialog>
|
||||
#include <QSettings>
|
||||
#include <QMessageBox>
|
||||
#include <QPlainTextEdit>
|
||||
#include <QToolBar>
|
||||
|
||||
#include "DockAreaWidget.h"
|
||||
#include "DockAreaTitleBar.h"
|
||||
#include "DockAreaTabBar.h"
|
||||
#include "FloatingDockContainer.h"
|
||||
#include "DockComponentsFactory.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);
|
||||
DockManager = new CDockManager(this);
|
||||
|
||||
// Set central widget
|
||||
QPlainTextEdit* w = new QPlainTextEdit();
|
||||
w->setPlaceholderText("This is the central editor. Enter your text here.");
|
||||
CDockWidget* CentralDockWidget = new CDockWidget("CentralWidget");
|
||||
CentralDockWidget->setWidget(w);
|
||||
auto* CentralDockArea = DockManager->setCentralWidget(CentralDockWidget);
|
||||
CentralDockArea->setAllowedAreas(DockWidgetArea::OuterDockAreas);
|
||||
|
||||
// create other dock widgets
|
||||
QTableWidget* table = new QTableWidget();
|
||||
table->setColumnCount(3);
|
||||
table->setRowCount(10);
|
||||
CDockWidget* TableDockWidget = new CDockWidget("Table 1");
|
||||
TableDockWidget->setWidget(table);
|
||||
TableDockWidget->setMinimumSizeHintMode(CDockWidget::MinimumSizeHintFromDockWidget);
|
||||
TableDockWidget->resize(250, 150);
|
||||
TableDockWidget->setMinimumSize(200,150);
|
||||
auto TableArea = DockManager->addDockWidget(DockWidgetArea::LeftDockWidgetArea, TableDockWidget);
|
||||
ui->menuView->addAction(TableDockWidget->toggleViewAction());
|
||||
|
||||
table = new QTableWidget();
|
||||
table->setColumnCount(5);
|
||||
table->setRowCount(1020);
|
||||
TableDockWidget = new CDockWidget("Table 2");
|
||||
TableDockWidget->setWidget(table);
|
||||
TableDockWidget->setMinimumSizeHintMode(CDockWidget::MinimumSizeHintFromDockWidget);
|
||||
TableDockWidget->resize(250, 150);
|
||||
TableDockWidget->setMinimumSize(200,150);
|
||||
DockManager->addDockWidget(DockWidgetArea::BottomDockWidgetArea, TableDockWidget, TableArea);
|
||||
ui->menuView->addAction(TableDockWidget->toggleViewAction());
|
||||
|
||||
QTableWidget* propertiesTable = new QTableWidget();
|
||||
propertiesTable->setColumnCount(3);
|
||||
propertiesTable->setRowCount(10);
|
||||
CDockWidget* PropertiesDockWidget = new CDockWidget("Properties");
|
||||
PropertiesDockWidget->setWidget(propertiesTable);
|
||||
PropertiesDockWidget->setMinimumSizeHintMode(CDockWidget::MinimumSizeHintFromDockWidget);
|
||||
PropertiesDockWidget->resize(250, 150);
|
||||
PropertiesDockWidget->setMinimumSize(200,150);
|
||||
DockManager->addDockWidget(DockWidgetArea::RightDockWidgetArea, PropertiesDockWidget, CentralDockArea);
|
||||
ui->menuView->addAction(PropertiesDockWidget->toggleViewAction());
|
||||
|
||||
createPerspectiveUi();
|
||||
}
|
||||
|
||||
CMainWindow::~CMainWindow()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
||||
void CMainWindow::createPerspectiveUi()
|
||||
{
|
||||
SavePerspectiveAction = new QAction("Create Perspective", this);
|
||||
connect(SavePerspectiveAction, SIGNAL(triggered()), SLOT(savePerspective()));
|
||||
PerspectiveListAction = new QWidgetAction(this);
|
||||
PerspectiveComboBox = new QComboBox(this);
|
||||
PerspectiveComboBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||
PerspectiveComboBox->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
|
||||
connect(PerspectiveComboBox, SIGNAL(activated(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/centralwidget/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/centralwidget/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>
|
||||
24
examples/deleteonclose/CMakeLists.txt
Normal file
@@ -0,0 +1,24 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
project(ads_example_deleteonclose 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(DeleteOnCloseTest WIN32
|
||||
main.cpp
|
||||
)
|
||||
target_include_directories(DeleteOnCloseTest PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../src")
|
||||
target_link_libraries(DeleteOnCloseTest PRIVATE qtadvanceddocking)
|
||||
target_link_libraries(DeleteOnCloseTest PUBLIC Qt${QT_VERSION_MAJOR}::Core
|
||||
Qt${QT_VERSION_MAJOR}::Gui
|
||||
Qt${QT_VERSION_MAJOR}::Widgets)
|
||||
set_target_properties(DeleteOnCloseTest PROPERTIES
|
||||
AUTOMOC ON
|
||||
CXX_STANDARD 14
|
||||
CXX_STANDARD_REQUIRED ON
|
||||
CXX_EXTENSIONS OFF
|
||||
VERSION ${VERSION_SHORT}
|
||||
EXPORT_NAME "Qt Advanced Docking System Delete on Close 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"
|
||||
)
|
||||
23
examples/deleteonclose/deleteonclose.pro
Normal file
@@ -0,0 +1,23 @@
|
||||
ADS_OUT_ROOT = $${OUT_PWD}/../..
|
||||
|
||||
QT += core gui widgets
|
||||
|
||||
TARGET = DeleteOnCloseTest
|
||||
DESTDIR = $${ADS_OUT_ROOT}/lib
|
||||
TEMPLATE = app
|
||||
CONFIG += c++14
|
||||
CONFIG += debug_and_release
|
||||
adsBuildStatic {
|
||||
DEFINES += ADS_STATIC
|
||||
}
|
||||
|
||||
DEFINES += QT_DEPRECATED_WARNINGS
|
||||
|
||||
SOURCES += main.cpp
|
||||
|
||||
|
||||
LIBS += -L$${ADS_OUT_ROOT}/lib
|
||||
include(../../ads.pri)
|
||||
INCLUDEPATH += ../../src
|
||||
DEPENDPATH += ../../src
|
||||
|
||||
90
examples/deleteonclose/main.cpp
Normal file
@@ -0,0 +1,90 @@
|
||||
#include <QMainWindow>
|
||||
#include <QAction>
|
||||
#include <QTextEdit>
|
||||
#include <QApplication>
|
||||
#include <QMenuBar>
|
||||
#include "DockManager.h"
|
||||
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
private:
|
||||
ads::CDockManager* m_DockManager = nullptr;
|
||||
|
||||
protected:
|
||||
virtual void closeEvent(QCloseEvent *event) override
|
||||
{
|
||||
QMainWindow::closeEvent(event);
|
||||
if (m_DockManager)
|
||||
{
|
||||
m_DockManager->deleteLater();
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
void setDockManager(ads::CDockManager* DockManager) {m_DockManager = DockManager;}
|
||||
};
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
MainWindow w;
|
||||
|
||||
ads::CDockManager::setConfigFlag(ads::CDockManager::FocusHighlighting, true);
|
||||
ads::CDockManager::setConfigFlag(ads::CDockManager::AllTabsHaveCloseButton, true);
|
||||
auto dockManager = new ads::CDockManager(&w);
|
||||
w.setDockManager(dockManager);
|
||||
QObject::connect(dockManager, &ads::CDockManager::focusedDockWidgetChanged, [] (ads::CDockWidget* old, ads::CDockWidget* now) {
|
||||
static int Count = 0;
|
||||
qDebug() << Count++ << " CDockManager::focusedDockWidgetChanged old: " << (old ? old->objectName() : "-") << " now: " << now->objectName() << " visible: " << now->isVisible();
|
||||
now->widget()->setFocus();
|
||||
});
|
||||
|
||||
QAction *action = new QAction("New [DockWidgetDeleteOnClose]", &w);
|
||||
w.menuBar()->addAction(action);
|
||||
|
||||
int i = 0;
|
||||
QObject::connect(action, &QAction::triggered, [&]() {
|
||||
auto dw = new ads::CDockWidget(QStringLiteral("test %1 [DockWidgetDeleteOnClose]").arg(i++), &w);
|
||||
auto editor = new QTextEdit(QStringLiteral("lorem ipsum..."), dw);
|
||||
dw->setWidget(editor);
|
||||
dw->setFeature(ads::CDockWidget::DockWidgetDeleteOnClose, true);
|
||||
auto area = dockManager->addDockWidgetTab(ads::CenterDockWidgetArea, dw);
|
||||
qDebug() << "doc dock widget created!" << dw << area;
|
||||
});
|
||||
|
||||
auto dw = new ads::CDockWidget(QStringLiteral("test %1 [DeleteContentOnClose]").arg(i++), &w);
|
||||
auto editor = new QTextEdit(QStringLiteral("recreated lorem ipsum......"), dw);
|
||||
dw->setWidget(editor);
|
||||
dw->setFeature(ads::CDockWidget::DeleteContentOnClose, true);
|
||||
dw->setWidgetFactory([](QWidget* dw)
|
||||
{
|
||||
static int timesRecreated = 0;
|
||||
return new QTextEdit(QStringLiteral("recreated lorem ipsum... times %1").arg(++timesRecreated), dw);
|
||||
});
|
||||
auto area = dockManager->addDockWidgetTab(ads::CenterDockWidgetArea, dw);
|
||||
qDebug() << "DeleteContentOnClose dock widget created!" << dw << area;
|
||||
|
||||
action = new QAction("Toggle [DeleteContentOnClose]", &w);
|
||||
w.menuBar()->addAction(action);
|
||||
|
||||
QObject::connect(action, &QAction::triggered, [dw]() {
|
||||
dw->toggleView(dw->isClosed());
|
||||
qDebug() << QString("dock widget %1! contents widget %2!").arg(dw->isClosed() ? "closed" : "open", dw->widget() ? "created" : "deleted");
|
||||
});
|
||||
|
||||
action = new QAction("New", &w);
|
||||
w.menuBar()->addAction(action);
|
||||
QObject::connect(action, &QAction::triggered, [&]() {
|
||||
auto dw = new ads::CDockWidget(QStringLiteral("test %1").arg(i++), &w);
|
||||
auto editor = new QTextEdit(QStringLiteral("lorem ipsum..."), dw);
|
||||
dw->setWidget(editor);
|
||||
auto area = dockManager->addDockWidgetTab(ads::CenterDockWidgetArea, dw);
|
||||
qDebug() << "dock widget created!" << dw << area;
|
||||
});
|
||||
|
||||
w.show();
|
||||
|
||||
return a.exec();
|
||||
}
|
||||
73
examples/deleteonclose/main.py
Normal file
@@ -0,0 +1,73 @@
|
||||
import sys
|
||||
|
||||
from PyQtAds import QtAds
|
||||
from PyQt5.QtGui import QCloseEvent
|
||||
from PyQt5.QtCore import (qDebug, pyqtSlot, QObject, pyqtSignal)
|
||||
from PyQt5.QtWidgets import (QMainWindow, QAction, QTextEdit, QApplication,
|
||||
QMenuBar)
|
||||
|
||||
|
||||
class MainWindow(QMainWindow):
|
||||
dock_manager = None
|
||||
|
||||
def closeEvent(self, event: QCloseEvent):
|
||||
super().closeEvent(event)
|
||||
if self.dock_manager is not None:
|
||||
self.dock_manager.deleteLater()
|
||||
|
||||
def setDockManager(self, dock_manager: QtAds.CDockManager):
|
||||
self.dock_manager = dock_manager
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app = QApplication(sys.argv)
|
||||
w = MainWindow()
|
||||
|
||||
QtAds.CDockManager.setConfigFlag(QtAds.CDockManager.FocusHighlighting, True)
|
||||
QtAds.CDockManager.setConfigFlag(QtAds.CDockManager.AllTabsHaveCloseButton, True)
|
||||
dock_manager = QtAds.CDockManager(w)
|
||||
w.setDockManager(dock_manager)
|
||||
|
||||
count = 0
|
||||
|
||||
def on_focused_dock_widget_changed(old: QtAds.CDockWidget, now: QtAds.CDockWidget):
|
||||
global count
|
||||
qDebug( "{:d} CDockManager::focusedDockWidgetChanged old: {} now: {} visible: {}".format(
|
||||
count,
|
||||
old.objectName() if old else "-",
|
||||
now.objectName(),
|
||||
now.isVisible()))
|
||||
count += 1
|
||||
now.widget().setFocus()
|
||||
|
||||
dock_manager.focusedDockWidgetChanged.connect(on_focused_dock_widget_changed)
|
||||
|
||||
action = QAction("New Delete On Close", w)
|
||||
w.menuBar().addAction(action)
|
||||
|
||||
i = 0
|
||||
def on_action_triggered():
|
||||
global i
|
||||
dw = QtAds.CDockWidget("test doc {:d}".format(i))
|
||||
i += 1
|
||||
editor = QTextEdit("lorem ipsum...", dw)
|
||||
dw.setWidget(editor)
|
||||
dw.setFeature(QtAds.CDockWidget.DockWidgetDeleteOnClose, True)
|
||||
area = dock_manager.addDockWidgetTab(QtAds.CenterDockWidgetArea, dw)
|
||||
qDebug("doc dock widget created! {} {}".format(dw, area))
|
||||
action.triggered.connect(on_action_triggered)
|
||||
|
||||
action = QAction("New", w)
|
||||
w.menuBar().addAction(action)
|
||||
def on_action2_triggered():
|
||||
global i
|
||||
dw = QtAds.CDockWidget("test {:d}".format(i))
|
||||
i += 1
|
||||
editor = QTextEdit("lorem ipsum...", dw)
|
||||
dw.setWidget(editor)
|
||||
area = dock_manager.addDockWidgetTab(QtAds.CenterDockWidgetArea, dw)
|
||||
qDebug("dock widget created! {} {}".format(dw, area))
|
||||
action.triggered.connect(on_action2_triggered)
|
||||
|
||||
w.show()
|
||||
app.exec_()
|
||||
31
examples/dockindock/CMakeLists.txt
Normal file
@@ -0,0 +1,31 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
project(ads_example_dockindock 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(DockInDockExample WIN32
|
||||
dockindock.cpp
|
||||
dockindockmanager.cpp
|
||||
perspectiveactions.cpp
|
||||
perspectives.cpp
|
||||
main.cpp
|
||||
mainframe.cpp
|
||||
)
|
||||
target_include_directories(DockInDockExample PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../src")
|
||||
target_link_libraries(DockInDockExample PRIVATE qtadvanceddocking)
|
||||
target_link_libraries(DockInDockExample PUBLIC Qt${QT_VERSION_MAJOR}::Core
|
||||
Qt${QT_VERSION_MAJOR}::Gui
|
||||
Qt${QT_VERSION_MAJOR}::Widgets)
|
||||
set_target_properties(DockInDockExample 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 Simple 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"
|
||||
)
|
||||
296
examples/dockindock/dockindock.cpp
Normal file
@@ -0,0 +1,296 @@
|
||||
#include "dockindock.h"
|
||||
#include "perspectives.h"
|
||||
#include "dockindockmanager.h"
|
||||
#include "perspectiveactions.h"
|
||||
|
||||
#include <QMenu>
|
||||
#include <QDir>
|
||||
#include <QVBoxLayout>
|
||||
#include <QMainWindow>
|
||||
#include <QMessageBox>
|
||||
#include <QInputDialog>
|
||||
|
||||
#include <set>
|
||||
#include <assert.h>
|
||||
|
||||
using namespace QtAdsUtl;
|
||||
|
||||
DockInDockWidget::DockInDockWidget( QWidget* parent, bool canCreateNewGroups, PerspectivesManager* perspectivesManager ) :
|
||||
DockInDockWidget( parent, (DockInDockWidget*)NULL, perspectivesManager )
|
||||
{
|
||||
m_canCreateNewGroups = canCreateNewGroups;
|
||||
m_topLevelDockWidget = this;
|
||||
}
|
||||
|
||||
DockInDockWidget::DockInDockWidget( QWidget* parent, DockInDockWidget* topLevelDockWidget, PerspectivesManager* perspectivesManager ) :
|
||||
baseClass( parent ),
|
||||
m_topLevelDockWidget( topLevelDockWidget ),
|
||||
m_canCreateNewGroups( (topLevelDockWidget) ? topLevelDockWidget->m_canCreateNewGroups : false ),
|
||||
m_perspectivesManager( perspectivesManager )
|
||||
{
|
||||
QVBoxLayout* layout = new QVBoxLayout(this);
|
||||
layout->setContentsMargins( 0,0,0,0 );
|
||||
layout->addWidget( m_mgr = new DockInDockManager(*this) );
|
||||
}
|
||||
|
||||
DockInDockWidget::~DockInDockWidget()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
ads::CDockAreaWidget* DockInDockWidget::addTabWidget( QWidget* widget, const QString& name, ads::CDockAreaWidget* after )
|
||||
{
|
||||
return addTabWidget( widget, name, QIcon(), after );
|
||||
}
|
||||
|
||||
ads::CDockAreaWidget* DockInDockWidget::addTabWidget( QWidget* widget, const QString& name, QIcon icon, ads::CDockAreaWidget* after )
|
||||
{
|
||||
for ( auto existing : getTopLevelDockWidget()->getManager()->allDockWidgets(true,true) )
|
||||
{
|
||||
if ( existing.second->objectName() == name )
|
||||
{
|
||||
QMessageBox::critical( this, "Error", "Name '" + name + "' already in use" );
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
ads::CDockWidget* DockWidget = new ads::CDockWidget(name);
|
||||
DockWidget->setWidget(widget);
|
||||
DockWidget->setIcon( icon );
|
||||
|
||||
// Add the dock widget to the top dock widget area
|
||||
return m_mgr->addDockWidget(ads::CenterDockWidgetArea, DockWidget, after);
|
||||
}
|
||||
|
||||
bool DockInDockWidget::isTopLevel()
|
||||
{
|
||||
return objectName().isEmpty();
|
||||
}
|
||||
|
||||
QString DockInDockWidget::getGroupNameError( const QString& groupName )
|
||||
{
|
||||
if ( groupName.isEmpty() )
|
||||
{
|
||||
return "Group must have a non-empty name";
|
||||
}
|
||||
|
||||
std::vector<DockInDockManager*> dockManagers = m_mgr->allManagers( true, true );
|
||||
for ( auto mgr : dockManagers )
|
||||
{
|
||||
if ( mgr->getGroupName() == groupName )
|
||||
return "Group name '" + groupName + "' already used";
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
DockInDockWidget* DockInDockWidget::createGroup( const QString& groupName, ads::CDockAreaWidget*& insertPos )
|
||||
{
|
||||
return createGroup( groupName, QIcon(), insertPos );
|
||||
}
|
||||
|
||||
DockInDockWidget* DockInDockWidget::createGroup( const QString& groupName, QIcon icon, ads::CDockAreaWidget*& insertPos )
|
||||
{
|
||||
QString error = getGroupNameError( groupName );
|
||||
if ( !error.isEmpty() )
|
||||
{
|
||||
QMessageBox::critical( NULL, "Error", error );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
DockInDockWidget* child = new DockInDockWidget( this, m_topLevelDockWidget, m_perspectivesManager );
|
||||
child->setObjectName( groupName );
|
||||
|
||||
ads::CDockWidget* DockWidget = new ads::CDockWidget(groupName);
|
||||
DockWidget->setWidget(child);
|
||||
DockWidget->setIcon(icon);
|
||||
|
||||
insertPos = m_mgr->addDockWidget(ads::CenterDockWidgetArea, DockWidget, insertPos);
|
||||
|
||||
return child;
|
||||
}
|
||||
|
||||
void DockInDockWidget::destroyGroup( DockInDockWidget* widgetToRemove )
|
||||
{
|
||||
auto topLevelWidget = widgetToRemove->getTopLevelDockWidget();
|
||||
|
||||
if ( topLevelWidget && topLevelWidget != widgetToRemove )
|
||||
{
|
||||
// reaffect all child docks to top-level
|
||||
for ( auto dockwidget : widgetToRemove->getManager()->getWidgetsInGUIOrder() ) // don't use allDockWidgets to preserve sub-groups
|
||||
{
|
||||
MoveDockWidgetAction::move( dockwidget, topLevelWidget->getManager() );
|
||||
}
|
||||
assert( widgetToRemove->getManager()->allDockWidgets( true, true ).empty() );
|
||||
|
||||
// find widget's parent:
|
||||
for ( auto dockwidget : topLevelWidget->getManager()->allDockWidgets( true, true ) )
|
||||
{
|
||||
if ( dockwidget.second->widget() == widgetToRemove )
|
||||
{
|
||||
dockwidget.first->removeDockWidget( dockwidget.second );
|
||||
delete dockwidget.second;
|
||||
//delete widgetToRemove; automatically deleted when dockWidget is deleted
|
||||
widgetToRemove = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
assert( widgetToRemove == NULL );
|
||||
}
|
||||
else
|
||||
{
|
||||
assert( false );
|
||||
}
|
||||
}
|
||||
|
||||
void DockInDockWidget::attachViewMenu( QMenu* menu )
|
||||
{
|
||||
connect( menu, SIGNAL(aboutToShow()), this, SLOT(autoFillAttachedViewMenu()) );
|
||||
}
|
||||
|
||||
void DockInDockWidget::autoFillAttachedViewMenu()
|
||||
{
|
||||
QMenu* menu = dynamic_cast<QMenu*>( QObject::sender() );
|
||||
|
||||
if ( menu )
|
||||
{
|
||||
menu->clear();
|
||||
setupViewMenu( menu );
|
||||
}
|
||||
else
|
||||
{
|
||||
assert( false );
|
||||
}
|
||||
}
|
||||
|
||||
void DockInDockWidget::setupViewMenu( QMenu* menu )
|
||||
{
|
||||
std::vector<DockInDockManager*> dockManagers = m_mgr->allManagers( true, true );
|
||||
|
||||
bool hasPerspectivesMenu = false;
|
||||
if ( getTopLevelDockWidget() == this )
|
||||
hasPerspectivesMenu = (m_perspectivesManager != NULL);
|
||||
else
|
||||
assert( false );
|
||||
|
||||
QMenu* organize = menu;
|
||||
if ( hasPerspectivesMenu )
|
||||
organize = menu->addMenu( "Organize" );
|
||||
|
||||
setupMenu( organize, dockManagers );
|
||||
|
||||
if ( hasPerspectivesMenu )
|
||||
{
|
||||
QMenu* perspectives = menu->addMenu( "Perspectives" );
|
||||
fillPerspectivesMenu( perspectives );
|
||||
}
|
||||
}
|
||||
|
||||
void DockInDockWidget::setupMenu( QMenu* menu, const std::vector<DockInDockManager*>& moveTo )
|
||||
{
|
||||
m_mgr->fillViewMenu( menu, moveTo );
|
||||
menu->addSeparator();
|
||||
auto moveMenu = menu->addMenu( "Move" );
|
||||
m_mgr->fillMoveMenu( moveMenu, moveTo );
|
||||
}
|
||||
|
||||
void DockInDockWidget::fillPerspectivesMenu( QMenu* menu )
|
||||
{
|
||||
menu->addAction( "Create perspective...", this, SLOT(createPerspective()) );
|
||||
|
||||
QStringList perspectiveNames;
|
||||
if ( m_perspectivesManager )
|
||||
perspectiveNames = m_perspectivesManager->perspectiveNames();
|
||||
|
||||
if ( !perspectiveNames.isEmpty() )
|
||||
{
|
||||
QMenu* load = menu->addMenu( "Load perspective" );
|
||||
for ( auto name : perspectiveNames )
|
||||
load->addAction( new LoadPerspectiveAction( load, name, *this ) );
|
||||
QMenu* remove = menu->addMenu( "Remove perspective" );
|
||||
for ( auto name : perspectiveNames )
|
||||
remove->addAction( new RemovePerspectiveAction( remove, name, *this ) );
|
||||
}
|
||||
}
|
||||
|
||||
void DockInDockWidget::setNewPerspectiveDefaultName( const QString& defaultName )
|
||||
{
|
||||
m_newPerspectiveDefaultName = defaultName;
|
||||
}
|
||||
|
||||
void DockInDockWidget::createPerspective()
|
||||
{
|
||||
if ( !m_perspectivesManager )
|
||||
return;
|
||||
|
||||
QString name = m_newPerspectiveDefaultName;
|
||||
if ( !m_newPerspectiveDefaultName.isEmpty() )
|
||||
{
|
||||
int index = 2;
|
||||
while ( m_perspectivesManager->perspectiveNames().contains( name ) )
|
||||
{
|
||||
name = m_newPerspectiveDefaultName + " (" + QString::number(index) + ")";
|
||||
++index;
|
||||
}
|
||||
}
|
||||
|
||||
while ( true )
|
||||
{
|
||||
bool ok = false;
|
||||
name = QInputDialog::getText( NULL, "Create perspective", "Enter perspective name", QLineEdit::Normal, name, &ok );
|
||||
if ( ok )
|
||||
{
|
||||
if ( name.isEmpty() )
|
||||
{
|
||||
QMessageBox::critical( NULL, "Error", "Perspective name cannot be empty" );
|
||||
continue;
|
||||
}
|
||||
else if ( m_perspectivesManager->perspectiveNames().contains( name ) )
|
||||
{
|
||||
if ( QMessageBox::critical( NULL, "Error", "Perspective '" + name + "' already exists, overwrite it?", QMessageBox::Yes | QMessageBox::No, QMessageBox::No ) == QMessageBox::No )
|
||||
continue;
|
||||
}
|
||||
|
||||
m_perspectivesManager->addPerspective( name, *this );
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void dumpStatus( std::ostream& str, ads::CDockWidget* widget, const std::string& tab, std::string suffix )
|
||||
{
|
||||
DockInDockManager* asMgr = DockInDockManager::dockInAManager( widget );
|
||||
if ( asMgr )
|
||||
{
|
||||
asMgr->parent().dumpStatus( str, tab );
|
||||
}
|
||||
else
|
||||
{
|
||||
str << tab << widget->objectName().toStdString() << suffix << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void DockInDockWidget::dumpStatus( std::ostream& str, std::string tab )
|
||||
{
|
||||
str << tab << "Group: " << getManager()->getGroupName().toStdString() << std::endl;
|
||||
tab += " ";
|
||||
std::set<ads::CDockWidget*> visibleWidgets;
|
||||
for ( auto widget : getManager()->getWidgetsInGUIOrder() )
|
||||
{
|
||||
visibleWidgets.insert( widget );
|
||||
::dumpStatus( str, widget, tab, "" );
|
||||
}
|
||||
|
||||
for ( auto closed : getManager()->dockWidgetsMap() )
|
||||
{
|
||||
if ( visibleWidgets.find( closed ) == visibleWidgets.end() )
|
||||
{
|
||||
::dumpStatus( str, closed, tab, " (closed)" );
|
||||
}
|
||||
}
|
||||
}
|
||||
80
examples/dockindock/dockindock.h
Normal file
@@ -0,0 +1,80 @@
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
#include <QMap>
|
||||
|
||||
#include <memory>
|
||||
#include <ostream>
|
||||
|
||||
class QMenu;
|
||||
|
||||
namespace ads
|
||||
{
|
||||
class CDockAreaWidget;
|
||||
}
|
||||
|
||||
namespace QtAdsUtl
|
||||
{
|
||||
|
||||
class DockInDockManager;
|
||||
class PerspectivesManager;
|
||||
// tab of tab example for https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/issues/306
|
||||
class DockInDockWidget : public QWidget
|
||||
{
|
||||
typedef QWidget baseClass;
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DockInDockWidget( QWidget* parent, bool canCreateNewGroups, PerspectivesManager* perspectivesManager );
|
||||
~DockInDockWidget() override;
|
||||
|
||||
ads::CDockAreaWidget* addTabWidget( QWidget* widget, const QString& name, ads::CDockAreaWidget* after );
|
||||
DockInDockWidget* createGroup( const QString& groupName, ads::CDockAreaWidget*& insertPos );
|
||||
|
||||
ads::CDockAreaWidget* addTabWidget( QWidget* widget, const QString& name, QIcon icon, ads::CDockAreaWidget* after );
|
||||
DockInDockWidget* createGroup( const QString& groupName, QIcon icon, ads::CDockAreaWidget*& insertPos );
|
||||
|
||||
QString getGroupNameError( const QString& groupName );
|
||||
void destroyGroup( DockInDockWidget* widget );
|
||||
|
||||
/** Manually fill a given view menu */
|
||||
void setupViewMenu( QMenu* menu );
|
||||
|
||||
/** Attach a view menu that will be automatically fill */
|
||||
void attachViewMenu( QMenu* menu );
|
||||
|
||||
bool isTopLevel();
|
||||
void setupMenu( QMenu* menu, const std::vector<DockInDockManager*>& moveTo );
|
||||
|
||||
inline DockInDockManager* getManager() { return m_mgr; }
|
||||
inline DockInDockWidget* getTopLevelDockWidget() { return m_topLevelDockWidget; }
|
||||
|
||||
inline bool canCreateNewGroups() const { return m_canCreateNewGroups; }
|
||||
|
||||
void dumpStatus( std::ostream& str, std::string tab = "" );
|
||||
|
||||
inline PerspectivesManager* getPerspectivesManager() { return m_perspectivesManager; }
|
||||
|
||||
void setNewPerspectiveDefaultName( const QString& defaultName );
|
||||
|
||||
private slots:
|
||||
void autoFillAttachedViewMenu();
|
||||
void createPerspective();
|
||||
|
||||
private:
|
||||
DockInDockManager* m_mgr;
|
||||
DockInDockWidget* m_topLevelDockWidget;
|
||||
|
||||
bool m_canCreateNewGroups;
|
||||
|
||||
DockInDockWidget( QWidget* parent, DockInDockWidget* topLevelDockWidget, PerspectivesManager* perspectivesManager );
|
||||
|
||||
PerspectivesManager* m_perspectivesManager;
|
||||
QString m_newPerspectiveDefaultName;
|
||||
|
||||
void fillPerspectivesMenu( QMenu* menu );
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
35
examples/dockindock/dockindock.pro
Normal file
@@ -0,0 +1,35 @@
|
||||
ADS_OUT_ROOT = $${OUT_PWD}/../..
|
||||
|
||||
QT += core gui widgets
|
||||
|
||||
TARGET = DockInDock
|
||||
DESTDIR = $${ADS_OUT_ROOT}/lib
|
||||
TEMPLATE = app
|
||||
CONFIG += c++14
|
||||
CONFIG += debug_and_release
|
||||
adsBuildStatic {
|
||||
DEFINES += ADS_STATIC
|
||||
}
|
||||
|
||||
DEFINES += QT_DEPRECATED_WARNINGS
|
||||
|
||||
SOURCES += \
|
||||
dockindock.cpp \
|
||||
dockindockmanager.cpp \
|
||||
perspectiveactions.cpp \
|
||||
perspectives.cpp \
|
||||
main.cpp \
|
||||
mainframe.cpp
|
||||
|
||||
HEADERS += \
|
||||
dockindock.h \
|
||||
dockindockmanager.h \
|
||||
perspectiveactions.h \
|
||||
perspectives.h \
|
||||
mainframe.h
|
||||
|
||||
LIBS += -L$${ADS_OUT_ROOT}/lib
|
||||
include(../../ads.pri)
|
||||
INCLUDEPATH += ../../src
|
||||
DEPENDPATH += ../../src
|
||||
|
||||
203
examples/dockindock/dockindock.py
Normal file
@@ -0,0 +1,203 @@
|
||||
import sys
|
||||
|
||||
from PyQt5.QtWidgets import (QApplication, QWidget, QVBoxLayout, QMessageBox,
|
||||
QInputDialog, QMenu, QLineEdit)
|
||||
from PyQt5.QtGui import QIcon
|
||||
from PyQtAds import QtAds
|
||||
|
||||
from dockindockmanager import DockInDockManager
|
||||
from perspectiveactions import LoadPerspectiveAction, RemovePerspectiveAction
|
||||
|
||||
|
||||
class DockInDockWidget(QWidget):
|
||||
def __init__(self, parent, perspectives_manager: 'PerspectivesManager', can_create_new_groups: bool = False, top_level_widget = None):
|
||||
super().__init__(parent)
|
||||
|
||||
if top_level_widget is not None:
|
||||
self.__can_create_new_groups = top_level_widget.can_create_new_groups
|
||||
else:
|
||||
self.__can_create_new_groups = can_create_new_groups
|
||||
self.__top_level_dock_widget = top_level_widget if top_level_widget else self
|
||||
self.__perspectives_manager = perspectives_manager
|
||||
self.__new_perspective_default_name: str = ''
|
||||
|
||||
layout = QVBoxLayout(self)
|
||||
layout.setContentsMargins(0,0,0,0)
|
||||
self.__mgr = DockInDockManager(self)
|
||||
layout.addWidget(self.__mgr)
|
||||
|
||||
def getManager(self) -> 'DockInDockManager':
|
||||
return self.__mgr
|
||||
|
||||
def getTopLevelDockWidget(self) -> 'DockInDockWidget':
|
||||
return self.__top_level_dock_widget
|
||||
|
||||
def canCreateNewGroups(self) -> bool:
|
||||
return self.__can_create_new_groups
|
||||
|
||||
def getPerspectivesManager(self) -> 'PerspectivesManager':
|
||||
return self.__perspectives_manager
|
||||
|
||||
def addTabWidget(self, widget: QWidget, name: str, after: QtAds.CDockAreaWidget, icon = QIcon()) -> QtAds.CDockAreaWidget:
|
||||
for existing in self.getTopLevelDockWidget().getManager().allDockWidgets(True, True):
|
||||
if existing[1].objectName() == name:
|
||||
QMessageBox.critical(self, "Error", "Name '" + name + "' already in use")
|
||||
return
|
||||
|
||||
dock_widget = QtAds.CDockWidget(name)
|
||||
dock_widget.setWidget(widget)
|
||||
dock_widget.setIcon(icon)
|
||||
|
||||
# Add the dock widget to the top dock widget area
|
||||
return self.__mgr.addDockWidget(QtAds.CenterDockWidgetArea, dock_widget, after)
|
||||
|
||||
def isTopLevel(self) -> bool:
|
||||
return not self.objectName()
|
||||
|
||||
def getGroupNameError(self, group_name: str) -> str:
|
||||
if not group_name:
|
||||
return "Group must have a non-empty name"
|
||||
|
||||
dock_managers = self.__mgr.allManagers(True, True)
|
||||
for mgr in dock_managers:
|
||||
if mgr.getGroupName() == group_name:
|
||||
return "Group name '" + group_name + "' already used"
|
||||
|
||||
return ""
|
||||
|
||||
def createGroup(self, group_name: str, insert_pos: QtAds.CDockAreaWidget, icon = QIcon()) -> 'DockInDockWidget':
|
||||
error = self.getGroupNameError(group_name)
|
||||
if error:
|
||||
QMessageBox.critical(None, "Error", error)
|
||||
return
|
||||
|
||||
child = DockInDockWidget(self, self.__top_level_dock_widget, self.__perspectives_manager)
|
||||
child.setObjectName(group_name)
|
||||
|
||||
dock_widget = QtAds.CDockWidget(group_name)
|
||||
dock_widget.setWidget(child)
|
||||
dock_widget.setIcon(icon)
|
||||
|
||||
insert_pos = self.__mgr.addDockWidget(QtAds.CenterDockWidgetArea, dock_widget, insert_pos)
|
||||
|
||||
return child, insert_pos
|
||||
|
||||
def destroyGroup(self, widget_to_remove: 'DockInDockWidget') -> None:
|
||||
top_level_widget = widget_to_remove.getTopLevelDockWidget()
|
||||
|
||||
if top_level_widget and top_level_widget != widget_to_remove:
|
||||
for dock_widget in widget_to_remove.getManager().getWidgetsInGUIOrder(): #don't use allDockWidgets to preserve sub-groups
|
||||
MoveDockWidgetAction.move(dock_widget, top_level_widget.getManager())
|
||||
assert not widget_to_remove.getManager().allDockWidgets(True, True)
|
||||
|
||||
# find widget's parent:
|
||||
for dock_widget in top_level_widget.getManager().allDockWidgets(True, True):
|
||||
if dockwidget[1].widget() == widget_to_remove:
|
||||
dockwidget[0].removeDockWidget(dockwidget[1])
|
||||
del dockwidget[1]
|
||||
# delete widgetToRemove; automatically deleted when dockWidget is deleted
|
||||
widget_to_remove = None
|
||||
break
|
||||
|
||||
assert widget_to_remove == None
|
||||
else:
|
||||
assert False
|
||||
|
||||
def attachViewMenu(self, menu: QMenu) -> None:
|
||||
menu.aboutToShow.connect(self.autoFillAttachedViewMenu)
|
||||
|
||||
def autoFillAttachedViewMenu(self) -> None:
|
||||
menu = self.sender()
|
||||
|
||||
if menu:
|
||||
menu.clear()
|
||||
self.setupViewMenu(menu)
|
||||
else:
|
||||
assert False
|
||||
|
||||
def setupViewMenu(self, menu):
|
||||
dock_managers = self.__mgr.allManagers(True, True)
|
||||
|
||||
has_perspectives_menu = False
|
||||
if self.getTopLevelDockWidget() == self:
|
||||
has_perspectives_menu = (self.__perspectives_manager != None)
|
||||
else:
|
||||
assert False
|
||||
|
||||
organize = menu
|
||||
if has_perspectives_menu:
|
||||
organize = menu.addMenu("Organize")
|
||||
|
||||
self.setupMenu(organize, dock_managers)
|
||||
|
||||
if has_perspectives_menu:
|
||||
perspectives = menu.addMenu("Perspectives")
|
||||
self.fillPerspectivesMenu(perspectives)
|
||||
|
||||
def setupMenu(self, menu: QMenu, move_to: 'list[DockInDockManager]') -> None:
|
||||
self.__mgr.fillViewMenu(menu, move_to)
|
||||
menu.addSeparator()
|
||||
move_menu = menu.addMenu("Move")
|
||||
self.__mgr.fillMoveMenu(move_menu, move_to)
|
||||
|
||||
def fillPerspectivesMenu(self, menu: QMenu):
|
||||
menu.addAction("Create perspective...", self.createPerspective)
|
||||
perspectives_names = []
|
||||
if self.__perspectives_manager:
|
||||
perspectives_names = self.__perspectives_manager.perspectiveNames()
|
||||
|
||||
if perspectives_names:
|
||||
load = menu.addMenu("Load perspective")
|
||||
for name in perspectives_names:
|
||||
load.addAction(LoadPerspectiveAction(load, name, self))
|
||||
remove = menu.addMenu("Remove perspective")
|
||||
for name in perspectives_names:
|
||||
remove.addAction(RemovePerspectiveAction(remove, name, self))
|
||||
|
||||
def setNewPerspectiveDefaultName(default_name: str) -> None:
|
||||
self.__new_perspective_default_name = default_name
|
||||
|
||||
def createPerspective(self) -> None:
|
||||
if not self.__perspectives_manager:
|
||||
return
|
||||
|
||||
name = self.__new_perspective_default_name
|
||||
if self.__new_perspective_default_name:
|
||||
index = 2
|
||||
while name in self.__perspectives_manager.perspectiveNames():
|
||||
name = f"{self.__new_perspective_default_name}({index})"
|
||||
index += 1
|
||||
|
||||
while True:
|
||||
name, ok = QInputDialog.getText(None, "Create perspective", "Enter perspective name", QLineEdit.Normal, name)
|
||||
if ok:
|
||||
if not name:
|
||||
QMessageBox.critical(None, "Error", "Perspective name cannot be empty")
|
||||
continue
|
||||
elif name in self.__perspectives_manager.perspectiveNames():
|
||||
if QMessageBox.critical(None, "Error", f"Perspective '{name}' already exists, overwrite it?", QMessageBox.Yes | QMessageBox.No, QMessageBox.No) == QMessageBox.No:
|
||||
continue
|
||||
|
||||
self.__perspectives_manager.addPerspective(name, self)
|
||||
break
|
||||
else:
|
||||
break
|
||||
|
||||
def dumpStatus(self, echo: callable = print, widget: QtAds.CDockWidget = None, tab: str = '', suffix: str = '') -> str:
|
||||
if widget is not None:
|
||||
as_mgr = DockInDockManager.dockInAManager(widget)
|
||||
if as_mgr:
|
||||
as_mgr.parent().dumpStatus(tab=tab)
|
||||
else:
|
||||
echo(tab + widget.objectName() + suffix)
|
||||
else:
|
||||
echo(tab + "Group: " + self.getManager().getGroupName())
|
||||
tab += " "
|
||||
visible_widgets = set()
|
||||
for widget in self.getManager().getWidgetsInGUIOrder():
|
||||
visible_widgets.add(widget)
|
||||
self.dumpStatus(widget=widget, tab=tab)
|
||||
|
||||
for closed in self.getManager().dockWidgetsMap().values():
|
||||
if not closed in visible_widgets:
|
||||
self.dumpStatus(widget=closed, tab=tab, suffix=" (closed)")
|
||||
334
examples/dockindock/dockindockmanager.cpp
Normal file
@@ -0,0 +1,334 @@
|
||||
#include "dockindockmanager.h"
|
||||
#include "dockindock.h"
|
||||
|
||||
#include "DockAreaWidget.h"
|
||||
|
||||
#include <QMenu>
|
||||
#include <QInputDialog>
|
||||
#include <QSettings>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
using namespace QtAdsUtl;
|
||||
|
||||
/////////////////////////////////////
|
||||
// DockInDockManager
|
||||
/////////////////////////////////////
|
||||
DockInDockManager::DockInDockManager( DockInDockWidget& parent ) :
|
||||
baseClass( &parent ),
|
||||
m_parent( parent )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
DockInDockManager::~DockInDockManager()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void DockInDockManager::fillViewMenu( QMenu* menu, const std::vector<DockInDockManager*>& moveTo )
|
||||
{
|
||||
auto widgetsMap = dockWidgetsMap();
|
||||
for ( auto iter = widgetsMap.begin(); iter != widgetsMap.end(); ++iter )
|
||||
{
|
||||
auto widget = iter.value()->widget();
|
||||
auto action = iter.value()->toggleViewAction();
|
||||
|
||||
DockInDockWidget* asMgr = dynamic_cast<DockInDockWidget*>( widget );
|
||||
if ( asMgr )
|
||||
{
|
||||
auto subMenu = menu->addMenu( iter.key() );
|
||||
|
||||
subMenu->addAction( action );
|
||||
subMenu->addSeparator();
|
||||
|
||||
asMgr->setupMenu( subMenu, moveTo );
|
||||
}
|
||||
else
|
||||
{
|
||||
menu->addAction(action);
|
||||
}
|
||||
}
|
||||
|
||||
if ( parent().canCreateNewGroups() )
|
||||
{
|
||||
// see how this works, to create it in the right place,
|
||||
// and also to have load perspective work when some groups are missing
|
||||
menu->addSeparator();
|
||||
menu->addAction( new QtAdsUtl::CreateChildDockAction( m_parent, menu ) );
|
||||
|
||||
if ( parent().getTopLevelDockWidget()->getManager() != this )
|
||||
menu->addAction( new QtAdsUtl::DestroyGroupAction( &m_parent, menu ) );
|
||||
}
|
||||
}
|
||||
|
||||
void DockInDockManager::fillMoveMenu( QMenu* menu, const std::vector<DockInDockManager*>& moveTo )
|
||||
{
|
||||
auto widgetsMap = dockWidgetsMap();
|
||||
for ( auto iter = widgetsMap.begin(); iter != widgetsMap.end(); ++iter )
|
||||
{
|
||||
auto subMenu = menu->addMenu( iter.key() );
|
||||
|
||||
for ( auto mgr : moveTo )
|
||||
{
|
||||
// iterate over all possible target managers
|
||||
if ( mgr == this )
|
||||
{
|
||||
// if dock is already in mgr, no reason to move it there
|
||||
}
|
||||
else if ( mgr == dockInAManager( iter.value() ) )
|
||||
{
|
||||
// if target is the group itself, can't move it there, would make no sense
|
||||
}
|
||||
else
|
||||
{
|
||||
subMenu->addAction( new MoveDockWidgetAction( iter.value(), mgr, subMenu ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DockInDockManager::addPerspectiveRec( const QString& name )
|
||||
{
|
||||
std::vector<DockInDockManager*> managers = allManagers( true, true );
|
||||
|
||||
for ( auto child : managers )
|
||||
child->addPerspective( name );
|
||||
}
|
||||
|
||||
void DockInDockManager::openPerspectiveRec( const QString& name )
|
||||
{
|
||||
std::vector<DockInDockManager*> managers = allManagers( true, true );
|
||||
|
||||
for ( auto child : managers )
|
||||
child->openPerspective( name );
|
||||
}
|
||||
|
||||
QString DockInDockManager::getGroupName()
|
||||
{
|
||||
return parent().objectName();
|
||||
}
|
||||
|
||||
#define CHILD_PREFIX QString("Child-")
|
||||
QString DockInDockManager::getPersistGroupName()
|
||||
{
|
||||
QString group = "Top";
|
||||
if ( !getGroupName().isEmpty() )
|
||||
group = CHILD_PREFIX + getGroupName();
|
||||
return group;
|
||||
}
|
||||
|
||||
QString DockInDockManager::getGroupNameFromPersistGroupName( QString persistGroupName )
|
||||
{
|
||||
if ( persistGroupName.startsWith( CHILD_PREFIX ) )
|
||||
{
|
||||
persistGroupName = persistGroupName.mid( CHILD_PREFIX.size() );
|
||||
}
|
||||
else
|
||||
{
|
||||
assert( false );
|
||||
}
|
||||
return persistGroupName;
|
||||
}
|
||||
|
||||
void DockInDockManager::loadPerspectivesRec(QSettings& Settings)
|
||||
{
|
||||
std::vector<DockInDockManager*> children = allManagers( true, true );
|
||||
|
||||
for ( auto mgr : children )
|
||||
{
|
||||
Settings.beginGroup(mgr->getPersistGroupName());
|
||||
mgr->loadPerspectives( Settings );
|
||||
Settings.endGroup();
|
||||
}
|
||||
}
|
||||
|
||||
void DockInDockManager::savePerspectivesRec(QSettings& Settings) const
|
||||
{
|
||||
std::vector<DockInDockManager*> children = allManagers( true, true );
|
||||
|
||||
for ( auto mgr : children )
|
||||
{
|
||||
Settings.beginGroup(mgr->getPersistGroupName());
|
||||
mgr->savePerspectives( Settings );
|
||||
Settings.endGroup();
|
||||
}
|
||||
}
|
||||
|
||||
void DockInDockManager::removePerspectivesRec()
|
||||
{
|
||||
std::vector<DockInDockManager*> managers = allManagers( true, true );
|
||||
|
||||
for ( auto child : managers )
|
||||
child->removePerspectives( child->perspectiveNames() );
|
||||
}
|
||||
|
||||
DockInDockManager* DockInDockManager::dockInAManager( ads::CDockWidget* widget )
|
||||
{
|
||||
DockInDockWidget* dockWidget = widget ? dynamic_cast<DockInDockWidget*>( widget->widget() ) : NULL;
|
||||
return ( dockWidget ) ? dockWidget->getManager() : NULL;
|
||||
}
|
||||
|
||||
void DockInDockManager::childManagers( std::vector<DockInDockManager*>& managers, bool rec ) const
|
||||
{
|
||||
auto widgets = getWidgetsInGUIOrder();
|
||||
for ( auto widget : widgets )
|
||||
{
|
||||
DockInDockManager* asMgr = dockInAManager( widget );
|
||||
if ( asMgr )
|
||||
{
|
||||
managers.push_back( asMgr );
|
||||
if ( rec )
|
||||
asMgr->childManagers( managers, rec );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<DockInDockManager*> DockInDockManager::allManagers( bool includeThis, bool rec ) const
|
||||
{
|
||||
std::vector<DockInDockManager*> managers;
|
||||
if ( includeThis )
|
||||
managers.push_back( const_cast<DockInDockManager*>(this) );
|
||||
childManagers( managers, rec );
|
||||
return managers;
|
||||
}
|
||||
|
||||
std::vector<std::pair<DockInDockManager*,ads::CDockWidget*>> DockInDockManager::allDockWidgets( bool includeThis, bool rec ) const
|
||||
{
|
||||
std::vector<std::pair<DockInDockManager*,ads::CDockWidget*>> widgets;
|
||||
for ( auto mgr : allManagers( includeThis, rec ) )
|
||||
{
|
||||
for ( auto widget : mgr->getWidgetsInGUIOrder() )
|
||||
widgets.push_back( std::make_pair(mgr, widget) );
|
||||
}
|
||||
return widgets;
|
||||
}
|
||||
|
||||
QMap<QString,QStringList> DockInDockManager::getGroupContents()
|
||||
{
|
||||
QMap<QString,QStringList> result;
|
||||
std::vector<DockInDockManager*> managers = allManagers( true, true );
|
||||
for ( auto mgr : managers )
|
||||
{
|
||||
result[mgr->getPersistGroupName()] = mgr->dockWidgetsMap().keys();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
ads::CDockAreaWidget* DockInDockManager::getInsertDefaultPos()
|
||||
{
|
||||
ads::CDockAreaWidget* defaultPos = NULL;
|
||||
if ( dockAreaCount() != 0 )
|
||||
defaultPos = dockArea(dockAreaCount()-1);
|
||||
return defaultPos;
|
||||
}
|
||||
|
||||
std::vector<ads::CDockWidget*> DockInDockManager::getWidgetsInGUIOrder() const
|
||||
{
|
||||
std::vector<ads::CDockWidget*> result;
|
||||
result.reserve( dockWidgetsMap().size() );
|
||||
for ( int i = 0; i != dockAreaCount(); ++i )
|
||||
{
|
||||
for ( auto widget : dockArea(i)->dockWidgets() )
|
||||
result.push_back( widget );
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/////////////////////////////////////
|
||||
// CreateChildDockAction
|
||||
/////////////////////////////////////
|
||||
CreateChildDockAction::CreateChildDockAction( DockInDockWidget& dockInDock, QMenu* menu ) :
|
||||
QAction("New group...", menu),
|
||||
m_dockInDock( dockInDock )
|
||||
{
|
||||
connect( this, SIGNAL(triggered()), this, SLOT(createGroup()) );
|
||||
}
|
||||
|
||||
void CreateChildDockAction::createGroup()
|
||||
{
|
||||
QString name = "";
|
||||
while ( true )
|
||||
{
|
||||
bool ok = false;
|
||||
name = QInputDialog::getText( NULL, this->text(), "Enter group name", QLineEdit::Normal, name, &ok );
|
||||
if ( ok )
|
||||
{
|
||||
QString error = "";
|
||||
if ( m_dockInDock.getTopLevelDockWidget() )
|
||||
error = m_dockInDock.getTopLevelDockWidget()->getGroupNameError( name );
|
||||
else
|
||||
assert( false );
|
||||
|
||||
if ( error.isEmpty() )
|
||||
{
|
||||
ads::CDockAreaWidget* insertPos = NULL;
|
||||
m_dockInDock.createGroup( name, insertPos );
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox::critical( NULL, "Error", error );
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////
|
||||
// DestroyGroupAction
|
||||
/////////////////////////////////////
|
||||
DestroyGroupAction::DestroyGroupAction( DockInDockWidget* widget, QMenu* menu ) :
|
||||
QAction("Destroy " + widget->getManager()->getGroupName(), menu),
|
||||
m_widget( widget )
|
||||
{
|
||||
connect( this, SIGNAL(triggered()), this, SLOT(destroyGroup()) );
|
||||
}
|
||||
|
||||
void DestroyGroupAction::destroyGroup()
|
||||
{
|
||||
m_widget->getTopLevelDockWidget()->destroyGroup( m_widget );
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////
|
||||
// MoveDockWidgetAction
|
||||
/////////////////////////////////////
|
||||
MoveDockWidgetAction::MoveDockWidgetAction( ads::CDockWidget* widget, DockInDockManager* moveTo, QMenu* menu ) :
|
||||
QAction(menu),
|
||||
m_widget( widget ),
|
||||
m_moveTo( moveTo )
|
||||
{
|
||||
if ( moveTo->parent().isTopLevel() )
|
||||
{
|
||||
setText( "To top" );
|
||||
}
|
||||
else
|
||||
{
|
||||
setText( "To " + moveTo->parent().objectName() );
|
||||
}
|
||||
connect( this, SIGNAL(triggered()), this, SLOT(move()) );
|
||||
}
|
||||
|
||||
void MoveDockWidgetAction::move()
|
||||
{
|
||||
move( m_widget, m_moveTo );
|
||||
}
|
||||
|
||||
void MoveDockWidgetAction::move( ads::CDockWidget* widget, DockInDockManager* moveTo )
|
||||
{
|
||||
if ( widget && moveTo )
|
||||
{
|
||||
widget->dockManager()->removeDockWidget( widget );
|
||||
moveTo->addDockWidget(ads::CenterDockWidgetArea, widget, moveTo->getInsertDefaultPos());
|
||||
}
|
||||
else
|
||||
{
|
||||
assert( false );
|
||||
}
|
||||
}
|
||||
96
examples/dockindock/dockindockmanager.h
Normal file
@@ -0,0 +1,96 @@
|
||||
#pragma once
|
||||
|
||||
#include "DockManager.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QMap>
|
||||
|
||||
namespace QtAdsUtl
|
||||
{
|
||||
|
||||
class DockInDockWidget;
|
||||
class DockInDockManager : public ads::CDockManager
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
typedef ads::CDockManager baseClass;
|
||||
|
||||
public:
|
||||
DockInDockManager( DockInDockWidget& parent );
|
||||
~DockInDockManager() override;
|
||||
|
||||
void fillViewMenu( QMenu* menu, const std::vector<DockInDockManager*>& moveTo );
|
||||
void fillMoveMenu( QMenu* menu, const std::vector<DockInDockManager*>& moveTo );
|
||||
|
||||
void addPerspectiveRec( const QString& name );
|
||||
void openPerspectiveRec( const QString& name );
|
||||
void removePerspectivesRec();
|
||||
void loadPerspectivesRec(QSettings& Settings);
|
||||
void savePerspectivesRec(QSettings& Settings) const;
|
||||
|
||||
static DockInDockManager* dockInAManager( ads::CDockWidget* widget );
|
||||
|
||||
inline DockInDockWidget& parent() { return m_parent; }
|
||||
|
||||
void childManagers( std::vector<DockInDockManager*>& managers, bool rec ) const;
|
||||
std::vector<DockInDockManager*> allManagers( bool includeThis, bool rec ) const;
|
||||
std::vector<std::pair<DockInDockManager*,ads::CDockWidget*>> allDockWidgets( bool includeThis, bool rec ) const;
|
||||
|
||||
QString getGroupName();
|
||||
QString getPersistGroupName();
|
||||
static QString getGroupNameFromPersistGroupName( QString persistGroupName );
|
||||
|
||||
QMap<QString,QStringList> getGroupContents();
|
||||
|
||||
ads::CDockAreaWidget* getInsertDefaultPos();
|
||||
|
||||
std::vector<ads::CDockWidget*> getWidgetsInGUIOrder() const;
|
||||
|
||||
private:
|
||||
DockInDockWidget& m_parent;
|
||||
};
|
||||
|
||||
class CreateChildDockAction : public QAction
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CreateChildDockAction( DockInDockWidget& dockInDock, QMenu* menu );
|
||||
|
||||
public slots:
|
||||
void createGroup();
|
||||
|
||||
private:
|
||||
DockInDockWidget& m_dockInDock;
|
||||
};
|
||||
|
||||
class DestroyGroupAction : public QAction
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
DestroyGroupAction( DockInDockWidget* widget, QMenu* menu );
|
||||
|
||||
public slots:
|
||||
void destroyGroup();
|
||||
|
||||
private:
|
||||
DockInDockWidget* m_widget;
|
||||
};
|
||||
|
||||
class MoveDockWidgetAction : public QAction
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
MoveDockWidgetAction( ads::CDockWidget* widget, DockInDockManager* moveTo, QMenu* menu );
|
||||
|
||||
static void move( ads::CDockWidget* widget, DockInDockManager* moveTo );
|
||||
|
||||
public slots:
|
||||
void move();
|
||||
|
||||
private:
|
||||
ads::CDockWidget* m_widget;
|
||||
DockInDockManager* m_moveTo;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
214
examples/dockindock/dockindockmanager.py
Normal file
@@ -0,0 +1,214 @@
|
||||
from PyQt5.QtWidgets import QAction, QMenu, QInputDialog, QLineEdit
|
||||
from PyQt5.QtCore import QSettings
|
||||
|
||||
from PyQtAds import QtAds
|
||||
|
||||
CHILD_PREFIX = "Child-"
|
||||
|
||||
class DockInDockManager(QtAds.CDockManager):
|
||||
def __init__(self, parent: 'DockInDockWidget'):
|
||||
super().__init__()
|
||||
self.__parent = parent
|
||||
|
||||
def parent(self) -> 'DockInDockWidget':
|
||||
return self.__parent
|
||||
|
||||
def fillViewMenu(self, menu: QMenu, move_to: 'dict[DockInDockManager]') -> None:
|
||||
from dockindock import DockInDockWidget # Prevent cyclic import
|
||||
|
||||
widgets_map = self.dockWidgetsMap()
|
||||
for key, value in widgets_map.items():
|
||||
widget = value.widget()
|
||||
action = value.toggleViewAction()
|
||||
|
||||
if isinstance(widget, DockInDockWidget):
|
||||
sub_menu = menu.addMenu(key)
|
||||
|
||||
sub_menu.addAction(action)
|
||||
sub_menu.addSeparator()
|
||||
|
||||
widget.setupMenu(sub_menu, move_to)
|
||||
else:
|
||||
menu.addAction(action)
|
||||
|
||||
if self.parent().canCreateNewGroups():
|
||||
# see how this works, to create it in the right place,
|
||||
# and also to have load perspective work when some groups are missing
|
||||
menu.addSeparator()
|
||||
menu.addAction(CreateChildDockAction(self.__parent, menu))
|
||||
|
||||
if self.parent().getTopLevelDockWidget().getManager() != self:
|
||||
menu.addAction(DestroyGroupAction( self.parent, menu))
|
||||
|
||||
def fillMoveMenu(self, menu: QMenu, move_to: 'list[DockInDockManager]') -> None:
|
||||
widgets_map = self.dockWidgetsMap()
|
||||
for key, value in widgets_map.items():
|
||||
sub_menu = menu.addMenu(key)
|
||||
|
||||
for mgr in move_to:
|
||||
# iterate over all possible target managers
|
||||
if mgr == self:
|
||||
pass # if dock is already in mgr, no reason to move it there
|
||||
elif mgr == DockInDockManager.dockInAManager(value):
|
||||
pass # if target is the group itself, can't move it there, would make no sense
|
||||
else:
|
||||
sub_menu.addAction(MoveDockWidgetAction(value, mgr, sub_menu))
|
||||
|
||||
def addPerspectiveRec(self, name: str) -> None:
|
||||
managers = self.allManagers(True, True)
|
||||
|
||||
for child in managers:
|
||||
child.addPerspective(name)
|
||||
|
||||
def openPerspectiveRec(self, name: str) -> None:
|
||||
managers = self.allManagers(True, True)
|
||||
|
||||
for child in managers:
|
||||
child.openPerspective(name)
|
||||
|
||||
def getGroupName(self) -> str:
|
||||
return self.parent().objectName()
|
||||
|
||||
def getPersistGroupName(self) -> str:
|
||||
group = "Top"
|
||||
if self.getGroupName():
|
||||
group = CHILD_PREFIX + self.getGroupName()
|
||||
return group
|
||||
|
||||
def getGroupNameFromPersistGroupName(self, persist_group_name) -> str:
|
||||
if persist_group_name.startswith(CHILD_PREFIX):
|
||||
persist_group_name = persist_group_name[len(CHILD_PREFIX):]
|
||||
else:
|
||||
assert False
|
||||
return persist_group_name
|
||||
|
||||
def loadPerspectivesRec(self, settings: QSettings) -> None:
|
||||
children = self.allManagers(True, True)
|
||||
|
||||
for mgr in children:
|
||||
settings.beginGroup(mgr.getPersistGroupName())
|
||||
mgr.loadPerspectives(settings)
|
||||
settings.endGroup()
|
||||
|
||||
def savePerspectivesRec(self, settings: QSettings) -> None:
|
||||
children = self.allManagers(True, True)
|
||||
|
||||
for mgr in children:
|
||||
settings.beginGroup(mgr.getPersistGroupName())
|
||||
mgr.savePerspectives(settings)
|
||||
settings.endGroup()
|
||||
|
||||
def removePerspectivesRec(self, settings: QSettings) -> None:
|
||||
children = self.allManagers(True, True)
|
||||
|
||||
for mgr in children:
|
||||
child.removePerspectives(child.perspectiveNames())
|
||||
|
||||
@staticmethod
|
||||
def dockInAManager(widget) -> 'DockInDockManager':
|
||||
from dockindock import DockInDockWidget # Prevent cyclic import
|
||||
|
||||
dock_widget = widget.widget() if widget else None
|
||||
return dock_widget.getManager() if isinstance(dock_widget, DockInDockWidget) else None
|
||||
|
||||
def childManagers(self, managers: 'list[DockInDockManager]', rec: bool) -> None:
|
||||
widgets = self.getWidgetsInGUIOrder()
|
||||
for widget in widgets:
|
||||
as_mgr = DockInDockManager.dockInAManager(widget)
|
||||
if as_mgr:
|
||||
managers.append(as_mgr)
|
||||
if rec:
|
||||
as_mgr.childManagers(managers, rec)
|
||||
|
||||
def allManagers(self, include_self: bool, rec: bool) -> 'list[DockInDockManager]':
|
||||
managers = []
|
||||
if include_self:
|
||||
managers.append(self)
|
||||
self.childManagers(managers, rec)
|
||||
return managers
|
||||
|
||||
def allDockWidgets(self, include_self: bool, rec: bool) -> 'list[tuple[DockInDockManager, QtAds.CDockWidget]]':
|
||||
widgets = []
|
||||
for mgr in self.allManagers(include_self, rec):
|
||||
for widget in mgr.getWidgetsInGUIOrder():
|
||||
widgets.append((mgr, widget))
|
||||
return widgets
|
||||
|
||||
def getGroupContents(self) -> 'dict[str, list[str]]':
|
||||
result = {}
|
||||
managers = self.allManagers(True, True)
|
||||
for mgr in managers:
|
||||
result[mgr.getPersistGroupName()] = mgr.dockWidgetsMap().keys()
|
||||
return result
|
||||
|
||||
def getInsertDefaultPos(self) -> QtAds.CDockAreaWidget:
|
||||
default_pos = None
|
||||
if self.dockAreaCount() != 0:
|
||||
default_pos = self.dockArea(self.dockAreaCount()-1)
|
||||
return default_pos
|
||||
|
||||
def getWidgetsInGUIOrder(self) -> 'list[QtAds.CDockWidget]':
|
||||
result = []
|
||||
for i in range(self.dockAreaCount()):
|
||||
for widget in self.dockArea(i).dockWidgets():
|
||||
result.append(widget)
|
||||
return result
|
||||
|
||||
|
||||
class CreateChildDockAction(QAction):
|
||||
def __init__(self, dock_in_dock: 'DockInDockWidget', menu: QMenu):
|
||||
super().__init__("New group...", menu)
|
||||
self.__dock_in_dock = dock_in_dock
|
||||
self.triggered.connect(self.createGroup)
|
||||
|
||||
def createGroup(self) -> None:
|
||||
name = ""
|
||||
while True:
|
||||
name, ok = QInputDialog.getText(None, self.text(), "Enter group name", QLineEdit.Normal, name)
|
||||
if ok:
|
||||
error = ""
|
||||
if self.__dock_in_dock.getTopLevelDockWidget():
|
||||
error = self.__dock_in_dock.getTopLevelDockWidget().getGroupNameError(name)
|
||||
else:
|
||||
assert False
|
||||
|
||||
if not error:
|
||||
self.__dock_in_dock.createGroup(name, None)
|
||||
break
|
||||
else:
|
||||
QMessageBox.critical(None, "Error", error)
|
||||
continue
|
||||
else:
|
||||
break
|
||||
|
||||
class DestroyGroupAction(QAction):
|
||||
def __init__(self, widget: 'DockInDockWidget', menu: QMenu):
|
||||
super().__init__("Destroy" + widget.getManager().getGroupName(), menu)
|
||||
self.__widget = widget
|
||||
self.triggered.connect(self.destroyGroup)
|
||||
|
||||
def destroyGroup(self) -> None:
|
||||
self.__widget.getTopLevelDockWidget().destroyGroup(self.__widget)
|
||||
|
||||
|
||||
class MoveDockWidgetAction(QAction):
|
||||
def __init__(self, widget: 'DockInDockWidget', move_to: DockInDockManager, menu: QMenu):
|
||||
super().__init__(menu)
|
||||
self.__widget = widget
|
||||
self.__move_to = move_to
|
||||
|
||||
if move_to.parent().isTopLevel():
|
||||
self.setText("To top")
|
||||
else:
|
||||
self.setText(f"To {move_to.parent().objectName()}")
|
||||
self.triggered.connect(self._move)
|
||||
|
||||
def _move(self) -> None:
|
||||
self.move(self.__widget, self.__move_to)
|
||||
|
||||
def move(self, widget: QtAds.CDockWidget, move_to: QtAds.CDockManager) -> None:
|
||||
if widget and move_to:
|
||||
widget.dockManager().removeDockWidget(widget)
|
||||
move_to.addDockWidget(QtAds.CenterDockWidgetArea, widget, move_to.getInsertDefaultPos())
|
||||
else:
|
||||
assert False
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "MainWindow.h"
|
||||
#include <QApplication>
|
||||
#include "../../examples/simple/MainWindow.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
72
examples/dockindock/main.py
Normal file
@@ -0,0 +1,72 @@
|
||||
import sys
|
||||
import os
|
||||
import atexit
|
||||
|
||||
from PyQt5.QtWidgets import QApplication, QMainWindow, QLabel
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQtAds import QtAds
|
||||
|
||||
from perspectives import PerspectivesManager
|
||||
from dockindock import DockInDockWidget
|
||||
|
||||
class MainWindow(QMainWindow):
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
|
||||
self.perspectives_manager = PerspectivesManager("persist")
|
||||
self.resize(400, 400)
|
||||
self.dock_manager = DockInDockWidget(self, self.perspectives_manager, can_create_new_groups=True)
|
||||
self.setCentralWidget(self.dock_manager)
|
||||
self.dock_manager.attachViewMenu(self.menuBar().addMenu("View"))
|
||||
|
||||
previous_dock_widget = None
|
||||
for i in range(3):
|
||||
l = QLabel()
|
||||
l.setWordWrap(True)
|
||||
l.setAlignment(Qt.AlignTop | Qt.AlignLeft)
|
||||
l.setText("Lorem ipsum dolor sit amet, consectetuer adipiscing elit. ")
|
||||
|
||||
previous_dock_widget = self.dock_manager.addTabWidget(l, f"Top label {i}", previous_dock_widget)
|
||||
|
||||
last_top_level_dock = previous_dock_widget
|
||||
|
||||
for j in range(2):
|
||||
group_manager, _ = self.dock_manager.createGroup(f"Group {j}", last_top_level_dock)
|
||||
|
||||
previous_dock_widget = None
|
||||
|
||||
for i in range(3):
|
||||
# Create example content label - this can be any application specific widget
|
||||
l = QLabel()
|
||||
l.setWordWrap(True)
|
||||
l.setAlignment(Qt.AlignTop | Qt.AlignLeft)
|
||||
l.setText("Lorem ipsum dolor sit amet, consectetuer adipiscing elit. ")
|
||||
|
||||
previous_dock_widget = group_manager.addTabWidget(l, f"ZInner {j}/{i}", previous_dock_widget)
|
||||
|
||||
# create sub-group
|
||||
sub_group, _ = group_manager.createGroup(f"SubGroup {j}", previous_dock_widget)
|
||||
previous_dock_widget = None
|
||||
for i in range(3):
|
||||
# Create example content label - this can be any application specific widget
|
||||
l = QLabel()
|
||||
l.setWordWrap(True)
|
||||
l.setAlignment(Qt.AlignTop | Qt.AlignLeft)
|
||||
l.setText("Lorem ipsum dolor sit amet, consectetuer adipiscing elit. ")
|
||||
|
||||
previous_dock_widget = sub_group.addTabWidget(l, f"SubInner {j}/{i}", previous_dock_widget)
|
||||
|
||||
self.perspectives_manager.loadPerspectives()
|
||||
|
||||
atexit.register(self.cleanup)
|
||||
|
||||
def cleanup(self):
|
||||
self.perspectives_manager.savePerspectives()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app = QApplication(sys.argv)
|
||||
|
||||
w = MainWindow()
|
||||
w.show()
|
||||
app.exec_()
|
||||
76
examples/dockindock/mainframe.cpp
Normal file
@@ -0,0 +1,76 @@
|
||||
#include "mainframe.h"
|
||||
|
||||
#include "dockindock.h"
|
||||
#include "perspectives.h"
|
||||
|
||||
#include <QLabel>
|
||||
#include <QMenuBar>
|
||||
#include <QMessageBox>
|
||||
#include <QSettings>
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent) :
|
||||
QMainWindow(parent),
|
||||
m_perspectivesManager( new QtAdsUtl::PerspectivesManager( "persist" ) )
|
||||
{
|
||||
resize( 400, 400 );
|
||||
|
||||
setCentralWidget( m_dockManager = new QtAdsUtl::DockInDockWidget(this,true,m_perspectivesManager.get()) );
|
||||
|
||||
m_dockManager->attachViewMenu( menuBar()->addMenu( "View" ) );
|
||||
|
||||
ads::CDockAreaWidget* previousDockWidget = NULL;
|
||||
for ( int i = 0; i != 3; ++i )
|
||||
{
|
||||
// Create example content label - this can be any application specific
|
||||
// widget
|
||||
QLabel* l = new QLabel();
|
||||
l->setWordWrap(true);
|
||||
l->setAlignment(Qt::AlignTop | Qt::AlignLeft);
|
||||
l->setText("Lorem ipsum dolor sit amet, consectetuer adipiscing elit. ");
|
||||
|
||||
previousDockWidget = m_dockManager->addTabWidget( l, "Top label " + QString::number(i), previousDockWidget );
|
||||
}
|
||||
|
||||
auto lastTopLevelDock = previousDockWidget;
|
||||
|
||||
for ( int j = 0; j != 2; ++j )
|
||||
{
|
||||
QtAdsUtl::DockInDockWidget* groupManager = m_dockManager->createGroup( "Group " + QString::number(j), lastTopLevelDock );
|
||||
|
||||
previousDockWidget = NULL;
|
||||
for ( int i = 0; i != 3; ++i )
|
||||
{
|
||||
// Create example content label - this can be any application specific
|
||||
// widget
|
||||
QLabel* l = new QLabel();
|
||||
l->setWordWrap(true);
|
||||
l->setAlignment(Qt::AlignTop | Qt::AlignLeft);
|
||||
l->setText("Lorem ipsum dolor sit amet, consectetuer adipiscing elit. ");
|
||||
|
||||
previousDockWidget = groupManager->addTabWidget( l, "ZInner " + QString::number(j) + "/" + QString::number(i), previousDockWidget );
|
||||
}
|
||||
|
||||
// create sub-group
|
||||
auto subGroup = groupManager->createGroup( "SubGroup " + QString::number(j), previousDockWidget );
|
||||
previousDockWidget = NULL;
|
||||
for ( int i = 0; i != 3; ++i )
|
||||
{
|
||||
// Create example content label - this can be any application specific
|
||||
// widget
|
||||
QLabel* l = new QLabel();
|
||||
l->setWordWrap(true);
|
||||
l->setAlignment(Qt::AlignTop | Qt::AlignLeft);
|
||||
l->setText("Lorem ipsum dolor sit amet, consectetuer adipiscing elit. ");
|
||||
|
||||
previousDockWidget = subGroup->addTabWidget( l, "SubInner " + QString::number(j) + "/" + QString::number(i), previousDockWidget );
|
||||
}
|
||||
}
|
||||
|
||||
m_perspectivesManager->loadPerspectives();
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
m_perspectivesManager->savePerspectives();
|
||||
}
|
||||
|
||||
30
examples/dockindock/mainframe.h
Normal file
@@ -0,0 +1,30 @@
|
||||
#pragma once
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QAction>
|
||||
#include <QSettings>
|
||||
|
||||
#include <memory>
|
||||
namespace QtAdsUtl
|
||||
{
|
||||
class DockInDockWidget;
|
||||
class PerspectivesManager;
|
||||
}
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MainWindow(QWidget *parent = 0);
|
||||
~MainWindow();
|
||||
|
||||
QtAdsUtl::DockInDockWidget* m_dockManager;
|
||||
std::unique_ptr<QtAdsUtl::PerspectivesManager> m_perspectivesManager;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
39
examples/dockindock/perspectiveactions.cpp
Normal file
@@ -0,0 +1,39 @@
|
||||
#include "perspectiveactions.h"
|
||||
#include "dockindock.h"
|
||||
#include "perspectives.h"
|
||||
|
||||
#include <QMenu>
|
||||
|
||||
using namespace QtAdsUtl;
|
||||
|
||||
//////////////////////////////
|
||||
// LoadPerspectiveAction
|
||||
//////////////////////////////
|
||||
LoadPerspectiveAction::LoadPerspectiveAction( QMenu* parent, const QString& name, QtAdsUtl::DockInDockWidget& dockManager ) :
|
||||
QAction( name, parent ),
|
||||
name( name ),
|
||||
dockManager( dockManager )
|
||||
{
|
||||
connect( this, SIGNAL(triggered()), this, SLOT(load()) );
|
||||
}
|
||||
|
||||
void LoadPerspectiveAction::load()
|
||||
{
|
||||
dockManager.getPerspectivesManager()->openPerspective( name, dockManager );
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
// RemovePerspectiveAction
|
||||
//////////////////////////////
|
||||
RemovePerspectiveAction::RemovePerspectiveAction( QMenu* parent, const QString& name, QtAdsUtl::DockInDockWidget& dockManager ) :
|
||||
QAction( name, parent ),
|
||||
name( name ),
|
||||
dockManager( dockManager )
|
||||
{
|
||||
connect( this, SIGNAL(triggered()), this, SLOT(remove()) );
|
||||
}
|
||||
|
||||
void RemovePerspectiveAction::remove()
|
||||
{
|
||||
dockManager.getPerspectivesManager()->removePerspective( name );
|
||||
}
|
||||
38
examples/dockindock/perspectiveactions.h
Normal file
@@ -0,0 +1,38 @@
|
||||
#pragma once
|
||||
|
||||
#include <QAction>
|
||||
|
||||
namespace QtAdsUtl
|
||||
{
|
||||
|
||||
class DockInDockWidget;
|
||||
class LoadPerspectiveAction : public QAction
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
LoadPerspectiveAction( QMenu* parent, const QString& name, QtAdsUtl::DockInDockWidget& dockManager );
|
||||
|
||||
public slots:
|
||||
void load();
|
||||
|
||||
private:
|
||||
QString name;
|
||||
QtAdsUtl::DockInDockWidget& dockManager;
|
||||
};
|
||||
|
||||
class RemovePerspectiveAction : public QAction
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
RemovePerspectiveAction( QMenu* parent, const QString& name, QtAdsUtl::DockInDockWidget& dockManager );
|
||||
|
||||
public slots:
|
||||
void remove();
|
||||
|
||||
private:
|
||||
QString name;
|
||||
QtAdsUtl::DockInDockWidget& dockManager;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
25
examples/dockindock/perspectiveactions.py
Normal file
@@ -0,0 +1,25 @@
|
||||
from PyQt5.QtWidgets import QAction, QMenu
|
||||
|
||||
|
||||
class LoadPerspectiveAction(QAction):
|
||||
def __init__(self, parent: QMenu, name: str, dock_manager: 'DockInDockWidget'):
|
||||
super().__init__(name, parent)
|
||||
self.name = name
|
||||
self.dock_manager = dock_manager
|
||||
|
||||
self.triggered.connect(self.load)
|
||||
|
||||
def load(self):
|
||||
self.dock_manager.getPerspectivesManager().openPerspective(self.name, self.dock_manager)
|
||||
|
||||
|
||||
class RemovePerspectiveAction(QAction):
|
||||
def __init__(self, parent: QMenu, name: str, dock_manager: 'DockInDockWidget'):
|
||||
super().__init__(name, parent)
|
||||
self.name = name
|
||||
self.dock_manager = dock_manager
|
||||
|
||||
self.triggered.connect(self.remove)
|
||||
|
||||
def remove(self):
|
||||
self.dock_manager.getPerspectivesManager().removePerspective(self.name)
|
||||