Compare commits
584 Commits
fixing_bui
...
python38
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
db9babbdca | ||
|
|
463dd2261e | ||
|
|
4dd66969af | ||
|
|
2c98003219 | ||
|
|
dd853a8f72 | ||
|
|
88d5e6b29d | ||
|
|
71e5d8cc31 | ||
|
|
15b3843172 | ||
|
|
3cffe3b3be | ||
|
|
9dd87b7777 | ||
|
|
b057cf905b | ||
|
|
d7943d30d8 | ||
|
|
1826d68841 | ||
|
|
dc1e5103e2 | ||
|
|
33c5647e57 | ||
|
|
f6f772edc5 | ||
|
|
7e460d8f34 | ||
|
|
7af2095f2f | ||
|
|
8307598d5d | ||
|
|
13fe276dbe | ||
|
|
13a5a472cd | ||
|
|
b5c11ce199 | ||
|
|
83c8c22736 | ||
|
|
c8ca7bf9e1 | ||
|
|
0184deb54d | ||
|
|
389042f3cc | ||
|
|
736358a71f | ||
|
|
bffe671679 | ||
|
|
fafc0b7946 | ||
|
|
3574feea98 | ||
|
|
25b48920bb | ||
|
|
e22ca48674 | ||
|
|
3b9773f872 | ||
|
|
3e3cf10fff | ||
|
|
421b401b4f | ||
|
|
a0c97e3388 | ||
|
|
d2a3968897 | ||
|
|
4ea7953a76 | ||
|
|
0cc0972eea | ||
|
|
77b5d1630d | ||
|
|
f962989484 | ||
|
|
1ccdf445eb | ||
|
|
3fb8861eee | ||
|
|
78381badd1 | ||
|
|
8b1a9f2a41 | ||
|
|
9ee52a0011 | ||
|
|
240169ce23 | ||
|
|
97a431f367 | ||
|
|
3769ad9615 | ||
|
|
8332ab3ddc | ||
|
|
3b4a2f134f | ||
|
|
5899e3716c | ||
|
|
25bc05ae40 | ||
|
|
f42629a6e5 | ||
|
|
192cb2daaa | ||
|
|
63cc87af2d | ||
|
|
3e1ea3ec67 | ||
|
|
c27a09c13c | ||
|
|
b3486ebca8 | ||
|
|
6a7230e546 | ||
|
|
ca173de71d | ||
|
|
5732e8ed14 | ||
|
|
5cc7a0864b | ||
|
|
e4671f175c | ||
|
|
17fd6b2454 | ||
|
|
7ed3945d58 | ||
|
|
35de0a2fef | ||
|
|
8a0e475f21 | ||
|
|
63d14f2345 | ||
|
|
e91849759c | ||
|
|
ee3a3af408 | ||
|
|
c470c89fc6 | ||
|
|
73cfa64ebb | ||
|
|
ffe5d5f6cb | ||
|
|
aff4450b42 | ||
|
|
d40580c550 | ||
|
|
8e19b81eb9 | ||
|
|
d5191696e1 | ||
|
|
1d01466181 | ||
|
|
1cead0e2b8 | ||
|
|
aff4d426b8 | ||
|
|
4597cdeda8 | ||
|
|
2e7f0bf51d | ||
|
|
fa551b84f6 | ||
|
|
ce105212ab | ||
|
|
31d4b62181 | ||
|
|
7ec542a211 | ||
|
|
e615d1c618 | ||
|
|
ce349d0fcd | ||
|
|
c86813b1cb | ||
|
|
1fe651aaa7 | ||
|
|
ba7809236b | ||
|
|
84814b3c59 | ||
|
|
73ca6e6671 | ||
|
|
a26759f340 | ||
|
|
200ef12b4a | ||
|
|
990fac9a0a | ||
|
|
31ec4cdecb | ||
|
|
1d968bd902 | ||
|
|
69a632cfc2 | ||
|
|
9a784f1222 | ||
|
|
4a390696d5 | ||
|
|
68aaccadab | ||
|
|
3940228b59 | ||
|
|
f8abe48c82 | ||
|
|
86db81e5b7 | ||
|
|
34676f016f | ||
|
|
4448891315 | ||
|
|
fc1f12b77c | ||
|
|
a50057f5d2 | ||
|
|
d7b32e475e | ||
|
|
e32aaccaac | ||
|
|
8b695eec79 | ||
|
|
c85904c67e | ||
|
|
22a709a39e | ||
|
|
4f4a5de700 | ||
|
|
08ecbb2ca6 | ||
|
|
048b494874 | ||
|
|
1539d7233b | ||
|
|
214dbdf359 | ||
|
|
473ce60340 | ||
|
|
74ba8c6bd2 | ||
|
|
11a1023e79 | ||
|
|
3302401a36 | ||
|
|
3c5f07ac79 | ||
|
|
c0c1383254 | ||
|
|
ec4a4d1c86 | ||
|
|
5ef330f479 | ||
|
|
bbdbadd630 | ||
|
|
80a1483617 | ||
|
|
13a7d27046 | ||
|
|
8800c02403 | ||
|
|
dd9ec48979 | ||
|
|
262d703608 | ||
|
|
5629e1dfc2 | ||
|
|
7001aa58ce | ||
|
|
d87898b59e | ||
|
|
d1078adad2 | ||
|
|
e4f0fae7e5 | ||
|
|
4b06706d61 | ||
|
|
7e1331bd76 | ||
|
|
f735f25fb0 | ||
|
|
750c089ab0 | ||
|
|
3088f33837 | ||
|
|
1d598d2585 | ||
|
|
768c51f01c | ||
|
|
a2e2b32fc3 | ||
|
|
a6abf73669 | ||
|
|
a6e62ec74d | ||
|
|
93441a5754 | ||
|
|
fe57686715 | ||
|
|
330f5aebdf | ||
|
|
02c17e59dd | ||
|
|
be8af12a90 | ||
|
|
238193f56b | ||
|
|
54233085a4 | ||
|
|
2241b938c9 | ||
|
|
631d036c26 | ||
|
|
d70f795dea | ||
|
|
0be99d3e79 | ||
|
|
45aab49be7 | ||
|
|
2c66238791 | ||
|
|
bec1ddae67 | ||
|
|
913d3b263d | ||
|
|
614e20a183 | ||
|
|
f9f270980d | ||
|
|
763b878ca1 | ||
|
|
d3d040adee | ||
|
|
31f5cc10cf | ||
|
|
38c9a3d9c6 | ||
|
|
362f2d5750 | ||
|
|
463b6a1322 | ||
|
|
00a95ac468 | ||
|
|
966f30e356 | ||
|
|
f0217f53c2 | ||
|
|
ced1c4dcc8 | ||
|
|
e1578436d0 | ||
|
|
701df72db6 | ||
|
|
c4ebef1f1e | ||
|
|
6f0eb7a2f2 | ||
|
|
be6c3ca2df | ||
|
|
18b49686f1 | ||
|
|
02d4611501 | ||
|
|
2fe8117e80 | ||
|
|
457ea402d5 | ||
|
|
89623eb8b4 | ||
|
|
df02382387 | ||
|
|
7470d62b7c | ||
|
|
9eb9018f47 | ||
|
|
d7bcbe666c | ||
|
|
aaa5b4ba26 | ||
|
|
720dad1ed6 | ||
|
|
6417db6d91 | ||
|
|
ec681e99ca | ||
|
|
47ef203643 | ||
|
|
844aa2f36a | ||
|
|
e2e8f10948 | ||
|
|
1c49e2297a | ||
|
|
6f031e3c33 | ||
|
|
f74fd52d53 | ||
|
|
2d4cef670b | ||
|
|
dfaf455624 | ||
|
|
5d2e09de36 | ||
|
|
c86de50032 | ||
|
|
5ff720f432 | ||
|
|
6f7e47324c | ||
|
|
b68f81779c | ||
|
|
4c1b433269 | ||
|
|
7c63da18ed | ||
|
|
6f2e5ecc3b | ||
|
|
759cf33f08 | ||
|
|
77279d21ef | ||
|
|
46872fdfe8 | ||
|
|
79fe9c2875 | ||
|
|
f04ea37ac2 | ||
|
|
d2db92f1e7 | ||
|
|
206433e430 | ||
|
|
fb1f3fa931 | ||
|
|
3d106ae2f1 | ||
|
|
05f0a6463b | ||
|
|
7b5d5d0f31 | ||
|
|
20174989a6 | ||
|
|
80d48adc07 | ||
|
|
3454185df4 | ||
|
|
9de0868c74 | ||
|
|
66cb6c7dee | ||
|
|
1ce67b1c8f | ||
|
|
a9bb5b2f42 | ||
|
|
97ca7fd2a0 | ||
|
|
b85e291d40 | ||
|
|
b3e3752789 | ||
|
|
7cd6928b87 | ||
|
|
bb1b3c7b7b | ||
|
|
49c7cea3a5 | ||
|
|
64f5009297 | ||
|
|
0ab701bab6 | ||
|
|
1721415799 | ||
|
|
26269459db | ||
|
|
675da6b2e2 | ||
|
|
517bfca259 | ||
|
|
3e30685eb4 | ||
|
|
95cbba4618 | ||
|
|
d89c6b9c06 | ||
|
|
4bda994d5c | ||
|
|
2b4f6f33af | ||
|
|
62500a322f | ||
|
|
ae58a8b9df | ||
|
|
2a8732fdcd | ||
|
|
19931ec18e | ||
|
|
b981fc4b7d | ||
|
|
4b2f268921 | ||
|
|
7fb5a8d444 | ||
|
|
913cc16371 | ||
|
|
4e8a9ff8ed | ||
|
|
68034de1a7 | ||
|
|
f67d8615ca | ||
|
|
4483c921ea | ||
|
|
e8732ecfc0 | ||
|
|
71a538651a | ||
|
|
18c9963124 | ||
|
|
cd0f2f4e33 | ||
|
|
fc028ec0be | ||
|
|
2dbdb9f7eb | ||
|
|
50f6e76e81 | ||
|
|
c6af93adcb | ||
|
|
bd985781b9 | ||
|
|
70ecdaf54c | ||
|
|
a04287b9b3 | ||
|
|
be8d00f0c8 | ||
|
|
b08797c400 | ||
|
|
2836edd32d | ||
|
|
92f6886217 | ||
|
|
0c9518dc74 | ||
|
|
944ee7c7dc | ||
|
|
917dbf09f6 | ||
|
|
d732be4e17 | ||
|
|
18dbbb291a | ||
|
|
3bb7922f2c | ||
|
|
4aedba3b2b | ||
|
|
99c0e99b26 | ||
|
|
28ab554cb3 | ||
|
|
cd80a47c93 | ||
|
|
eb05b54b0e | ||
|
|
bbbce6f694 | ||
|
|
ba0d515330 | ||
|
|
69154c0384 | ||
|
|
66ac5e9d2f | ||
|
|
4924b951cc | ||
|
|
96f7def396 | ||
|
|
4556f1c949 | ||
|
|
a4cca3bcc2 | ||
|
|
6254c2089f | ||
|
|
89f50769b6 | ||
|
|
a24f5e31b9 | ||
|
|
b338f183e1 | ||
|
|
8ab8e0524b | ||
|
|
affb48f44d | ||
|
|
d5b2336b69 | ||
|
|
580e3a6a2c | ||
|
|
e3d5203f1a | ||
|
|
9e42b11272 | ||
|
|
ce93c3b739 | ||
|
|
6a8e00bfa2 | ||
|
|
0b5a99860f | ||
|
|
3f012a2ef1 | ||
|
|
a102e4ae1e | ||
|
|
03f5817488 | ||
|
|
0f2edfdb4e | ||
|
|
d289134b15 | ||
|
|
7475c7cc71 | ||
|
|
7958eeeded | ||
|
|
f29f773555 | ||
|
|
a113205881 | ||
|
|
7830ccb017 | ||
|
|
6a205a5406 | ||
|
|
d91a42930d | ||
|
|
6f3df707f4 | ||
|
|
f388b11d0d | ||
|
|
66d12fef82 | ||
|
|
83c744041e | ||
|
|
dcac39a35f | ||
|
|
c4d3ba71b2 | ||
|
|
74c74593e2 | ||
|
|
62591bc360 | ||
|
|
1fca162fb2 | ||
|
|
82967435ea | ||
|
|
7738354be1 | ||
|
|
0d2166770e | ||
|
|
9d7de9ea4d | ||
|
|
5aa3ba25cc | ||
|
|
b330f902fd | ||
|
|
aa76dfba02 | ||
|
|
b3c2d87a9b | ||
|
|
cc1347adf8 | ||
|
|
df0a80b320 | ||
|
|
26f7557834 | ||
|
|
e6c2f29532 | ||
|
|
37cc16fe17 | ||
|
|
c7ac88836a | ||
|
|
536e048f1c | ||
|
|
4671848428 | ||
|
|
4449785e2c | ||
|
|
39deb9ee83 | ||
|
|
2266f4a75c | ||
|
|
06b680f603 | ||
|
|
ec6be7d1a5 | ||
|
|
37040bfc9e | ||
|
|
1f4f7ec0e5 | ||
|
|
a31571ab2c | ||
|
|
714ef2adb8 | ||
|
|
e447bbf03b | ||
|
|
3846b638fb | ||
|
|
6ae8a203d9 | ||
|
|
1dbd491738 | ||
|
|
e8693edb33 | ||
|
|
5cbad00cb5 | ||
|
|
c6e4deb0ca | ||
|
|
693fb84a3e | ||
|
|
b0a7d5d4a0 | ||
|
|
818acc0ff1 | ||
|
|
819fec6061 | ||
|
|
4ea8c98243 | ||
|
|
95317a7336 | ||
|
|
9b6abfbbc3 | ||
|
|
4bee3023d2 | ||
|
|
45f12db8d3 | ||
|
|
9956b3fed3 | ||
|
|
374e837aa9 | ||
|
|
6ffd3e574f | ||
|
|
8a3706f6cb | ||
|
|
faa16ad910 | ||
|
|
eb69e25622 | ||
|
|
b006bb0c3c | ||
|
|
02ed50b336 | ||
|
|
f0023bc084 | ||
|
|
6502f7760d | ||
|
|
7606691ea3 | ||
|
|
257a1e9474 | ||
|
|
9f02ccbb48 | ||
|
|
a18199e9a2 | ||
|
|
cdd6f998c4 | ||
|
|
df21b6fc6f | ||
|
|
edf7dee78e | ||
|
|
f723e5ea59 | ||
|
|
748243f512 | ||
|
|
e7d37402d7 | ||
|
|
7c101ae3af | ||
|
|
cf9cdd8b3b | ||
|
|
b18783c17a | ||
|
|
201d06d878 | ||
|
|
742ef7d529 | ||
|
|
3d73fc10cd | ||
|
|
075c1b06f7 | ||
|
|
2706a3d379 | ||
|
|
e476dce1d4 | ||
|
|
2f25657cfa | ||
|
|
1167545199 | ||
|
|
fcd1fae77e | ||
|
|
06db10561c | ||
|
|
ead9e8945e | ||
|
|
15d4f77d5d | ||
|
|
c903a64726 | ||
|
|
8fa63a8773 | ||
|
|
8a0e6c90b9 | ||
|
|
e4fdf33cfc | ||
|
|
548e38fca0 | ||
|
|
c804c806e1 | ||
|
|
7c291691aa | ||
|
|
cec8cf25ef | ||
|
|
5a2812ecf3 | ||
|
|
0f09ba717f | ||
|
|
1026abbbf4 | ||
|
|
5b578c86e8 | ||
|
|
d7e4a782c1 | ||
|
|
d65dfeceb0 | ||
|
|
e9a7a3a5f5 | ||
|
|
8504252142 | ||
|
|
19730ab6a4 | ||
|
|
44ae75110b | ||
|
|
4ab2a93d59 | ||
|
|
f82ea82403 | ||
|
|
fff6c004e0 | ||
|
|
75c7744e59 | ||
|
|
1e8bdba2dd | ||
|
|
2587831855 | ||
|
|
f00a283722 | ||
|
|
e3b333aca8 | ||
|
|
c9602c2b0a | ||
|
|
c660c80a15 | ||
|
|
6f889d1c3b | ||
|
|
80577832d7 | ||
|
|
7a18ef77cd | ||
|
|
e29f7cb1d3 | ||
|
|
8970274810 | ||
|
|
d57fd8bfd3 | ||
|
|
8507866891 | ||
|
|
425d53fbe3 | ||
|
|
b0cb983830 | ||
|
|
02515d8956 | ||
|
|
447b4337dd | ||
|
|
633daf124e | ||
|
|
446560931b | ||
|
|
9fe11a7ad5 | ||
|
|
b099994ac5 | ||
|
|
a8d56ef4e6 | ||
|
|
1f8d212dee | ||
|
|
64ea87f4cc | ||
|
|
e6fef433d5 | ||
|
|
2f212031b3 | ||
|
|
586ab710f6 | ||
|
|
d263ae649e | ||
|
|
c81ca45e41 | ||
|
|
9ce50fa305 | ||
|
|
f0240deaeb | ||
|
|
017f06dcfb | ||
|
|
54f17cb546 | ||
|
|
f174ab6ebc | ||
|
|
263f936690 | ||
|
|
bd903a0353 | ||
|
|
5040d3a6b6 | ||
|
|
3684da776d | ||
|
|
bc17c8e5b3 | ||
|
|
778c647782 | ||
|
|
2a91f6279b | ||
|
|
4ef2ddbfec | ||
|
|
ff06f0cc73 | ||
|
|
a37ab34fae | ||
|
|
cb2ffe66af | ||
|
|
16b0770d72 | ||
|
|
3fe44ee735 | ||
|
|
40d1a72300 | ||
|
|
4d428d42f6 | ||
|
|
7e9896263b | ||
|
|
cf0665c9b6 | ||
|
|
93c011c69d | ||
|
|
f50c0b9d06 | ||
|
|
6fc79d942b | ||
|
|
d01228d9ff | ||
|
|
b58d766d54 | ||
|
|
79cbb96a38 | ||
|
|
aabaeacb81 | ||
|
|
3ab3e6d41b | ||
|
|
f2f4afd0bb | ||
|
|
0d62c43b9e | ||
|
|
1614d5702c | ||
|
|
610b9542e9 | ||
|
|
946f32a274 | ||
|
|
c7a6bc015e | ||
|
|
19fd1635e6 | ||
|
|
74b034a195 | ||
|
|
581139d099 | ||
|
|
e5492ea906 | ||
|
|
623133a0dc | ||
|
|
6baa8f2dbb | ||
|
|
d2739d7218 | ||
|
|
5702101935 | ||
|
|
35d45a7523 | ||
|
|
e37c1f0e8c | ||
|
|
ac0d35ef12 | ||
|
|
15e63381a9 | ||
|
|
aa49ddacd5 | ||
|
|
f68e876bcb | ||
|
|
6b82ded399 | ||
|
|
000e67a09e | ||
|
|
1b6aa4c3d1 | ||
|
|
8912a2c842 | ||
|
|
4de50db68c | ||
|
|
6b95e4aac9 | ||
|
|
c27658822e | ||
|
|
8ec980c1e8 | ||
|
|
a952c5829a | ||
|
|
20e1b55a8a | ||
|
|
a2605868db | ||
|
|
67be35b9f8 | ||
|
|
b15eb1e62f | ||
|
|
d2e3ec0448 | ||
|
|
828c403fe5 | ||
|
|
53d3bc86ea | ||
|
|
6ed8742cc1 | ||
|
|
7bd047f6e6 | ||
|
|
482757b1cc | ||
|
|
c143f832c6 | ||
|
|
67a173ef53 | ||
|
|
c2c37488a3 | ||
|
|
8c1840b9cf | ||
|
|
1088e37cd4 | ||
|
|
4d6c3dac3d | ||
|
|
adf29873ef | ||
|
|
772afe29ea | ||
|
|
9c78953800 | ||
|
|
ff67b9bcbc | ||
|
|
103de4f910 | ||
|
|
7c3f06f98f | ||
|
|
6ac77a7662 | ||
|
|
610b85d01a | ||
|
|
d4d222ebd3 | ||
|
|
5cbed1d34b | ||
|
|
ba4a2eef5c | ||
|
|
acdf03fc84 | ||
|
|
a6f19e07c4 | ||
|
|
f07301bb1e | ||
|
|
2116e3741b | ||
|
|
1f11c732ed | ||
|
|
e42bee27a4 | ||
|
|
b36dcf1325 | ||
|
|
421746c943 | ||
|
|
f544ac58e6 | ||
|
|
6047275cfa | ||
|
|
630d832f50 | ||
|
|
e0a34465d8 | ||
|
|
443a4049c3 | ||
|
|
54980e7585 | ||
|
|
14ff8bb26b | ||
|
|
615bb0ee3f | ||
|
|
986fd8c13b | ||
|
|
ec1cc27815 | ||
|
|
3874e2d886 | ||
|
|
1afcf21529 | ||
|
|
4c0f3bd7cb | ||
|
|
9aafa2a662 | ||
|
|
029ba1202e | ||
|
|
b5043b2b87 | ||
|
|
52ce80fd97 | ||
|
|
cd19c5eb38 | ||
|
|
0d101d779f | ||
|
|
1ff6f43eac | ||
|
|
98d892f643 | ||
|
|
cc80afff7d | ||
|
|
91ad74e3ad | ||
|
|
b128d25fbe | ||
|
|
8b23769ccc | ||
|
|
13f84ab518 | ||
|
|
feadc1ff9e | ||
|
|
f75c3a123e | ||
|
|
12dfe49d9b | ||
|
|
545618964d | ||
|
|
a6f3f21b70 | ||
|
|
e6135f49fb | ||
|
|
cd3a1c869e | ||
|
|
8bb21b12aa | ||
|
|
f500791ba3 | ||
|
|
4ebc4e9546 | ||
|
|
94ee2e55fd | ||
|
|
e3c370eb6b |
@@ -7,6 +7,7 @@ IndentWidth: 4
|
||||
SpacesBeforeTrailingComments: 1
|
||||
TabWidth: 8
|
||||
UseTab: Never
|
||||
SortIncludes: false
|
||||
ContinuationIndentWidth: 4
|
||||
MaxEmptyLinesToKeep: 3
|
||||
BreakBeforeBinaryOperators: NonAssignment
|
||||
@@ -46,7 +47,7 @@ AlignAfterOpenBracket: true
|
||||
AlwaysBreakBeforeMultilineStrings: false
|
||||
AlwaysBreakTemplateDeclarations: true
|
||||
BinPackParameters: true
|
||||
ColumnLimit: 100
|
||||
ColumnLimit: 0
|
||||
Cpp11BracedListStyle: false
|
||||
DerivePointerBinding: false
|
||||
ExperimentalAutoDetectBinPacking: false
|
||||
|
||||
4
.codespellrc
Normal file
4
.codespellrc
Normal file
@@ -0,0 +1,4 @@
|
||||
[codespell]
|
||||
skip = ./build-*,.git,*.svg,rc_assets.py
|
||||
interactive = 3
|
||||
ignore-words-list = overlay,overlayed
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -63,4 +63,4 @@ kddockwidgets_minimal_example
|
||||
*.vcxproj*
|
||||
*.sln
|
||||
*.dir
|
||||
|
||||
.vscode
|
||||
|
||||
4
.krazy
4
.krazy
@@ -16,6 +16,8 @@ SKIP Doxyfile.cmake
|
||||
|
||||
#skip CMake files
|
||||
SKIP /KDDockWidgetsConfig.cmake.in
|
||||
#skip more files
|
||||
SKIP CMakePresets.json
|
||||
#skip the borrowed code in the cmake subdir
|
||||
SKIP /cmake/Qt5Portability.cmake|/cmake/ECM/|/cmake/InstallLocation.cmake
|
||||
SKIP /cmake/InstallLocation.cmake|/cmake/ECM/|/cmake/KDAB/
|
||||
|
||||
|
||||
18
.reuse/dep5
Normal file
18
.reuse/dep5
Normal file
@@ -0,0 +1,18 @@
|
||||
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||
Upstream-Name: KDDockWidgets
|
||||
Upstream-Contact: <info@kdab.com>
|
||||
Source: https://www.github.com/KDAB/KDDockWidgets
|
||||
|
||||
Files: *.qrc *.json *.xml *.html src/fwd_headers/*
|
||||
Copyright: 2019-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
License: GPL-2.0-only OR GPL-3.0-only
|
||||
|
||||
#artwork
|
||||
Files: screencap.gif images/* src/img/* docs/api/*.png examples/dockwidgets/assets/*.png src/img/classic_indicators/*.png
|
||||
Copyright: 2019-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
License: GPL-2.0-only OR GPL-3.0-only
|
||||
|
||||
#3rdparty
|
||||
Files: cmake/ECM/modules/*
|
||||
Copyright:
|
||||
License: BSD-3-Clause
|
||||
66
.travis.yml
Normal file
66
.travis.yml
Normal file
@@ -0,0 +1,66 @@
|
||||
env:
|
||||
global:
|
||||
- secure: "NlWO/NTPlOU6cowOMuPOvjAprXVwIjmpHHf9CoMR71E2c/eBFFKIHj10kXuyFwz2KihHAIExmo9OlGtGniNWobvIrVrabO3dsOSb6UGbPAQkzQiyQLKsDNQAZx3nMuWEKBtMsVRee6rd7/2uGTY4WB5Ot3VhrUYcN1FoRgQQ9gk="
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- os: linux
|
||||
dist: bionic
|
||||
- os: osx
|
||||
osx_image: xcode11.5
|
||||
env:
|
||||
- QT_SELECT=qt5
|
||||
- CMAKE_PREFIX_PATH=/usr/local/opt/qt
|
||||
|
||||
language: cpp
|
||||
compiler:
|
||||
- gcc
|
||||
- clang
|
||||
|
||||
script:
|
||||
- mkdir build
|
||||
- cd build
|
||||
- cmake -DCMAKE_BUILD_TYPE=Release -DKDDockWidgets_TESTS=True -KDDockWidgets_EXAMPLES=True -DKDDockWidgets_DEVELOPER_MODE=True ..
|
||||
- make
|
||||
- make test
|
||||
|
||||
notifications:
|
||||
email:
|
||||
recipients:
|
||||
- allen.winter@kdab.com
|
||||
- sergio.martins@kdab.com
|
||||
on_success: never
|
||||
on_failure: always
|
||||
|
||||
dist: bionic
|
||||
addons:
|
||||
apt:
|
||||
update: true
|
||||
packages:
|
||||
- qt5-default
|
||||
- qtbase5-dev
|
||||
- qtbase5-dev-tools
|
||||
- qtbase5-private-dev
|
||||
- qttools5-dev
|
||||
- qttools5-dev-tools
|
||||
- qtdeclarative5-dev
|
||||
- qtdeclarative5-dev-tools
|
||||
- libqt5xmlpatterns5-dev
|
||||
- libqt5xmlpatterns5
|
||||
- qtxmlpatterns5-dev-tools
|
||||
- libqt5x11extras5-dev
|
||||
homebrew:
|
||||
update: true
|
||||
packages:
|
||||
- qt5
|
||||
coverity_scan:
|
||||
project:
|
||||
name: KDAB/KDDockWidgets
|
||||
notification_email: allen.winter@kdab.com
|
||||
build_command_prepend: cd build && cmake ..
|
||||
build_command: make
|
||||
branch_pattern: coverity_scan
|
||||
635
.uncrustify
635
.uncrustify
@@ -1,635 +0,0 @@
|
||||
align_asm_colon = false
|
||||
align_assign_span = 0
|
||||
align_assign_thresh = 0
|
||||
align_enum_equ_span = 0
|
||||
align_enum_equ_thresh = 0
|
||||
align_func_params = false
|
||||
align_func_params_gap = 0
|
||||
align_func_params_span = 0
|
||||
align_func_params_thresh = 0
|
||||
align_func_proto_gap = 0
|
||||
align_func_proto_span = 0
|
||||
align_keep_extra_space = false
|
||||
align_keep_tabs = false
|
||||
align_left_shift = true
|
||||
align_mix_var_proto = false
|
||||
align_nl_cont = false
|
||||
align_number_right = false
|
||||
align_oc_decl_colon = false
|
||||
align_oc_msg_colon_first = false
|
||||
align_oc_msg_colon_span = 0
|
||||
align_oc_msg_spec_span = 0
|
||||
align_on_operator = false
|
||||
align_on_tabstop = false
|
||||
align_pp_define_gap = 0
|
||||
align_pp_define_span = 0
|
||||
align_pp_define_together = false
|
||||
align_right_cmt_at_col = 0
|
||||
align_right_cmt_gap = 0
|
||||
align_right_cmt_mix = false
|
||||
align_right_cmt_span = 0
|
||||
align_same_func_call_params = false
|
||||
align_single_line_brace = false
|
||||
align_single_line_brace_gap = 0
|
||||
align_single_line_func = false
|
||||
align_struct_init_span = 0
|
||||
align_typedef_amp_style = 0
|
||||
align_typedef_func = 0
|
||||
align_typedef_gap = 0
|
||||
align_typedef_span = 0
|
||||
align_typedef_star_style = 0
|
||||
align_var_class_gap = 0
|
||||
align_var_class_span = 0
|
||||
align_var_class_thresh = 0
|
||||
align_var_def_amp_style = 0
|
||||
align_var_def_attribute = false
|
||||
align_var_def_colon = false
|
||||
align_var_def_colon_gap = 0
|
||||
align_var_def_gap = 0
|
||||
align_var_def_inline = false
|
||||
align_var_def_span = 0
|
||||
align_var_def_star_style = 0
|
||||
align_var_def_thresh = 0
|
||||
align_var_struct_gap = 0
|
||||
align_var_struct_span = 0
|
||||
align_var_struct_thresh = 0
|
||||
align_with_tabs = false
|
||||
cmt_c_group = false
|
||||
cmt_c_nl_end = false
|
||||
cmt_c_nl_start = false
|
||||
cmt_convert_tab_to_spaces = false
|
||||
cmt_cpp_group = false
|
||||
cmt_cpp_nl_end = false
|
||||
cmt_cpp_nl_start = false
|
||||
cmt_cpp_to_c = false
|
||||
cmt_indent_multi = false
|
||||
cmt_insert_before_ctor_dtor = false
|
||||
cmt_insert_before_inlines = true
|
||||
cmt_insert_before_preproc = false
|
||||
cmt_insert_class_header = ""
|
||||
cmt_insert_file_footer = ""
|
||||
cmt_insert_file_header = ""
|
||||
cmt_insert_func_header = ""
|
||||
cmt_insert_oc_msg_header = ""
|
||||
cmt_multi_check_last = true
|
||||
cmt_multi_first_len_minimum = 4
|
||||
cmt_reflow_mode = 0
|
||||
cmt_sp_after_star_cont = 0
|
||||
cmt_sp_before_star_cont = 0
|
||||
cmt_star_cont = false
|
||||
cmt_width = 0
|
||||
code_width = 0
|
||||
disable_processing_cmt = ""
|
||||
eat_blanks_after_open_brace = false
|
||||
eat_blanks_before_close_brace = false
|
||||
enable_digraphs = false
|
||||
enable_processing_cmt = ""
|
||||
force_tab_after_define = false
|
||||
include_category_0 = ""
|
||||
include_category_1 = ""
|
||||
include_category_2 = ""
|
||||
indent_access_spec = -4
|
||||
indent_access_spec_body = false
|
||||
indent_align_assign = true
|
||||
indent_align_paren = true
|
||||
indent_align_string = false
|
||||
indent_bool_paren = false
|
||||
indent_brace = 0
|
||||
indent_brace_parent = false
|
||||
indent_braces = false
|
||||
indent_braces_no_class = false
|
||||
indent_braces_no_func = false
|
||||
indent_braces_no_struct = false
|
||||
indent_case_brace = 0
|
||||
indent_case_shift = 0
|
||||
indent_class_colon = false
|
||||
indent_class_on_colon = false
|
||||
indent_class = true
|
||||
indent_cmt_with_tabs = false
|
||||
indent_col1_comment = false
|
||||
indent_columns = 4
|
||||
indent_comma_paren = false
|
||||
indent_constr_colon = false
|
||||
indent_continue = 0
|
||||
indent_cpp_lambda_body = false
|
||||
indent_cpp_lambda_only_once = true
|
||||
indent_ctor_init = 0
|
||||
indent_ctor_init_leading = 2
|
||||
indent_else_if = false
|
||||
indent_extern = false
|
||||
indent_first_bool_expr = false
|
||||
indent_first_for_expr = false
|
||||
indent_func_call_param = false
|
||||
indent_func_class_param = false
|
||||
indent_func_const = 0
|
||||
indent_func_ctor_var_param = false
|
||||
indent_func_def_force_col1 = false
|
||||
indent_func_def_param = false
|
||||
indent_func_param_double = false
|
||||
indent_func_proto_param = false
|
||||
indent_func_throw = 0
|
||||
indent_ignore_asm_block = false
|
||||
indent_label = 1
|
||||
indent_member = 0
|
||||
indent_member_single = false
|
||||
indent_min_vbrace_open = 0
|
||||
indent_namespace = false
|
||||
indent_namespace_level = 0
|
||||
indent_namespace_limit = 0
|
||||
indent_namespace_single_indent = false
|
||||
indent_oc_block = false
|
||||
indent_oc_block_msg = 0
|
||||
indent_oc_block_msg_from_brace = false
|
||||
indent_oc_block_msg_from_caret = false
|
||||
indent_oc_block_msg_from_colon = false
|
||||
indent_oc_block_msg_from_keyword = false
|
||||
indent_oc_block_msg_xcode_style = false
|
||||
indent_oc_msg_colon = 0
|
||||
indent_oc_msg_prioritize_first_colon = true
|
||||
indent_off_after_return_new = false
|
||||
indent_param = 0
|
||||
indent_paren_after_func_call = false
|
||||
indent_paren_after_func_decl = false
|
||||
indent_paren_after_func_def = false
|
||||
indent_paren_close = 0
|
||||
indent_paren_nl = false
|
||||
indent_paren_open_brace = false
|
||||
indent_preserve_sql = false
|
||||
indent_relative_single_line_comments = false
|
||||
indent_semicolon_for_paren = false
|
||||
indent_shift = false
|
||||
indent_single_after_return = false
|
||||
indent_single_newlines = false
|
||||
indent_sing_line_comments = 0
|
||||
indent_square_nl = false
|
||||
indent_switch_case = 0
|
||||
indent_switch_pp = true
|
||||
indent_template_param = false
|
||||
indent_ternary_operator = 2
|
||||
indent_token_after_brace = true
|
||||
indent_var_def_blk = 0
|
||||
indent_var_def_cont = false
|
||||
indent_vbrace_open_on_tabstop = false
|
||||
indent_with_tabs = 0
|
||||
indent_xml_string = 0
|
||||
input_tab_size = 4
|
||||
ls_code_width = false
|
||||
ls_for_split_full = false
|
||||
ls_func_split_full = false
|
||||
mod_add_long_class_closebrace_comment = 0
|
||||
mod_add_long_function_closebrace_comment = 0
|
||||
mod_add_long_ifdef_else_comment = 0
|
||||
mod_add_long_ifdef_endif_comment = 0
|
||||
mod_add_long_namespace_closebrace_comment = 0
|
||||
mod_add_long_switch_closebrace_comment = 0
|
||||
mod_case_brace = ignore
|
||||
mod_full_brace_do = ignore
|
||||
mod_full_brace_for = ignore
|
||||
mod_full_brace_function = ignore
|
||||
mod_full_brace_if_chain = false
|
||||
mod_full_brace_if_chain_only = false
|
||||
mod_full_brace_if = ignore
|
||||
mod_full_brace_nl = 0
|
||||
mod_full_brace_nl_block_rem_mlcond = false
|
||||
mod_full_brace_using = ignore
|
||||
mod_full_brace_while = ignore
|
||||
mod_full_paren_if_bool = false
|
||||
mod_move_case_break = false
|
||||
mod_paren_on_return = ignore
|
||||
mod_pawn_semicolon = false
|
||||
mod_remove_empty_return = false
|
||||
mod_remove_extra_semicolon = false
|
||||
mod_sort_import = false
|
||||
mod_sort_include = false
|
||||
mod_sort_oc_properties = false
|
||||
mod_sort_oc_property_class_weight = 0
|
||||
mod_sort_oc_property_getter_weight = 0
|
||||
mod_sort_oc_property_nullability_weight = 0
|
||||
mod_sort_oc_property_readwrite_weight = 0
|
||||
mod_sort_oc_property_reference_weight = 0
|
||||
mod_sort_oc_property_setter_weight = 0
|
||||
mod_sort_oc_property_thread_safe_weight = 0
|
||||
mod_sort_using = false
|
||||
newlines = auto
|
||||
nl_after_access_spec = 0
|
||||
nl_after_annotation = ignore
|
||||
nl_after_brace_close = false
|
||||
nl_after_brace_open_cmt = false
|
||||
nl_after_brace_open = false
|
||||
nl_after_case = false
|
||||
nl_after_class = 0
|
||||
nl_after_do = ignore
|
||||
nl_after_for = ignore
|
||||
nl_after_func_body = 0
|
||||
nl_after_func_body_class = 0
|
||||
nl_after_func_body_one_liner = 0
|
||||
nl_after_func_class_proto = 0
|
||||
nl_after_func_class_proto_group = 0
|
||||
nl_after_func_proto = 0
|
||||
nl_after_func_proto_group = 0
|
||||
nl_after_if = ignore
|
||||
nl_after_label_colon = false
|
||||
nl_after_multiline_comment = false
|
||||
nl_after_return = false
|
||||
nl_after_semicolon = false
|
||||
nl_after_square_assign = ignore
|
||||
nl_after_struct = 0
|
||||
nl_after_switch = ignore
|
||||
nl_after_synchronized = ignore
|
||||
nl_after_try_catch_finally = 0
|
||||
nl_after_vbrace_close = false
|
||||
nl_after_vbrace_open_empty = false
|
||||
nl_after_vbrace_open = false
|
||||
nl_after_while = ignore
|
||||
nl_around_cs_property = 0
|
||||
nl_assign_brace = ignore
|
||||
nl_assign_leave_one_liners = false
|
||||
nl_assign_square = ignore
|
||||
nl_before_access_spec = 0
|
||||
nl_before_block_comment = 0
|
||||
nl_before_case = false
|
||||
nl_before_c_comment = 0
|
||||
nl_before_class = 0
|
||||
nl_before_cpp_comment = 0
|
||||
nl_before_do = ignore
|
||||
nl_before_for = ignore
|
||||
nl_before_func_body_def = 0
|
||||
nl_before_func_body_proto = 0
|
||||
nl_before_func_class_def = 0
|
||||
nl_before_func_class_proto = 0
|
||||
nl_before_if_closing_paren = ignore
|
||||
nl_before_if = ignore
|
||||
nl_before_return = false
|
||||
nl_before_switch = ignore
|
||||
nl_before_synchronized = ignore
|
||||
nl_before_throw = ignore
|
||||
nl_before_while = ignore
|
||||
nl_between_annotation = ignore
|
||||
nl_between_get_set = 0
|
||||
nl_brace_brace = ignore
|
||||
nl_brace_catch = ignore
|
||||
nl_brace_else = ignore
|
||||
nl_brace_finally = ignore
|
||||
nl_brace_fparen = ignore
|
||||
nl_brace_square = ignore
|
||||
nl_brace_struct_var = ignore
|
||||
nl_brace_while = ignore
|
||||
nl_case_colon_brace = ignore
|
||||
nl_catch_brace = ignore
|
||||
nl_class_brace = ignore
|
||||
nl_class_colon = remove
|
||||
nl_class_init_args = add
|
||||
nl_class_leave_one_liners = false
|
||||
nl_collapse_empty_body = false
|
||||
nl_comment_func_def = 0
|
||||
nl_constr_colon = ignore
|
||||
nl_constr_init_args = ignore
|
||||
nl_cpp_lambda_leave_one_liners = true
|
||||
nl_cpp_ldef_brace = remove
|
||||
nl_create_for_one_liner = false
|
||||
nl_create_func_def_one_liner = false
|
||||
nl_create_if_one_liner = false
|
||||
nl_create_while_one_liner = false
|
||||
nl_cs_property_leave_one_liners = false
|
||||
nl_define_macro = false
|
||||
nl_do_brace = ignore
|
||||
nl_ds_struct_enum_close_brace = false
|
||||
nl_ds_struct_enum_cmt = false
|
||||
nl_else_brace = ignore
|
||||
nl_elseif_brace = ignore
|
||||
nl_else_if = ignore
|
||||
nl_end_of_file = ignore
|
||||
nl_end_of_file_min = 0
|
||||
nl_enum_brace = ignore
|
||||
nl_enum_class_identifier = ignore
|
||||
nl_enum_class = ignore
|
||||
nl_enum_colon_type = ignore
|
||||
nl_enum_identifier_colon = ignore
|
||||
nl_enum_leave_one_liners = false
|
||||
nl_enum_own_lines = ignore
|
||||
nl_fcall_brace = ignore
|
||||
nl_fdef_brace = ignore
|
||||
nl_finally_brace = ignore
|
||||
nl_for_brace = ignore
|
||||
nl_func_call_args_multi_line = false
|
||||
nl_func_call_empty = ignore
|
||||
nl_func_call_end_multi_line = false
|
||||
nl_func_call_paren_empty = ignore
|
||||
nl_func_call_paren = ignore
|
||||
nl_func_call_start_multi_line = false
|
||||
nl_func_class_scope = ignore
|
||||
nl_func_decl_args = ignore
|
||||
nl_func_decl_args_multi_line = false
|
||||
nl_func_decl_empty = ignore
|
||||
nl_func_decl_end = ignore
|
||||
nl_func_decl_end_multi_line = false
|
||||
nl_func_decl_end_single = ignore
|
||||
nl_func_decl_start = ignore
|
||||
nl_func_decl_start_multi_line = false
|
||||
nl_func_decl_start_single = ignore
|
||||
nl_func_def_args = ignore
|
||||
nl_func_def_args_multi_line = false
|
||||
nl_func_def_empty = ignore
|
||||
nl_func_def_end = ignore
|
||||
nl_func_def_end_multi_line = false
|
||||
nl_func_def_end_single = ignore
|
||||
nl_func_def_paren_empty = ignore
|
||||
nl_func_def_paren = ignore
|
||||
nl_func_def_start = ignore
|
||||
nl_func_def_start_multi_line = false
|
||||
nl_func_def_start_single = ignore
|
||||
nl_func_leave_one_liners = true
|
||||
nl_func_paren_empty = ignore
|
||||
nl_func_paren = ignore
|
||||
nl_func_proto_type_name = ignore
|
||||
nl_func_scope_name = ignore
|
||||
nl_func_type_name_class = ignore
|
||||
nl_func_type_name = ignore
|
||||
nl_func_var_def_blk = 0
|
||||
nl_getset_brace = ignore
|
||||
nl_getset_leave_one_liners = false
|
||||
nl_if_brace = ignore
|
||||
nl_if_leave_one_liners = false
|
||||
nl_max = 0
|
||||
nl_max_blank_in_func = 0
|
||||
nl_multi_line_cond = false
|
||||
nl_multi_line_define = false
|
||||
nl_namespace_brace = ignore
|
||||
nl_namespace_two_to_one_liner = false
|
||||
nl_oc_block_brace = ignore
|
||||
nl_oc_brace_catch = ignore
|
||||
nl_oc_catch_brace = ignore
|
||||
nl_oc_implementation_brace = ignore
|
||||
nl_oc_interface_brace = ignore
|
||||
nl_oc_msg_args = false
|
||||
nl_oc_msg_leave_one_liner = false
|
||||
nl_paren_dbrace_open = ignore
|
||||
nl_property_brace = ignore
|
||||
nl_remove_extra_newlines = 0
|
||||
nl_return_expr = ignore
|
||||
nl_scope_brace = ignore
|
||||
nl_split_for_one_liner = false
|
||||
nl_split_if_one_liner = false
|
||||
nl_split_while_one_liner = false
|
||||
nl_squeeze_ifdef = false
|
||||
nl_squeeze_ifdef_top_level = false
|
||||
nl_squeeze_paren_close = false
|
||||
nl_start_of_file = ignore
|
||||
nl_start_of_file_min = 0
|
||||
nl_struct_brace = ignore
|
||||
nl_switch_brace = ignore
|
||||
nl_synchronized_brace = ignore
|
||||
nl_template_class = ignore
|
||||
nl_try_brace = ignore
|
||||
nl_tsquare_brace = ignore
|
||||
nl_type_brace_init_lst_close = ignore
|
||||
nl_type_brace_init_lst = ignore
|
||||
nl_type_brace_init_lst_open = ignore
|
||||
nl_typedef_blk_end = 0
|
||||
nl_typedef_blk_in = 0
|
||||
nl_typedef_blk_start = 0
|
||||
nl_union_brace = ignore
|
||||
nl_unittest_brace = ignore
|
||||
nl_using_brace = ignore
|
||||
nl_var_def_blk_end = 0
|
||||
nl_var_def_blk_in = 0
|
||||
nl_var_def_blk_start = 0
|
||||
nl_version_brace = ignore
|
||||
nl_while_brace = ignore
|
||||
nl_while_leave_one_liners = false
|
||||
output_tab_size = 4
|
||||
pos_arith = ignore
|
||||
pos_assign = ignore
|
||||
pos_bool = ignore
|
||||
pos_class_colon = lead
|
||||
pos_class_comma = lead
|
||||
pos_comma = ignore
|
||||
pos_compare = ignore
|
||||
pos_conditional = ignore
|
||||
pos_constr_colon = ignore
|
||||
pos_constr_comma = ignore
|
||||
pos_enum_comma = ignore
|
||||
pp_define_at_level = false
|
||||
pp_if_indent_code = false
|
||||
pp_ignore_define_body = false
|
||||
pp_indent_at_level = false
|
||||
pp_indent_brace = true
|
||||
pp_indent_case = true
|
||||
pp_indent_count = 1
|
||||
pp_indent_extern = true
|
||||
pp_indent_func_def = true
|
||||
pp_indent_if = 0
|
||||
pp_indent = ignore
|
||||
pp_indent_region = 0
|
||||
pp_region_indent_code = false
|
||||
pp_space_count = 0
|
||||
pp_space = ignore
|
||||
sp_addr = remove
|
||||
sp_after_angle = ignore
|
||||
sp_after_assign = ignore
|
||||
sp_after_byref_func = remove
|
||||
sp_after_byref = remove
|
||||
sp_after_cast = ignore
|
||||
sp_after_class_colon = add
|
||||
sp_after_comma = add
|
||||
sp_after_constr_colon = ignore
|
||||
sp_after_dc = ignore
|
||||
sp_after_for_colon = ignore
|
||||
sp_after_invariant_paren = ignore
|
||||
sp_after_mdatype_commas = ignore
|
||||
sp_after_new = ignore
|
||||
sp_after_newop_paren = ignore
|
||||
sp_after_noexcept = ignore
|
||||
sp_after_oc_at_sel = ignore
|
||||
sp_after_oc_block_caret = ignore
|
||||
sp_after_oc_colon = ignore
|
||||
sp_after_oc_dict_colon = ignore
|
||||
sp_after_oc_msg_receiver = ignore
|
||||
sp_after_oc_property = ignore
|
||||
sp_after_oc_return_type = ignore
|
||||
sp_after_oc_scope = ignore
|
||||
sp_after_oc_synchronized = ignore
|
||||
sp_after_oc_type = ignore
|
||||
sp_after_operator = ignore
|
||||
sp_after_operator_sym_empty = ignore
|
||||
sp_after_operator_sym = ignore
|
||||
sp_after_ptr_block_caret = ignore
|
||||
sp_after_ptr_star_func = remove
|
||||
sp_after_ptr_star = remove
|
||||
sp_after_ptr_star_qualifier = ignore
|
||||
sp_after_semi = add
|
||||
sp_after_semi_for_empty = ignore
|
||||
sp_after_semi_for = force
|
||||
sp_after_send_oc_colon = ignore
|
||||
sp_after_sparen = ignore
|
||||
sp_after_tag = ignore
|
||||
sp_after_throw = ignore
|
||||
sp_after_tparen_close = remove
|
||||
sp_after_type_brace_init_lst_open = ignore
|
||||
sp_after_type = force
|
||||
sp_angle_colon = ignore
|
||||
sp_angle_paren_empty = ignore
|
||||
sp_angle_paren = ignore
|
||||
sp_angle_shift = remove
|
||||
sp_angle_word = ignore
|
||||
sp_annotation_paren = ignore
|
||||
sp_arith_additive = ignore
|
||||
sp_arith = ignore
|
||||
sp_assign_default = ignore
|
||||
sp_assign = ignore
|
||||
sp_attribute_paren = ignore
|
||||
sp_balance_nested_parens = false
|
||||
sp_before_angle = ignore
|
||||
sp_before_assign = ignore
|
||||
sp_before_byref_func = ignore
|
||||
sp_before_byref = add
|
||||
sp_before_case_colon = remove
|
||||
sp_before_class_colon = add
|
||||
sp_before_comma = remove
|
||||
sp_before_constr_colon = ignore
|
||||
sp_before_dc = ignore
|
||||
sp_before_ellipsis = ignore
|
||||
sp_before_for_colon = ignore
|
||||
sp_before_mdatype_commas = ignore
|
||||
sp_before_nl_cont = add
|
||||
sp_before_oc_block_caret = ignore
|
||||
sp_before_oc_colon = ignore
|
||||
sp_before_oc_dict_colon = ignore
|
||||
sp_before_pp_stringify = ignore
|
||||
sp_before_ptr_star_func = ignore
|
||||
sp_before_ptr_star = add
|
||||
sp_before_semi_for_empty = ignore
|
||||
sp_before_semi_for = ignore
|
||||
sp_before_semi = remove
|
||||
sp_before_send_oc_colon = ignore
|
||||
sp_before_sparen = ignore
|
||||
sp_before_square = ignore
|
||||
sp_before_squares = ignore
|
||||
sp_before_template_paren = ignore
|
||||
sp_before_tr_emb_cmt = ignore
|
||||
sp_before_type_brace_init_lst_close = ignore
|
||||
sp_before_unnamed_byref = ignore
|
||||
sp_before_unnamed_ptr_star = ignore
|
||||
sp_between_mdatype_commas = ignore
|
||||
sp_between_new_paren = ignore
|
||||
sp_between_ptr_star = ignore
|
||||
sp_bool = ignore
|
||||
sp_brace_catch = ignore
|
||||
sp_brace_else = ignore
|
||||
sp_brace_finally = ignore
|
||||
sp_brace_typedef = ignore
|
||||
sp_case_label = ignore
|
||||
sp_catch_brace = ignore
|
||||
sp_catch_paren = ignore
|
||||
sp_cmt_cpp_doxygen = false
|
||||
sp_cmt_cpp_qttr = false
|
||||
sp_cmt_cpp_start = ignore
|
||||
sp_compare = ignore
|
||||
sp_cond_colon_after = ignore
|
||||
sp_cond_colon_before = ignore
|
||||
sp_cond_colon = ignore
|
||||
sp_cond_question_after = ignore
|
||||
sp_cond_question_before = ignore
|
||||
sp_cond_question = ignore
|
||||
sp_cond_ternary_short = ignore
|
||||
sp_cparen_oparen = ignore
|
||||
sp_cpp_before_struct_binding = ignore
|
||||
sp_cpp_cast_paren = ignore
|
||||
sp_cpp_lambda_assign = ignore
|
||||
sp_cpp_lambda_paren = ignore
|
||||
sp_d_array_colon = ignore
|
||||
sp_defined_paren = ignore
|
||||
sp_deref = remove
|
||||
sp_else_brace = ignore
|
||||
sp_endif_cmt = ignore
|
||||
sp_enum_after_assign = ignore
|
||||
sp_enum_assign = ignore
|
||||
sp_enum_before_assign = ignore
|
||||
sp_enum_colon = ignore
|
||||
sp_enum_paren = ignore
|
||||
sp_extern_paren = ignore
|
||||
sp_finally_brace = ignore
|
||||
sp_fparen_brace = ignore
|
||||
sp_fparen_brace_initializer = ignore
|
||||
sp_fparen_dbrace = ignore
|
||||
sp_func_call_paren_empty = ignore
|
||||
sp_func_call_paren = ignore
|
||||
sp_func_call_user_inside_fparen = ignore
|
||||
sp_func_call_user_paren = ignore
|
||||
sp_func_call_user_paren_paren = remove
|
||||
sp_func_class_paren_empty = ignore
|
||||
sp_func_class_paren = ignore
|
||||
sp_func_def_paren_empty = ignore
|
||||
sp_func_def_paren = ignore
|
||||
sp_func_proto_paren_empty = ignore
|
||||
sp_func_proto_paren = ignore
|
||||
sp_getset_brace = ignore
|
||||
sp_incdec = remove
|
||||
sp_inside_angle = ignore
|
||||
sp_inside_braces_empty = remove
|
||||
sp_inside_braces_enum = ignore
|
||||
sp_inside_braces = ignore
|
||||
sp_inside_braces_oc_dict = ignore
|
||||
sp_inside_braces_struct = ignore
|
||||
sp_inside_fparen = ignore
|
||||
sp_inside_fparens = remove
|
||||
sp_inside_newop_paren_close = ignore
|
||||
sp_inside_newop_paren = ignore
|
||||
sp_inside_newop_paren_open = ignore
|
||||
sp_inside_oc_at_sel_parens = ignore
|
||||
sp_inside_paren_cast = ignore
|
||||
sp_inside_paren = ignore
|
||||
sp_inside_sparen_close = ignore
|
||||
sp_inside_sparen = ignore
|
||||
sp_inside_sparen_open = ignore
|
||||
sp_inside_square = ignore
|
||||
sp_inside_square_oc_array = ignore
|
||||
sp_inside_tparen = ignore
|
||||
sp_inside_type_brace_init_lst = ignore
|
||||
sp_invariant_paren = ignore
|
||||
sp_inv = remove
|
||||
sp_macro_func = ignore
|
||||
sp_macro = ignore
|
||||
sp_member = remove
|
||||
sp_not = remove
|
||||
sp_num_before_tr_emb_cmt = 0
|
||||
sp_oc_brace_catch = ignore
|
||||
sp_oc_catch_brace = ignore
|
||||
sp_oc_catch_paren = ignore
|
||||
sp_paren_brace = remove
|
||||
sp_paren_comma = force
|
||||
sp_paren_paren = remove
|
||||
sp_permit_cpp11_shift = true
|
||||
sp_pp_concat = add
|
||||
sp_pp_stringify = ignore
|
||||
sp_ptr_star_paren = ignore
|
||||
sp_range = ignore
|
||||
sp_return_paren = ignore
|
||||
sp_scope_paren = ignore
|
||||
sp_sign = remove
|
||||
sp_sizeof_paren = ignore
|
||||
sp_skip_vbrace_tokens = false
|
||||
sp_sparen_brace = add
|
||||
sp_special_semi = ignore
|
||||
sp_square_fparen = ignore
|
||||
sp_super_paren = remove
|
||||
sp_template_angle = ignore
|
||||
sp_this_paren = remove
|
||||
sp_throw_paren = ignore
|
||||
sp_try_brace = ignore
|
||||
sp_type_brace_init_lst = ignore
|
||||
sp_type_func = ignore
|
||||
sp_version_paren = ignore
|
||||
sp_word_brace = add
|
||||
sp_word_brace_ns = add
|
||||
string_escape_char2 = 0
|
||||
string_escape_char = 92
|
||||
string_replace_tab_chars = false
|
||||
tok_split_gte = false
|
||||
use_indent_continue_only_once = false
|
||||
use_indent_func_call_param = true
|
||||
use_options_overriding_for_qt_macros = true
|
||||
utf8_bom = ignore
|
||||
utf8_byte = false
|
||||
utf8_force = false
|
||||
warn_level_tabs_found_in_verbatim_string_literals = 2
|
||||
358
CMakeLists.txt
358
CMakeLists.txt
@@ -21,7 +21,7 @@
|
||||
#
|
||||
# -DKDDockWidgets_TESTS=[true|false]
|
||||
# Build the test harness.
|
||||
# Currently does nothing unless you also set KDDockWidgets_DEVELOPER_MODE=True
|
||||
# Currently ignored unless you also set KDDockWidgets_DEVELOPER_MODE=True
|
||||
# Default=false
|
||||
#
|
||||
# -DKDDockWidgets_EXAMPLES=[true|false]
|
||||
@@ -29,41 +29,54 @@
|
||||
# Default=true
|
||||
#
|
||||
# -DKDDockWidgets_DOCS=[true|false]
|
||||
# Build the API documentation.
|
||||
# Build the API documentation. Enables the 'docs' build target.
|
||||
# Default=false
|
||||
#
|
||||
# -DKDDockWidgets_QTQUICK=[true|false]
|
||||
# Build for QtQuick instead of QtWidgets.
|
||||
# Default=false
|
||||
#
|
||||
# -DKDDockWidgets_PYTHON_BINDINGS=[true|false]
|
||||
# Build/Generate python bindings. Always false for Debug builds
|
||||
# (If your shiboken or pyside is installed in a non-standard locations
|
||||
# try passing the SHIBOKEN_CUSTOM_PREFIX and PYSIDE_CUSTOM_PREFIX variables.)
|
||||
# Default=false
|
||||
#
|
||||
# -DKDDockWidgets_PYTHON_BINDINGS_INSTALL_PREFIX=[path]
|
||||
# Set an alternative install path for Python bindings
|
||||
# Default=CMAKE_INSTALL_PREFIX
|
||||
|
||||
# ## DO NOT USE IF YOU ARE AN END-USER. FOR THE DEVELOPERS ONLY!!
|
||||
## Special CMake Options for Developers
|
||||
#
|
||||
# -DKDDockWidgets_DEVELOPER_MODE=[true|false]
|
||||
# Configure the build for a developer setup.
|
||||
# Enables some features that are not geared towards end-users.
|
||||
# Forces the test harness to be built.
|
||||
# Default=false
|
||||
#
|
||||
# -DKDDockWidgets_QTQUICK == IN DEVELOPMENT. DO NOT USE! ==
|
||||
# Build for QtQuick instead of QtWidgets
|
||||
# -DKDDockWidgets_WERROR=[true|false]
|
||||
# Compile with the -Werror gcc/clang option (always true for developer-mode)
|
||||
# Default=false
|
||||
#
|
||||
# -DKDDockWidgets_PYTHON_BINDINGS=[true|false]
|
||||
# Build/Generate python bindings. Always false for Debug builds
|
||||
# Default=false
|
||||
# -DKDDockWidgets_LINTER=[true|false]
|
||||
# Build the layout linter.
|
||||
# Ignored unless KDDockWidgets_DEVELOPER_MODE=True
|
||||
# Default=true
|
||||
#
|
||||
# -DKDDockWidgets_PYTHON_BINDINGS_INSTALL_PREFIX=[path]
|
||||
# Set an alternative install path for Python bindings
|
||||
# Default=CMAKE_INSTALL_PREFIX
|
||||
# -DKDDockWidgets_FUZZER=[true|false]
|
||||
# Build the fuzzer.
|
||||
# Ignored unless KDDockWidgets_DEVELOPER_MODE=True
|
||||
# Default=true
|
||||
|
||||
cmake_minimum_required(VERSION 3.7)
|
||||
if(POLICY CMP0020)
|
||||
cmake_policy(SET CMP0020 NEW)
|
||||
endif()
|
||||
if(POLICY CMP0042)
|
||||
cmake_policy(SET CMP0042 NEW)
|
||||
endif()
|
||||
|
||||
set(KDAB_INSTALL True)
|
||||
if((NOT DEFINED ${USE_DEFAULT_INSTALL_LOCATION}) OR (NOT ${USE_DEFAULT_INSTALL_LOCATION}))
|
||||
# Allow using a non-KDAB install location.
|
||||
set(KDAB_INSTALL True CACHE INTERNAL "Install to default KDAB Location")
|
||||
if(DEFINED CMAKE_INSTALL_PREFIX)
|
||||
if(NOT "${CMAKE_INSTALL_PREFIX}" STREQUAL "")
|
||||
set(KDAB_INSTALL False)
|
||||
set(KDAB_INSTALL False CACHE INTERNAL "Install to non-KDAB Location")
|
||||
endif()
|
||||
set(USE_DEFAULT_INSTALL_LOCATION ${KDAB_INSTALL} CACHE INTERNAL "Install to default KDAB Location" FORCE)
|
||||
endif()
|
||||
|
||||
if(${CMAKE_VERSION} VERSION_LESS "3.12.0")
|
||||
@@ -77,54 +90,94 @@ endif()
|
||||
|
||||
set(${PROJECT_NAME}_VERSION_MAJOR 1)
|
||||
set(${PROJECT_NAME}_VERSION_MINOR 4)
|
||||
set(${PROJECT_NAME}_VERSION_PATCH 0)
|
||||
set(${PROJECT_NAME}_VERSION_PATCH 95)
|
||||
set(${PROJECT_NAME}_VERSION ${${PROJECT_NAME}_VERSION_MAJOR}.${${PROJECT_NAME}_VERSION_MINOR}.${${PROJECT_NAME}_VERSION_PATCH})
|
||||
set(${PROJECT_NAME}_SOVERSION "1.4")
|
||||
set(PROJECT_VERSION ${${PROJECT_NAME}_VERSION}) #PROJECT_VERSION is needed by some ECM modules
|
||||
set(${PROJECT_NAME}_SOVERSION "1.5")
|
||||
|
||||
include(FeatureSummary)
|
||||
|
||||
option(${PROJECT_NAME}_QT6 "Build against Qt 6" OFF)
|
||||
option(${PROJECT_NAME}_DEVELOPER_MODE "Developer Mode" OFF)
|
||||
option(${PROJECT_NAME}_PYTHON_BINDINGS "Build python bindings" OFF)
|
||||
|
||||
if(${PROJECT_NAME}_PYTHON_BINDINGS AND (CMAKE_BUILD_TYPE MATCHES "^[Dd]eb" OR ${PROJECT_NAME}_STATIC))
|
||||
message(FATAL_ERROR "** Python Bindings are disabled in debug or static builds.")
|
||||
endif()
|
||||
|
||||
option(${PROJECT_NAME}_QTQUICK "Build for QtQuick instead of QtWidgets" OFF)
|
||||
option(${PROJECT_NAME}_STATIC "Build statically" OFF)
|
||||
option(${PROJECT_NAME}_TESTS "Build the tests" OFF)
|
||||
option(${PROJECT_NAME}_EXAMPLES "Build the examples" ON)
|
||||
option(${PROJECT_NAME}_DOCS "Build the API documentation" OFF)
|
||||
option(${PROJECT_NAME}_WERROR "Use -Werror (will be true for developer-mode unconditionally)" OFF)
|
||||
option(${PROJECT_NAME}_X11EXTRAS "On Linux, link against QtX11Extras so we can detect if the compositor supports transparency. Not applicable to other platforms or Qt6." ON)
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/ECM/modules")
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/KDAB/modules")
|
||||
|
||||
# Set a default build type if none was specified
|
||||
set(default_build_type "Release")
|
||||
if(EXISTS "${CMAKE_SOURCE_DIR}/.git" OR ${PROJECT_NAME}_DEVELOPER_MODE)
|
||||
set(default_build_type "Debug")
|
||||
endif()
|
||||
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||
message(STATUS "Setting build type to ${default_build_type} as none was specified.")
|
||||
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE STRING "Choose the type of build." FORCE)
|
||||
# Set the possible values of build type for cmake-gui
|
||||
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
|
||||
endif()
|
||||
|
||||
if(${PROJECT_NAME}_QT6)
|
||||
set(Qt_VERSION_MAJOR 6)
|
||||
set(QT_MIN_VERSION "6.0.0")
|
||||
find_package(Qt6Widgets ${QT_MIN_VERSION} REQUIRED)
|
||||
find_package(Qt6Test ${QT_MIN_VERSION} REQUIRED)
|
||||
set(${PROJECT_NAME}_LIBRARY_QTID "-qt6")
|
||||
else()
|
||||
set(Qt_VERSION_MAJOR 5)
|
||||
set(QT_MIN_VERSION "5.12")
|
||||
find_package(Qt5Widgets ${QT_MIN_VERSION} REQUIRED)
|
||||
find_package(Qt5Test ${QT_MIN_VERSION} REQUIRED)
|
||||
set(${PROJECT_NAME}_LIBRARY_QTID "")
|
||||
endif()
|
||||
include(KDQtInstallPaths) #to set QT_INSTALL_FOO variables
|
||||
|
||||
set(${PROJECT_NAME}_DEPS "widgets")
|
||||
if(${PROJECT_NAME}_QTQUICK)
|
||||
find_package(Qt${Qt_VERSION_MAJOR}Quick)
|
||||
find_package(Qt${Qt_VERSION_MAJOR}QuickControls2)
|
||||
add_definitions(-DKDDOCKWIDGETS_QTQUICK)
|
||||
set(${PROJECT_NAME}_DEPS "${${PROJECT_NAME}_DEPS} quick quickcontrols2")
|
||||
else()
|
||||
add_definitions(-DKDDOCKWIDGETS_QTWIDGETS)
|
||||
endif()
|
||||
|
||||
if(NOT WIN32 AND NOT APPLE AND NOT EMSCRIPTEN AND NOT ${PROJECT_NAME}_QT6 AND ${PROJECT_NAME}_X11EXTRAS)
|
||||
set(${PROJECT_NAME}_DEPS "${${PROJECT_NAME}_DEPS} x11extras")
|
||||
endif()
|
||||
|
||||
#Always build the test harness in developer-mode
|
||||
if(${PROJECT_NAME}_DEVELOPER_MODE)
|
||||
set(${PROJECT_NAME}_TESTS ON)
|
||||
set(${PROJECT_NAME}_WERROR ON)
|
||||
include(ECMEnableSanitizers)
|
||||
endif()
|
||||
|
||||
#option(${PROJECT_NAME}_QTQUICK "Build for QtQuick instead of QtWidgets" OFF)
|
||||
|
||||
if(${PROJECT_NAME}_QT6)
|
||||
find_package(Qt6Widgets REQUIRED)
|
||||
find_package(Qt6Test REQUIRED)
|
||||
set(QT_MAJOR_VERSION 6)
|
||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
set(IS_CLANG_BUILD TRUE)
|
||||
else()
|
||||
find_package(Qt5Widgets 5.9 REQUIRED)
|
||||
find_package(Qt5Test 5.9 REQUIRED)
|
||||
set(QT_MAJOR_VERSION 5)
|
||||
set(IS_CLANG_BUILD FALSE)
|
||||
endif()
|
||||
|
||||
if(${PROJECT_NAME}_QTQUICK)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
endif()
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
|
||||
set(ECM_MODULE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cmake/ECM/modules/")
|
||||
set(PYTHON_MODULE_DIR "${CMAKE_CURRENT_LIST_DIR}/cmake/Python")
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake" ${ECM_MODULE_DIR} ${PYTHON_MODULE_DIR})
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
||||
|
||||
# setup default install locations
|
||||
include(InstallLocation)
|
||||
include(QtInstallPaths) #to set QT_INSTALL_FOO variables
|
||||
# Default to hidden visibility for symbols
|
||||
set(CMAKE_C_VISIBILITY_PRESET hidden)
|
||||
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
|
||||
set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
|
||||
|
||||
macro(set_compiler_flags targetName)
|
||||
if(${PROJECT_NAME}_DEVELOPER_MODE)
|
||||
@@ -140,25 +193,31 @@ macro(set_compiler_flags targetName)
|
||||
endif()
|
||||
|
||||
# Enable -Werror
|
||||
if(NOT MSVC AND ${PROJECT_NAME}_WERROR)
|
||||
target_compile_options(${targetName} PRIVATE -Werror -Wno-error=deprecated-declarations)
|
||||
if(${PROJECT_NAME}_WERROR AND (NOT MSVC OR IS_CLANG_BUILD)) # clang-cl accepts these too
|
||||
target_compile_options(${targetName} PRIVATE -Werror -Wundef -Wno-error=deprecated-declarations)
|
||||
endif()
|
||||
|
||||
endmacro()
|
||||
|
||||
set(${PROJECT_NAME}_DEPS "widgets")
|
||||
if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT APPLE) OR
|
||||
(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND NOT APPLE) OR
|
||||
(CMAKE_CXX_COMPILER_ID STREQUAL "Intel" AND NOT WIN32))
|
||||
# Linker warnings should be treated as errors
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--fatal-warnings ${CMAKE_SHARED_LINKER_FLAGS}")
|
||||
set(CMAKE_MODULE_LINKER_FLAGS "-Wl,--fatal-warnings ${CMAKE_MODULE_LINKER_FLAGS}")
|
||||
|
||||
if(${PROJECT_NAME}_QTQUICK)
|
||||
find_package(Qt${QT_MAJOR_VERSION}Quick)
|
||||
find_package(Qt${QT_MAJOR_VERSION}QuickControls2)
|
||||
add_definitions(-DKDDOCKWIDGETS_QTQUICK)
|
||||
set(${PROJECT_NAME}_DEPS "${${PROJECT_NAME}_DEPS} quick quickcontrols2")
|
||||
else()
|
||||
add_definitions(-DKDDOCKWIDGETS_QTWIDGETS)
|
||||
endif()
|
||||
string(TOUPPER "CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}" compileflags)
|
||||
if("${CMAKE_CXX_FLAGS} ${${compileflags}}" MATCHES "-fsanitize")
|
||||
set(sanitizers_enabled TRUE)
|
||||
else()
|
||||
set(sanitizers_enabled FALSE)
|
||||
endif()
|
||||
|
||||
if(NOT WIN32 AND NOT APPLE AND NOT EMSCRIPTEN AND NOT ${PROJECT_NAME}_QT6)
|
||||
set(${PROJECT_NAME}_DEPS "${${PROJECT_NAME}_DEPS} x11extras")
|
||||
# cannot enable this for clang + sanitizers
|
||||
if(NOT sanitizers_enabled OR NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
# Do not allow undefined symbols, even in non-symbolic shared libraries
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined ${CMAKE_SHARED_LINKER_FLAGS}")
|
||||
set(CMAKE_MODULE_LINKER_FLAGS "-Wl,--no-undefined ${CMAKE_MODULE_LINKER_FLAGS}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(${PROJECT_NAME}_STATIC)
|
||||
@@ -167,92 +226,117 @@ else()
|
||||
set(${PROJECT_NAME}_LIBRARY_MODE "SHARED")
|
||||
endif()
|
||||
|
||||
if(USE_DEFAULT_INSTALL_LOCATION)
|
||||
if(KDAB_INSTALL)
|
||||
if(UNIX)
|
||||
set(CMAKE_INSTALL_PREFIX "/usr/local/KDAB/${PROJECT_NAME}-${${PROJECT_NAME}_VERSION}")
|
||||
set(CMAKE_INSTALL_PREFIX "/usr/local/KDAB/${PROJECT_NAME}-${${PROJECT_NAME}_VERSION}" CACHE INTERNAL "Install to default KDAB Location")
|
||||
elseif(WIN32)
|
||||
set(CMAKE_INSTALL_PREFIX "C:\\KDAB\\${PROJECT_NAME}-${${PROJECT_NAME}_VERSION}")
|
||||
set(CMAKE_INSTALL_PREFIX "C:\\KDAB\\${PROJECT_NAME}-$$VERSION" CACHE INTERNAL "Install to default KDAB Location")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# setup default install locations
|
||||
include(InstallLocation)
|
||||
|
||||
if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
|
||||
set(${PROJECT_NAME}_IS_ROOT_PROJECT TRUE)
|
||||
|
||||
message(STATUS "Building ${PROJECT_NAME} ${${PROJECT_NAME}_VERSION} in ${CMAKE_BUILD_TYPE} mode. Installing to ${CMAKE_INSTALL_PREFIX}")
|
||||
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin")
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib")
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib")
|
||||
|
||||
install(FILES LICENSE.txt README.md DESTINATION ${INSTALL_DOC_DIR})
|
||||
install(DIRECTORY LICENSES DESTINATION ${INSTALL_DOC_DIR})
|
||||
|
||||
# Generate .pri file for qmake users
|
||||
#TODO: ECM does not support Qt6 yet
|
||||
if(Qt_VERSION_MAJOR EQUAL 5 AND
|
||||
CMAKE_VERSION VERSION_GREATER "3.11.99" AND NOT CMAKE_CONFIGURATION_TYPES) # Not working with VS generator or older cmake versions
|
||||
include(ECMGeneratePriFile)
|
||||
set(PROJECT_VERSION_STRING ${${PROJECT_NAME}_VERSION})
|
||||
ecm_generate_pri_file(BASE_NAME KDDockWidgets
|
||||
LIB_NAME kddockwidgets
|
||||
DEPS ${${PROJECT_NAME}_DEPS}
|
||||
FILENAME_VAR pri_filename
|
||||
INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
)
|
||||
install(FILES ${pri_filename} DESTINATION ${ECM_MKSPECS_INSTALL_DIR})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_subdirectory(src)
|
||||
|
||||
if(${PROJECT_NAME}_IS_ROOT_PROJECT)
|
||||
if(${PROJECT_NAME}_EXAMPLES)
|
||||
if(${PROJECT_NAME}_QTQUICK)
|
||||
add_subdirectory(examples/qtquick)
|
||||
else()
|
||||
add_subdirectory(examples/dockwidgets)
|
||||
add_subdirectory(examples/minimal)
|
||||
add_subdirectory(examples/minimal-mdi)
|
||||
set_compiler_flags(kddockwidgets_example)
|
||||
set_compiler_flags(kddockwidgets_minimal_example)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(${PROJECT_NAME}_DEVELOPER_MODE)
|
||||
|
||||
if(${PROJECT_NAME}_TESTS)
|
||||
enable_testing()
|
||||
add_subdirectory(tests)
|
||||
|
||||
# Require Qt5.15.1 or higher to run the tests_launcher tests on Mac
|
||||
if(NOT APPLE OR Qt5Widgets_VERSION VERSION_GREATER 5.15.0)
|
||||
# tst_docks.exe is pretty big (160 tests), so split it in more runs so we can use threads.
|
||||
add_test(NAME tst_docks0 COMMAND tests_launcher 0 5)
|
||||
add_test(NAME tst_docks1 COMMAND tests_launcher 1 5)
|
||||
add_test(NAME tst_docks2 COMMAND tests_launcher 2 5)
|
||||
add_test(NAME tst_docks3 COMMAND tests_launcher 3 5)
|
||||
add_test(NAME tst_docks4 COMMAND tests_launcher 4 5)
|
||||
add_test(NAME tst_docks5 COMMAND tests_launcher 5 5)
|
||||
add_test(NAME tst_docks6 COMMAND tests_launcher 6 5)
|
||||
add_test(NAME tst_docks7 COMMAND tests_launcher 7 5)
|
||||
add_test(NAME tst_docks8 COMMAND tests_launcher 8 5)
|
||||
add_test(NAME tst_docks9 COMMAND tests_launcher 9 5)
|
||||
add_test(NAME tst_docks10 COMMAND tests_launcher 10 5)
|
||||
add_test(NAME tst_docks11 COMMAND tests_launcher 10 5)
|
||||
add_test(NAME tst_docks12 COMMAND tests_launcher 11 5)
|
||||
add_test(NAME tst_docks13 COMMAND tests_launcher 12 5)
|
||||
add_test(NAME tst_docks14 COMMAND tests_launcher 13 5)
|
||||
add_test(NAME tst_docks15 COMMAND tests_launcher 14 5)
|
||||
add_test(NAME tst_docks16 COMMAND tests_launcher 15 5)
|
||||
add_test(NAME tst_docks17 COMMAND tests_launcher 16 5)
|
||||
add_test(NAME tst_docks18 COMMAND tests_launcher 17 5)
|
||||
add_test(NAME tst_docks19 COMMAND tests_launcher 18 5)
|
||||
add_test(NAME tst_docks20 COMMAND tests_launcher 19 5)
|
||||
add_test(NAME tst_docks21 COMMAND tests_launcher 20 5) # one more for rounding leftovers
|
||||
endif()
|
||||
if(NOT ${PROJECT_NAME}_QTQUICK)
|
||||
# tst_multisplitter depends on QWidget
|
||||
add_test(NAME tst_multisplitter COMMAND tst_multisplitter)
|
||||
endif()
|
||||
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(${PROJECT_NAME}_DOCS)
|
||||
add_subdirectory(docs) # needs to go last, in case there are build source files
|
||||
else()
|
||||
add_custom_target(docs
|
||||
COMMAND ${CMAKE_COMMAND} -E echo "Sorry, there is no docs target since KDDockWidgets_DOCS=OFF."
|
||||
"Re-run cmake with the -DKDDockWidgets_DOCS=True option if you want to generate the documentation.")
|
||||
endif()
|
||||
|
||||
# Add uninstall target
|
||||
include(ECMUninstallTarget)
|
||||
endif()
|
||||
|
||||
if(${PROJECT_NAME}_PYTHON_BINDINGS)
|
||||
if(CMAKE_BUILD_TYPE MATCHES "^[Dd]eb" OR ${PROJECT_NAME}_STATIC)
|
||||
message(FATAL_ERROR "** Python Bindings are disabled in debug or static builds.")
|
||||
endif()
|
||||
add_subdirectory(python)
|
||||
endif()
|
||||
|
||||
# Generate .pri file for qmake users
|
||||
if(CMAKE_VERSION VERSION_GREATER "3.11.99" AND NOT CMAKE_CONFIGURATION_TYPES) # Not working with VS generator or older cmake versions
|
||||
include(ECMGeneratePriFile)
|
||||
set(PROJECT_VERSION_STRING ${${PROJECT_NAME}_VERSION})
|
||||
ecm_generate_pri_file(BASE_NAME KDDockWidgets
|
||||
LIB_NAME kddockwidgets
|
||||
DEPS ${${PROJECT_NAME}_DEPS}
|
||||
FILENAME_VAR pri_filename
|
||||
INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
)
|
||||
install(FILES ${pri_filename} DESTINATION ${ECM_MKSPECS_INSTALL_DIR})
|
||||
else()
|
||||
message(WARNING "Unable to generate the pri file for qmake users. Try updating CMake.")
|
||||
endif()
|
||||
|
||||
install(FILES LICENSE.txt README.md DESTINATION ${INSTALL_DOC_DIR})
|
||||
install(DIRECTORY LICENSES DESTINATION ${INSTALL_DOC_DIR})
|
||||
|
||||
if(${PROJECT_NAME}_EXAMPLES)
|
||||
if(${PROJECT_NAME}_QTQUICK)
|
||||
add_subdirectory(examples/qtquick)
|
||||
else()
|
||||
add_subdirectory(examples/dockwidgets)
|
||||
add_subdirectory(examples/minimal)
|
||||
add_subdirectory(examples/minimal-mdi)
|
||||
set_compiler_flags(kddockwidgets_example)
|
||||
set_compiler_flags(kddockwidgets_minimal_example)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(${PROJECT_NAME}_DEVELOPER_MODE)
|
||||
include(ECMEnableSanitizers)
|
||||
if(${PROJECT_NAME}_TESTS)
|
||||
enable_testing()
|
||||
add_subdirectory(tests)
|
||||
|
||||
# Require Qt5.15.1 or higher to run the tests_launcher tests on Mac
|
||||
if(NOT APPLE OR Qt5Widgets_VERSION VERSION_GREATER 5.15.0)
|
||||
# tst_docks.exe is pretty big (160 tests), so split it in more runs so we can use threads.
|
||||
add_test(NAME tst_docks0 COMMAND tests_launcher 0 5)
|
||||
add_test(NAME tst_docks1 COMMAND tests_launcher 1 5)
|
||||
add_test(NAME tst_docks2 COMMAND tests_launcher 2 5)
|
||||
add_test(NAME tst_docks3 COMMAND tests_launcher 3 5)
|
||||
add_test(NAME tst_docks4 COMMAND tests_launcher 4 5)
|
||||
add_test(NAME tst_docks5 COMMAND tests_launcher 5 5)
|
||||
add_test(NAME tst_docks6 COMMAND tests_launcher 6 5)
|
||||
add_test(NAME tst_docks7 COMMAND tests_launcher 7 5)
|
||||
add_test(NAME tst_docks8 COMMAND tests_launcher 8 5)
|
||||
add_test(NAME tst_docks9 COMMAND tests_launcher 9 5)
|
||||
add_test(NAME tst_docks10 COMMAND tests_launcher 10 5)
|
||||
add_test(NAME tst_docks11 COMMAND tests_launcher 10 5)
|
||||
add_test(NAME tst_docks12 COMMAND tests_launcher 11 5)
|
||||
add_test(NAME tst_docks13 COMMAND tests_launcher 12 5)
|
||||
add_test(NAME tst_docks14 COMMAND tests_launcher 13 5)
|
||||
add_test(NAME tst_docks15 COMMAND tests_launcher 14 5)
|
||||
add_test(NAME tst_docks16 COMMAND tests_launcher 15 5)
|
||||
add_test(NAME tst_docks17 COMMAND tests_launcher 16 5)
|
||||
add_test(NAME tst_docks18 COMMAND tests_launcher 17 5)
|
||||
add_test(NAME tst_docks19 COMMAND tests_launcher 18 5)
|
||||
add_test(NAME tst_docks20 COMMAND tests_launcher 19 5)
|
||||
add_test(NAME tst_docks21 COMMAND tests_launcher 20 5) # one more for rounding leftovers
|
||||
endif()
|
||||
if(NOT ${PROJECT_NAME}_QTQUICK)
|
||||
# tst_multisplitter depends on QWidget
|
||||
add_test(NAME tst_multisplitter COMMAND tst_multisplitter)
|
||||
endif()
|
||||
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(${PROJECT_NAME}_DOCS)
|
||||
add_subdirectory(docs) # needs to go last, in case there are build source files
|
||||
endif()
|
||||
|
||||
# Add uninstall target
|
||||
include(ECMUninstallTarget)
|
||||
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
|
||||
|
||||
@@ -1,51 +1,99 @@
|
||||
{
|
||||
"version": 1,
|
||||
"version": 2,
|
||||
"configurePresets": [
|
||||
{
|
||||
"name": "dev-qtwidgets",
|
||||
"displayName": "dev-qtwidgets",
|
||||
"name": "dev",
|
||||
"displayName": "dev",
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build-dev-qtwidgets",
|
||||
"binaryDir": "${sourceDir}/build-dev",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug",
|
||||
"KDDockWidgets_DEVELOPER_MODE": "ON",
|
||||
"ECM_ENABLE_SANITIZERS" : "'address;undefined'",
|
||||
"CMAKE_EXPORT_COMPILE_COMMANDS" : "ON",
|
||||
"KDDockWidgets_FUZZER" : "OFF"
|
||||
},
|
||||
"warnings" : {
|
||||
"uninitialized" : true
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "clazy-qtwidgets",
|
||||
"displayName": "clazy-qtwidgets",
|
||||
"name": "dev-gammaray",
|
||||
"displayName": "dev-gammaray",
|
||||
"description": "A Gammaray friendly build. (No ASAN)",
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build-clazy-qtwidgets",
|
||||
"binaryDir": "${sourceDir}/build-dev-gammaray",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug",
|
||||
"KDDockWidgets_WERROR": "ON"
|
||||
"KDDockWidgets_DEVELOPER_MODE": "ON",
|
||||
"CMAKE_EXPORT_COMPILE_COMMANDS" : "ON",
|
||||
"KDDockWidgets_FUZZER" : "OFF"
|
||||
},
|
||||
"warnings" : {
|
||||
"uninitialized" : true
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "clazy",
|
||||
"displayName": "clazy",
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build-clazy",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug",
|
||||
"KDDockWidgets_WERROR": "ON",
|
||||
"KDDockWidgets_EXAMPLES" : "OFF"
|
||||
},
|
||||
"environment": {
|
||||
"CXX": "clazy"
|
||||
"CXX": "clazy",
|
||||
"CCACHE_DISABLE" : "ON"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "qtwidgets",
|
||||
"displayName": "qtwidgets",
|
||||
"name": "clazy-qtquick",
|
||||
"displayName": "clazy-qtquick",
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build-qtwidgets",
|
||||
"binaryDir": "${sourceDir}/build-clazy-qtquick",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug",
|
||||
"KDDockWidgets_EXAMPLES" : "OFF",
|
||||
"KDDockWidgets_WERROR": "ON",
|
||||
"KDDockWidgets_QTQUICK": "ON"
|
||||
},
|
||||
"environment": {
|
||||
"CXX": "clazy",
|
||||
"CCACHE_DISABLE" : "ON"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "release",
|
||||
"displayName": "release",
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build-release",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release",
|
||||
"CMAKE_EXPORT_COMPILE_COMMANDS" : "ON"
|
||||
"CMAKE_UNITY_BUILD" : "ON"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "qtquick",
|
||||
"displayName": "qtquick",
|
||||
"name": "release-no-x11extras",
|
||||
"displayName": "release-no-x11extras",
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build-qtquick",
|
||||
"binaryDir": "${sourceDir}/build-release-no-x11extras",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release",
|
||||
"CMAKE_UNITY_BUILD" : "ON",
|
||||
"KDDockWidgets_X11EXTRAS" : "OFF"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "release-qtquick",
|
||||
"displayName": "release-qtquick",
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build-release-qtquick",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release",
|
||||
"KDDockWidgets_QTQUICK": "ON",
|
||||
"CMAKE_EXPORT_COMPILE_COMMANDS" : "ON"
|
||||
"CMAKE_UNITY_BUILD" : "ON"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -70,18 +118,18 @@
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release",
|
||||
"KDDockWidgets_PYTHON_BINDINGS": "ON",
|
||||
"CMAKE_EXPORT_COMPILE_COMMANDS" : "ON"
|
||||
"CMAKE_UNITY_BUILD" : "ON"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "static-qtwidgets",
|
||||
"displayName": "static-qtwidgets",
|
||||
"name": "static",
|
||||
"displayName": "static",
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build-static-qtwidgets",
|
||||
"binaryDir": "${sourceDir}/build-static",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release",
|
||||
"KDDockWidgets_STATIC": "ON",
|
||||
"CMAKE_EXPORT_COMPILE_COMMANDS" : "ON"
|
||||
"CMAKE_UNITY_BUILD" : "ON"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -93,54 +141,178 @@
|
||||
"CMAKE_BUILD_TYPE": "Release",
|
||||
"KDDockWidgets_STATIC": "ON",
|
||||
"KDDockWidgets_QTQUICK": "ON",
|
||||
"CMAKE_EXPORT_COMPILE_COMMANDS" : "ON"
|
||||
"CMAKE_UNITY_BUILD" : "ON"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "qtwidgets6",
|
||||
"displayName": "qtwidgets6",
|
||||
"name": "release6",
|
||||
"displayName": "release6",
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build-qtwidgets6",
|
||||
"binaryDir": "${sourceDir}/build-release6",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release",
|
||||
"KDDockWidgets_QT6": "ON",
|
||||
"CMAKE_EXPORT_COMPILE_COMMANDS" : "ON"
|
||||
"CMAKE_UNITY_BUILD" : "ON",
|
||||
"CMAKE_PREFIX_PATH" : "$env{QT6_DIR}"
|
||||
},
|
||||
"environment": {
|
||||
"PATH": "$env{QT6_DIR}/bin:$penv{PATH}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "dev-qtwidgets6",
|
||||
"displayName": "dev-qtwidgets6",
|
||||
"name": "dev6",
|
||||
"displayName": "dev6",
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build-dev-qtwidgets6",
|
||||
"binaryDir": "${sourceDir}/build-dev6",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug",
|
||||
"KDDockWidgets_QT6": "ON",
|
||||
"KDDockWidgets_DEVELOPER_MODE": "ON",
|
||||
"CMAKE_EXPORT_COMPILE_COMMANDS" : "ON",
|
||||
"ECM_ENABLE_SANITIZERS" : "'address;undefined'",
|
||||
"KDDockWidgets_FUZZER" : "OFF"
|
||||
"KDDockWidgets_FUZZER" : "OFF",
|
||||
"CMAKE_PREFIX_PATH" : "$env{QT6_DIR}"
|
||||
},
|
||||
"environment": {
|
||||
"PATH": "$env{QT6_DIR}/bin:$penv{PATH}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "qtquick6",
|
||||
"displayName": "qtquick6",
|
||||
"name": "release-qtquick6",
|
||||
"displayName": "release-qtquick6",
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build-qtquick6",
|
||||
"binaryDir": "${sourceDir}/build-release-qtquick6",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release",
|
||||
"KDDockWidgets_QTQUICK": "ON",
|
||||
"KDDockWidgets_QT6": "ON",
|
||||
"CMAKE_EXPORT_COMPILE_COMMANDS" : "ON"
|
||||
"CMAKE_UNITY_BUILD" : "ON",
|
||||
"CMAKE_PREFIX_PATH" : "$env{QT6_DIR}"
|
||||
},
|
||||
"environment": {
|
||||
"PATH": "$env{QT6_DIR}/bin:$penv{PATH}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "dev-qtquick6",
|
||||
"displayName": "dev-qtquick6",
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build-dev-qtquick6",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug",
|
||||
"KDDockWidgets_QTQUICK": "ON",
|
||||
"CMAKE_EXPORT_COMPILE_COMMANDS" : "ON",
|
||||
"KDDockWidgets_DEVELOPER_MODE": "ON",
|
||||
"ECM_ENABLE_SANITIZERS" : "'address;undefined'",
|
||||
"KDDockWidgets_QT6": "ON",
|
||||
"CMAKE_PREFIX_PATH" : "$env{QT6_DIR}"
|
||||
},
|
||||
"environment": {
|
||||
"PATH": "$env{QT6_DIR}/bin:$penv{PATH}",
|
||||
"QML2_IMPORT_PATH" : "$env{QT6_DIR}/imports:$env{QT6_DIR}/qml",
|
||||
"LD_LIBRARY_PATH" : "$env{QT6_DIR}/lib"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "dev-clangcl",
|
||||
"displayName": "dev-clangcl",
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build-dev-clangcl",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug",
|
||||
"KDDockWidgets_DEVELOPER_MODE": "ON",
|
||||
"CMAKE_EXPORT_COMPILE_COMMANDS" : "ON",
|
||||
"KDDockWidgets_FUZZER" : "ON"
|
||||
},
|
||||
"warnings" : {
|
||||
"uninitialized" : true
|
||||
},
|
||||
"environment": {
|
||||
"CC": "clang-cl",
|
||||
"CXX": "clang-cl"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "dev-qtquick-clangcl",
|
||||
"displayName": "dev-qtquick-clangcl",
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build-dev-qtquick-clangcl",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug",
|
||||
"KDDockWidgets_DEVELOPER_MODE": "ON",
|
||||
"KDDockWidgets_FUZZER" : "OFF",
|
||||
"KDDockWidgets_QTQUICK": "ON"
|
||||
},
|
||||
"warnings" : {
|
||||
"uninitialized" : true
|
||||
},
|
||||
"environment": {
|
||||
"CC": "clang-cl",
|
||||
"CXX": "clang-cl"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "dev-clangcl6",
|
||||
"displayName": "dev-clangcl6",
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build-dev-clangcl6",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug",
|
||||
"KDDockWidgets_DEVELOPER_MODE": "ON",
|
||||
"KDDockWidgets_FUZZER" : "ON",
|
||||
"KDDockWidgets_QT6": "ON",
|
||||
"CMAKE_PREFIX_PATH" : "$env{QT6_DIR}"
|
||||
},
|
||||
"warnings" : {
|
||||
"uninitialized" : true
|
||||
},
|
||||
"environment": {
|
||||
"CC": "clang-cl",
|
||||
"CXX": "clang-cl",
|
||||
"PATH": "$env{QT6_DIR}/bin:$penv{PATH}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "dev-qtquick-clangcl6",
|
||||
"displayName": "dev-qtquick-clangcl6",
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build-dev-qtquick-clangcl6",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug",
|
||||
"KDDockWidgets_DEVELOPER_MODE": "ON",
|
||||
"KDDockWidgets_FUZZER" : "OFF",
|
||||
"KDDockWidgets_QTQUICK": "ON",
|
||||
"KDDockWidgets_QT6": "ON",
|
||||
"CMAKE_PREFIX_PATH" : "$env{QT6_DIR}"
|
||||
},
|
||||
"warnings" : {
|
||||
"uninitialized" : true
|
||||
},
|
||||
"environment": {
|
||||
"CC": "clang-cl",
|
||||
"CXX": "clang-cl",
|
||||
"PATH": "$env{QT6_DIR}/bin:$penv{PATH}",
|
||||
"QML2_IMPORT_PATH" : "$env{QT6_DIR}/imports:$env{QT6_DIR}/qml",
|
||||
"LD_LIBRARY_PATH" : "$env{QT6_DIR}/lib"
|
||||
}
|
||||
}
|
||||
],
|
||||
"buildPresets": [
|
||||
{
|
||||
"name": "clazy",
|
||||
"configurePreset": "clazy",
|
||||
"environment": {
|
||||
"CLAZY_CHECKS" : "level2,detaching-member,heap-allocated-small-trivial-type,isempty-vs-count,qstring-varargs,qvariant-template-instantiation,raw-environment-function,reserve-candidates,signal-with-return-value,thread-with-slots,no-ctor-missing-parent-argument,no-missing-typeinfo",
|
||||
"CCACHE_DISABLE" : "ON"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "clazy-qtquick",
|
||||
"configurePreset": "clazy-qtquick",
|
||||
"environment": {
|
||||
"CLAZY_CHECKS" : "level2,detaching-member,heap-allocated-small-trivial-type,isempty-vs-count,qstring-varargs,qvariant-template-instantiation,raw-environment-function,reserve-candidates,signal-with-return-value,thread-with-slots,no-ctor-missing-parent-argument,no-missing-typeinfo",
|
||||
"CCACHE_DISABLE" : "ON"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
People who have signed the CLA:
|
||||
|
||||
Christian Riggenbach <criggenbach@magahugu.ch>
|
||||
Jacob Young <amazingjacob@gmail.com>
|
||||
Matthew Waltz <matthewwaltzis@gmail.com>
|
||||
Roman Pudashkin <r.pudashkin@gmail.com>
|
||||
Elnur Ismailzada <eismailzada@gmail.com>
|
||||
Daniel Price <danielp@nvidia.com>
|
||||
|
||||
42
Changelog
42
Changelog
@@ -1,13 +1,49 @@
|
||||
* v1.4.0 (unreleased)
|
||||
* v1.5.0 (unreleased)
|
||||
- Install the Python bindings to "site-packages"
|
||||
- The Python bindings for Qt6 use the "PyKDDockWidgetsQt6" namespace
|
||||
- Co-installable with Qt6
|
||||
- Adds support for non-detachable central widget, MainWindowOption_HasCentralWidget. (#225)
|
||||
|
||||
* v1.4.1 (unreleased)
|
||||
-
|
||||
|
||||
* v1.4.0 (16 July 2021)
|
||||
- No longer supports Qt versions less than 5.12
|
||||
- Experimental MDI support. By using MainWindowMDI you can now have "docked" dock widgets
|
||||
which are free to be arbitrarily positioned and even overlapped inside the main window.
|
||||
- TitleBar's height is now controlled by sizeHint() instead of hardcoded.
|
||||
If you haven't overridden TitleBar or just inheriting from TitleBarWidget then there's nothing to do,
|
||||
as TitleBarWidget already reimplements sizeHint. If you're inheriting directly from TitleBar then make
|
||||
sure to provide a sizeHint.
|
||||
- Added MainWindow::closeDockWidgets()
|
||||
- Fixed crash in MainWindow::layoutEqually()
|
||||
- QtQuick: Added more declarative API
|
||||
- FloatingWindow now honours the dockwidget's max-size, if there's a single
|
||||
dock widget docked. Tabbed cases are more difficult since QStackedLayout doesn't
|
||||
propagate size constraints.
|
||||
- Added MainWindowBase::frameCountChanged()
|
||||
- Introduced Config::setDropIndicatorsInhibited(), which allows you to disable support
|
||||
for drop indicators while dragging.
|
||||
- Fixed embedding the main window into a non-kddw main window (#204, #168)
|
||||
- Fixed crash with an MFC application
|
||||
- Allows to disable translucency via the KDDW_NO_TRANSLUCENCY env var, useful
|
||||
in case running on weird Window Managers.
|
||||
- Added Flag_ShowButtonsOnTabBarIfTitleBarHidden, which can be used when using Flag_HideTitleBarWhenTabsVisible.
|
||||
The close and float buttons will be shown directly in the tab-bar.
|
||||
- Fixes persistent central frame being invisible after closing all tabs (#220)
|
||||
- Added python bindings for the InitialOption struct (#198)
|
||||
- Generate and install camelcase forwarding headers (public, exported classes)
|
||||
- Build in Release mode by default (in non-developer situations)
|
||||
|
||||
* v1.3.1 (unreleased)
|
||||
-
|
||||
* v1.3.1 (7 June 2021)
|
||||
- Improve restoring layout when RestoreOption_RelativeToMainWindow is used (#171)
|
||||
- Improved dragging windows across screens in mixed hdpi setups
|
||||
- Fixed Flag_NativeTitleBar not hiding the client title bars when restoring (#170)
|
||||
- Double clicking a native title bar of a Qt::Tool window will now redock the window (#173)
|
||||
- Size of FloatingWindow now accounts for the fact that it's using Flag_NativeTitleBar and
|
||||
resizes its content accordingly (#174)
|
||||
- Fixed popups on overlayed dock widgets not working
|
||||
- Don't restore maximized state when using RestoreOption_RelativeToMainWindow (#184)
|
||||
|
||||
* v1.3.0 (8 February 2021)
|
||||
- Experimental QtQuick support (#49)
|
||||
|
||||
28
LICENSES/BSD-3-Clause.txt
Normal file
28
LICENSES/BSD-3-Clause.txt
Normal file
@@ -0,0 +1,28 @@
|
||||
Copyright (c) <year> <owner>. All rights reserved.
|
||||
|
||||
This license applies to the CMake ECM modules only.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
18
README-QtQuick.md
Normal file
18
README-QtQuick.md
Normal file
@@ -0,0 +1,18 @@
|
||||
Supported Qt versions and toolchains
|
||||
=====================================
|
||||
|
||||
KDDockWidgets for QtQuick requires a C++17 capable compiler and either
|
||||
Qt >= 5.15.0 or Qt >= 6.2.
|
||||
|
||||
|
||||
TROUBLESHOOTING
|
||||
===============
|
||||
|
||||
- QtGraphicalEffects is not supported, as it's buggy when moving between different QWindows.
|
||||
See for example QTBUG-94943, KDDockWidgets issue #213. Also search the Qt bug tracker
|
||||
for "QQuickItem: Cannot use same item on different windows at the same time"
|
||||
|
||||
- Very rarely, in some Nvidia/X11 setups, floating/docking has noticeable lag (like 1 second)
|
||||
This could be solved by going to Nvidia's settings and making sure all monitors have
|
||||
the same refresh rate and disabling "Allow Flipping". It's not known why this solves it. Might also
|
||||
be a bug in Qt.
|
||||
74
README-bindings.md
Normal file
74
README-bindings.md
Normal file
@@ -0,0 +1,74 @@
|
||||
These are the instructions for building the Python bindings for KDDockWidgets.
|
||||
|
||||
Make sure you have PySide2, shiboken2 and shiboken2-generator installed.
|
||||
As this time, you cannot get shiboken2-generator because the wheels are not on PyPi.
|
||||
To use the wheels do this:
|
||||
|
||||
```
|
||||
% pip3 install \
|
||||
--index-url=http://download.qt.io/official_releases/QtForPython/ \
|
||||
--trusted-host download.qt.io \
|
||||
shiboken2 pyside2 shiboken2_generator
|
||||
```
|
||||
|
||||
For more info visit https://doc.qt.io/qtforpython/shiboken2/gettingstarted.html
|
||||
|
||||
afterwards run 'pip3 list | grep PySide2'
|
||||
Note the version *must* match the same Qt you intend to use when building KDDockWidgets.
|
||||
|
||||
Not supported:
|
||||
- Debug builds
|
||||
- static builds
|
||||
- python2 bindings
|
||||
- only some 32-bit platforms are supported. see https://wiki.qt.io/Qt_for_Python
|
||||
|
||||
Tell CMake to build the bindings by passing the `-DKDDockWidgets_PYTHON_BINDINGS=True' option,
|
||||
followed by the make command.
|
||||
|
||||
The bindings will be installed to the passed `-DCMAKE_INSTALL_PREFIX`, which
|
||||
might require setting the `PYTHONPATH` env variable to point to that path when
|
||||
running applications. Alternatively, configure the bindings install location
|
||||
by passing `-DKDDockWidgets_PYTHON_BINDINGS_INSTALL_PREFIX=/usr/lib/python3.8/site-packages`
|
||||
to CMake (adjust to the python path on your system).
|
||||
|
||||
To run the KDDW python example
|
||||
|
||||
```
|
||||
$ export PYTHONPATH=/kddw/install/path # Only if needed
|
||||
$ cd python/examples/
|
||||
$ rcc -g python -o rc_assets.py ../../examples/dockwidgets/resources_example.qrc
|
||||
$ python3 main.py
|
||||
```
|
||||
|
||||
Build Issues
|
||||
|
||||
* If you see errors like "Unable to locate Clang's built-in include directory"
|
||||
then first make sure you have llvm installed. If you still have problems try
|
||||
setting the environment variable `LLVM_INSTALL_DIR` to point to your llvm installation.
|
||||
|
||||
Examples:
|
||||
|
||||
```
|
||||
export LLVM_INSTALL_DIR=/usr/local/opt/llvm-11
|
||||
set "LLVM_INSTALL_DIR=C:\Program Files\LLVM" #Windows
|
||||
```
|
||||
|
||||
* When building the examples you may encounter errors loading shared libraries from shiboken2_generator.
|
||||
|
||||
Try:
|
||||
|
||||
```
|
||||
export LD_LIBRARY_PATH=/usr/local/lib/python/dist-packages/PySide2/Qt/lib #linux
|
||||
export DYLD_LIBRARY_PATH=/usr/local/lib/python/dist-packages/PySide2/Qt/lib #Mac
|
||||
#adjust to wherever your PySide is installed
|
||||
```
|
||||
|
||||
* On Windows the `libclang.dll` that ship with QtForPython is not compatible with MSVC2019.
|
||||
To fix this, copy the `libclang.dll` that comes with llvm into shiboken2, like so:
|
||||
|
||||
```
|
||||
cd C:\Python37\Lib\site-packages\shiboken2_generator
|
||||
copy libclang.dll libclang.dll.save
|
||||
copy "C:\Program Files\llvm\bin\libclang.dll" libclang.dll
|
||||
#Python3 installation in C:\Python37 and llvm in c:\Program Files\llvm. adjust as needed
|
||||
```
|
||||
58
README.md
58
README.md
@@ -1,3 +1,5 @@
|
||||
[](https://travis-ci.com/KDAB/KDDockWidgets)
|
||||
|
||||
KDDockWidgets
|
||||
=============
|
||||
`KDDockWidgets` is a Qt dock widget library written by KDAB, suitable for replacing
|
||||
@@ -69,10 +71,6 @@ Screen capture
|
||||

|
||||
|
||||
|
||||
Roadmap
|
||||
========
|
||||
- QtQuick support
|
||||
|
||||
Trying out the examples
|
||||
=======================
|
||||
A full demo that showcases most of the features lives in [examples/dockwidgets](examples/dockwidgets).
|
||||
@@ -108,54 +106,28 @@ You can change the installation location by passing the option `-DCMAKE_INSTALL_
|
||||
|
||||
Using
|
||||
=====
|
||||
From your CMake project, add
|
||||
From your CMake Qt5 project, add
|
||||
|
||||
```
|
||||
find_package(KDDockWidgets CONFIG)
|
||||
```
|
||||
|
||||
or for Qt6
|
||||
|
||||
```
|
||||
find_package(KDDockWidgets-qt6 CONFIG)
|
||||
```
|
||||
|
||||
and link to the imported target `KDAB::kddockwidgets`.
|
||||
That's all you need to do (the imported target also brings in the include directories)
|
||||
|
||||
You may also need to modify the `CMAKE_MODULE_PATH` environment variable depending
|
||||
You may also need to modify the `CMAKE_PREFIX_PATH` environment variable depending
|
||||
on where you installed KDDockWidgets.
|
||||
|
||||
|
||||
Python Bindings
|
||||
================
|
||||
Make sure you have PySide2, shiboken2 and shiboken2-generator installed.
|
||||
As this time, you cannot get shiboken2-generator because the wheels are not on PyPi.
|
||||
To use the wheels do this:
|
||||
|
||||
```
|
||||
% pip3 install \
|
||||
--index-url=http://download.qt.io/official_releases/QtForPython/ \
|
||||
--trusted-host download.qt.io \
|
||||
shiboken2 pyside2 shiboken2_generator
|
||||
```
|
||||
|
||||
For more info visit https://doc.qt.io/qtforpython/shiboken2/gettingstarted.html
|
||||
|
||||
Once QtForPython is installed you are ready to generate the PySide2 bindings
|
||||
for KDDockWidgets.
|
||||
|
||||
Next pass `-DKDDockWidgets_PYTHON_BINDINGS=ON` to CMake, followed by the
|
||||
make command.
|
||||
|
||||
The bindings will be installed to the passed `-DCMAKE_INSTALL_PREFIX`, which
|
||||
might require setting the `PYTHONPATH` env variable to point to that path when
|
||||
running applications. Alternatively, configure the bindings install location
|
||||
by passing `-DKDDockWidgets_PYTHON_BINDINGS_INSTALL_PREFIX=/usr/lib/python3.8/site-packages`
|
||||
to CMake (adjust to the python path on your system).
|
||||
|
||||
To run the KDDW python example
|
||||
|
||||
```
|
||||
$ export PYTHONPATH=/kddw/install/path # Only if needed
|
||||
$ cd python/examples/
|
||||
$ rcc -g python -o rc_assets.py ../../examples/dockwidgets/resources_example.qrc
|
||||
$ python3 main.py
|
||||
```
|
||||
Please refer to [README-bindings.md](README-bindings.md).
|
||||
|
||||
Versioning
|
||||
==========
|
||||
@@ -174,9 +146,9 @@ your application whenever updating KDDW.
|
||||
|
||||
Supported Qt versions and toolchains
|
||||
=====================================
|
||||
KDDockWidgets requires Qt >= 5.9 (or >=5.12 if Python bindings are enabled).
|
||||
The QtQuick support will require Qt >= 5.15.
|
||||
Qt 6 is supported.
|
||||
KDDockWidgets requires Qt5 >= 5.12 or Qt6 >= 6.1.
|
||||
The QtQuick support requires Qt5 >= 5.15 or Qt6 >= 6.1.
|
||||
|
||||
|
||||
Regarding compilers, whatever toolchain is able to build Qt 5.9 should also be
|
||||
fine. Note however that MSVC 2013 isn't supported anymore due to compiler crashes.
|
||||
@@ -184,7 +156,7 @@ fine. Note however that MSVC 2013 isn't supported anymore due to compiler crashe
|
||||
|
||||
Licensing
|
||||
=========
|
||||
KDDockWidgets is (C) 2018-2021, Klarälvdalens Datakonsult AB, and is licensed according to
|
||||
KDDockWidgets is (C) 2019-2021, Klarälvdalens Datakonsult AB, and is licensed according to
|
||||
the terms of the [GPL 2.0](LICENSES/GPL-2.0-only.txt) or [GPL 3.0](LICENSES/GPL-3.0-only.txt).
|
||||
|
||||
Contact KDAB at <info@kdab.com> to inquire about commercial licensing.
|
||||
|
||||
80
appveyor.yml
Normal file
80
appveyor.yml
Normal file
@@ -0,0 +1,80 @@
|
||||
#---------------------------------#
|
||||
# general configuration #
|
||||
#---------------------------------#
|
||||
|
||||
# version format
|
||||
version: 1.0.{build}-{branch}
|
||||
|
||||
# branches to build
|
||||
branches:
|
||||
except:
|
||||
- gh-pages
|
||||
|
||||
# Do not build on tags (GitHub and BitBucket)
|
||||
skip_tags: false
|
||||
|
||||
#---------------------------------#
|
||||
# environment configuration #
|
||||
#---------------------------------#
|
||||
|
||||
# Build worker image
|
||||
image:
|
||||
- Visual Studio 2019
|
||||
|
||||
# scripts that are called at very beginning, before repo cloning
|
||||
init:
|
||||
- git config --global core.autocrlf input
|
||||
|
||||
#---------------------------------#
|
||||
# build configuration #
|
||||
#---------------------------------#
|
||||
|
||||
# build platform, i.e. x86, x64, Any CPU. This setting is optional.
|
||||
platform:
|
||||
- x64
|
||||
|
||||
# build Configuration, i.e. Debug, Release, etc.
|
||||
configuration:
|
||||
- Release
|
||||
|
||||
install:
|
||||
- call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
|
||||
- set QTDIR=C:\Qt\5.15\msvc2019_64
|
||||
- set PATH=%QTDIR%\bin;%PATH%
|
||||
build_script:
|
||||
- mkdir build
|
||||
- cd build
|
||||
- cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=%CONFIGURATION% -DKDDockWidgets_TESTS=True -DKDDockWidgets_EXAMPLES=True -DKDDockWidgets_DEVELOPER_MODE=True ..
|
||||
- nmake
|
||||
|
||||
# to disable automatic builds
|
||||
#build: off
|
||||
|
||||
#---------------------------------#
|
||||
# tests configuration #
|
||||
#---------------------------------#
|
||||
|
||||
test_script:
|
||||
- nmake test
|
||||
|
||||
# to disable automatic tests
|
||||
#test: off
|
||||
|
||||
|
||||
#---------------------------------#
|
||||
# deployment configuration #
|
||||
#---------------------------------#
|
||||
|
||||
deploy: off
|
||||
|
||||
#---------------------------------#
|
||||
# notifications #
|
||||
#---------------------------------#
|
||||
notifications:
|
||||
# Email
|
||||
- provider: Email
|
||||
to:
|
||||
- allen.winter@kdab.com
|
||||
- sergio.martins@kdab.com
|
||||
on_build_success: false
|
||||
on_build_failure: true
|
||||
@@ -40,6 +40,7 @@
|
||||
# - thread
|
||||
# - leak
|
||||
# - undefined
|
||||
# - fuzzer-no-link
|
||||
# - fuzzer
|
||||
#
|
||||
# The sanitizers "address", "memory" and "thread" are mutually exclusive. You
|
||||
@@ -102,30 +103,47 @@ endmacro ()
|
||||
# MACRO check_compiler_support
|
||||
#------------------------------
|
||||
macro (enable_sanitizer_flags sanitize_option)
|
||||
if (${sanitize_option} MATCHES "address")
|
||||
check_compiler_version("4.8" "3.1")
|
||||
set(XSAN_COMPILE_FLAGS "-fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls")
|
||||
set(XSAN_LINKER_FLAGS "asan")
|
||||
elseif (${sanitize_option} MATCHES "thread")
|
||||
check_compiler_version("4.8" "3.1")
|
||||
set(XSAN_COMPILE_FLAGS "-fsanitize=thread")
|
||||
set(XSAN_LINKER_FLAGS "tsan")
|
||||
elseif (${sanitize_option} MATCHES "memory")
|
||||
check_compiler_version("99.99" "3.1")
|
||||
set(XSAN_COMPILE_FLAGS "-fsanitize=memory")
|
||||
elseif (${sanitize_option} MATCHES "leak")
|
||||
check_compiler_version("4.9" "3.4")
|
||||
set(XSAN_COMPILE_FLAGS "-fsanitize=leak")
|
||||
set(XSAN_LINKER_FLAGS "lsan")
|
||||
elseif (${sanitize_option} MATCHES "undefined")
|
||||
check_compiler_version("4.9" "3.1")
|
||||
set(XSAN_COMPILE_FLAGS "-fsanitize=undefined -fno-omit-frame-pointer -fno-optimize-sibling-calls")
|
||||
elseif (${sanitize_option} MATCHES "fuzzer")
|
||||
check_compiler_version("99.99" "6.0")
|
||||
set(XSAN_COMPILE_FLAGS "-fsanitize=fuzzer")
|
||||
else ()
|
||||
message(FATAL_ERROR "Compiler sanitizer option \"${sanitize_option}\" not supported.")
|
||||
endif ()
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
||||
if (${sanitize_option} MATCHES "address")
|
||||
set(msvc_asan_required_version "19.28")
|
||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS ${msvc_asan_required_version})
|
||||
message(WARNING "Address sanitizer requires at least MSVC ${msvc_asan_required_version}")
|
||||
else()
|
||||
set(XSAN_COMPILE_FLAGS "-fsanitize=address")
|
||||
endif()
|
||||
else()
|
||||
message(WARNING "Compiler sanitizer option \"${sanitize_option}\" not supported on MSVC yet")
|
||||
endif()
|
||||
else()
|
||||
if (${sanitize_option} MATCHES "address")
|
||||
check_compiler_version("4.8" "3.1")
|
||||
set(XSAN_COMPILE_FLAGS "-fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls")
|
||||
set(XSAN_LINKER_FLAGS "asan")
|
||||
elseif (${sanitize_option} MATCHES "thread")
|
||||
check_compiler_version("4.8" "3.1")
|
||||
set(XSAN_COMPILE_FLAGS "-fsanitize=thread")
|
||||
set(XSAN_LINKER_FLAGS "tsan")
|
||||
elseif (${sanitize_option} MATCHES "memory")
|
||||
check_compiler_version("99.99" "3.1")
|
||||
set(XSAN_COMPILE_FLAGS "-fsanitize=memory")
|
||||
elseif (${sanitize_option} MATCHES "leak")
|
||||
check_compiler_version("4.9" "3.4")
|
||||
set(XSAN_COMPILE_FLAGS "-fsanitize=leak")
|
||||
set(XSAN_LINKER_FLAGS "lsan")
|
||||
elseif (${sanitize_option} MATCHES "undefined")
|
||||
check_compiler_version("4.9" "3.1")
|
||||
set(XSAN_COMPILE_FLAGS "-fsanitize=undefined -fsanitize=float-divide-by-zero -fno-omit-frame-pointer -fno-optimize-sibling-calls")
|
||||
elseif (${sanitize_option} MATCHES "fuzzer-no-link")
|
||||
check_compiler_version("99.99" "6.0")
|
||||
set(XSAN_COMPILE_FLAGS "-fsanitize=fuzzer-no-link")
|
||||
set(XSAN_LINKER_FLAGS "-fsanitize=fuzzer-no-link")
|
||||
elseif (${sanitize_option} MATCHES "fuzzer")
|
||||
check_compiler_version("99.99" "6.0")
|
||||
set(XSAN_COMPILE_FLAGS "-fsanitize=fuzzer")
|
||||
else ()
|
||||
message(FATAL_ERROR "Compiler sanitizer option \"${sanitize_option}\" not supported.")
|
||||
endif ()
|
||||
endif()
|
||||
endmacro ()
|
||||
|
||||
if (ECM_ENABLE_SANITIZERS)
|
||||
@@ -149,6 +167,11 @@ if (ECM_ENABLE_SANITIZERS)
|
||||
string(REPLACE "-Wl,--no-undefined" "" CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS}")
|
||||
endif ()
|
||||
endforeach()
|
||||
elseif (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
||||
foreach (CUR_SANITIZER ${ECM_ENABLE_SANITIZERS})
|
||||
enable_sanitizer_flags(${CUR_SANITIZER})
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${XSAN_COMPILE_FLAGS}")
|
||||
endforeach()
|
||||
else()
|
||||
message(STATUS "Tried to enable sanitizers (-DECM_ENABLE_SANITIZERS=${ECM_ENABLE_SANITIZERS}), \
|
||||
but compiler (${CMAKE_CXX_COMPILER_ID}) does not have sanitizer support")
|
||||
|
||||
223
cmake/ECM/modules/ECMGenerateHeaders.cmake
Normal file
223
cmake/ECM/modules/ECMGenerateHeaders.cmake
Normal file
@@ -0,0 +1,223 @@
|
||||
# SPDX-FileCopyrightText: 2013 Aleix Pol Gonzalez <aleixpol@blue-systems.com>
|
||||
# SPDX-FileCopyrightText: 2014 Alex Merry <alex.merry@kdemail.net>
|
||||
# SPDX-FileCopyrightText: 2015 Patrick Spendrin <patrick.spendrin@kdab.com>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
ECMGenerateHeaders
|
||||
------------------
|
||||
|
||||
Generate C/C++ CamelCase forwarding headers.
|
||||
|
||||
::
|
||||
|
||||
ecm_generate_headers(<camelcase_forwarding_headers_var>
|
||||
HEADER_NAMES <CamelCaseName> [<CamelCaseName> [...]]
|
||||
[ORIGINAL <CAMELCASE|LOWERCASE>]
|
||||
[HEADER_EXTENSION <header_extension>]
|
||||
[OUTPUT_DIR <output_dir>]
|
||||
[PREFIX <prefix>]
|
||||
[REQUIRED_HEADERS <variable>]
|
||||
[COMMON_HEADER <HeaderName>]
|
||||
[RELATIVE <relative_path>])
|
||||
|
||||
For each CamelCase header name passed to HEADER_NAMES, a file of that name
|
||||
will be generated that will include a version with ``.h`` or, if set,
|
||||
``.<header_extension>`` appended.
|
||||
For example, the generated header ``ClassA`` will include ``classa.h`` (or
|
||||
``ClassA.h``, see ORIGINAL).
|
||||
If a CamelCaseName consists of multiple comma-separated files, e.g.
|
||||
``ClassA,ClassB,ClassC``, then multiple camelcase header files will be
|
||||
generated which are redirects to the first header file.
|
||||
The file locations of these generated headers will be stored in
|
||||
<camelcase_forwarding_headers_var>.
|
||||
|
||||
ORIGINAL specifies how the name of the original header is written: lowercased
|
||||
or also camelcased. The default is LOWERCASE. Since 1.8.0.
|
||||
|
||||
HEADER_EXTENSION specifies what file name extension is used for the header
|
||||
files. The default is "h". Since 5.48.0.
|
||||
|
||||
PREFIX places the generated headers in subdirectories. This should be a
|
||||
CamelCase name like ``KParts``, which will cause the CamelCase forwarding
|
||||
headers to be placed in the ``KParts`` directory (e.g. ``KParts/Part``). It
|
||||
will also, for the convenience of code in the source distribution, generate
|
||||
forwarding headers based on the original names (e.g. ``kparts/part.h``). This
|
||||
allows includes like ``"#include <kparts/part.h>"`` to be used before
|
||||
installation, as long as the include_directories are set appropriately.
|
||||
|
||||
OUTPUT_DIR specifies where the files will be generated; this should be within
|
||||
the build directory. By default, ``${CMAKE_CURRENT_BINARY_DIR}`` will be used.
|
||||
This option can be used to avoid file conflicts.
|
||||
|
||||
REQUIRED_HEADERS specifies an output variable name where all the required
|
||||
headers will be appended so that they can be installed together with the
|
||||
generated ones. This is mostly intended as a convenience so that adding a new
|
||||
header to a project only requires specifying the CamelCase variant in the
|
||||
CMakeLists.txt file; the original variant will then be added to this
|
||||
variable.
|
||||
|
||||
COMMON_HEADER generates an additional convenience header which includes all
|
||||
other header files.
|
||||
|
||||
The RELATIVE argument indicates where the original headers can be found
|
||||
relative to CMAKE_CURRENT_SOURCE_DIR. It does not affect the generated
|
||||
CamelCase forwarding files, but ecm_generate_headers() uses it when checking
|
||||
that the original header exists, and to generate originally named forwarding
|
||||
headers when PREFIX is set.
|
||||
|
||||
To allow other parts of the source distribution (eg: tests) to use the
|
||||
generated headers before installation, it may be desirable to set the
|
||||
INCLUDE_DIRECTORIES property for the library target to output_dir. For
|
||||
example, if OUTPUT_DIR is CMAKE_CURRENT_BINARY_DIR (the default), you could do
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
target_include_directories(MyLib PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>")
|
||||
|
||||
Example usage (without PREFIX):
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
ecm_generate_headers(
|
||||
MyLib_FORWARDING_HEADERS
|
||||
HEADERS
|
||||
MLFoo
|
||||
MLBar
|
||||
# etc
|
||||
REQUIRED_HEADERS MyLib_HEADERS
|
||||
COMMON_HEADER MLGeneral
|
||||
)
|
||||
install(FILES ${MyLib_FORWARDING_HEADERS} ${MyLib_HEADERS}
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/include
|
||||
COMPONENT Devel)
|
||||
|
||||
Example usage (with PREFIX):
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
ecm_generate_headers(
|
||||
MyLib_FORWARDING_HEADERS
|
||||
HEADERS
|
||||
Foo
|
||||
# several classes are contained in bar.h, so generate
|
||||
# additional files
|
||||
Bar,BarList
|
||||
# etc
|
||||
PREFIX MyLib
|
||||
REQUIRED_HEADERS MyLib_HEADERS
|
||||
)
|
||||
install(FILES ${MyLib_FORWARDING_HEADERS}
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/include/MyLib
|
||||
COMPONENT Devel)
|
||||
install(FILES ${MyLib_HEADERS}
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/include/mylib
|
||||
COMPONENT Devel)
|
||||
|
||||
Since pre-1.0.0.
|
||||
#]=======================================================================]
|
||||
|
||||
include(CMakeParseArguments)
|
||||
|
||||
function(ECM_GENERATE_HEADERS camelcase_forwarding_headers_var)
|
||||
set(options)
|
||||
set(oneValueArgs ORIGINAL HEADER_EXTENSION OUTPUT_DIR PREFIX REQUIRED_HEADERS COMMON_HEADER RELATIVE)
|
||||
set(multiValueArgs HEADER_NAMES)
|
||||
cmake_parse_arguments(EGH "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
if (EGH_UNPARSED_ARGUMENTS)
|
||||
message(FATAL_ERROR "Unexpected arguments to ECM_GENERATE_HEADERS: ${EGH_UNPARSED_ARGUMENTS}")
|
||||
endif()
|
||||
|
||||
if(NOT EGH_HEADER_NAMES)
|
||||
message(FATAL_ERROR "Missing header_names argument to ECM_GENERATE_HEADERS")
|
||||
endif()
|
||||
|
||||
if(NOT EGH_ORIGINAL)
|
||||
# default
|
||||
set(EGH_ORIGINAL "LOWERCASE")
|
||||
endif()
|
||||
if(NOT EGH_ORIGINAL STREQUAL "LOWERCASE" AND NOT EGH_ORIGINAL STREQUAL "CAMELCASE")
|
||||
message(FATAL_ERROR "Unexpected value for original argument to ECM_GENERATE_HEADERS: ${EGH_ORIGINAL}")
|
||||
endif()
|
||||
|
||||
if(NOT EGH_HEADER_EXTENSION)
|
||||
set(EGH_HEADER_EXTENSION "h")
|
||||
endif()
|
||||
|
||||
if(NOT EGH_OUTPUT_DIR)
|
||||
set(EGH_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
endif()
|
||||
|
||||
# Make sure EGH_RELATIVE is /-terminated when it's not empty
|
||||
if (EGH_RELATIVE AND NOT "${EGH_RELATIVE}" MATCHES "^.*/$")
|
||||
set(EGH_RELATIVE "${EGH_RELATIVE}/")
|
||||
endif()
|
||||
|
||||
set(originalprefix)
|
||||
if (EGH_PREFIX)
|
||||
if (NOT "${EGH_PREFIX}" MATCHES "^.*/$")
|
||||
set(EGH_PREFIX "${EGH_PREFIX}/")
|
||||
endif()
|
||||
if (EGH_ORIGINAL STREQUAL "CAMELCASE")
|
||||
set(originalprefix "${EGH_PREFIX}")
|
||||
else()
|
||||
string(TOLOWER "${EGH_PREFIX}" originalprefix)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
foreach(_classnameentry ${EGH_HEADER_NAMES})
|
||||
string(REPLACE "," ";" _classnames ${_classnameentry})
|
||||
list(GET _classnames 0 _baseclass)
|
||||
|
||||
if (EGH_ORIGINAL STREQUAL "CAMELCASE")
|
||||
set(originalbasename "${_baseclass}")
|
||||
else()
|
||||
string(TOLOWER "${_baseclass}" originalbasename)
|
||||
endif()
|
||||
|
||||
set(_actualheader "${CMAKE_CURRENT_SOURCE_DIR}/${EGH_RELATIVE}${originalbasename}.${EGH_HEADER_EXTENSION}")
|
||||
if (NOT EXISTS ${_actualheader})
|
||||
message(FATAL_ERROR "Could not find \"${_actualheader}\"")
|
||||
endif()
|
||||
|
||||
foreach(_CLASSNAME ${_classnames})
|
||||
set(FANCY_HEADER_FILE "${EGH_OUTPUT_DIR}/${EGH_PREFIX}${_CLASSNAME}")
|
||||
if (NOT EXISTS ${FANCY_HEADER_FILE})
|
||||
file(WRITE ${FANCY_HEADER_FILE} "#include \"${originalprefix}${originalbasename}.${EGH_HEADER_EXTENSION}\"\n")
|
||||
endif()
|
||||
list(APPEND ${camelcase_forwarding_headers_var} "${FANCY_HEADER_FILE}")
|
||||
if (EGH_PREFIX)
|
||||
# Local forwarding header, for namespaced headers, e.g. kparts/part.h
|
||||
if(EGH_ORIGINAL STREQUAL "CAMELCASE")
|
||||
set(originalclassname "${_CLASSNAME}")
|
||||
else()
|
||||
string(TOLOWER "${_CLASSNAME}" originalclassname)
|
||||
endif()
|
||||
set(REGULAR_HEADER_NAME ${EGH_OUTPUT_DIR}/${originalprefix}${originalclassname}.${EGH_HEADER_EXTENSION})
|
||||
if (NOT EXISTS ${REGULAR_HEADER_NAME})
|
||||
file(WRITE ${REGULAR_HEADER_NAME} "#include \"${_actualheader}\"\n")
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
list(APPEND _REQUIRED_HEADERS "${_actualheader}")
|
||||
endforeach()
|
||||
|
||||
if(EGH_COMMON_HEADER)
|
||||
#combine required headers into 1 big convenience header
|
||||
set(COMMON_HEADER ${EGH_OUTPUT_DIR}/${EGH_PREFIX}${EGH_COMMON_HEADER})
|
||||
file(WRITE ${COMMON_HEADER} "// convenience header\n")
|
||||
foreach(_header ${_REQUIRED_HEADERS})
|
||||
get_filename_component(_base ${_header} NAME)
|
||||
file(APPEND ${COMMON_HEADER} "#include \"${_base}\"\n")
|
||||
endforeach()
|
||||
list(APPEND ${camelcase_forwarding_headers_var} "${COMMON_HEADER}")
|
||||
endif()
|
||||
|
||||
set(${camelcase_forwarding_headers_var} ${${camelcase_forwarding_headers_var}} PARENT_SCOPE)
|
||||
if (EGH_REQUIRED_HEADERS)
|
||||
set(${EGH_REQUIRED_HEADERS} ${${EGH_REQUIRED_HEADERS}} ${_REQUIRED_HEADERS} PARENT_SCOPE)
|
||||
endif ()
|
||||
endfunction()
|
||||
@@ -1,81 +1,88 @@
|
||||
#.rst:
|
||||
# ECMGeneratePriFile
|
||||
# ------------------
|
||||
#
|
||||
# Generate a ``.pri`` file for the benefit of qmake-based projects.
|
||||
#
|
||||
# As well as the function below, this module creates the cache variable
|
||||
# ``ECM_MKSPECS_INSTALL_DIR`` and sets the default value to ``mkspecs/modules``.
|
||||
# This assumes Qt and the current project are both installed to the same
|
||||
# non-system prefix. Packagers who use ``-DCMAKE_INSTALL_PREFIX=/usr`` will
|
||||
# certainly want to set ``ECM_MKSPECS_INSTALL_DIR`` to something like
|
||||
# ``share/qt5/mkspecs/modules``.
|
||||
#
|
||||
# The main thing is that this should be the ``modules`` subdirectory of either
|
||||
# the default qmake ``mkspecs`` directory or of a directory that will be in the
|
||||
# ``$QMAKEPATH`` environment variable when qmake is run.
|
||||
#
|
||||
# ::
|
||||
#
|
||||
# ecm_generate_pri_file(BASE_NAME <baseName>
|
||||
# LIB_NAME <libName>
|
||||
# [DEPS "<dep> [<dep> [...]]"]
|
||||
# [FILENAME_VAR <filename_variable>]
|
||||
# [INCLUDE_INSTALL_DIR <dir>]
|
||||
# [LIB_INSTALL_DIR <dir>])
|
||||
#
|
||||
# If your CMake project produces a Qt-based library, you may expect there to be
|
||||
# applications that wish to use it that use a qmake-based build system, rather
|
||||
# than a CMake-based one. Creating a ``.pri`` file will make use of your
|
||||
# library convenient for them, in much the same way that CMake config files make
|
||||
# things convenient for CMake-based applications.
|
||||
#
|
||||
# ecm_generate_pri_file() generates just such a file. It requires the
|
||||
# ``PROJECT_VERSION_STRING`` variable to be set. This is typically set by
|
||||
# :module:`ECMSetupVersion`, although the project() command in CMake 3.0.0 and
|
||||
# later can also set this.
|
||||
#
|
||||
# BASE_NAME specifies the name qmake project (.pro) files should use to refer to
|
||||
# the library (eg: KArchive). LIB_NAME is the name of the actual library to
|
||||
# link to (ie: the first argument to add_library()). DEPS is a space-separated
|
||||
# list of the base names of other libraries (for Qt libraries, use the same
|
||||
# names you use with the ``QT`` variable in a qmake project file, such as "core"
|
||||
# for QtCore). FILENAME_VAR specifies the name of a variable to store the path
|
||||
# to the generated file in.
|
||||
#
|
||||
# INCLUDE_INSTALL_DIR is the path (relative to ``CMAKE_INSTALL_PREFIX``) that
|
||||
# include files will be installed to. It defaults to
|
||||
# ``${INCLUDE_INSTALL_DIR}/<baseName>`` if the ``INCLUDE_INSTALL_DIR`` variable
|
||||
# is set. If that variable is not set, the ``CMAKE_INSTALL_INCLUDEDIR`` variable
|
||||
# is used instead, and if neither are set ``include`` is used. LIB_INSTALL_DIR
|
||||
# operates similarly for the installation location for libraries; it defaults to
|
||||
# ``${LIB_INSTALL_DIR}``, ``${CMAKE_INSTALL_LIBDIR}`` or ``lib``, in that order.
|
||||
#
|
||||
# Example usage:
|
||||
#
|
||||
# .. code-block:: cmake
|
||||
#
|
||||
# ecm_generate_pri_file(
|
||||
# BASE_NAME KArchive
|
||||
# LIB_NAME KF5KArchive
|
||||
# DEPS "core"
|
||||
# FILENAME_VAR pri_filename
|
||||
# )
|
||||
# install(FILES ${pri_filename} DESTINATION ${ECM_MKSPECS_INSTALL_DIR})
|
||||
#
|
||||
# A qmake-based project that wished to use this would then do::
|
||||
#
|
||||
# QT += KArchive
|
||||
#
|
||||
# in their ``.pro`` file.
|
||||
#
|
||||
# Since pre-1.0.0.
|
||||
|
||||
#=============================================================================
|
||||
# SPDX-FileCopyrightText: 2014 David Faure <faure@kde.org>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
ECMGeneratePriFile
|
||||
------------------
|
||||
|
||||
Generate a ``.pri`` file for the benefit of qmake-based projects.
|
||||
|
||||
As well as the function below, this module creates the cache variable
|
||||
``ECM_MKSPECS_INSTALL_DIR`` and sets the default value to ``mkspecs/modules``.
|
||||
This assumes Qt and the current project are both installed to the same
|
||||
non-system prefix. Packagers who use ``-DCMAKE_INSTALL_PREFIX=/usr`` will
|
||||
certainly want to set ``ECM_MKSPECS_INSTALL_DIR`` to something like
|
||||
``share/qt5/mkspecs/modules``.
|
||||
|
||||
The main thing is that this should be the ``modules`` subdirectory of either
|
||||
the default qmake ``mkspecs`` directory or of a directory that will be in the
|
||||
``$QMAKEPATH`` environment variable when qmake is run.
|
||||
|
||||
::
|
||||
|
||||
ecm_generate_pri_file(BASE_NAME <baseName>
|
||||
LIB_NAME <libName>
|
||||
[VERSION <version>] # since 5.83
|
||||
[DEPS "<dep> [<dep> [...]]"]
|
||||
[FILENAME_VAR <filename_variable>]
|
||||
[INCLUDE_INSTALL_DIR <dir>]
|
||||
[LIB_INSTALL_DIR <dir>])
|
||||
|
||||
If your CMake project produces a Qt-based library, you may expect there to be
|
||||
applications that wish to use it that use a qmake-based build system, rather
|
||||
than a CMake-based one. Creating a ``.pri`` file will make use of your
|
||||
library convenient for them, in much the same way that CMake config files make
|
||||
things convenient for CMake-based applications. ``ecm_generate_pri_file()``
|
||||
generates just such a file.
|
||||
|
||||
VERSION specifies the version of the library the ``.pri`` file describes. If
|
||||
not set, the value is taken from the context variable ``PROJECT_VERSION``.
|
||||
This variable is usually set by the ``project(... VERSION ...)`` command or,
|
||||
if CMake policy CMP0048 is not NEW, by :module:`ECMSetupVersion`.
|
||||
For backward-compatibility with older ECM versions the
|
||||
``PROJECT_VERSION_STRING`` variable as set by :module:`ECMSetupVersion`
|
||||
will be preferred over ``PROJECT_VERSION`` if set, unless the minimum
|
||||
required version of ECM is 5.83 and newer. Since 5.83.
|
||||
|
||||
BASE_NAME specifies the name qmake project (.pro) files should use to refer to
|
||||
the library (eg: KArchive). LIB_NAME is the name of the actual library to
|
||||
link to (ie: the first argument to add_library()). DEPS is a space-separated
|
||||
list of the base names of other libraries (for Qt libraries, use the same
|
||||
names you use with the ``QT`` variable in a qmake project file, such as "core"
|
||||
for QtCore). FILENAME_VAR specifies the name of a variable to store the path
|
||||
to the generated file in.
|
||||
|
||||
INCLUDE_INSTALL_DIR is the path (relative to ``CMAKE_INSTALL_PREFIX``) that
|
||||
include files will be installed to. It defaults to
|
||||
``${INCLUDE_INSTALL_DIR}/<baseName>`` if the ``INCLUDE_INSTALL_DIR`` variable
|
||||
is set. If that variable is not set, the ``CMAKE_INSTALL_INCLUDEDIR`` variable
|
||||
is used instead, and if neither are set ``include`` is used. LIB_INSTALL_DIR
|
||||
operates similarly for the installation location for libraries; it defaults to
|
||||
``${LIB_INSTALL_DIR}``, ``${CMAKE_INSTALL_LIBDIR}`` or ``lib``, in that order.
|
||||
|
||||
Example usage:
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
ecm_generate_pri_file(
|
||||
BASE_NAME KArchive
|
||||
LIB_NAME KF5KArchive
|
||||
DEPS "core"
|
||||
FILENAME_VAR pri_filename
|
||||
VERSION 4.2.0
|
||||
)
|
||||
install(FILES ${pri_filename} DESTINATION ${ECM_MKSPECS_INSTALL_DIR})
|
||||
|
||||
A qmake-based project that wished to use this would then do::
|
||||
|
||||
QT += KArchive
|
||||
|
||||
in their ``.pro`` file.
|
||||
|
||||
Since pre-1.0.0.
|
||||
#]=======================================================================]
|
||||
|
||||
# Replicate the logic from KDEInstallDirs.cmake as we can't depend on it
|
||||
# Ask qmake if we're using the same prefix as Qt
|
||||
set(_askqmake OFF)
|
||||
@@ -89,15 +96,24 @@ endif()
|
||||
|
||||
if(KDE_INSTALL_USE_QT_SYS_PATHS OR _askqmake)
|
||||
include(ECMQueryQmake)
|
||||
query_qmake(qt_install_prefix_dir QT_INSTALL_PREFIX)
|
||||
query_qmake(qt_host_data_dir QT_HOST_DATA)
|
||||
set(ECM_MKSPECS_INSTALL_DIR ${qt_host_data_dir}/mkspecs/modules CACHE PATH "The directory where mkspecs will be installed to.")
|
||||
if(qt_install_prefix_dir STREQUAL "${CMAKE_INSTALL_PREFIX}")
|
||||
file(RELATIVE_PATH qt_host_data_dir ${qt_install_prefix_dir} ${qt_host_data_dir})
|
||||
endif()
|
||||
if(qt_host_data_dir STREQUAL "")
|
||||
set(mkspecs_install_dir mkspecs/modules)
|
||||
else()
|
||||
set(mkspecs_install_dir ${qt_host_data_dir}/mkspecs/modules)
|
||||
endif()
|
||||
set(ECM_MKSPECS_INSTALL_DIR ${mkspecs_install_dir} CACHE PATH "The directory where mkspecs will be installed to.")
|
||||
else()
|
||||
set(ECM_MKSPECS_INSTALL_DIR mkspecs/modules CACHE PATH "The directory where mkspecs will be installed to.")
|
||||
endif()
|
||||
|
||||
function(ECM_GENERATE_PRI_FILE)
|
||||
set(options )
|
||||
set(oneValueArgs BASE_NAME LIB_NAME DEPS FILENAME_VAR INCLUDE_INSTALL_DIR LIB_INSTALL_DIR)
|
||||
set(oneValueArgs BASE_NAME LIB_NAME DEPS FILENAME_VAR INCLUDE_INSTALL_DIR LIB_INSTALL_DIR VERSION)
|
||||
set(multiValueArgs )
|
||||
|
||||
cmake_parse_arguments(EGPF "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
@@ -106,14 +122,28 @@ function(ECM_GENERATE_PRI_FILE)
|
||||
message(FATAL_ERROR "Unknown keywords given to ECM_GENERATE_PRI_FILE(): \"${EGPF_UNPARSED_ARGUMENTS}\"")
|
||||
endif()
|
||||
|
||||
if(ECM_GLOBAL_FIND_VERSION VERSION_LESS 5.83.0)
|
||||
set(_support_backward_compat_version_string_var TRUE)
|
||||
else()
|
||||
set(_support_backward_compat_version_string_var FALSE)
|
||||
endif()
|
||||
|
||||
if(NOT EGPF_BASE_NAME)
|
||||
message(FATAL_ERROR "Required argument BASE_NAME missing in ECM_GENERATE_PRI_FILE() call")
|
||||
endif()
|
||||
if(NOT EGPF_LIB_NAME)
|
||||
message(FATAL_ERROR "Required argument LIB_NAME missing in ECM_GENERATE_PRI_FILE() call")
|
||||
endif()
|
||||
if(NOT PROJECT_VERSION_STRING)
|
||||
message(FATAL_ERROR "Required variable PROJECT_VERSION_STRING not set before ECM_GENERATE_PRI_FILE() call. Did you call ecm_setup_version?")
|
||||
if(NOT EGPF_VERSION)
|
||||
if(_support_backward_compat_version_string_var)
|
||||
if(NOT PROJECT_VERSION_STRING AND NOT PROJECT_VERSION)
|
||||
message(FATAL_ERROR "Required variable PROJECT_VERSION_STRING or PROJECT_VERSION not set before ECM_GENERATE_PRI_FILE() call. Missing call of ecm_setup_version() or project(VERSION)?")
|
||||
endif()
|
||||
else()
|
||||
if(NOT PROJECT_VERSION)
|
||||
message(FATAL_ERROR "Required variable PROJECT_VERSION not set before ECM_GENERATE_PRI_FILE() call. Missing call of ecm_setup_version() or project(VERSION)?")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
if(NOT EGPF_INCLUDE_INSTALL_DIR)
|
||||
if(INCLUDE_INSTALL_DIR)
|
||||
@@ -134,9 +164,22 @@ function(ECM_GENERATE_PRI_FILE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
string(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" PROJECT_VERSION_MAJOR "${PROJECT_VERSION_STRING}")
|
||||
string(REGEX REPLACE "^[0-9]+\\.([0-9]+)\\.[0-9]+.*" "\\1" PROJECT_VERSION_MINOR "${PROJECT_VERSION_STRING}")
|
||||
string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" PROJECT_VERSION_PATCH "${PROJECT_VERSION_STRING}")
|
||||
if(EGPF_VERSION)
|
||||
set(PRI_VERSION "${EGPF_VERSION}")
|
||||
else()
|
||||
if(_support_backward_compat_version_string_var AND PROJECT_VERSION_STRING)
|
||||
set(PRI_VERSION "${PROJECT_VERSION_STRING}")
|
||||
if(NOT PROJECT_VERSION_STRING STREQUAL PROJECT_VERSION)
|
||||
message(DEPRECATION "ECM_GENERATE_PRI_FILE() will no longer support PROJECT_VERSION_STRING when the required minimum version of ECM is 5.83 or newer. Set VERSION parameter or use PROJECT_VERSION instead.")
|
||||
endif()
|
||||
else()
|
||||
set(PRI_VERSION "${PROJECT_VERSION}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
string(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" PRI_VERSION_MAJOR "${PRI_VERSION}")
|
||||
string(REGEX REPLACE "^[0-9]+\\.([0-9]+)\\.[0-9]+.*" "\\1" PRI_VERSION_MINOR "${PRI_VERSION}")
|
||||
string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" PRI_VERSION_PATCH "${PRI_VERSION}")
|
||||
|
||||
# Prepare the right number of "../.." to go from ECM_MKSPECS_INSTALL_DIR to the install prefix
|
||||
# This allows to make the generated pri files relocatable (no absolute paths)
|
||||
@@ -160,6 +203,7 @@ function(ECM_GENERATE_PRI_FILE)
|
||||
else()
|
||||
set(PRI_TARGET_LIBS "${BASEPATH}/${EGPF_LIB_INSTALL_DIR}")
|
||||
endif()
|
||||
set(PRI_TARGET_DEFINES "")
|
||||
|
||||
set(PRI_FILENAME ${CMAKE_CURRENT_BINARY_DIR}/qt_${PRI_TARGET_BASENAME}.pri)
|
||||
if (EGPF_FILENAME_VAR)
|
||||
@@ -167,8 +211,6 @@ function(ECM_GENERATE_PRI_FILE)
|
||||
endif()
|
||||
|
||||
set(PRI_TARGET_MODULE_CONFIG "")
|
||||
set(PRI_TARGET_DEFINES "")
|
||||
set(PRI_TARGET_POSTFIX "")
|
||||
# backward compat: it was not obvious LIB_NAME needs to be a target name,
|
||||
# and some projects where the target name was not the actual library output name
|
||||
# passed the output name for LIB_NAME, so .name & .module prperties are correctly set.
|
||||
@@ -178,22 +220,18 @@ function(ECM_GENERATE_PRI_FILE)
|
||||
if (target_type STREQUAL "STATIC_LIBRARY")
|
||||
set(PRI_TARGET_MODULE_CONFIG "staticlib")
|
||||
endif()
|
||||
get_target_property(target_defs ${EGPF_LIB_NAME} INTERFACE_COMPILE_DEFINITIONS)
|
||||
list(FILTER target_defs EXCLUDE REGEX ^QT_)
|
||||
string(JOIN " " PRI_TARGET_DEFINES "${target_defs}")
|
||||
set(PRI_TARGET_POSTFIX "$<TARGET_PROPERTY:${EGPF_LIB_NAME},$<UPPER_CASE:$<CONFIG>$<$<CONFIG:>:Debug>>_POSTFIX>")
|
||||
endif()
|
||||
|
||||
file(GENERATE
|
||||
OUTPUT ${PRI_FILENAME}
|
||||
CONTENT
|
||||
"QT.${PRI_TARGET_BASENAME}.VERSION = ${PROJECT_VERSION_STRING}
|
||||
QT.${PRI_TARGET_BASENAME}.MAJOR_VERSION = ${PROJECT_VERSION_MAJOR}
|
||||
QT.${PRI_TARGET_BASENAME}.MINOR_VERSION = ${PROJECT_VERSION_MINOR}
|
||||
QT.${PRI_TARGET_BASENAME}.PATCH_VERSION = ${PROJECT_VERSION_PATCH}
|
||||
"QT.${PRI_TARGET_BASENAME}.VERSION = ${PRI_VERSION}
|
||||
QT.${PRI_TARGET_BASENAME}.MAJOR_VERSION = ${PRI_VERSION_MAJOR}
|
||||
QT.${PRI_TARGET_BASENAME}.MINOR_VERSION = ${PRI_VERSION_MINOR}
|
||||
QT.${PRI_TARGET_BASENAME}.PATCH_VERSION = ${PRI_VERSION_PATCH}
|
||||
QT.${PRI_TARGET_BASENAME}.name = ${PRI_TARGET_LIBNAME}
|
||||
QT.${PRI_TARGET_BASENAME}.module = ${PRI_TARGET_LIBNAME}${PRI_TARGET_POSTFIX}
|
||||
QT.${PRI_TARGET_BASENAME}.DEFINES = ${PRI_TARGET_DEFINES}
|
||||
QT.${PRI_TARGET_BASENAME}.module = ${PRI_TARGET_LIBNAME}
|
||||
QT.${PRI_TARGET_BASENAME}.defines = ${PRI_TARGET_DEFINES}
|
||||
QT.${PRI_TARGET_BASENAME}.includes = ${PRI_TARGET_INCLUDES}
|
||||
QT.${PRI_TARGET_BASENAME}.private_includes =
|
||||
QT.${PRI_TARGET_BASENAME}.libs = ${PRI_TARGET_LIBS}
|
||||
|
||||
@@ -1,88 +1,96 @@
|
||||
#.rst:
|
||||
# ECMSetupVersion
|
||||
# ---------------
|
||||
#
|
||||
# Handle library version information.
|
||||
#
|
||||
# ::
|
||||
#
|
||||
# ecm_setup_version(<version>
|
||||
# VARIABLE_PREFIX <prefix>
|
||||
# [SOVERSION <soversion>]
|
||||
# [VERSION_HEADER <filename>]
|
||||
# [PACKAGE_VERSION_FILE <filename> [COMPATIBILITY <compat>]] )
|
||||
#
|
||||
# This parses a version string and sets up a standard set of version variables.
|
||||
# It can optionally also create a C version header file and a CMake package
|
||||
# version file to install along with the library.
|
||||
#
|
||||
# If the ``<version>`` argument is of the form ``<major>.<minor>.<patch>``
|
||||
# (or ``<major>.<minor>.<patch>.<tweak>``), The following CMake variables are
|
||||
# set::
|
||||
#
|
||||
# <prefix>_VERSION_MAJOR - <major>
|
||||
# <prefix>_VERSION_MINOR - <minor>
|
||||
# <prefix>_VERSION_PATCH - <patch>
|
||||
# <prefix>_VERSION - <version>
|
||||
# <prefix>_VERSION_STRING - <version> (for compatibility: use <prefix>_VERSION instead)
|
||||
# <prefix>_SOVERSION - <soversion>, or <major> if SOVERSION was not given
|
||||
#
|
||||
# If CMake policy CMP0048 is not NEW, the following CMake variables will also
|
||||
# be set::
|
||||
#
|
||||
# PROJECT_VERSION_MAJOR - <major>
|
||||
# PROJECT_VERSION_MINOR - <minor>
|
||||
# PROJECT_VERSION_PATCH - <patch>
|
||||
# PROJECT_VERSION - <version>
|
||||
# PROJECT_VERSION_STRING - <version> (for compatibility: use PROJECT_VERSION instead)
|
||||
#
|
||||
# If the VERSION_HEADER option is used, a simple C header is generated with the
|
||||
# given filename. If filename is a relative path, it is interpreted as relative
|
||||
# to CMAKE_CURRENT_BINARY_DIR. The generated header contains the following
|
||||
# macros::
|
||||
#
|
||||
# <prefix>_VERSION_MAJOR - <major> as an integer
|
||||
# <prefix>_VERSION_MINOR - <minor> as an integer
|
||||
# <prefix>_VERSION_PATCH - <patch> as an integer
|
||||
# <prefix>_VERSION_STRING - <version> as a C string
|
||||
# <prefix>_VERSION - the version as an integer
|
||||
#
|
||||
# ``<prefix>_VERSION`` has ``<patch>`` in the bottom 8 bits, ``<minor>`` in the
|
||||
# next 8 bits and ``<major>`` in the remaining bits. Note that ``<patch>`` and
|
||||
# ``<minor>`` must be less than 256.
|
||||
#
|
||||
# If the PACKAGE_VERSION_FILE option is used, a simple CMake package version
|
||||
# file is created using the write_basic_package_version_file() macro provided by
|
||||
# CMake. It should be installed in the same location as the Config.cmake file of
|
||||
# the library so that it can be found by find_package(). If the filename is a
|
||||
# relative path, it is interpreted as relative to CMAKE_CURRENT_BINARY_DIR. The
|
||||
# optional COMPATIBILITY option is forwarded to
|
||||
# write_basic_package_version_file(), and defaults to AnyNewerVersion.
|
||||
#
|
||||
# If CMake policy CMP0048 is NEW, an alternative form of the command is
|
||||
# available::
|
||||
#
|
||||
# ecm_setup_version(PROJECT
|
||||
# [VARIABLE_PREFIX <prefix>]
|
||||
# [SOVERSION <soversion>]
|
||||
# [VERSION_HEADER <filename>]
|
||||
# [PACKAGE_VERSION_FILE <filename>] )
|
||||
#
|
||||
# This will use the version information set by the project() command.
|
||||
# VARIABLE_PREFIX defaults to the project name. Note that PROJECT must be the
|
||||
# first argument. In all other respects, it behaves like the other form of the
|
||||
# command.
|
||||
#
|
||||
# Since pre-1.0.0.
|
||||
#
|
||||
# COMPATIBILITY option available since 1.6.0.
|
||||
|
||||
#=============================================================================
|
||||
# SPDX-FileCopyrightText: 2014 Alex Merry <alex.merry@kde.org>
|
||||
# SPDX-FileCopyrightText: 2012 Alexander Neundorf <neundorf@kde.org>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
ECMSetupVersion
|
||||
---------------
|
||||
|
||||
Handle library version information.
|
||||
|
||||
::
|
||||
|
||||
ecm_setup_version(<version>
|
||||
VARIABLE_PREFIX <prefix>
|
||||
[SOVERSION <soversion>]
|
||||
[VERSION_HEADER <filename>]
|
||||
[PACKAGE_VERSION_FILE <filename> [COMPATIBILITY <compat>]] )
|
||||
|
||||
This parses a version string and sets up a standard set of version variables.
|
||||
It can optionally also create a C version header file and a CMake package
|
||||
version file to install along with the library.
|
||||
|
||||
If the ``<version>`` argument is of the form ``<major>.<minor>.<patch>``
|
||||
(or ``<major>.<minor>.<patch>.<tweak>``), The following CMake variables are
|
||||
set::
|
||||
|
||||
<prefix>_VERSION_MAJOR - <major>
|
||||
<prefix>_VERSION_MINOR - <minor>
|
||||
<prefix>_VERSION_PATCH - <patch>
|
||||
<prefix>_VERSION - <version>
|
||||
<prefix>_SOVERSION - <soversion>, or <major> if SOVERSION was not given
|
||||
|
||||
For backward-compatibility also this variable is set (only if the minimum required
|
||||
version of ECM is < 5.83)::
|
||||
|
||||
<prefix>_VERSION_STRING - <version> (use <prefix>_VERSION instead)
|
||||
|
||||
If CMake policy CMP0048 is not NEW, the following CMake variables will also
|
||||
be set::
|
||||
|
||||
PROJECT_VERSION_MAJOR - <major>
|
||||
PROJECT_VERSION_MINOR - <minor>
|
||||
PROJECT_VERSION_PATCH - <patch>
|
||||
PROJECT_VERSION - <version>
|
||||
|
||||
For backward-compatibility, if CMake policy CMP0048 is not NEW, also this variable is set
|
||||
(only if the minimum required version of ECM is < 5.83)::
|
||||
|
||||
PROJECT_VERSION_STRING - <version> (use PROJECT_VERSION instead)
|
||||
|
||||
If the VERSION_HEADER option is used, a simple C header is generated with the
|
||||
given filename. If filename is a relative path, it is interpreted as relative
|
||||
to CMAKE_CURRENT_BINARY_DIR. The generated header contains the following
|
||||
macros::
|
||||
|
||||
<prefix>_VERSION_MAJOR - <major> as an integer
|
||||
<prefix>_VERSION_MINOR - <minor> as an integer
|
||||
<prefix>_VERSION_PATCH - <patch> as an integer
|
||||
<prefix>_VERSION_STRING - <version> as a C string
|
||||
<prefix>_VERSION - the version as an integer
|
||||
|
||||
``<prefix>_VERSION`` has ``<patch>`` in the bottom 8 bits, ``<minor>`` in the
|
||||
next 8 bits and ``<major>`` in the remaining bits. Note that ``<patch>`` and
|
||||
``<minor>`` must be less than 256.
|
||||
|
||||
If the PACKAGE_VERSION_FILE option is used, a simple CMake package version
|
||||
file is created using the write_basic_package_version_file() macro provided by
|
||||
CMake. It should be installed in the same location as the Config.cmake file of
|
||||
the library so that it can be found by find_package(). If the filename is a
|
||||
relative path, it is interpreted as relative to CMAKE_CURRENT_BINARY_DIR. The
|
||||
optional COMPATIBILITY option is forwarded to
|
||||
write_basic_package_version_file(), and defaults to AnyNewerVersion.
|
||||
|
||||
If CMake policy CMP0048 is NEW, an alternative form of the command is
|
||||
available::
|
||||
|
||||
ecm_setup_version(PROJECT
|
||||
[VARIABLE_PREFIX <prefix>]
|
||||
[SOVERSION <soversion>]
|
||||
[VERSION_HEADER <filename>]
|
||||
[PACKAGE_VERSION_FILE <filename>] )
|
||||
|
||||
This will use the version information set by the project() command.
|
||||
VARIABLE_PREFIX defaults to the project name. Note that PROJECT must be the
|
||||
first argument. In all other respects, it behaves like the other form of the
|
||||
command.
|
||||
|
||||
Since pre-1.0.0.
|
||||
|
||||
COMPATIBILITY option available since 1.6.0.
|
||||
#]=======================================================================]
|
||||
|
||||
include(CMakePackageConfigHelpers)
|
||||
|
||||
# save the location of the header template while CMAKE_CURRENT_LIST_DIR
|
||||
@@ -102,12 +110,7 @@ function(ecm_setup_version _version)
|
||||
|
||||
set(project_manages_version FALSE)
|
||||
set(use_project_version FALSE)
|
||||
# CMP0048 only exists in CMake 3.0.0 and later
|
||||
if(CMAKE_VERSION VERSION_LESS 3.0.0)
|
||||
set(project_version_policy "OLD")
|
||||
else()
|
||||
cmake_policy(GET CMP0048 project_version_policy)
|
||||
endif()
|
||||
cmake_policy(GET CMP0048 project_version_policy)
|
||||
if(project_version_policy STREQUAL "NEW")
|
||||
set(project_manages_version TRUE)
|
||||
if(_version STREQUAL "PROJECT")
|
||||
@@ -142,6 +145,12 @@ function(ecm_setup_version _version)
|
||||
set(ESV_SOVERSION ${_major})
|
||||
endif()
|
||||
|
||||
if(ECM_GLOBAL_FIND_VERSION VERSION_LESS 5.83.0)
|
||||
set(_set_backward_compat_version_string_vars TRUE)
|
||||
else()
|
||||
set(_set_backward_compat_version_string_vars FALSE)
|
||||
endif()
|
||||
|
||||
if(should_set_prefixed_vars)
|
||||
set(${ESV_VARIABLE_PREFIX}_VERSION "${_version}")
|
||||
set(${ESV_VARIABLE_PREFIX}_VERSION_MAJOR ${_major})
|
||||
@@ -158,9 +167,10 @@ function(ecm_setup_version _version)
|
||||
set(PROJECT_VERSION_PATCH "${_patch}")
|
||||
endif()
|
||||
|
||||
# compat
|
||||
set(PROJECT_VERSION_STRING "${PROJECT_VERSION}")
|
||||
set(${ESV_VARIABLE_PREFIX}_VERSION_STRING "${${ESV_VARIABLE_PREFIX}_VERSION}")
|
||||
if(_set_backward_compat_version_string_vars)
|
||||
set(PROJECT_VERSION_STRING "${PROJECT_VERSION}")
|
||||
set(${ESV_VARIABLE_PREFIX}_VERSION_STRING "${${ESV_VARIABLE_PREFIX}_VERSION}")
|
||||
endif()
|
||||
|
||||
if(ESV_VERSION_HEADER)
|
||||
set(HEADER_PREFIX "${ESV_VARIABLE_PREFIX}")
|
||||
@@ -195,8 +205,8 @@ function(ecm_setup_version _version)
|
||||
set(PROJECT_VERSION_PATCH "${PROJECT_VERSION_PATCH}" PARENT_SCOPE)
|
||||
endif()
|
||||
|
||||
# always set the compatibility variables
|
||||
set(PROJECT_VERSION_STRING "${PROJECT_VERSION_STRING}" PARENT_SCOPE)
|
||||
set(${ESV_VARIABLE_PREFIX}_VERSION_STRING "${${ESV_VARIABLE_PREFIX}_VERSION}" PARENT_SCOPE)
|
||||
|
||||
if(_set_backward_compat_version_string_vars)
|
||||
set(PROJECT_VERSION_STRING "${PROJECT_VERSION_STRING}" PARENT_SCOPE)
|
||||
set(${ESV_VARIABLE_PREFIX}_VERSION_STRING "${${ESV_VARIABLE_PREFIX}_VERSION}" PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
@@ -1,40 +1,40 @@
|
||||
#.rst:
|
||||
# ECMUninstallTarget
|
||||
# ------------------
|
||||
#
|
||||
# Add an ``uninstall`` target.
|
||||
#
|
||||
# By including this module, an ``uninstall`` target will be added to your CMake
|
||||
# project. This will remove all files installed (or updated) by a previous
|
||||
# invocation of the ``install`` target. It will not remove files created or
|
||||
# modified by an ``install(SCRIPT)`` or ``install(CODE)`` command; you should
|
||||
# create a custom uninstallation target for these and use ``add_dependency`` to
|
||||
# make the ``uninstall`` target depend on it:
|
||||
#
|
||||
# .. code-block:: cmake
|
||||
#
|
||||
# include(ECMUninstallTarget)
|
||||
# install(SCRIPT install-foo.cmake)
|
||||
# add_custom_target(uninstall_foo COMMAND ${CMAKE_COMMAND} -P uninstall-foo.cmake)
|
||||
# add_dependency(uninstall uninstall_foo)
|
||||
#
|
||||
# The target will fail if the ``install`` target has not yet been run (so it is
|
||||
# not possible to run CMake on the project and then immediately run the
|
||||
# ``uninstall`` target).
|
||||
#
|
||||
# .. warning::
|
||||
#
|
||||
# CMake deliberately does not provide an ``uninstall`` target by default on
|
||||
# the basis that such a target has the potential to remove important files
|
||||
# from a user's computer. Use with caution.
|
||||
#
|
||||
# Since 1.7.0.
|
||||
|
||||
#=============================================================================
|
||||
# SPDX-FileCopyrightText: 2015 Alex Merry <alex.merry@kde.org>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
ECMUninstallTarget
|
||||
------------------
|
||||
|
||||
Add an ``uninstall`` target.
|
||||
|
||||
By including this module, an ``uninstall`` target will be added to your CMake
|
||||
project. This will remove all files installed (or updated) by a previous
|
||||
invocation of the ``install`` target. It will not remove files created or
|
||||
modified by an ``install(SCRIPT)`` or ``install(CODE)`` command; you should
|
||||
create a custom uninstallation target for these and use ``add_dependency`` to
|
||||
make the ``uninstall`` target depend on it:
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
include(ECMUninstallTarget)
|
||||
install(SCRIPT install-foo.cmake)
|
||||
add_custom_target(uninstall_foo COMMAND ${CMAKE_COMMAND} -P uninstall-foo.cmake)
|
||||
add_dependency(uninstall uninstall_foo)
|
||||
|
||||
The target will fail if the ``install`` target has not yet been run (so it is
|
||||
not possible to run CMake on the project and then immediately run the
|
||||
``uninstall`` target).
|
||||
|
||||
.. warning::
|
||||
|
||||
CMake deliberately does not provide an ``uninstall`` target by default on
|
||||
the basis that such a target has the potential to remove important files
|
||||
from a user's computer. Use with caution.
|
||||
|
||||
Since 1.7.0.
|
||||
#]=======================================================================]
|
||||
|
||||
if (NOT TARGET uninstall)
|
||||
configure_file(
|
||||
"${CMAKE_CURRENT_LIST_DIR}/ecm_uninstall.cmake.in"
|
||||
|
||||
@@ -12,10 +12,10 @@ if(NOT INSTALL_RUNTIME_DIR)
|
||||
set(INSTALL_RUNTIME_DIR ${CMAKE_INSTALL_BINDIR})
|
||||
endif()
|
||||
if(NOT INSTALL_LIBRARY_DIR)
|
||||
set(INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR})
|
||||
set(INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR})
|
||||
endif()
|
||||
if(NOT INSTALL_ARCHIVE_DIR)
|
||||
set(INSTALL_ARCHIVE_DIR ${CMAKE_INSTALL_LIBDIR})
|
||||
set(INSTALL_ARCHIVE_DIR ${CMAKE_INSTALL_LIBDIR})
|
||||
endif()
|
||||
if(NOT INSTALL_INCLUDE_DIR)
|
||||
set(INSTALL_INCLUDE_DIR ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
@@ -24,11 +24,11 @@ if(NOT INSTALL_DATADIR)
|
||||
set(INSTALL_DATADIR ${CMAKE_INSTALL_DATADIR})
|
||||
endif()
|
||||
if(NOT INSTALL_DOC_DIR)
|
||||
set(INSTALL_DOC_DIR ${CMAKE_INSTALL_DOCDIR})
|
||||
set(INSTALL_DOC_DIR ${CMAKE_INSTALL_DOCDIR}${KDDockWidgets_LIBRARY_QTID})
|
||||
endif()
|
||||
|
||||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||
if (APPLE)
|
||||
if(APPLE)
|
||||
set(CMAKE_MACOSX_RPATH ON)
|
||||
else()
|
||||
set(CMAKE_INSTALL_RPATH "$ORIGIN/../${INSTALL_LIBRARY_DIR}")
|
||||
|
||||
154
cmake/KDAB/modules/FindPySide2.cmake
Normal file
154
cmake/KDAB/modules/FindPySide2.cmake
Normal file
@@ -0,0 +1,154 @@
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2019-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
# Author: Renato Araujo Oliveira Filho <renato.araujo@kdab.com>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
# PYSIDE_BASEDIR - Top of the PySide2 installation
|
||||
# PYSIDE_INCLUDE_DIR - Directories to include to use PySide2
|
||||
# PYSIDE_LIBRARY - Files to link against to use PySide2
|
||||
# PYSIDE_TYPESYSTEMS - Type system files that should be used by other bindings extending PySide2
|
||||
#
|
||||
# You can install PySide2 from Qt repository with
|
||||
# pip3 install --index-url=https://download.qt.io/official_releases/QtForPython --trusted-host download.qt.io pyside2
|
||||
|
||||
find_package(PkgConfig)
|
||||
if(PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(PYSIDE2_PRIV QUIET pyside2)
|
||||
endif()
|
||||
|
||||
set(PYSIDE2_FOUND FALSE)
|
||||
|
||||
if(PYSIDE2_PRIV_FOUND)
|
||||
set(PYSIDE2_FOUND TRUE)
|
||||
message(STATUS "Using PySide2 found in the system!")
|
||||
pkg_get_variable(SHIBOKEN_BINARY
|
||||
pyside2
|
||||
generator_location
|
||||
)
|
||||
pkg_get_variable(PYSIDE2_BASEDIR
|
||||
pyside2
|
||||
typesystemdir
|
||||
)
|
||||
pkg_get_variable(PYSIDE_INCLUDE_DIR
|
||||
pyside2
|
||||
includedir
|
||||
)
|
||||
set(PYSIDE_TYPESYSTEMS ${PYSIDE2_BASEDIR})
|
||||
set(PYSIDE2_SO_VERSION ${PYSIDE2_PRIV_VERSION})
|
||||
set(PYSIDE_LIBRARY ${PYSIDE2_PRIV_LINK_LIBRARIES})
|
||||
list(GET PYSIDE_LIBRARY 0 PYSIDE_LIBRARY)
|
||||
else()
|
||||
# extract python library basename
|
||||
list(GET Python3_LIBRARIES 0 PYTHON_LIBRARY_FILENAME)
|
||||
get_filename_component(PYTHON_LIBRARY_FILENAME ${PYTHON_LIBRARY_FILENAME} NAME)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${Python3_EXECUTABLE} -c "if True:
|
||||
import os, sys
|
||||
try:
|
||||
import PySide2.QtCore as QtCore
|
||||
print(os.path.dirname(QtCore.__file__))
|
||||
except Exception as error:
|
||||
print(error, file=sys.stderr)
|
||||
exit()
|
||||
"
|
||||
OUTPUT_VARIABLE PYSIDE2_BASEDIR
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
if(NOT PYSIDE2_BASEDIR)
|
||||
message(FATAL_ERROR "The PySide2 module could not be imported. Make sure you have it installed by checking the output of \"pip${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR} list\"")
|
||||
endif()
|
||||
|
||||
set(PYSIDE_BASEDIR ${PYSIDE2_BASEDIR} CACHE PATH "Top level install of PySide2" FORCE)
|
||||
execute_process(
|
||||
COMMAND ${Python3_EXECUTABLE} -c "if True:
|
||||
import os
|
||||
import PySide2.QtCore as QtCore
|
||||
print(os.path.basename(QtCore.__file__).split('.', 1)[1])
|
||||
"
|
||||
OUTPUT_VARIABLE PYSIDE2_SUFFIX
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${Python3_EXECUTABLE} -c "if True:
|
||||
import os
|
||||
import PySide2.QtCore as QtCore
|
||||
print(';'.join(map(str, QtCore.__version_info__)))
|
||||
"
|
||||
OUTPUT_VARIABLE PYSIDE2_SO_VERSION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
list(GET PYSIDE2_SO_VERSION 0 PYSIDE2_SO_MACRO_VERSION)
|
||||
list(GET PYSIDE2_SO_VERSION 1 PYSIDE2_SO_MICRO_VERSION)
|
||||
list(GET PYSIDE2_SO_VERSION 2 PYSIDE2_SO_MINOR_VERSION)
|
||||
string(REPLACE ";" "." PYSIDE2_SO_VERSION "${PYSIDE2_SO_VERSION}")
|
||||
|
||||
if(NOT APPLE)
|
||||
set(PYSIDE2_SUFFIX "${PYSIDE2_SUFFIX}.${PYSIDE2_SO_MACRO_VERSION}.${PYSIDE2_SO_MICRO_VERSION}")
|
||||
else()
|
||||
string(REPLACE ".so" "" PYSIDE2_SUFFIX ${PYSIDE2_SUFFIX})
|
||||
set(PYSIDE2_SUFFIX "${PYSIDE2_SUFFIX}.${PYSIDE2_SO_MACRO_VERSION}.${PYSIDE2_SO_MICRO_VERSION}.dylib")
|
||||
endif()
|
||||
|
||||
set(PYSIDE2_FOUND TRUE)
|
||||
message(STATUS "PySide2 base dir: ${PYSIDE2_BASEDIR}")
|
||||
message(STATUS "PySide2 suffix: ${PYSIDE2_SUFFIX}")
|
||||
|
||||
#PySide
|
||||
#===============================================================================
|
||||
find_path(PYSIDE_INCLUDE_DIR
|
||||
pyside.h
|
||||
PATHS ${PYSIDE2_BASEDIR}/include ${PYSIDE_CUSTOM_PREFIX}/include/PySide2
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
# Platform specific library names
|
||||
if(MSVC)
|
||||
set(PYSIDE_LIBRARY_BASENAMES "pyside2.abi3.lib")
|
||||
elseif(CYGWIN)
|
||||
set(PYSIDE_LIBRARY_BASENAMES "")
|
||||
elseif(WIN32)
|
||||
set(PYSIDE_LIBRARY_BASENAMES "libpyside2.${PYSIDE2_SUFFIX}")
|
||||
else()
|
||||
set(PYSIDE_LIBRARY_BASENAMES "libpyside2.${PYSIDE2_SUFFIX}")
|
||||
endif()
|
||||
|
||||
find_file(PYSIDE_LIBRARY
|
||||
${PYSIDE_LIBRARY_BASENAMES}
|
||||
PATHS ${PYSIDE2_BASEDIR} ${PYSIDE_CUSTOM_PREFIX}/lib
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
find_path(PYSIDE_TYPESYSTEMS
|
||||
typesystem_core.xml
|
||||
PATHS ${PYSIDE2_BASEDIR}/typesystems ${PYSIDE_CUSTOM_PREFIX}/share/PySide2/typesystems
|
||||
NO_DEFAULT_PATH)
|
||||
endif()
|
||||
|
||||
if(PYSIDE2_FOUND)
|
||||
message(STATUS "PySide include dir: ${PYSIDE_INCLUDE_DIR}")
|
||||
message(STATUS "PySide library: ${PYSIDE_LIBRARY}")
|
||||
message(STATUS "PySide typesystems: ${PYSIDE_TYPESYSTEMS}")
|
||||
message(STATUS "PySide2 version: ${PYSIDE2_SO_VERSION}")
|
||||
|
||||
# Create PySide2 target
|
||||
add_library(PySide2::pyside2 SHARED IMPORTED GLOBAL)
|
||||
if(MSVC)
|
||||
set_property(TARGET PySide2::pyside2 PROPERTY IMPORTED_IMPLIB ${PYSIDE_LIBRARY})
|
||||
endif()
|
||||
set_property(TARGET PySide2::pyside2 PROPERTY IMPORTED_LOCATION ${PYSIDE_LIBRARY})
|
||||
set_property(TARGET PySide2::pyside2 APPEND PROPERTY
|
||||
INTERFACE_INCLUDE_DIRECTORIES
|
||||
${PYSIDE_INCLUDE_DIR}
|
||||
${PYSIDE_INCLUDE_DIR}/QtCore/
|
||||
${PYSIDE_INCLUDE_DIR}/QtGui/
|
||||
${PYSIDE_INCLUDE_DIR}/QtWidgets/
|
||||
${Python3_INCLUDE_DIRS}
|
||||
)
|
||||
endif()
|
||||
|
||||
find_package_handle_standard_args(PySide2
|
||||
REQUIRED_VARS PYSIDE2_BASEDIR PYSIDE_INCLUDE_DIR PYSIDE_LIBRARY PYSIDE_TYPESYSTEMS
|
||||
VERSION_VAR PYSIDE2_SO_VERSION
|
||||
)
|
||||
@@ -2,9 +2,7 @@
|
||||
# SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
# Author: Renato Araujo Oliveira Filho <renato.araujo@kdab.com>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
#
|
||||
# Contact KDAB at <info@kdab.com> for commercial licensing options.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
# PYSIDE_BASEDIR - Top of the PySide6 installation
|
||||
@@ -23,25 +21,28 @@ get_filename_component(PYTHON_LIBRARY_FILENAME ${PYTHON_LIBRARY_FILENAME} NAME)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${Python3_EXECUTABLE} -c "if True:
|
||||
import os, sys
|
||||
try:
|
||||
import PySide6.QtCore as QtCore
|
||||
print(os.path.dirname(QtCore.__file__))
|
||||
except Exception as error:
|
||||
print(error, file=sys.stderr)
|
||||
exit()
|
||||
import os, sys
|
||||
try:
|
||||
import PySide6.QtCore as QtCore
|
||||
print(os.path.dirname(QtCore.__file__))
|
||||
except Exception as error:
|
||||
print(error, file=sys.stderr)
|
||||
exit()
|
||||
"
|
||||
OUTPUT_VARIABLE PYSIDE6_BASEDIR
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
if(NOT PYSIDE6_BASEDIR)
|
||||
message(FATAL_ERROR "The PySide6 module could not be imported. Make sure you have it installed by checking the output of \"pip${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR} list\"")
|
||||
endif()
|
||||
|
||||
if(PYSIDE6_BASEDIR)
|
||||
set(PYSIDE_BASEDIR ${PYSIDE6_BASEDIR} CACHE PATH "Top level install of PySide6" FORCE)
|
||||
execute_process(
|
||||
COMMAND ${Python3_EXECUTABLE} -c "if True:
|
||||
import os
|
||||
import PySide6.QtCore as QtCore
|
||||
print(os.path.basename(QtCore.__file__).split('.', 1)[1])
|
||||
import os
|
||||
import PySide6.QtCore as QtCore
|
||||
print(os.path.basename(QtCore.__file__).split('.', 1)[1])
|
||||
"
|
||||
OUTPUT_VARIABLE PYSIDE6_SUFFIX
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
@@ -49,9 +50,9 @@ if(PYSIDE6_BASEDIR)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${Python3_EXECUTABLE} -c "if True:
|
||||
import os
|
||||
import PySide6.QtCore as QtCore
|
||||
print(';'.join(map(str, QtCore.__version_info__)))
|
||||
import os
|
||||
import PySide6.QtCore as QtCore
|
||||
print(';'.join(map(str, QtCore.__version_info__)))
|
||||
"
|
||||
OUTPUT_VARIABLE PYSIDE6_SO_VERSION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
@@ -63,43 +64,43 @@ if(PYSIDE6_BASEDIR)
|
||||
|
||||
if(NOT APPLE)
|
||||
set(PYSIDE6_SUFFIX "${PYSIDE6_SUFFIX}.${PYSIDE6_SO_MACRO_VERSION}.${PYSIDE6_SO_MICRO_VERSION}")
|
||||
else()
|
||||
else()
|
||||
string(REPLACE ".so" "" PYSIDE6_SUFFIX ${PYSIDE6_SUFFIX})
|
||||
set(PYSIDE6_SUFFIX "${PYSIDE6_SUFFIX}.${PYSIDE6_SO_MACRO_VERSION}.${PYSIDE6_SO_MICRO_VERSION}.dylib")
|
||||
endif()
|
||||
|
||||
set(PYSIDE6_FOUND TRUE)
|
||||
message(STATUS "PySide6 base dir: ${PYSIDE6_BASEDIR}" )
|
||||
message(STATUS "PySide6 base dir: ${PYSIDE6_BASEDIR}")
|
||||
message(STATUS "PySide6 suffix: ${PYSIDE6_SUFFIX}")
|
||||
endif()
|
||||
|
||||
if (PYSIDE6_FOUND)
|
||||
if(PYSIDE6_FOUND)
|
||||
#PySide
|
||||
#===============================================================================
|
||||
find_path(PYSIDE_INCLUDE_DIR
|
||||
pyside.h
|
||||
PATHS ${PYSIDE6_BASEDIR}/include ${PYSIDE6_CUSTOM_PREFIX}/include/PySide6
|
||||
PATHS ${PYSIDE6_BASEDIR}/include ${PYSIDE_CUSTOM_PREFIX}/include/PySide6
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
# Platform specific library names
|
||||
if(MSVC)
|
||||
SET(PYSIDE_LIBRARY_BASENAMES "pyside6.abi3.lib")
|
||||
set(PYSIDE_LIBRARY_BASENAMES "pyside6.abi3.lib")
|
||||
elseif(CYGWIN)
|
||||
SET(PYSIDE_LIBRARY_BASENAMES "")
|
||||
set(PYSIDE_LIBRARY_BASENAMES "")
|
||||
elseif(WIN32)
|
||||
SET(PYSIDE_LIBRARY_BASENAMES "libpyside6.${PYSIDE6_SUFFIX}")
|
||||
set(PYSIDE_LIBRARY_BASENAMES "libpyside6.${PYSIDE6_SUFFIX}")
|
||||
else()
|
||||
SET(PYSIDE_LIBRARY_BASENAMES "libpyside6.${PYSIDE6_SUFFIX}")
|
||||
set(PYSIDE_LIBRARY_BASENAMES "libpyside6.${PYSIDE6_SUFFIX}")
|
||||
endif()
|
||||
|
||||
find_file(PYSIDE_LIBRARY
|
||||
${PYSIDE_LIBRARY_BASENAMES}
|
||||
PATHS ${PYSIDE6_BASEDIR} ${PYSIDE6_CUSTOM_PREFIX}/lib
|
||||
PATHS ${PYSIDE6_BASEDIR} ${PYSIDE_CUSTOM_PREFIX}/lib
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
find_path(PYSIDE_TYPESYSTEMS
|
||||
typesystem_core.xml
|
||||
PATHS ${PYSIDE6_BASEDIR}/typesystems ${PYSIDE6_CUSTOM_PREFIX}/share/PySide6/typesystems
|
||||
PATHS ${PYSIDE6_BASEDIR}/typesystems ${PYSIDE_CUSTOM_PREFIX}/share/PySide6/typesystems
|
||||
NO_DEFAULT_PATH)
|
||||
endif()
|
||||
|
||||
@@ -112,11 +113,9 @@ if(PYSIDE6_FOUND)
|
||||
# Create PySide6 target
|
||||
add_library(PySide6::pyside6 SHARED IMPORTED GLOBAL)
|
||||
if(MSVC)
|
||||
set_property(TARGET PySide6::pyside6 PROPERTY
|
||||
IMPORTED_IMPLIB ${PYSIDE_LIBRARY})
|
||||
set_property(TARGET PySide6::pyside6 PROPERTY IMPORTED_IMPLIB ${PYSIDE_LIBRARY})
|
||||
endif()
|
||||
set_property(TARGET PySide6::pyside6 PROPERTY
|
||||
IMPORTED_LOCATION ${PYSIDE_LIBRARY})
|
||||
set_property(TARGET PySide6::pyside6 PROPERTY IMPORTED_LOCATION ${PYSIDE_LIBRARY})
|
||||
set_property(TARGET PySide6::pyside6 APPEND PROPERTY
|
||||
INTERFACE_INCLUDE_DIRECTORIES
|
||||
${PYSIDE_INCLUDE_DIR}
|
||||
@@ -127,7 +126,6 @@ if(PYSIDE6_FOUND)
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
find_package_handle_standard_args(PySide6
|
||||
REQUIRED_VARS PYSIDE6_BASEDIR PYSIDE_INCLUDE_DIR PYSIDE_LIBRARY PYSIDE_TYPESYSTEMS
|
||||
VERSION_VAR PYSIDE6_SO_VERSION
|
||||
@@ -1,10 +1,8 @@
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
# SPDX-FileCopyrightText: 2019-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
# Author: Renato Araujo Oliveira Filho <renato.araujo@kdab.com>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
#
|
||||
# Contact KDAB at <info@kdab.com> for commercial licensing options.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
# SHIBOKEN_INCLUDE_DIR - Directories to include to use SHIBOKEN
|
||||
@@ -17,7 +15,7 @@
|
||||
|
||||
find_package(PkgConfig)
|
||||
if(PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(SHIBOKEN2_PRIV QUIET shiboken2)
|
||||
pkg_check_modules(SHIBOKEN2_PRIV QUIET shiboken2)
|
||||
endif()
|
||||
|
||||
set(SHIBOKEN_FOUND FALSE)
|
||||
@@ -42,33 +40,39 @@ if(SHIBOKEN2_PRIV_FOUND)
|
||||
else()
|
||||
execute_process(
|
||||
COMMAND ${Python3_EXECUTABLE} -c "if True:
|
||||
import os
|
||||
try:
|
||||
import shiboken2_generator
|
||||
print(shiboken2_generator.__path__[0])
|
||||
except:
|
||||
exit()
|
||||
import os
|
||||
try:
|
||||
import shiboken2_generator
|
||||
print(shiboken2_generator.__path__[0])
|
||||
except:
|
||||
exit()
|
||||
"
|
||||
OUTPUT_VARIABLE SHIBOKEN_GENERATOR_BASEDIR
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
if(NOT SHIBOKEN_GENERATOR_BASEDIR)
|
||||
message(FATAL_ERROR "The shiboken2_generator module could not be imported. Make sure you have it installed by checking the output of \"pip${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR} list\"")
|
||||
endif()
|
||||
execute_process(
|
||||
COMMAND ${Python3_EXECUTABLE} -c "if True:
|
||||
import os
|
||||
try:
|
||||
import shiboken2
|
||||
print(shiboken2.__path__[0])
|
||||
except:
|
||||
exit()
|
||||
import os
|
||||
try:
|
||||
import shiboken2
|
||||
print(shiboken2.__path__[0])
|
||||
except:
|
||||
exit()
|
||||
"
|
||||
OUTPUT_VARIABLE SHIBOKEN_BASEDIR
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
if(NOT SHIBOKEN_BASEDIR)
|
||||
message(FATAL_ERROR "The shiboken2 module could not be imported. Make sure you have it installed by checking the output of \"pip${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR} list\"")
|
||||
endif()
|
||||
execute_process(
|
||||
COMMAND ${Python3_EXECUTABLE} -c "if True:
|
||||
import os
|
||||
import shiboken2
|
||||
print(';'.join(filter(None, map(str, shiboken2.__version_info__))))
|
||||
import os
|
||||
import shiboken2
|
||||
print(';'.join(filter(None, map(str, shiboken2.__version_info__))))
|
||||
"
|
||||
OUTPUT_VARIABLE SHIBOKEN_VERSION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
@@ -80,39 +84,40 @@ else()
|
||||
|
||||
message(STATUS "ShibokenGenerator base dir: ${SHIBOKEN_GENERATOR_BASEDIR}")
|
||||
message(STATUS "Shiboken base dir: ${SHIBOKEN_BASEDIR}")
|
||||
message(STATUS "Shiboken custom path: ${SHIBOKEN_CUSTOM_PATH}")
|
||||
message(STATUS "Shiboken custom path: ${SHIBOKEN_CUSTOM_PREFIX}")
|
||||
|
||||
if(SHIBOKEN_BASEDIR)
|
||||
find_path(SHIBOKEN_INCLUDE_DIR
|
||||
shiboken.h
|
||||
PATHS ${SHIBOKEN_CUSTOM_PATH} ${SHIBOKEN_GENERATOR_BASEDIR}/include
|
||||
NO_DEFAULT_PATH)
|
||||
shiboken.h
|
||||
PATHS ${SHIBOKEN_CUSTOM_PREFIX} ${SHIBOKEN_GENERATOR_BASEDIR}/include
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
if(MSVC)
|
||||
SET(SHIBOKEN_LIBRARY_BASENAMES "shiboken2.abi3.lib")
|
||||
set(SHIBOKEN_LIBRARY_BASENAMES "shiboken2.abi3.lib")
|
||||
elseif(CYGWIN)
|
||||
SET(SHIBOKEN_LIBRARY_BASENAMES "")
|
||||
set(SHIBOKEN_LIBRARY_BASENAMES "")
|
||||
elseif(WIN32)
|
||||
SET(SHIBOKEN_LIBRARY_BASENAMES "libshiboken2.${PYSIDE2_SUFFIX}")
|
||||
set(SHIBOKEN_LIBRARY_BASENAMES "libshiboken2.${PYSIDE2_SUFFIX}")
|
||||
elseif(APPLE)
|
||||
SET(SHIBOKEN_LIBRARY_BASENAMES
|
||||
libshiboken2.abi3.dylib
|
||||
libshiboken2.abi3.${SHIBOKEN_MACRO_VERSION}.dylib
|
||||
libshiboken2.abi3.${SHIBOKEN_MACRO_VERSION}.${SHIBOKEN_MICRO_VERSION}.dylib
|
||||
libshiboken2.abi3.${SHIBOKEN_VERSION}.dylib
|
||||
set(SHIBOKEN_LIBRARY_BASENAMES
|
||||
libshiboken2.abi3.dylib
|
||||
libshiboken2.abi3.${SHIBOKEN_MACRO_VERSION}.dylib
|
||||
libshiboken2.abi3.${SHIBOKEN_MACRO_VERSION}.${SHIBOKEN_MICRO_VERSION}.dylib
|
||||
libshiboken2.abi3.${SHIBOKEN_VERSION}.dylib
|
||||
)
|
||||
else()
|
||||
SET(SHIBOKEN_LIBRARY_BASENAMES
|
||||
libshiboken2.abi3.so
|
||||
libshiboken2.abi3.so.${SHIBOKEN_MACRO_VERSION}
|
||||
libshiboken2.abi3.so.${SHIBOKEN_MACRO_VERSION}.${SHIBOKEN_MICRO_VERSION}
|
||||
libshiboken2.abi3.so.${SHIBOKEN_VERSION}
|
||||
set(SHIBOKEN_LIBRARY_BASENAMES
|
||||
libshiboken2.abi3.so
|
||||
libshiboken2.abi3.so.${SHIBOKEN_MACRO_VERSION}
|
||||
libshiboken2.abi3.so.${SHIBOKEN_MACRO_VERSION}.${SHIBOKEN_MICRO_VERSION}
|
||||
libshiboken2.abi3.so.${SHIBOKEN_VERSION}
|
||||
)
|
||||
endif()
|
||||
|
||||
if (NOT SHIBOKEN_INCLUDE_DIR)
|
||||
if(NOT SHIBOKEN_INCLUDE_DIR)
|
||||
return()
|
||||
endif()
|
||||
set(SHIBOKEN_SEARCH_PATHS ${SHIBOKEN_CUSTOM_PATH})
|
||||
set(SHIBOKEN_SEARCH_PATHS ${SHIBOKEN_CUSTOM_PREFIX})
|
||||
list(APPEND SHIBOKEN_SEARCH_PATHS ${SHIBOKEN_BASEDIR})
|
||||
list(APPEND SHIBOKEN_SEARCH_PATHS ${SHIBOKEN_GENERATOR_BASEDIR})
|
||||
find_file(SHIBOKEN_LIBRARY
|
||||
@@ -126,14 +131,13 @@ else()
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
endif()
|
||||
if (SHIBOKEN_INCLUDE_DIR AND SHIBOKEN_LIBRARY AND SHIBOKEN_BINARY)
|
||||
if(SHIBOKEN_INCLUDE_DIR AND SHIBOKEN_LIBRARY AND SHIBOKEN_BINARY)
|
||||
set(SHIBOKEN_FOUND TRUE)
|
||||
endif()
|
||||
|
||||
if(SHIBOKEN_FOUND)
|
||||
endif()
|
||||
|
||||
|
||||
if(MSVC)
|
||||
# On Windows we must link to python3.dll that is a small library that links against python3x.dll
|
||||
# that allow us to choose any python3x.dll at runtime
|
||||
@@ -150,12 +154,12 @@ else()
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
else()
|
||||
# On Linux and MacOs our modules should not link with any python library
|
||||
# that must be handled by the main process
|
||||
# On Linux and MacOs our modules should not link with any python library
|
||||
# that must be handled by the main process
|
||||
set(PYTHON_LIMITED_LIBRARIES "")
|
||||
endif()
|
||||
endif()
|
||||
if (SHIBOKEN_FOUND)
|
||||
if(SHIBOKEN_FOUND)
|
||||
message(STATUS "Shiboken include dir: ${SHIBOKEN_INCLUDE_DIR}")
|
||||
message(STATUS "Shiboken library: ${SHIBOKEN_LIBRARY}")
|
||||
message(STATUS "Shiboken binary: ${SHIBOKEN_BINARY}")
|
||||
@@ -167,17 +171,17 @@ if (SHIBOKEN_FOUND)
|
||||
set_property(TARGET Shiboken2::libshiboken PROPERTY
|
||||
IMPORTED_IMPLIB ${SHIBOKEN_LIBRARY})
|
||||
endif()
|
||||
set_property(TARGET Shiboken2::libshiboken PROPERTY
|
||||
IMPORTED_LOCATION ${SHIBOKEN_LIBRARY})
|
||||
set_property(TARGET Shiboken2::libshiboken PROPERTY IMPORTED_LOCATION ${SHIBOKEN_LIBRARY})
|
||||
set_property(TARGET Shiboken2::libshiboken APPEND PROPERTY
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${SHIBOKEN_INCLUDE_DIR} ${Python3_INCLUDE_DIRS})
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${SHIBOKEN_INCLUDE_DIR} ${Python3_INCLUDE_DIRS}
|
||||
)
|
||||
set_property(TARGET Shiboken2::libshiboken APPEND PROPERTY
|
||||
INTERFACE_LINK_LIBRARIES ${PYTHON_LIMITED_LIBRARIES})
|
||||
INTERFACE_LINK_LIBRARIES ${PYTHON_LIMITED_LIBRARIES}
|
||||
)
|
||||
|
||||
# Generator target
|
||||
add_executable(Shiboken2::shiboken IMPORTED GLOBAL)
|
||||
set_property(TARGET Shiboken2::shiboken PROPERTY
|
||||
IMPORTED_LOCATION ${SHIBOKEN_BINARY})
|
||||
set_property(TARGET Shiboken2::shiboken PROPERTY IMPORTED_LOCATION ${SHIBOKEN_BINARY})
|
||||
endif()
|
||||
|
||||
find_package_handle_standard_args(Shiboken2
|
||||
@@ -2,9 +2,7 @@
|
||||
# SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
# Author: Renato Araujo Oliveira Filho <renato.araujo@kdab.com>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
#
|
||||
# Contact KDAB at <info@kdab.com> for commercial licensing options.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
# SHIBOKEN_INCLUDE_DIR - Directories to include to use SHIBOKEN
|
||||
@@ -15,38 +13,43 @@
|
||||
# You can install Shiboken from Qt repository with
|
||||
# pip3 install --index-url=https://download.qt.io/official_releases/QtForPython --trusted-host download.qt.io shiboken6-generator
|
||||
|
||||
|
||||
set(SHIBOKEN_FOUND FALSE)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${Python3_EXECUTABLE} -c "if True:
|
||||
import os
|
||||
try:
|
||||
import shiboken6_generator
|
||||
print(shiboken6_generator.__path__[0])
|
||||
except:
|
||||
exit()
|
||||
import os
|
||||
try:
|
||||
import shiboken6_generator
|
||||
print(shiboken6_generator.__path__[0])
|
||||
except:
|
||||
exit()
|
||||
"
|
||||
OUTPUT_VARIABLE SHIBOKEN_GENERATOR_BASEDIR
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
if(NOT SHIBOKEN_GENERATOR_BASEDIR)
|
||||
message(FATAL_ERROR "The shiboken6_generator module could not be imported. Make sure you have it installed by checking the output of \"pip${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR} list\"")
|
||||
endif()
|
||||
execute_process(
|
||||
COMMAND ${Python3_EXECUTABLE} -c "if True:
|
||||
import os
|
||||
try:
|
||||
import shiboken6
|
||||
print(shiboken6.__path__[0])
|
||||
except:
|
||||
exit()
|
||||
import os
|
||||
try:
|
||||
import shiboken6
|
||||
print(shiboken6.__path__[0])
|
||||
except:
|
||||
exit()
|
||||
"
|
||||
OUTPUT_VARIABLE SHIBOKEN_BASEDIR
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
if(NOT SHIBOKEN_BASEDIR)
|
||||
message(FATAL_ERROR "The shiboken6 module could not be imported. Make sure you have it installed by checking the output of \"pip${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR} list\"")
|
||||
endif()
|
||||
execute_process(
|
||||
COMMAND ${Python3_EXECUTABLE} -c "if True:
|
||||
import os
|
||||
import shiboken6
|
||||
print(';'.join(filter(None, map(str, shiboken6.__version_info__))))
|
||||
import os
|
||||
import shiboken6
|
||||
print(';'.join(filter(None, map(str, shiboken6.__version_info__))))
|
||||
"
|
||||
OUTPUT_VARIABLE SHIBOKEN_VERSION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
@@ -58,39 +61,40 @@ string(REPLACE ";" "." SHIBOKEN_VERSION "${SHIBOKEN_VERSION}")
|
||||
|
||||
message(STATUS "ShibokenGenerator base dir: ${SHIBOKEN_GENERATOR_BASEDIR}")
|
||||
message(STATUS "Shiboken base dir: ${SHIBOKEN_BASEDIR}")
|
||||
message(STATUS "Shiboken custom path: ${SHIBOKEN_CUSTOM_PATH}")
|
||||
message(STATUS "Shiboken custom path: ${SHIBOKEN_CUSTOM_PREFIX}")
|
||||
|
||||
if(SHIBOKEN_BASEDIR)
|
||||
find_path(SHIBOKEN_INCLUDE_DIR
|
||||
shiboken.h
|
||||
PATHS ${SHIBOKEN_CUSTOM_PATH} ${SHIBOKEN_GENERATOR_BASEDIR}/include
|
||||
NO_DEFAULT_PATH)
|
||||
shiboken.h
|
||||
PATHS ${SHIBOKEN_CUSTOM_PREFIX} ${SHIBOKEN_GENERATOR_BASEDIR}/include
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
if(MSVC)
|
||||
SET(SHIBOKEN_LIBRARY_BASENAMES "shiboken6.abi3.lib")
|
||||
set(SHIBOKEN_LIBRARY_BASENAMES "shiboken6.abi3.lib")
|
||||
elseif(CYGWIN)
|
||||
SET(SHIBOKEN_LIBRARY_BASENAMES "")
|
||||
set(SHIBOKEN_LIBRARY_BASENAMES "")
|
||||
elseif(WIN32)
|
||||
SET(SHIBOKEN_LIBRARY_BASENAMES "libshiboken6.${PYSIDE2_SUFFIX}")
|
||||
set(SHIBOKEN_LIBRARY_BASENAMES "libshiboken6.${PYSIDE2_SUFFIX}")
|
||||
elseif(APPLE)
|
||||
SET(SHIBOKEN_LIBRARY_BASENAMES
|
||||
libshiboken6.abi3.dylib
|
||||
libshiboken6.abi3.${SHIBOKEN_MACRO_VERSION}.dylib
|
||||
libshiboken6.abi3.${SHIBOKEN_MACRO_VERSION}.${SHIBOKEN_MICRO_VERSION}.dylib
|
||||
libshiboken6.abi3.${SHIBOKEN_VERSION}.dylib
|
||||
set(SHIBOKEN_LIBRARY_BASENAMES
|
||||
libshiboken6.abi3.dylib
|
||||
libshiboken6.abi3.${SHIBOKEN_MACRO_VERSION}.dylib
|
||||
libshiboken6.abi3.${SHIBOKEN_MACRO_VERSION}.${SHIBOKEN_MICRO_VERSION}.dylib
|
||||
libshiboken6.abi3.${SHIBOKEN_VERSION}.dylib
|
||||
)
|
||||
else()
|
||||
SET(SHIBOKEN_LIBRARY_BASENAMES
|
||||
libshiboken6.abi3.so
|
||||
libshiboken6.abi3.so.${SHIBOKEN_MACRO_VERSION}
|
||||
libshiboken6.abi3.so.${SHIBOKEN_MACRO_VERSION}.${SHIBOKEN_MICRO_VERSION}
|
||||
libshiboken6.abi3.so.${SHIBOKEN_VERSION}
|
||||
set(SHIBOKEN_LIBRARY_BASENAMES
|
||||
libshiboken6.abi3.so
|
||||
libshiboken6.abi3.so.${SHIBOKEN_MACRO_VERSION}
|
||||
libshiboken6.abi3.so.${SHIBOKEN_MACRO_VERSION}.${SHIBOKEN_MICRO_VERSION}
|
||||
libshiboken6.abi3.so.${SHIBOKEN_VERSION}
|
||||
)
|
||||
endif()
|
||||
|
||||
if (NOT SHIBOKEN_INCLUDE_DIR)
|
||||
if(NOT SHIBOKEN_INCLUDE_DIR)
|
||||
return()
|
||||
endif()
|
||||
set(SHIBOKEN_SEARCH_PATHS ${SHIBOKEN_CUSTOM_PATH})
|
||||
set(SHIBOKEN_SEARCH_PATHS ${SHIBOKEN_CUSTOM_PREFIX})
|
||||
list(APPEND SHIBOKEN_SEARCH_PATHS ${SHIBOKEN_BASEDIR})
|
||||
list(APPEND SHIBOKEN_SEARCH_PATHS ${SHIBOKEN_GENERATOR_BASEDIR})
|
||||
find_file(SHIBOKEN_LIBRARY
|
||||
@@ -104,14 +108,13 @@ if(SHIBOKEN_BASEDIR)
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
endif()
|
||||
if (SHIBOKEN_INCLUDE_DIR AND SHIBOKEN_LIBRARY AND SHIBOKEN_BINARY)
|
||||
if(SHIBOKEN_INCLUDE_DIR AND SHIBOKEN_LIBRARY AND SHIBOKEN_BINARY)
|
||||
set(SHIBOKEN_FOUND TRUE)
|
||||
endif()
|
||||
|
||||
if(SHIBOKEN_FOUND)
|
||||
endif()
|
||||
|
||||
|
||||
if(MSVC)
|
||||
# On Windows we must link to python3.dll that is a small library that links against python3x.dll
|
||||
# that allow us to choose any python3x.dll at runtime
|
||||
@@ -128,12 +131,12 @@ if(MSVC)
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
else()
|
||||
# On Linux and MacOs our modules should not link with any python library
|
||||
# that must be handled by the main process
|
||||
# On Linux and MacOs our modules should not link with any python library
|
||||
# that must be handled by the main process
|
||||
set(PYTHON_LIMITED_LIBRARIES "")
|
||||
endif()
|
||||
|
||||
if (SHIBOKEN_FOUND)
|
||||
if(SHIBOKEN_FOUND)
|
||||
message(STATUS "Shiboken include dir: ${SHIBOKEN_INCLUDE_DIR}")
|
||||
message(STATUS "Shiboken library: ${SHIBOKEN_LIBRARY}")
|
||||
message(STATUS "Shiboken binary: ${SHIBOKEN_BINARY}")
|
||||
@@ -145,17 +148,17 @@ if (SHIBOKEN_FOUND)
|
||||
set_property(TARGET Shiboken6::libshiboken PROPERTY
|
||||
IMPORTED_IMPLIB ${SHIBOKEN_LIBRARY})
|
||||
endif()
|
||||
set_property(TARGET Shiboken6::libshiboken PROPERTY
|
||||
IMPORTED_LOCATION ${SHIBOKEN_LIBRARY})
|
||||
set_property(TARGET Shiboken6::libshiboken PROPERTY IMPORTED_LOCATION ${SHIBOKEN_LIBRARY})
|
||||
set_property(TARGET Shiboken6::libshiboken APPEND PROPERTY
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${SHIBOKEN_INCLUDE_DIR} ${Python3_INCLUDE_DIRS})
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${SHIBOKEN_INCLUDE_DIR} ${Python3_INCLUDE_DIRS}
|
||||
)
|
||||
set_property(TARGET Shiboken6::libshiboken APPEND PROPERTY
|
||||
INTERFACE_LINK_LIBRARIES ${PYTHON_LIMITED_LIBRARIES})
|
||||
INTERFACE_LINK_LIBRARIES ${PYTHON_LIMITED_LIBRARIES}
|
||||
)
|
||||
|
||||
# Generator target
|
||||
add_executable(Shiboken6::shiboken IMPORTED GLOBAL)
|
||||
set_property(TARGET Shiboken6::shiboken PROPERTY
|
||||
IMPORTED_LOCATION ${SHIBOKEN_BINARY})
|
||||
set_property(TARGET Shiboken6::shiboken PROPERTY IMPORTED_LOCATION ${SHIBOKEN_BINARY})
|
||||
endif()
|
||||
|
||||
find_package_handle_standard_args(Shiboken6
|
||||
52
cmake/KDAB/modules/KDQtInstallPaths.cmake
Normal file
52
cmake/KDAB/modules/KDQtInstallPaths.cmake
Normal file
@@ -0,0 +1,52 @@
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2016-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
# Author: Allen Winter <allen.winter@kdab.com>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
# Assumes you've already found Qt and Qt_VERSION_MAJOR is set
|
||||
#
|
||||
# Create variables for all the various install paths for the Qt version in use
|
||||
# Make sure to have found Qt before using this.
|
||||
# sets variables like QT_INSTALL_PREFIX, QT_INSTALL_DATA, QT_INSTALL_DOCS, etc.
|
||||
# run qmake -query to see a full list
|
||||
|
||||
if(NOT DEFINED Qt_VERSION_MAJOR)
|
||||
message(FATAL_ERROR "Please set Qt_VERSION_MAJOR first (ie. set(Qt_VERSION_MAJOR 5))")
|
||||
endif()
|
||||
|
||||
if(TARGET Qt${Qt_VERSION_MAJOR}::qmake)
|
||||
get_target_property(QT_QMAKE_EXECUTABLE Qt${Qt_VERSION_MAJOR}::qmake LOCATION)
|
||||
else()
|
||||
message(FATAL_ERROR "No supported Qt version found. Make sure you find Qt before calling this")
|
||||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND ${QT_QMAKE_EXECUTABLE} -query
|
||||
RESULT_VARIABLE return_code
|
||||
OUTPUT_VARIABLE ALL_VARS
|
||||
)
|
||||
if(NOT return_code EQUAL 0)
|
||||
message(WARNING "Failed call: ${QMAKE_EXECUTABLE} -query")
|
||||
message(FATAL_ERROR "QMake call failed: ${return_code}")
|
||||
endif()
|
||||
|
||||
string(REPLACE "\n" ";" VARS_LIST ${ALL_VARS})
|
||||
foreach(QVAL ${VARS_LIST})
|
||||
if(QVAL MATCHES "QT_INSTALL_")
|
||||
string(REPLACE ":" ";" QVAL_LIST ${QVAL})
|
||||
list(LENGTH QVAL_LIST listlen)
|
||||
list(GET QVAL_LIST 0 var)
|
||||
if(WIN32 AND ${listlen} GREATER 2)
|
||||
list(GET QVAL_LIST 2 path)
|
||||
list(GET QVAL_LIST 1 drive)
|
||||
set(path "${drive}:${path}")
|
||||
else()
|
||||
list(GET QVAL_LIST 1 path)
|
||||
endif()
|
||||
if(NOT ${var}) #if set already on the command line for example
|
||||
set(${var} ${path} CACHE PATH "Qt install path for ${var}")
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
@@ -1,30 +1,28 @@
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
# SPDX-FileCopyrightText: 2019-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
# Author: Renato Araujo Oliveira Filho <renato.araujo@kdab.com>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
#
|
||||
# Contact KDAB at <info@kdab.com> for commercial licensing options.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
if (NOT ${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX)
|
||||
SET(${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} CACHE FILEPATH "Custom path to install python bindings.")
|
||||
if(NOT ${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX)
|
||||
set(${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} CACHE FILEPATH "Custom path to install python bindings.")
|
||||
endif()
|
||||
|
||||
message(STATUS "PYTHON INSTALL PREFIX ${${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX}")
|
||||
|
||||
if (WIN32)
|
||||
if(WIN32)
|
||||
set(PATH_SEP "\;")
|
||||
else()
|
||||
set(PATH_SEP ":")
|
||||
endif()
|
||||
if (NOT CMAKE_CXX_STANDARD)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
endif()
|
||||
#Qt5 requires C++14
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
# On macOS, check if Qt is a framework build. This affects how include paths should be handled.
|
||||
get_target_property(QtCore_is_framework Qt5::Core FRAMEWORK)
|
||||
if (QtCore_is_framework)
|
||||
if(QtCore_is_framework)
|
||||
# Get the path to the framework dir.
|
||||
list(GET Qt5Core_INCLUDE_DIRS 0 QT_INCLUDE_DIR)
|
||||
get_filename_component(QT_FRAMEWORK_INCLUDE_DIR "${QT_INCLUDE_DIR}/../" ABSOLUTE)
|
||||
@@ -46,12 +44,14 @@ endif()
|
||||
# --use-isnull-as-nb_nonzero: If a class have an isNull() const method, it will be used to compute
|
||||
# the value of boolean casts.
|
||||
# Example, QImage::isNull() will be used when on python side you do `if (myQImage)`
|
||||
set(GENERATOR_EXTRA_FLAGS --generator-set=shiboken
|
||||
--enable-parent-ctor-heuristic
|
||||
--enable-pyside-extensions
|
||||
--enable-return-value-heuristic
|
||||
--use-isnull-as-nb_nonzero
|
||||
-std=c++${CMAKE_CXX_STANDARD})
|
||||
set(GENERATOR_EXTRA_FLAGS
|
||||
--generator-set=shiboken
|
||||
--enable-parent-ctor-heuristic
|
||||
--enable-pyside-extensions
|
||||
--enable-return-value-heuristic
|
||||
--use-isnull-as-nb_nonzero
|
||||
-std=c++${CMAKE_CXX_STANDARD}
|
||||
)
|
||||
|
||||
# 2017-04-24 The protected hack can unfortunately not be disabled, because
|
||||
# Clang does produce linker errors when we disable the hack.
|
||||
@@ -62,8 +62,8 @@ if(WIN32 OR DEFINED AVOID_PROTECTED_HACK)
|
||||
endif()
|
||||
|
||||
macro(make_path varname)
|
||||
# accepts any number of path variables
|
||||
string(REPLACE ";" "${PATH_SEP}" ${varname} "${ARGN}")
|
||||
# accepts any number of path variables
|
||||
string(REPLACE ";" "${PATH_SEP}" ${varname} "${ARGN}")
|
||||
endmacro()
|
||||
|
||||
# Creates a PySide module target based on the arguments
|
||||
@@ -74,26 +74,26 @@ endmacro()
|
||||
# Args:
|
||||
# LIBRARY_NAME - The name of the output module
|
||||
# TYPESYSTEM_PATHS - A list of paths where shiboken should look for typesystem files
|
||||
# INCLUDE_PATHS - Include pahts necessary to parse your class. *This is not the same as build*
|
||||
# INCLUDE_PATHS - Include paths necessary to parse your class. *This is not the same as build*
|
||||
# OUTPUT_SOURCES - The files that will be generated by shiboken
|
||||
# TARGET_INCLUDE_DIRS - This will be passed to target_include_directories
|
||||
# TARGET_LINK_LIBRARIES - This will be passed to target_link_libraries
|
||||
# GLOBAL_INCLUDE - A header-file that contains alls classes that will be generated
|
||||
# GLOBAL_INCLUDE - A header-file that contains all classes that will be generated
|
||||
# TYPESYSTEM_XML - The target binding typesystem (that should be the full path)
|
||||
# DEPENDS - This var will be passed to add_custom_command(DEPENDS) so a new generation will be
|
||||
# trigger if one of these files changes
|
||||
# MODULE_OUTPUT_DIR - Where the library file should be stored
|
||||
macro(CREATE_PYTHON_BINDINGS
|
||||
LIBRARY_NAME
|
||||
TYPESYSTEM_PATHS
|
||||
INCLUDE_PATHS
|
||||
OUTPUT_SOURCES
|
||||
TARGET_INCLUDE_DIRS
|
||||
TARGET_LINK_LIBRARIES
|
||||
GLOBAL_INCLUDE
|
||||
TYPESYSTEM_XML
|
||||
DEPENDS
|
||||
MODULE_OUTPUT_DIR)
|
||||
LIBRARY_NAME
|
||||
TYPESYSTEM_PATHS
|
||||
INCLUDE_PATHS
|
||||
OUTPUT_SOURCES
|
||||
TARGET_INCLUDE_DIRS
|
||||
TARGET_LINK_LIBRARIES
|
||||
GLOBAL_INCLUDE
|
||||
TYPESYSTEM_XML
|
||||
DEPENDS
|
||||
MODULE_OUTPUT_DIR)
|
||||
|
||||
# Transform the path separators into something shiboken understands.
|
||||
make_path(shiboken_include_dirs ${INCLUDE_PATHS})
|
||||
@@ -130,6 +130,11 @@ macro(CREATE_PYTHON_BINDINGS
|
||||
OUTPUT_NAME ${MODULE_NAME}
|
||||
LIBRARY_OUTPUT_DIRECTORY ${MODULE_OUTPUT_DIR}
|
||||
)
|
||||
if(APPLE)
|
||||
set_target_properties(${TARGET_NAME} PROPERTIES INSTALL_RPATH "@loader_path")
|
||||
elseif(NOT WIN32) #ie. linux
|
||||
set_target_properties(${TARGET_NAME} PROPERTIES INSTALL_RPATH "$ORIGIN")
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
set_target_properties(${TARGET_NAME} PROPERTIES SUFFIX ".pyd")
|
||||
@@ -137,7 +142,6 @@ macro(CREATE_PYTHON_BINDINGS
|
||||
|
||||
target_include_directories(${TARGET_NAME} PUBLIC
|
||||
${TARGET_INCLUDE_DIRS}
|
||||
${PYSIDE_EXTRA_INCLUDES}
|
||||
)
|
||||
|
||||
target_link_libraries(${TARGET_NAME}
|
||||
@@ -153,5 +157,5 @@ macro(CREATE_PYTHON_BINDINGS
|
||||
LINK_FLAGS "-undefined dynamic_lookup")
|
||||
endif()
|
||||
install(TARGETS ${TARGET_NAME}
|
||||
LIBRARY DESTINATION ${${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX}/${TARGET_NAME})
|
||||
LIBRARY DESTINATION ${${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX})
|
||||
endmacro()
|
||||
@@ -2,29 +2,27 @@
|
||||
# SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
# Author: Renato Araujo Oliveira Filho <renato.araujo@kdab.com>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
#
|
||||
# Contact KDAB at <info@kdab.com> for commercial licensing options.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
if (NOT ${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX)
|
||||
SET(${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} CACHE FILEPATH "Custom path to install python bindings.")
|
||||
if(NOT ${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX)
|
||||
set(${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} CACHE FILEPATH "Custom path to install python bindings.")
|
||||
endif()
|
||||
|
||||
message(STATUS "PYTHON INSTALL PREFIX ${${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX}")
|
||||
|
||||
if (WIN32)
|
||||
if(WIN32)
|
||||
set(PATH_SEP "\;")
|
||||
else()
|
||||
set(PATH_SEP ":")
|
||||
endif()
|
||||
if (NOT CMAKE_CXX_STANDARD)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
endif()
|
||||
#Qt6 requires C++17
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
# On macOS, check if Qt is a framework build. This affects how include paths should be handled.
|
||||
get_target_property(QtCore_is_framework Qt6::Core FRAMEWORK)
|
||||
if (QtCore_is_framework)
|
||||
if(QtCore_is_framework)
|
||||
# Get the path to the framework dir.
|
||||
list(GET Qt6Core_INCLUDE_DIRS 0 QT_INCLUDE_DIR)
|
||||
get_filename_component(QT_FRAMEWORK_INCLUDE_DIR "${QT_INCLUDE_DIR}/../" ABSOLUTE)
|
||||
@@ -46,12 +44,14 @@ endif()
|
||||
# --use-isnull-as-nb_nonzero: If a class have an isNull() const method, it will be used to compute
|
||||
# the value of boolean casts.
|
||||
# Example, QImage::isNull() will be used when on python side you do `if (myQImage)`
|
||||
set(GENERATOR_EXTRA_FLAGS --generator-set=shiboken
|
||||
--enable-parent-ctor-heuristic
|
||||
--enable-pyside-extensions
|
||||
--enable-return-value-heuristic
|
||||
--use-isnull-as-nb_nonzero
|
||||
-std=c++${CMAKE_CXX_STANDARD})
|
||||
set(GENERATOR_EXTRA_FLAGS
|
||||
--generator-set=shiboken
|
||||
--enable-parent-ctor-heuristic
|
||||
--enable-pyside-extensions
|
||||
--enable-return-value-heuristic
|
||||
--use-isnull-as-nb_nonzero
|
||||
-std=c++${CMAKE_CXX_STANDARD}
|
||||
)
|
||||
|
||||
# 2017-04-24 The protected hack can unfortunately not be disabled, because
|
||||
# Clang does produce linker errors when we disable the hack.
|
||||
@@ -62,8 +62,8 @@ if(WIN32 OR DEFINED AVOID_PROTECTED_HACK)
|
||||
endif()
|
||||
|
||||
macro(make_path varname)
|
||||
# accepts any number of path variables
|
||||
string(REPLACE ";" "${PATH_SEP}" ${varname} "${ARGN}")
|
||||
# accepts any number of path variables
|
||||
string(REPLACE ";" "${PATH_SEP}" ${varname} "${ARGN}")
|
||||
endmacro()
|
||||
|
||||
# Creates a PySide module target based on the arguments
|
||||
@@ -74,26 +74,26 @@ endmacro()
|
||||
# Args:
|
||||
# LIBRARY_NAME - The name of the output module
|
||||
# TYPESYSTEM_PATHS - A list of paths where shiboken should look for typesystem files
|
||||
# INCLUDE_PATHS - Include pahts necessary to parse your class. *This is not the same as build*
|
||||
# INCLUDE_PATHS - Include paths necessary to parse your class. *This is not the same as build*
|
||||
# OUTPUT_SOURCES - The files that will be generated by shiboken
|
||||
# TARGET_INCLUDE_DIRS - This will be passed to target_include_directories
|
||||
# TARGET_LINK_LIBRARIES - This will be passed to target_link_libraries
|
||||
# GLOBAL_INCLUDE - A header-file that contains alls classes that will be generated
|
||||
# GLOBAL_INCLUDE - A header-file that contains all classes that will be generated
|
||||
# TYPESYSTEM_XML - The target binding typesystem (that should be the full path)
|
||||
# DEPENDS - This var will be passed to add_custom_command(DEPENDS) so a new generation will be
|
||||
# trigger if one of these files changes
|
||||
# MODULE_OUTPUT_DIR - Where the library file should be stored
|
||||
macro(CREATE_PYTHON_BINDINGS
|
||||
LIBRARY_NAME
|
||||
TYPESYSTEM_PATHS
|
||||
INCLUDE_PATHS
|
||||
OUTPUT_SOURCES
|
||||
TARGET_INCLUDE_DIRS
|
||||
TARGET_LINK_LIBRARIES
|
||||
GLOBAL_INCLUDE
|
||||
TYPESYSTEM_XML
|
||||
DEPENDS
|
||||
MODULE_OUTPUT_DIR)
|
||||
LIBRARY_NAME
|
||||
TYPESYSTEM_PATHS
|
||||
INCLUDE_PATHS
|
||||
OUTPUT_SOURCES
|
||||
TARGET_INCLUDE_DIRS
|
||||
TARGET_LINK_LIBRARIES
|
||||
GLOBAL_INCLUDE
|
||||
TYPESYSTEM_XML
|
||||
DEPENDS
|
||||
MODULE_OUTPUT_DIR)
|
||||
|
||||
# Transform the path separators into something shiboken understands.
|
||||
make_path(shiboken_include_dirs ${INCLUDE_PATHS})
|
||||
@@ -130,6 +130,11 @@ macro(CREATE_PYTHON_BINDINGS
|
||||
OUTPUT_NAME ${MODULE_NAME}
|
||||
LIBRARY_OUTPUT_DIRECTORY ${MODULE_OUTPUT_DIR}
|
||||
)
|
||||
if(APPLE)
|
||||
set_target_properties(${TARGET_NAME} PROPERTIES INSTALL_RPATH "@loader_path")
|
||||
elseif(NOT WIN32) #ie. linux
|
||||
set_target_properties(${TARGET_NAME} PROPERTIES INSTALL_RPATH "$ORIGIN")
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
set_target_properties(${TARGET_NAME} PROPERTIES SUFFIX ".pyd")
|
||||
@@ -137,7 +142,6 @@ macro(CREATE_PYTHON_BINDINGS
|
||||
|
||||
target_include_directories(${TARGET_NAME} PUBLIC
|
||||
${TARGET_INCLUDE_DIRS}
|
||||
${PYSIDE_EXTRA_INCLUDES}
|
||||
)
|
||||
|
||||
target_link_libraries(${TARGET_NAME}
|
||||
@@ -153,5 +157,5 @@ macro(CREATE_PYTHON_BINDINGS
|
||||
LINK_FLAGS "-undefined dynamic_lookup")
|
||||
endif()
|
||||
install(TARGETS ${TARGET_NAME}
|
||||
LIBRARY DESTINATION ${${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX}/${TARGET_NAME})
|
||||
LIBRARY DESTINATION ${${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX})
|
||||
endmacro()
|
||||
@@ -1,160 +0,0 @@
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
# Author: Renato Araujo Oliveira Filho <renato.araujo@kdab.com>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
#
|
||||
# Contact KDAB at <info@kdab.com> for commercial licensing options.
|
||||
#
|
||||
|
||||
# PYSIDE_BASEDIR - Top of the PySide2 installation
|
||||
# PYSIDE_INCLUDE_DIR - Directories to include to use PySide2
|
||||
# PYSIDE_LIBRARY - Files to link against to use PySide2
|
||||
# PYSIDE_TYPESYSTEMS - Type system files that should be used by other bindings extending PySide2
|
||||
#
|
||||
# You can install PySide2 from Qt repository with
|
||||
# pip3 install --index-url=https://download.qt.io/official_releases/QtForPython --trusted-host download.qt.io pyside2
|
||||
|
||||
find_package(PkgConfig)
|
||||
if(PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(PYSIDE2_PRIV QUIET pyside2)
|
||||
endif()
|
||||
|
||||
set(PYSIDE2_FOUND FALSE)
|
||||
|
||||
if(PYSIDE2_PRIV_FOUND)
|
||||
set(PYSIDE2_FOUND TRUE)
|
||||
message(STATUS "Using PySide2 found in the system!")
|
||||
pkg_get_variable(SHIBOKEN_BINARY
|
||||
pyside2
|
||||
generator_location
|
||||
)
|
||||
pkg_get_variable(PYSIDE2_BASEDIR
|
||||
pyside2
|
||||
typesystemdir
|
||||
)
|
||||
pkg_get_variable(PYSIDE_INCLUDE_DIR
|
||||
pyside2
|
||||
includedir
|
||||
)
|
||||
set(PYSIDE_TYPESYSTEMS ${PYSIDE2_BASEDIR})
|
||||
set(PYSIDE2_SO_VERSION ${PYSIDE2_PRIV_VERSION})
|
||||
set(PYSIDE_LIBRARY ${PYSIDE2_PRIV_LINK_LIBRARIES})
|
||||
list(GET PYSIDE_LIBRARY 0 PYSIDE_LIBRARY)
|
||||
else()
|
||||
# extract python library basename
|
||||
list(GET Python3_LIBRARIES 0 PYTHON_LIBRARY_FILENAME)
|
||||
get_filename_component(PYTHON_LIBRARY_FILENAME ${PYTHON_LIBRARY_FILENAME} NAME)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${Python3_EXECUTABLE} -c "if True:
|
||||
import os, sys
|
||||
try:
|
||||
import PySide2.QtCore as QtCore
|
||||
print(os.path.dirname(QtCore.__file__))
|
||||
except Exception as error:
|
||||
print(error, file=sys.stderr)
|
||||
exit()
|
||||
"
|
||||
OUTPUT_VARIABLE PYSIDE2_BASEDIR
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
if(PYSIDE2_BASEDIR)
|
||||
set(PYSIDE_BASEDIR ${PYSIDE2_BASEDIR} CACHE PATH "Top level install of PySide2" FORCE)
|
||||
execute_process(
|
||||
COMMAND ${Python3_EXECUTABLE} -c "if True:
|
||||
import os
|
||||
import PySide2.QtCore as QtCore
|
||||
print(os.path.basename(QtCore.__file__).split('.', 1)[1])
|
||||
"
|
||||
OUTPUT_VARIABLE PYSIDE2_SUFFIX
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${Python3_EXECUTABLE} -c "if True:
|
||||
import os
|
||||
import PySide2.QtCore as QtCore
|
||||
print(';'.join(map(str, QtCore.__version_info__)))
|
||||
"
|
||||
OUTPUT_VARIABLE PYSIDE2_SO_VERSION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
list(GET PYSIDE2_SO_VERSION 0 PYSIDE2_SO_MACRO_VERSION)
|
||||
list(GET PYSIDE2_SO_VERSION 1 PYSIDE2_SO_MICRO_VERSION)
|
||||
list(GET PYSIDE2_SO_VERSION 2 PYSIDE2_SO_MINOR_VERSION)
|
||||
string(REPLACE ";" "." PYSIDE2_SO_VERSION "${PYSIDE2_SO_VERSION}")
|
||||
|
||||
if(NOT APPLE)
|
||||
set(PYSIDE2_SUFFIX "${PYSIDE2_SUFFIX}.${PYSIDE2_SO_MACRO_VERSION}.${PYSIDE2_SO_MICRO_VERSION}")
|
||||
else()
|
||||
string(REPLACE ".so" "" PYSIDE2_SUFFIX ${PYSIDE2_SUFFIX})
|
||||
set(PYSIDE2_SUFFIX "${PYSIDE2_SUFFIX}.${PYSIDE2_SO_MACRO_VERSION}.${PYSIDE2_SO_MICRO_VERSION}.dylib")
|
||||
endif()
|
||||
|
||||
set(PYSIDE2_FOUND TRUE)
|
||||
message(STATUS "PySide2 base dir: ${PYSIDE2_BASEDIR}" )
|
||||
message(STATUS "PySide2 suffix: ${PYSIDE2_SUFFIX}")
|
||||
endif()
|
||||
|
||||
if (PYSIDE2_FOUND)
|
||||
#PySide
|
||||
#===============================================================================
|
||||
find_path(PYSIDE_INCLUDE_DIR
|
||||
pyside.h
|
||||
PATHS ${PYSIDE2_BASEDIR}/include ${PYSIDE2_CUSTOM_PREFIX}/include/PySide2
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
# Platform specific library names
|
||||
if(MSVC)
|
||||
SET(PYSIDE_LIBRARY_BASENAMES "pyside2.abi3.lib")
|
||||
elseif(CYGWIN)
|
||||
SET(PYSIDE_LIBRARY_BASENAMES "")
|
||||
elseif(WIN32)
|
||||
SET(PYSIDE_LIBRARY_BASENAMES "libpyside2.${PYSIDE2_SUFFIX}")
|
||||
else()
|
||||
SET(PYSIDE_LIBRARY_BASENAMES "libpyside2.${PYSIDE2_SUFFIX}")
|
||||
endif()
|
||||
|
||||
find_file(PYSIDE_LIBRARY
|
||||
${PYSIDE_LIBRARY_BASENAMES}
|
||||
PATHS ${PYSIDE2_BASEDIR} ${PYSIDE2_CUSTOM_PREFIX}/lib
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
find_path(PYSIDE_TYPESYSTEMS
|
||||
typesystem_core.xml
|
||||
PATHS ${PYSIDE2_BASEDIR}/typesystems ${PYSIDE2_CUSTOM_PREFIX}/share/PySide2/typesystems
|
||||
NO_DEFAULT_PATH)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(PYSIDE2_FOUND)
|
||||
message(STATUS "PySide include dir: ${PYSIDE_INCLUDE_DIR}")
|
||||
message(STATUS "PySide library: ${PYSIDE_LIBRARY}")
|
||||
message(STATUS "PySide typesystems: ${PYSIDE_TYPESYSTEMS}")
|
||||
message(STATUS "PySide2 version: ${PYSIDE2_SO_VERSION}")
|
||||
|
||||
# Create PySide2 target
|
||||
add_library(PySide2::pyside2 SHARED IMPORTED GLOBAL)
|
||||
if(MSVC)
|
||||
set_property(TARGET PySide2::pyside2 PROPERTY
|
||||
IMPORTED_IMPLIB ${PYSIDE_LIBRARY})
|
||||
endif()
|
||||
set_property(TARGET PySide2::pyside2 PROPERTY
|
||||
IMPORTED_LOCATION ${PYSIDE_LIBRARY})
|
||||
set_property(TARGET PySide2::pyside2 APPEND PROPERTY
|
||||
INTERFACE_INCLUDE_DIRECTORIES
|
||||
${PYSIDE_INCLUDE_DIR}
|
||||
${PYSIDE_INCLUDE_DIR}/QtCore/
|
||||
${PYSIDE_INCLUDE_DIR}/QtGui/
|
||||
${PYSIDE_INCLUDE_DIR}/QtWidgets/
|
||||
${Python3_INCLUDE_DIRS}
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
find_package_handle_standard_args(PySide2
|
||||
REQUIRED_VARS PYSIDE2_BASEDIR PYSIDE_INCLUDE_DIR PYSIDE_LIBRARY PYSIDE_TYPESYSTEMS
|
||||
VERSION_VAR PYSIDE2_SO_VERSION
|
||||
)
|
||||
@@ -1,70 +0,0 @@
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2016-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
# Author: Allen Winter <allen.winter@kdab.com>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. The name of the author may not be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
#
|
||||
# Create variables for all the various install paths for the Qt version in use
|
||||
# Make sure to have found Qt before using this.
|
||||
# sets variables like QT_INSTALL_PREFIX, QT_INSTALL_DATA, QT_INSTALL_DOCS, etc.
|
||||
# run qmake -query to see a full list
|
||||
|
||||
if(TARGET Qt${QT_MAJOR_VERSION}::qmake)
|
||||
get_target_property(QT_QMAKE_EXECUTABLE Qt${QT_MAJOR_VERSION}::qmake LOCATION)
|
||||
else()
|
||||
message(FATAL_ERROR "No supported Qt version found. Make sure you find Qt before calling this")
|
||||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND ${QT_QMAKE_EXECUTABLE} -query
|
||||
RESULT_VARIABLE return_code
|
||||
OUTPUT_VARIABLE ALL_VARS
|
||||
)
|
||||
if(NOT return_code EQUAL 0)
|
||||
message(WARNING "Failed call: ${QMAKE_EXECUTABLE} -query")
|
||||
message(FATAL_ERROR "QMake call failed: ${return_code}")
|
||||
endif()
|
||||
|
||||
string(REPLACE "\n" ";" VARS_LIST ${ALL_VARS})
|
||||
foreach(QVAL ${VARS_LIST})
|
||||
if(QVAL MATCHES "QT_INSTALL_")
|
||||
string(REPLACE ":" ";" QVAL_LIST ${QVAL})
|
||||
list(LENGTH QVAL_LIST listlen)
|
||||
list(GET QVAL_LIST 0 var)
|
||||
if(WIN32 AND ${listlen} GREATER 2)
|
||||
list(GET QVAL_LIST 2 path)
|
||||
list(GET QVAL_LIST 1 drive)
|
||||
set(path "${drive}:${path}")
|
||||
else()
|
||||
list(GET QVAL_LIST 1 path)
|
||||
endif()
|
||||
if(NOT ${var}) #if set aleady on the command line for example
|
||||
set(${var} ${path} CACHE PATH "Qt install path for ${var}")
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
@@ -8,35 +8,139 @@
|
||||
"C_Cpp.default.compileCommands": "${workspaceFolder}/build-dev-qtquick/compile_commands.json",
|
||||
"C_Cpp.default.cStandard": "c17",
|
||||
"files.trimTrailingWhitespace": true,
|
||||
"editor.formatOnType": true
|
||||
"editor.formatOnType": true,
|
||||
"C_Cpp.autocompleteAddParentheses": true
|
||||
},
|
||||
"tasks": {
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
"launch": {
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "shell",
|
||||
"label": "cmake",
|
||||
"command": "cmake",
|
||||
"args": [
|
||||
"--preset=dev-qtquick"
|
||||
],
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}/"
|
||||
},
|
||||
"group": "build"
|
||||
"name": "gdb-kddockwidgets_customtitlebar_quick",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/build-dev-qtquick/bin/kddockwidgets_customtitlebar_quick",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"MIMode": "gdb",
|
||||
"stopAtEntry": false,
|
||||
"externalConsole": false
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"label": "make",
|
||||
"command": "cmake",
|
||||
"args": [
|
||||
"--build",
|
||||
"${workspaceFolder}/build-dev-qtquick"
|
||||
],
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}/"
|
||||
},
|
||||
"group": "build"
|
||||
"name": "gdb-kddockwidgets_example_mdi_quick",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/build-dev-qtquick/bin/kddockwidgets_example_mdi_quick",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"MIMode": "gdb",
|
||||
"stopAtEntry": false,
|
||||
"externalConsole": false
|
||||
},
|
||||
{
|
||||
"name": "gdb-kddockwidgets_example_quick",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/build-dev-qtquick/bin/kddockwidgets_example_quick",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"MIMode": "gdb",
|
||||
"stopAtEntry": false,
|
||||
"externalConsole": false
|
||||
},
|
||||
{
|
||||
"name": "gdb-tst_docks",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/build-dev-qtquick/bin/tst_docks",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"MIMode": "gdb",
|
||||
"stopAtEntry": false,
|
||||
"externalConsole": false
|
||||
},
|
||||
{
|
||||
"name": "lldb-kddockwidgets_customtitlebar_quick",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/build-dev-qtquick/bin/kddockwidgets_customtitlebar_quick",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"MIMode": "lldb",
|
||||
"stopAtEntry": false,
|
||||
"externalConsole": false
|
||||
},
|
||||
{
|
||||
"name": "lldb-kddockwidgets_example_mdi_quick",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/build-dev-qtquick/bin/kddockwidgets_example_mdi_quick",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"MIMode": "lldb",
|
||||
"stopAtEntry": false,
|
||||
"externalConsole": false
|
||||
},
|
||||
{
|
||||
"name": "lldb-kddockwidgets_example_quick",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/build-dev-qtquick/bin/kddockwidgets_example_quick",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"MIMode": "lldb",
|
||||
"stopAtEntry": false,
|
||||
"externalConsole": false
|
||||
},
|
||||
{
|
||||
"name": "lldb-tst_docks",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/build-dev-qtquick/bin/tst_docks",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"MIMode": "lldb",
|
||||
"stopAtEntry": false,
|
||||
"externalConsole": false
|
||||
},
|
||||
{
|
||||
"name": "msvc-kddockwidgets_customtitlebar_quick",
|
||||
"type": "cppvsdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/build-dev-qtquick/bin/kddockwidgets_customtitlebar_quick",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"stopAtEntry": false,
|
||||
"externalConsole": false
|
||||
},
|
||||
{
|
||||
"name": "msvc-kddockwidgets_example_mdi_quick",
|
||||
"type": "cppvsdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/build-dev-qtquick/bin/kddockwidgets_example_mdi_quick",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"stopAtEntry": false,
|
||||
"externalConsole": false
|
||||
},
|
||||
{
|
||||
"name": "msvc-kddockwidgets_example_quick",
|
||||
"type": "cppvsdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/build-dev-qtquick/bin/kddockwidgets_example_quick",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"stopAtEntry": false,
|
||||
"externalConsole": false
|
||||
},
|
||||
{
|
||||
"name": "msvc-tst_docks",
|
||||
"type": "cppvsdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/build-dev-qtquick/bin/tst_docks",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"stopAtEntry": false,
|
||||
"externalConsole": false
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -5,38 +5,142 @@
|
||||
}
|
||||
],
|
||||
"settings": {
|
||||
"C_Cpp.default.compileCommands": "${workspaceFolder}/build-dev-qtwidgets/compile_commands.json",
|
||||
"C_Cpp.default.compileCommands": "${workspaceFolder}/build-dev/compile_commands.json",
|
||||
"C_Cpp.default.cStandard": "c17",
|
||||
"files.trimTrailingWhitespace": true,
|
||||
"editor.formatOnType": true
|
||||
"editor.formatOnType": true,
|
||||
"C_Cpp.autocompleteAddParentheses": true
|
||||
},
|
||||
"tasks": {
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
"launch": {
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "shell",
|
||||
"label": "cmake",
|
||||
"command": "cmake",
|
||||
"args": [
|
||||
"--preset=dev-qtwidgets"
|
||||
],
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}/"
|
||||
},
|
||||
"group": "build"
|
||||
"name": "gdb-kddockwidgets_example",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/build-dev/bin/kddockwidgets_example",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"MIMode": "gdb",
|
||||
"stopAtEntry": false,
|
||||
"externalConsole": false
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"label": "make",
|
||||
"command": "cmake",
|
||||
"args": [
|
||||
"--build",
|
||||
"${workspaceFolder}/build-dev-qtwidgets"
|
||||
],
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}/"
|
||||
},
|
||||
"group": "build"
|
||||
"name": "gdb-kddockwidgets_minimal_example",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/build-dev/bin/kddockwidgets_minimal_example",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"MIMode": "gdb",
|
||||
"stopAtEntry": false,
|
||||
"externalConsole": false
|
||||
},
|
||||
{
|
||||
"name": "gdb-kddockwidgets_minimal_mdi_example",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/build-dev/bin/kddockwidgets_minimal_mdi_example",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"MIMode": "gdb",
|
||||
"stopAtEntry": false,
|
||||
"externalConsole": false
|
||||
},
|
||||
{
|
||||
"name": "gdb-tst_docks",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/build-dev/bin/tst_docks",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"MIMode": "gdb",
|
||||
"stopAtEntry": false,
|
||||
"externalConsole": false
|
||||
},
|
||||
{
|
||||
"name": "lldb-kddockwidgets_example",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/build-dev/bin/kddockwidgets_example",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"MIMode": "lldb",
|
||||
"stopAtEntry": false,
|
||||
"externalConsole": false
|
||||
},
|
||||
{
|
||||
"name": "lldb-kddockwidgets_minimal_example",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/build-dev/bin/kddockwidgets_minimal_example",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"MIMode": "lldb",
|
||||
"stopAtEntry": false,
|
||||
"externalConsole": false
|
||||
},
|
||||
{
|
||||
"name": "lldb-kddockwidgets_minimal_mdi_example",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/build-dev/bin/kddockwidgets_minimal_mdi_example",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"MIMode": "lldb",
|
||||
"stopAtEntry": false,
|
||||
"externalConsole": false
|
||||
},
|
||||
{
|
||||
"name": "lldb-tst_docks",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/build-dev/bin/tst_docks",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"MIMode": "lldb",
|
||||
"stopAtEntry": false,
|
||||
"externalConsole": false
|
||||
},
|
||||
{
|
||||
"name": "msvc-kddockwidgets_example",
|
||||
"type": "cppvsdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/build-dev/bin/kddockwidgets_example",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"stopAtEntry": false,
|
||||
"externalConsole": false
|
||||
},
|
||||
{
|
||||
"name": "msvc-kddockwidgets_minimal_example",
|
||||
"type": "cppvsdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/build-dev/bin/kddockwidgets_minimal_example",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"stopAtEntry": false,
|
||||
"externalConsole": false
|
||||
},
|
||||
{
|
||||
"name": "msvc-kddockwidgets_minimal_mdi_example",
|
||||
"type": "cppvsdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/build-dev/bin/kddockwidgets_minimal_mdi_example",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"stopAtEntry": false,
|
||||
"externalConsole": false
|
||||
},
|
||||
{
|
||||
"name": "msvc-tst_docks",
|
||||
"type": "cppvsdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/build-dev/bin/tst_docks",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"stopAtEntry": false,
|
||||
"externalConsole": false
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -5,38 +5,142 @@
|
||||
}
|
||||
],
|
||||
"settings": {
|
||||
"C_Cpp.default.compileCommands": "${workspaceFolder}/build-dev-qtwidgets6/compile_commands.json",
|
||||
"C_Cpp.default.compileCommands": "${workspaceFolder}/build-dev6/compile_commands.json",
|
||||
"C_Cpp.default.cStandard": "c17",
|
||||
"files.trimTrailingWhitespace": true,
|
||||
"editor.formatOnType": true
|
||||
"editor.formatOnType": true,
|
||||
"C_Cpp.autocompleteAddParentheses": true
|
||||
},
|
||||
"tasks": {
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
"launch": {
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "shell",
|
||||
"label": "cmake",
|
||||
"command": "cmake",
|
||||
"args": [
|
||||
"--preset=dev-qtwidgets6"
|
||||
],
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}/"
|
||||
},
|
||||
"group": "build"
|
||||
"name": "gdb-kddockwidgets_example",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/build-dev6/bin/kddockwidgets_example",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"MIMode": "gdb",
|
||||
"stopAtEntry": false,
|
||||
"externalConsole": false
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"label": "make",
|
||||
"command": "cmake",
|
||||
"args": [
|
||||
"--build",
|
||||
"${workspaceFolder}/build-dev-qtwidgets6"
|
||||
],
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}/"
|
||||
},
|
||||
"group": "build"
|
||||
"name": "gdb-kddockwidgets_minimal_example",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/build-dev6/bin/kddockwidgets_minimal_example",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"MIMode": "gdb",
|
||||
"stopAtEntry": false,
|
||||
"externalConsole": false
|
||||
},
|
||||
{
|
||||
"name": "gdb-kddockwidgets_minimal_mdi_example",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/build-dev6/bin/kddockwidgets_minimal_mdi_example",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"MIMode": "gdb",
|
||||
"stopAtEntry": false,
|
||||
"externalConsole": false
|
||||
},
|
||||
{
|
||||
"name": "gdb-tst_docks",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/build-dev6/bin/tst_docks",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"MIMode": "gdb",
|
||||
"stopAtEntry": false,
|
||||
"externalConsole": false
|
||||
},
|
||||
{
|
||||
"name": "lldb-kddockwidgets_example",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/build-dev6/bin/kddockwidgets_example",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"MIMode": "lldb",
|
||||
"stopAtEntry": false,
|
||||
"externalConsole": false
|
||||
},
|
||||
{
|
||||
"name": "lldb-kddockwidgets_minimal_example",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/build-dev6/bin/kddockwidgets_minimal_example",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"MIMode": "lldb",
|
||||
"stopAtEntry": false,
|
||||
"externalConsole": false
|
||||
},
|
||||
{
|
||||
"name": "lldb-kddockwidgets_minimal_mdi_example",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/build-dev6/bin/kddockwidgets_minimal_mdi_example",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"MIMode": "lldb",
|
||||
"stopAtEntry": false,
|
||||
"externalConsole": false
|
||||
},
|
||||
{
|
||||
"name": "lldb-tst_docks",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/build-dev6/bin/tst_docks",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"MIMode": "lldb",
|
||||
"stopAtEntry": false,
|
||||
"externalConsole": false
|
||||
},
|
||||
{
|
||||
"name": "msvc-kddockwidgets_example",
|
||||
"type": "cppvsdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/build-dev6/bin/kddockwidgets_example",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"stopAtEntry": false,
|
||||
"externalConsole": false
|
||||
},
|
||||
{
|
||||
"name": "msvc-kddockwidgets_minimal_example",
|
||||
"type": "cppvsdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/build-dev6/bin/kddockwidgets_minimal_example",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"stopAtEntry": false,
|
||||
"externalConsole": false
|
||||
},
|
||||
{
|
||||
"name": "msvc-kddockwidgets_minimal_mdi_example",
|
||||
"type": "cppvsdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/build-dev6/bin/kddockwidgets_minimal_mdi_example",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"stopAtEntry": false,
|
||||
"externalConsole": false
|
||||
},
|
||||
{
|
||||
"name": "msvc-tst_docks",
|
||||
"type": "cppvsdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/build-dev6/bin/tst_docks",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"stopAtEntry": false,
|
||||
"externalConsole": false
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -13,6 +13,9 @@ Configuration options:
|
||||
* build_examples
|
||||
Build the examples. Default=True
|
||||
|
||||
* builde_python_bindings
|
||||
* build_python_bindings
|
||||
Build/Generate python bindings (always false for Debug or static builds). Default=False
|
||||
|
||||
* build_for_qt6
|
||||
Build against Qt6 rather than Qt5. Default=false (Qt5 will be used even if Qt6 is available)
|
||||
(Make sure the Qt6 bin directory is found in your execute PATH)
|
||||
|
||||
@@ -11,7 +11,7 @@ from conans import ConanFile, CMake, tools
|
||||
|
||||
class KDDockWidgetsConan(ConanFile):
|
||||
name = "kddockwidgets"
|
||||
version = "1.3.0"
|
||||
version = "1.4.0"
|
||||
default_user = "kdab"
|
||||
default_channel = "stable"
|
||||
license = ("https://raw.githubusercontent.com/KDAB/KDDockWidgets/master/LICENSES/GPL-2.0-only.txt",
|
||||
@@ -28,14 +28,16 @@ class KDDockWidgetsConan(ConanFile):
|
||||
"build_examples": [True, False],
|
||||
"build_tests": [True, False],
|
||||
"build_python_bindings": [True, False],
|
||||
"build_for_qt6": [True, False],
|
||||
}
|
||||
|
||||
default_options = {
|
||||
"qt_version": "qt/[>5.9.0]@kdab/stable",
|
||||
"qt_version": "qt/[>5.12.0]@kdab/stable",
|
||||
"build_static": False,
|
||||
"build_examples": True,
|
||||
"build_tests": False,
|
||||
"build_python_bindings": False,
|
||||
"build_for_qt6": False,
|
||||
}
|
||||
|
||||
def requirements(self):
|
||||
@@ -52,6 +54,7 @@ class KDDockWidgetsConan(ConanFile):
|
||||
self.cmake.definitions["KDDockWidgets_EXAMPLES"] = self.options.build_examples
|
||||
self.cmake.definitions["KDDockWidgets_TESTS"] = self.options.build_tests
|
||||
self.cmake.definitions["KDDockWidgets_PYTHON_BINDINGS"] = self.options.build_python_bindings
|
||||
self.cmake.definitions["KDDockWidgets_QT6"] = self.options.build_for_qt6
|
||||
self.cmake.configure()
|
||||
self.cmake.build()
|
||||
|
||||
|
||||
@@ -1,3 +1,15 @@
|
||||
kddockwidgets (1.4.0) release candidate; urgency=high
|
||||
|
||||
* 1.4.0 final
|
||||
|
||||
-- Allen Winter <allen.winter@kdab.com> Fri, 16 Jul 2021 10:30:00 -0500
|
||||
|
||||
kddockwidgets (1.3.1) release candidate; urgency=high
|
||||
|
||||
* 1.3.1 final
|
||||
|
||||
-- Allen Winter <allen.winter@kdab.com> Mon, 07 Jun 2021 16:00:00 -0500
|
||||
|
||||
kddockwidgets (1.3.0) release candidate; urgency=high
|
||||
|
||||
* 1.3.0 final
|
||||
10
distro/qt5-kddockwidgets.dsc
Normal file
10
distro/qt5-kddockwidgets.dsc
Normal file
@@ -0,0 +1,10 @@
|
||||
Format: 1.0
|
||||
Source: kddockwidgets
|
||||
Version: 1.4.0-1
|
||||
Binary: kddockwidgets
|
||||
Maintainer: Allen Winter <allen.winter@kdab.com>
|
||||
Architecture: any
|
||||
Build-Depends: debhelper (>=9), cdbs, cmake, qtbase5-dev, libqt5x11extras5-dev
|
||||
|
||||
Files:
|
||||
00000000000000000000000000000000 00000 qt5-kddockwidgets-1.4.0.tar.gz
|
||||
@@ -1,7 +1,7 @@
|
||||
Name: kddockwidgets
|
||||
Version: 1.3.0
|
||||
Name: qt5-kddockwidgets
|
||||
Version: 1.4.0
|
||||
Release: 1
|
||||
Summary: KDAB's Dock Widget Framework for Qt
|
||||
Summary: KDAB's Dock Widget Framework for Qt5
|
||||
Source0: %{name}-%{version}.tar.gz
|
||||
Source1: %{name}-%{version}.tar.gz.asc
|
||||
Source2: %{name}-rpmlintrc
|
||||
@@ -88,6 +88,9 @@ cmake . -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release
|
||||
%if 0%{?fedora} > 28
|
||||
%{_libdir}/qt5/mkspecs/modules/*
|
||||
%endif
|
||||
%if %{defined rhel}
|
||||
%{_libdir}/qt5/mkspecs/modules/*
|
||||
%endif
|
||||
%dir %{_includedir}/kddockwidgets
|
||||
%{_includedir}/kddockwidgets/*
|
||||
%dir %{_libdir}/cmake/KDDockWidgets
|
||||
@@ -95,6 +98,10 @@ cmake . -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release
|
||||
%{_libdir}/libkddockwidgets.so
|
||||
|
||||
%changelog
|
||||
* Fri Jul 16 2021 Allen Winter <allen.winter@kdab.com> 1.4.0
|
||||
1.4.0 final
|
||||
* Mon Jun 07 2021 Allen Winter <allen.winter@kdab.com> 1.3.1
|
||||
1.3.1 final
|
||||
* Mon Feb 08 2021 Allen Winter <allen.winter@kdab.com> 1.3.0
|
||||
1.3.0 final
|
||||
* Thu Dec 17 2020 Allen Winter <allen.winter@kdab.com> 1.2.0
|
||||
4
distro/qt6-debian.rules
Normal file
4
distro/qt6-debian.rules
Normal file
@@ -0,0 +1,4 @@
|
||||
#!/usr/bin/make -f
|
||||
DEB_CMAKE_EXTRA_FLAGS = -DKDDockWidgets_QT6=True -DCMAKE_BUILD_TYPE=Release
|
||||
include /usr/share/cdbs/1/rules/debhelper.mk
|
||||
include /usr/share/cdbs/1/class/cmake.mk
|
||||
1
distro/qt6-kddockwidgets-rpmlintrc
Normal file
1
distro/qt6-kddockwidgets-rpmlintrc
Normal file
@@ -0,0 +1 @@
|
||||
addFilter("E: shlib-policy-name-error")
|
||||
10
distro/qt6-kddockwidgets.dsc
Normal file
10
distro/qt6-kddockwidgets.dsc
Normal file
@@ -0,0 +1,10 @@
|
||||
Format: 1.0
|
||||
Source: kddockwidgets
|
||||
Version: 1.4.0-1
|
||||
Binary: kddockwidgets
|
||||
Maintainer: Allen Winter <allen.winter@kdab.com>
|
||||
Architecture: any
|
||||
Build-Depends: debhelper (>=9), cdbs, cmake, qtbase6-dev, libqt6x11extras5-dev
|
||||
|
||||
Files:
|
||||
00000000000000000000000000000000 00000 qt6-kddockwidgets-1.4.0.tar.gz
|
||||
105
distro/qt6-kddockwidgets.spec
Normal file
105
distro/qt6-kddockwidgets.spec
Normal file
@@ -0,0 +1,105 @@
|
||||
Name: qt6-kddockwidgets
|
||||
Version: 1.4.0
|
||||
Release: 1
|
||||
Summary: KDAB's Dock Widget Framework for Qt6
|
||||
Source0: %{name}-%{version}.tar.gz
|
||||
Source1: %{name}-%{version}.tar.gz.asc
|
||||
Source2: %{name}-rpmlintrc
|
||||
URL: https://github.com/KDAB/KDDockWidgets
|
||||
Group: System/Libraries
|
||||
License: GPL-2.0-only OR GPL-3.0-only
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
Vendor: Klaralvdalens Datakonsult AB (KDAB)
|
||||
Packager: Klaralvdalens Datakonsult AB (KDAB) <info@kdab.com>
|
||||
|
||||
BuildRequires: cmake
|
||||
%if %{defined suse_version}
|
||||
BuildRequires: libqt6-qtbase-devel libqt6-qtx11extras-devel
|
||||
%endif
|
||||
|
||||
%if %{defined fedora}
|
||||
BuildRequires: gcc-c++ qt6-qtbase-devel desktop-file-utils
|
||||
%endif
|
||||
|
||||
%if %{defined rhel}
|
||||
BuildRequires: gcc-c++ qt6-qtbase-devel qt6-qtx11extras-devel desktop-file-utils
|
||||
%endif
|
||||
|
||||
%description
|
||||
KDDockWidgets is a Qt dock widget library written by KDAB, suitable for replacing
|
||||
QDockWidget and implementing advanced functionalities missing in Qt, including:
|
||||
- Nesting dock widgets in a floating window and docking that group back to main window
|
||||
- Docking to any main window, not only to the parent main window
|
||||
- Docking to center of main window, or simply removing the concept of "central widget"
|
||||
- Main window supporting detachable tabs in center widget
|
||||
- Detaching arbitrary tabs from a tab bar into a dock area
|
||||
- Exposing inner helper widgets so the user can customize them or provide his own
|
||||
- Customize tab widgets
|
||||
- Customize title bars
|
||||
- Customize window frames
|
||||
- Custom widget separators
|
||||
...and much more
|
||||
|
||||
Authors:
|
||||
--------
|
||||
Klaralvdalens Datakonsult AB (KDAB) <info@kdab.com>
|
||||
|
||||
%define debug_package %{nil}
|
||||
%global __debug_install_post %{nil}
|
||||
|
||||
%package devel
|
||||
Summary: Development files for %{name}
|
||||
Group: Development/Libraries/C and C++
|
||||
Requires: %{name} = %{version}
|
||||
|
||||
%description devel
|
||||
This package contains header files and associated tools and libraries to
|
||||
develop programs using kddockwidgets.
|
||||
|
||||
%prep
|
||||
%autosetup
|
||||
|
||||
%build
|
||||
cmake . -DCMAKE_INSTALL_PREFIX=/usr -DKDDockWidgets_QT6=True -DCMAKE_BUILD_TYPE=Release
|
||||
%__make %{?_smp_mflags}
|
||||
|
||||
%post -p /sbin/ldconfig
|
||||
%postun -p /sbin/ldconfig
|
||||
|
||||
%install
|
||||
%make_install
|
||||
|
||||
%clean
|
||||
%__rm -rf "%{buildroot}"
|
||||
|
||||
%files
|
||||
%defattr(-,root,root)
|
||||
%{_prefix}/share/doc/KDDockWidgets-qt6
|
||||
%{_libdir}/libkddockwidgets-qt6.so.*
|
||||
|
||||
%files devel
|
||||
%defattr(-,root,root,-)
|
||||
%dir %{_includedir}/kddockwidgets-qt6
|
||||
%{_includedir}/kddockwidgets-qt6/kddockwidgets/*
|
||||
%dir %{_libdir}/cmake/KDDockWidgets-qt6
|
||||
%{_libdir}/cmake/KDDockWidgets-qt6/*
|
||||
%{_libdir}/libkddockwidgets-qt6.so
|
||||
#%{_prefix}/mkspecs/modules/* ECMGeneratePriFile isn't ported to Qt6 yet
|
||||
|
||||
%changelog
|
||||
* Fri Jul 16 2021 Allen Winter <allen.winter@kdab.com> 1.4.0
|
||||
1.4.0 final
|
||||
* Mon Jun 07 2021 Allen Winter <allen.winter@kdab.com> 1.3.1
|
||||
1.3.1 final
|
||||
* Mon Feb 08 2021 Allen Winter <allen.winter@kdab.com> 1.3.0
|
||||
1.3.0 final
|
||||
* Thu Dec 17 2020 Allen Winter <allen.winter@kdab.com> 1.2.0
|
||||
1.2.0 final
|
||||
* Fri Dec 11 2020 Allen Winter <allen.winter@kdab.com> 1.1.1
|
||||
1.1.1 final
|
||||
* Mon Oct 26 2020 Allen Winter <allen.winter@kdab.com> 1.1.0
|
||||
1.1.0 final
|
||||
* Wed Sep 02 2020 Allen Winter <allen.winter@kdab.com> 1.0.0
|
||||
1.0.0 final
|
||||
* Thu Aug 06 2020 Allen Winter <allen.winter@kdab.com> 0.99.9
|
||||
1.0.0 release candidate
|
||||
@@ -9,17 +9,6 @@
|
||||
# Contact KDAB at <info@kdab.com> for commercial licensing options.
|
||||
#
|
||||
|
||||
# qhelpgenerator
|
||||
find_program(QHELPGEN_EXECUTABLE qhelpgenerator
|
||||
HINTS ${QT_INSTALL_BINS}
|
||||
)
|
||||
if(QHELPGEN_EXECUTABLE)
|
||||
set(HAVE_QHELPGEN "YES")
|
||||
else()
|
||||
set(HAVE_QHELPGEN "NO")
|
||||
message(STATUS "Unable to generate the API documentation in qch format. To fix, install the qthelpgenerator program which comes with Qt5.")
|
||||
endif()
|
||||
|
||||
# Doxygen
|
||||
find_package(Doxygen)
|
||||
set_package_properties(Doxygen PROPERTIES
|
||||
@@ -28,12 +17,6 @@ set_package_properties(Doxygen PROPERTIES
|
||||
URL "https://www.doxygen.org"
|
||||
PURPOSE "Needed to build the API documentation."
|
||||
)
|
||||
if(DOXYGEN_DOT_EXECUTABLE)
|
||||
set(HAVE_DOT "YES")
|
||||
else()
|
||||
set(HAVE_DOT "NO")
|
||||
message(STATUS "Unable to provide inheritance diagrams for the API documentation. To fix, install the graphviz project from https://www.graphviz.org")
|
||||
endif()
|
||||
|
||||
if(DOXYGEN_FOUND)
|
||||
add_subdirectory(api)
|
||||
|
||||
@@ -9,10 +9,30 @@
|
||||
# Contact KDAB at <info@kdab.com> for commercial licensing options.
|
||||
#
|
||||
|
||||
# dot should come with Doxygen find_package(Doxygen)
|
||||
if(DOXYGEN_DOT_EXECUTABLE)
|
||||
set(HAVE_DOT "YES")
|
||||
else()
|
||||
set(HAVE_DOT "NO")
|
||||
message(STATUS "Unable to provide inheritance diagrams for the API documentation. To fix, install the graphviz project from https://www.graphviz.org")
|
||||
endif()
|
||||
|
||||
# qhelpgenerator
|
||||
find_program(QHELPGEN_EXECUTABLE qhelpgenerator
|
||||
HINTS ${QT_INSTALL_BINS}
|
||||
)
|
||||
if(QHELPGEN_EXECUTABLE)
|
||||
set(HAVE_QHELPGEN "YES")
|
||||
else()
|
||||
set(HAVE_QHELPGEN "NO")
|
||||
message(STATUS "Unable to generate the API documentation in qch format. To fix, install the qthelpgenerator program which comes with Qt.")
|
||||
endif()
|
||||
|
||||
find_file(QDOC_QTCORE_TAG qtcore.tags
|
||||
HINTS ${QT_INSTALL_DOCS}/qtcore
|
||||
HINTS ${QT_INSTALL_DATA}/doc/qtcore
|
||||
)
|
||||
set(QDOC_TAG_DIR "<QDOC_TAG_DIR_not_found>")
|
||||
if(QDOC_QTCORE_TAG)
|
||||
get_filename_component(QDOC_TAG_DIR ${QDOC_QTCORE_TAG} DIRECTORY)
|
||||
get_filename_component(QDOC_TAG_DIR ${QDOC_TAG_DIR} DIRECTORY)
|
||||
@@ -33,6 +53,7 @@ add_custom_command(
|
||||
#handle a bug in doxygen where image files referred to in markdown are not copied the output
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/../../screencap.gif ${DOXYGEN_OUTPUT_DIR}/html
|
||||
#copy some files by-hand that are referred to by the markdown README
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/README-bindings.md ${DOXYGEN_OUTPUT_DIR}/html
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${DOXYGEN_OUTPUT_DIR}/html/LICENSES
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/LICENSES/GPL-2.0-only.txt ${DOXYGEN_OUTPUT_DIR}/html/LICENSES
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/LICENSES/GPL-3.0-only.txt ${DOXYGEN_OUTPUT_DIR}/html/LICENSES
|
||||
@@ -43,5 +64,8 @@ add_custom_command(
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
)
|
||||
add_custom_target(kddockwidgets-api.qch ALL DEPENDS ${DOXYGEN_OUTPUT_DIR}/qch/kddockwidgets-api.qch)
|
||||
add_custom_target(docs DEPENDS kddockwidgets-api.qch)
|
||||
|
||||
install(FILES ${DOXYGEN_OUTPUT_DIR}/qch/kddockwidgets-api.qch DESTINATION ${INSTALL_DOC_DIR})
|
||||
set(QCH_INSTALL_DIR ${INSTALL_DOC_DIR} CACHE STRING "Install location of Qt Assistant help files.")
|
||||
install(FILES ${DOXYGEN_OUTPUT_DIR}/qch/kddockwidgets-api.qch DESTINATION ${QCH_INSTALL_DIR})
|
||||
install(FILES ${DOXYGEN_OUTPUT_DIR}/kddockwidgets.tags DESTINATION ${INSTALL_DOC_DIR})
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Doxyfile 1.8.18
|
||||
# Doxyfile 1.8.20
|
||||
|
||||
# This file describes the settings to be used by the documentation system
|
||||
# doxygen (www.doxygen.org) for a project.
|
||||
@@ -32,13 +32,13 @@ DOXYFILE_ENCODING = UTF-8
|
||||
# title of most generated pages and in a few other places.
|
||||
# The default value is: My Project.
|
||||
|
||||
PROJECT_NAME = "KDDockWidgets API Documentation"
|
||||
PROJECT_NAME = "@PROJECT_NAME@ API Documentation"
|
||||
|
||||
# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
|
||||
# could be handy for archiving the generated documentation or if some version
|
||||
# control system is used.
|
||||
|
||||
PROJECT_NUMBER = @KDDockWidgets_VERSION@
|
||||
PROJECT_NUMBER = @KDDockWidgets_VERSION_MAJOR@.@KDDockWidgets_VERSION_MINOR@
|
||||
|
||||
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
||||
# for a project that appears at the top of each page and should give viewer a
|
||||
@@ -99,7 +99,7 @@ OUTPUT_LANGUAGE = English
|
||||
# Possible values are: None, LTR, RTL and Context.
|
||||
# The default value is: None.
|
||||
|
||||
#TOO NEW OUTPUT_TEXT_DIRECTION = None
|
||||
OUTPUT_TEXT_DIRECTION = None
|
||||
|
||||
# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member
|
||||
# descriptions after the members that are listed in the file and class
|
||||
@@ -205,7 +205,7 @@ JAVADOC_AUTOBRIEF = NO
|
||||
# interpreted by doxygen.
|
||||
# The default value is: NO.
|
||||
|
||||
#TOO NEW JAVADOC_BANNER = NO
|
||||
JAVADOC_BANNER = NO
|
||||
|
||||
# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first
|
||||
# line (until the first dot) of a Qt-style comment as the brief description. If
|
||||
@@ -227,6 +227,14 @@ QT_AUTOBRIEF = YES
|
||||
|
||||
MULTILINE_CPP_IS_BRIEF = NO
|
||||
|
||||
# By default Python docstrings are displayed as preformatted text and doxygen's
|
||||
# special commands cannot be used. By setting PYTHON_DOCSTRING to NO the
|
||||
# doxygen's special commands can be used and the contents of the docstring
|
||||
# documentation blocks is shown as doxygen documentation.
|
||||
# The default value is: YES.
|
||||
|
||||
PYTHON_DOCSTRING = YES
|
||||
|
||||
# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the
|
||||
# documentation from any documented member that it re-implements.
|
||||
# The default value is: YES.
|
||||
@@ -297,7 +305,7 @@ OPTIMIZE_OUTPUT_VHDL = NO
|
||||
# separated into more groups, etc.
|
||||
# The default value is: NO.
|
||||
|
||||
#TOO NEW: OPTIMIZE_OUTPUT_SLICE = NO
|
||||
OPTIMIZE_OUTPUT_SLICE = NO
|
||||
|
||||
# Doxygen selects the parser to use depending on the extension of the files it
|
||||
# parses. With this tag you can assign which parser to use for a given
|
||||
@@ -336,7 +344,7 @@ MARKDOWN_SUPPORT = YES
|
||||
# Minimum value: 0, maximum value: 99, default value: 5.
|
||||
# This tag requires that the tag MARKDOWN_SUPPORT is set to YES.
|
||||
|
||||
#TOO NEW TOC_INCLUDE_HEADINGS = 5
|
||||
TOC_INCLUDE_HEADINGS = 5
|
||||
|
||||
# When enabled doxygen tries to link words that correspond to documented
|
||||
# classes, or namespaces to their corresponding documentation. Such a link can
|
||||
@@ -449,6 +457,19 @@ TYPEDEF_HIDES_STRUCT = NO
|
||||
|
||||
LOOKUP_CACHE_SIZE = 0
|
||||
|
||||
# The NUM_PROC_THREADS specifies the number threads doxygen is allowed to use
|
||||
# during processing. When set to 0 doxygen will based this on the number of
|
||||
# cores available in the system. You can set it explicitly to a value larger
|
||||
# than 0 to get more control over the balance between CPU load and processing
|
||||
# speed. At this moment only the input processing can be done using multiple
|
||||
# threads. Since this is still an experimental feature the default is set to 1,
|
||||
# which efficively disables parallel processing. Please report any issues you
|
||||
# encounter. Generating dot graphs in parallel is controlled by the
|
||||
# DOT_NUM_THREADS setting.
|
||||
# Minimum value: 0, maximum value: 32, default value: 1.
|
||||
|
||||
NUM_PROC_THREADS = 1
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Build related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
@@ -461,7 +482,7 @@ LOOKUP_CACHE_SIZE = 0
|
||||
# normally produced when WARNINGS is set to YES.
|
||||
# The default value is: NO.
|
||||
|
||||
EXTRACT_ALL = NO
|
||||
EXTRACT_ALL = YES
|
||||
|
||||
# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will
|
||||
# be included in the documentation.
|
||||
@@ -473,7 +494,7 @@ EXTRACT_PRIVATE = NO
|
||||
# methods of a class will be included in the documentation.
|
||||
# The default value is: NO.
|
||||
|
||||
#TOO NEW EXTRACT_PRIV_VIRTUAL = NO
|
||||
EXTRACT_PRIV_VIRTUAL = NO
|
||||
|
||||
# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal
|
||||
# scope will be included in the documentation.
|
||||
@@ -547,13 +568,13 @@ HIDE_IN_BODY_DOCS = YES
|
||||
# will be excluded. Set it to YES to include the internal documentation.
|
||||
# The default value is: NO.
|
||||
|
||||
INTERNAL_DOCS = YES
|
||||
INTERNAL_DOCS = NO
|
||||
|
||||
# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file
|
||||
# names in lower-case letters. If set to YES, upper-case letters are also
|
||||
# allowed. This is useful if you have classes or files whose names only differ
|
||||
# in case and if your file system supports case sensitive file names. Windows
|
||||
# (including Cygwin) ands Mac users are advised to set this option to NO.
|
||||
# (including Cygwin) and Mac users are advised to set this option to NO.
|
||||
# The default value is: system dependent.
|
||||
|
||||
CASE_SENSE_NAMES = YES
|
||||
@@ -698,14 +719,14 @@ MAX_INITIALIZER_LINES = 30
|
||||
# list will mention the files that were used to generate the documentation.
|
||||
# The default value is: YES.
|
||||
|
||||
SHOW_USED_FILES = NO
|
||||
SHOW_USED_FILES = YES
|
||||
|
||||
# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This
|
||||
# will remove the Files entry from the Quick Index and from the Folder Tree View
|
||||
# (if specified).
|
||||
# The default value is: YES.
|
||||
|
||||
SHOW_FILES = NO
|
||||
SHOW_FILES = YES
|
||||
|
||||
# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces
|
||||
# page. This will remove the Namespaces entry from the Quick Index and from the
|
||||
@@ -823,7 +844,8 @@ WARN_LOGFILE = doxygen.log
|
||||
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
|
||||
# Note: If this tag is empty the current directory is searched.
|
||||
|
||||
INPUT = @CMAKE_SOURCE_DIR@
|
||||
INPUT = "@CMAKE_SOURCE_DIR@/README.md" \
|
||||
"@CMAKE_SOURCE_DIR@/src"
|
||||
|
||||
# This tag can be used to specify the character encoding of the source files
|
||||
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
|
||||
@@ -851,12 +873,7 @@ INPUT_ENCODING = UTF-8
|
||||
# *.vhdl, *.ucf, *.qsf and *.ice.
|
||||
|
||||
FILE_PATTERNS = *.cpp \
|
||||
*.cc \
|
||||
*.cxx \
|
||||
*.h \
|
||||
*.hh \
|
||||
*.hxx \
|
||||
*.hpp \
|
||||
*.dox \
|
||||
*.md \
|
||||
*.gif
|
||||
@@ -874,8 +891,7 @@ RECURSIVE = YES
|
||||
# Note that relative paths are relative to the directory from which doxygen is
|
||||
# run.
|
||||
|
||||
EXCLUDE = @CMAKE_SOURCE_DIR@/examples \
|
||||
@CMAKE_SOURCE_DIR@/src/private
|
||||
EXCLUDE =
|
||||
|
||||
# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
|
||||
# directories that are symbolic links (a Unix file system feature) are excluded
|
||||
@@ -901,7 +917,9 @@ EXCLUDE_PATTERNS = */.svn/* \
|
||||
*/test/* \
|
||||
*/tests/* \
|
||||
*_p.cpp \
|
||||
*_export.h
|
||||
*_p.h \
|
||||
*_export.h \
|
||||
*/fwd_headers/*
|
||||
|
||||
# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
|
||||
# (namespaces, classes, functions, etc.) that should be excluded from the
|
||||
@@ -925,7 +943,7 @@ EXAMPLE_PATH =
|
||||
# *.h) to filter out the source-files in the directories. If left blank all
|
||||
# files are included.
|
||||
|
||||
EXAMPLE_PATTERNS = *
|
||||
EXAMPLE_PATTERNS =
|
||||
|
||||
# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
|
||||
# searched for input files to be used with the \include or \dontinclude commands
|
||||
@@ -938,7 +956,8 @@ EXAMPLE_RECURSIVE = NO
|
||||
# that contain images that are to be included in the documentation (see the
|
||||
# \image command).
|
||||
|
||||
IMAGE_PATH = "@CMAKE_CURRENT_SOURCE_DIR@" \
|
||||
IMAGE_PATH = "@CMAKE_SOURCE_DIR@/images" \
|
||||
"@CMAKE_CURRENT_SOURCE_DIR@" \
|
||||
"@CMAKE_SOURCE_DIR@/screencap.gif"
|
||||
|
||||
# The INPUT_FILTER tag can be used to specify a program that doxygen should
|
||||
@@ -1008,7 +1027,7 @@ USE_MDFILE_AS_MAINPAGE = "@CMAKE_SOURCE_DIR@/README.md"
|
||||
# also VERBATIM_HEADERS is set to NO.
|
||||
# The default value is: NO.
|
||||
|
||||
SOURCE_BROWSER = NO
|
||||
SOURCE_BROWSER = YES
|
||||
|
||||
# Setting the INLINE_SOURCES tag to YES will include the body of functions,
|
||||
# classes and enums directly into the documentation.
|
||||
@@ -1027,13 +1046,13 @@ STRIP_CODE_COMMENTS = YES
|
||||
# entity all documented functions referencing it will be listed.
|
||||
# The default value is: NO.
|
||||
|
||||
REFERENCED_BY_RELATION = NO
|
||||
REFERENCED_BY_RELATION = YES
|
||||
|
||||
# If the REFERENCES_RELATION tag is set to YES then for each documented function
|
||||
# all documented entities called/used by that function will be listed.
|
||||
# The default value is: NO.
|
||||
|
||||
REFERENCES_RELATION = NO
|
||||
REFERENCES_RELATION = YES
|
||||
|
||||
# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set
|
||||
# to YES then the hyperlinks from functions in REFERENCES_RELATION and
|
||||
@@ -1081,7 +1100,39 @@ USE_HTAGS = NO
|
||||
# See also: Section \class.
|
||||
# The default value is: YES.
|
||||
|
||||
VERBATIM_HEADERS = NO
|
||||
VERBATIM_HEADERS = YES
|
||||
|
||||
# If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the
|
||||
# clang parser (see: http://clang.llvm.org/) for more accurate parsing at the
|
||||
# cost of reduced performance. This can be particularly helpful with template
|
||||
# rich C++ code for which doxygen's built-in parser lacks the necessary type
|
||||
# information.
|
||||
# Note: The availability of this option depends on whether or not doxygen was
|
||||
# generated with the -Duse_libclang=ON option for CMake.
|
||||
# The default value is: NO.
|
||||
|
||||
CLANG_ASSISTED_PARSING = NO
|
||||
|
||||
# If clang assisted parsing is enabled you can provide the compiler with command
|
||||
# line options that you would normally use when invoking the compiler. Note that
|
||||
# the include paths will already be set by doxygen for the files and directories
|
||||
# specified with INPUT and INCLUDE_PATH.
|
||||
# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES.
|
||||
|
||||
CLANG_OPTIONS =
|
||||
|
||||
# If clang assisted parsing is enabled you can provide the clang parser with the
|
||||
# path to the directory containing a file called compile_commands.json. This
|
||||
# file is the compilation database (see:
|
||||
# http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html) containing the
|
||||
# options used when the source files were built. This is equivalent to
|
||||
# specifying the "-p" option to a clang tool, such as clang-check. These options
|
||||
# will then be passed to the parser. Any options specified with CLANG_OPTIONS
|
||||
# will be added as well.
|
||||
# Note: The availability of this option depends on whether or not doxygen was
|
||||
# generated with the -Duse_libclang=ON option for CMake.
|
||||
|
||||
CLANG_DATABASE_PATH =
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the alphabetical class index
|
||||
@@ -1099,7 +1150,7 @@ ALPHABETICAL_INDEX = YES
|
||||
# Minimum value: 1, maximum value: 20, default value: 5.
|
||||
# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
|
||||
|
||||
COLS_IN_ALPHA_INDEX = 3
|
||||
COLS_IN_ALPHA_INDEX = 5
|
||||
|
||||
# In case all classes in a project start with a common prefix, all classes will
|
||||
# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag
|
||||
@@ -1247,7 +1298,7 @@ HTML_TIMESTAMP = YES
|
||||
# The default value is: YES.
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
|
||||
#TOO NEW HTML_DYNAMIC_MENUS = YES
|
||||
HTML_DYNAMIC_MENUS = YES
|
||||
|
||||
# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
|
||||
# documentation will contain sections that can be hidden and shown after the
|
||||
@@ -1348,7 +1399,7 @@ CHM_FILE =
|
||||
HHC_LOCATION =
|
||||
|
||||
# The GENERATE_CHI flag controls if a separate .chi index file is generated
|
||||
# (YES) or that it should be included in the master .chm file (NO).
|
||||
# (YES) or that it should be included in the main .chm file (NO).
|
||||
# The default value is: NO.
|
||||
# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
|
||||
|
||||
@@ -1389,7 +1440,7 @@ GENERATE_QHP = @HAVE_QHELPGEN@
|
||||
# the HTML output folder.
|
||||
# This tag requires that the tag GENERATE_QHP is set to YES.
|
||||
|
||||
QCH_FILE = @DOXYGEN_OUTPUT_DIR@/qch/kddockwidgets-api.qch
|
||||
QCH_FILE = "@DOXYGEN_OUTPUT_DIR@/qch/kddockwidgets-api.qch"
|
||||
|
||||
# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help
|
||||
# Project output. For more information please see Qt Help Project / Namespace
|
||||
@@ -1397,7 +1448,7 @@ QCH_FILE = @DOXYGEN_OUTPUT_DIR@/qch/kddockwidgets-api.qch
|
||||
# The default value is: org.doxygen.Project.
|
||||
# This tag requires that the tag GENERATE_QHP is set to YES.
|
||||
|
||||
QHP_NAMESPACE = com.kdab.KDDockWidgets.api.@KDDockWidgets_VERSION@
|
||||
QHP_NAMESPACE = com.kdab.@PROJECT_NAME@.api.@KDDockWidgets_VERSION@
|
||||
|
||||
# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt
|
||||
# Help Project output. For more information please see Qt Help Project / Virtual
|
||||
@@ -1406,7 +1457,7 @@ QHP_NAMESPACE = com.kdab.KDDockWidgets.api.@KDDockWidgets_VERSION@
|
||||
# The default value is: doc.
|
||||
# This tag requires that the tag GENERATE_QHP is set to YES.
|
||||
|
||||
QHP_VIRTUAL_FOLDER = KDDockWidgets-@KDDockWidgets_VERSION@
|
||||
QHP_VIRTUAL_FOLDER = @PROJECT_NAME@-@KDDockWidgets_VERSION@
|
||||
|
||||
# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom
|
||||
# filter to add. For more information please see Qt Help Project / Custom
|
||||
@@ -1436,7 +1487,7 @@ QHP_SECT_FILTER_ATTRS =
|
||||
# generated .qhp file.
|
||||
# This tag requires that the tag GENERATE_QHP is set to YES.
|
||||
|
||||
QHG_LOCATION = @QHELPGEN_EXECUTABLE@
|
||||
QHG_LOCATION = "@QHELPGEN_EXECUTABLE@"
|
||||
|
||||
# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be
|
||||
# generated, together with the HTML files, they form an Eclipse help plugin. To
|
||||
@@ -1514,12 +1565,12 @@ EXT_LINKS_IN_WINDOW = NO
|
||||
# tool (see https://github.com/dawbarton/pdf2svg) or inkscape (see
|
||||
# https://inkscape.org) to generate formulas as SVG images instead of PNGs for
|
||||
# the HTML output. These images will generally look nicer at scaled resolutions.
|
||||
# Possible values are: png The default and svg Looks nicer but requires the
|
||||
# pdf2svg tool.
|
||||
# Possible values are: png (the default) and svg (looks nicer but requires the
|
||||
# pdf2svg or inkscape tool).
|
||||
# The default value is: png.
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
|
||||
#TOO NEW HTML_FORMULA_FORMAT = png
|
||||
HTML_FORMULA_FORMAT = png
|
||||
|
||||
# Use this tag to change the font size of LaTeX formulas included as images in
|
||||
# the HTML documentation. When you change the font size after a successful
|
||||
@@ -1545,7 +1596,7 @@ FORMULA_TRANSPARENT = YES
|
||||
# to create new LaTeX commands to be used in formulas as building blocks. See
|
||||
# the section "Including formulas" for details.
|
||||
|
||||
#TOO NEW FORMULA_MACROFILE =
|
||||
FORMULA_MACROFILE =
|
||||
|
||||
# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see
|
||||
# https://www.mathjax.org) which uses client side JavaScript for the rendering
|
||||
@@ -1709,7 +1760,7 @@ LATEX_OUTPUT = latex
|
||||
# the output language.
|
||||
# This tag requires that the tag GENERATE_LATEX is set to YES.
|
||||
|
||||
LATEX_CMD_NAME =
|
||||
LATEX_CMD_NAME = latex
|
||||
|
||||
# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to generate
|
||||
# index for LaTeX.
|
||||
@@ -1729,7 +1780,7 @@ MAKEINDEX_CMD_NAME = makeindex
|
||||
# The default value is: makeindex.
|
||||
# This tag requires that the tag GENERATE_LATEX is set to YES.
|
||||
|
||||
#TOO NEW LATEX_MAKEINDEX_CMD = makeindex
|
||||
LATEX_MAKEINDEX_CMD = makeindex
|
||||
|
||||
# If the COMPACT_LATEX tag is set to YES, doxygen generates more compact LaTeX
|
||||
# documents. This may be useful for small projects and may help to save some
|
||||
@@ -1815,13 +1866,15 @@ LATEX_EXTRA_FILES =
|
||||
|
||||
PDF_HYPERLINKS = YES
|
||||
|
||||
# If the USE_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate
|
||||
# the PDF file directly from the LaTeX files. Set this option to YES, to get a
|
||||
# higher quality PDF documentation.
|
||||
# If the USE_PDFLATEX tag is set to YES, doxygen will use the engine as
|
||||
# specified with LATEX_CMD_NAME to generate the PDF file directly from the LaTeX
|
||||
# files. Set this option to YES, to get a higher quality PDF documentation.
|
||||
#
|
||||
# See also section LATEX_CMD_NAME for selecting the engine.
|
||||
# The default value is: YES.
|
||||
# This tag requires that the tag GENERATE_LATEX is set to YES.
|
||||
|
||||
USE_PDFLATEX = YES
|
||||
USE_PDFLATEX = NO
|
||||
|
||||
# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode
|
||||
# command to the generated LaTeX files. This will instruct LaTeX to keep running
|
||||
@@ -1871,7 +1924,7 @@ LATEX_TIMESTAMP = NO
|
||||
# LATEX_OUTPUT directory will be used.
|
||||
# This tag requires that the tag GENERATE_LATEX is set to YES.
|
||||
|
||||
#TOO NEW LATEX_EMOJI_DIRECTORY =
|
||||
LATEX_EMOJI_DIRECTORY =
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the RTF output
|
||||
@@ -2015,7 +2068,7 @@ XML_PROGRAMLISTING = YES
|
||||
# The default value is: NO.
|
||||
# This tag requires that the tag GENERATE_XML is set to YES.
|
||||
|
||||
#TOO NEW XML_NS_MEMB_FILE_SCOPE = NO
|
||||
XML_NS_MEMB_FILE_SCOPE = NO
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the DOCBOOK output
|
||||
@@ -2111,7 +2164,7 @@ ENABLE_PREPROCESSING = YES
|
||||
# The default value is: NO.
|
||||
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
|
||||
|
||||
MACRO_EXPANSION = YES
|
||||
MACRO_EXPANSION = NO
|
||||
|
||||
# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then
|
||||
# the macro expansion is limited to the macros specified with the PREDEFINED and
|
||||
@@ -2177,7 +2230,7 @@ EXPAND_AS_DEFINED =
|
||||
|
||||
SKIP_FUNCTION_MACROS = YES
|
||||
|
||||
#---------------------------------------------------------------------------O
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to external references
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
@@ -2194,15 +2247,17 @@ SKIP_FUNCTION_MACROS = YES
|
||||
# the path). If a tag file is not located in the directory in which doxygen is
|
||||
# run, you must also specify the path to the tagfile here.
|
||||
|
||||
TAGFILES = @QDOC_TAG_DIR@/qtcore/qtcore.tags=https://doc.qt.io/qt-5/ \
|
||||
@QDOC_TAG_DIR@/qtgui/qtgui.tags=https://doc.qt.io/qt-5/ \
|
||||
@QDOC_TAG_DIR@/qtwidgets/qtwidgets.tags=https://doc.qt.io/qt-5/
|
||||
TAGFILES = "@QDOC_TAG_DIR@/qtcore/qtcore.tags=https://doc.qt.io/qt-5/" \
|
||||
"@QDOC_TAG_DIR@/qtgui/qtgui.tags=https://doc.qt.io/qt-5/" \
|
||||
"@QDOC_TAG_DIR@/qtwidgets/qtwidgets.tags=https://doc.qt.io/qt-5/" \
|
||||
"@QDOC_TAG_DIR@/qtprintsupport/qtprintsupport.tags=https://doc.qt.io/qt-5/" \
|
||||
"@QDOC_TAG_DIR@/qtxml/qtxml.tags=https://doc.qt.io/qt-5/"
|
||||
|
||||
# When a file name is specified after GENERATE_TAGFILE, doxygen will create a
|
||||
# tag file that is based on the input files it reads. See section "Linking to
|
||||
# external documentation" for more information about the usage of tag files.
|
||||
|
||||
GENERATE_TAGFILE = kddockwidgets.tag
|
||||
GENERATE_TAGFILE = "@DOXYGEN_OUTPUT_DIR@/kddockwidgets.tags"
|
||||
|
||||
# If the ALLEXTERNALS tag is set to YES, all external class will be listed in
|
||||
# the class index. If set to NO, only the inherited external classes will be
|
||||
@@ -2403,7 +2458,7 @@ GRAPHICAL_HIERARCHY = YES
|
||||
# The default value is: YES.
|
||||
# This tag requires that the tag HAVE_DOT is set to YES.
|
||||
|
||||
DIRECTORY_GRAPH = NO
|
||||
DIRECTORY_GRAPH = YES
|
||||
|
||||
# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
|
||||
# generated by dot. For an explanation of the image formats see the section
|
||||
@@ -2468,7 +2523,7 @@ PLANTUML_JAR_PATH =
|
||||
# When using plantuml, the PLANTUML_CFG_FILE tag can be used to specify a
|
||||
# configuration file for plantuml.
|
||||
|
||||
#TOO NEW PLANTUML_CFG_FILE =
|
||||
PLANTUML_CFG_FILE =
|
||||
|
||||
# When using plantuml, the specified paths are searched for files specified by
|
||||
# the !include statement in a plantuml block.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<hr>
|
||||
<div style="float: left;">
|
||||
<img src="kdab-logo-16x16.png">
|
||||
<font style="font-weight: bold;">Klarälvdalens Datakonsult AB (KDAB)</font>
|
||||
<font style="font-weight: bold;">© 2019-2021 Klarälvdalens Datakonsult AB (KDAB)</font>
|
||||
<br>
|
||||
"The Qt, C++ and OpenGL Experts"<br>
|
||||
<a href="https://www.kdab.com/">https://www.kdab.com/</a>
|
||||
@@ -12,7 +12,8 @@
|
||||
<font style="font-weight: bold;">KDDockWidgets</font>
|
||||
<br>
|
||||
Advanced Dock Widget Framework for Qt<br>
|
||||
<a href="https://www.kdab.com/development-resources/qt-tools/kddockwidgets/">https://www.kdab.com/development-resources/qt-tools/kddockwidgets/</a>
|
||||
<a href="https://www.kdab.com/development-resources/qt-tools/kddockwidgets/">https://www.kdab.com/development-resources/qt-tools/kddockwidgets/</a><br>
|
||||
$generatedby doxygen $doxygenversion<br>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
*/
|
||||
|
||||
#include "MyFrameworkWidgetFactory.h"
|
||||
#include "MyTitleBar_CSS.h"
|
||||
|
||||
#include <kddockwidgets/FrameworkWidgetFactory.h>
|
||||
|
||||
@@ -89,11 +90,13 @@ MySeparator::~MySeparator() = default;
|
||||
|
||||
KDDockWidgets::TitleBar * CustomWidgetFactory::createTitleBar(KDDockWidgets::Frame *frame) const
|
||||
{
|
||||
// Feel free to return MyTitleBar_CSS here instead, but just for education purposes!
|
||||
return new MyTitleBar(frame);
|
||||
}
|
||||
|
||||
KDDockWidgets::TitleBar * CustomWidgetFactory::createTitleBar(KDDockWidgets::FloatingWindow *fw) const
|
||||
{
|
||||
// Feel free to return MyTitleBar_CSS here instead, but just for education purposes!
|
||||
return new MyTitleBar(fw);
|
||||
}
|
||||
|
||||
@@ -101,4 +104,3 @@ Layouting::Separator * CustomWidgetFactory::createSeparator(Layouting::Widget *p
|
||||
{
|
||||
return new MySeparator(parent);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "MyMainWindow.h"
|
||||
#include "MyWidget.h"
|
||||
|
||||
#include <kddockwidgets/Config.h>
|
||||
#include <kddockwidgets/LayoutSaver.h>
|
||||
|
||||
#include <QMenu>
|
||||
@@ -20,9 +21,7 @@
|
||||
#include <QDebug>
|
||||
#include <QString>
|
||||
#include <QTextEdit>
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
#include <QRandomGenerator>
|
||||
#endif
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
@@ -33,12 +32,7 @@
|
||||
|
||||
static MyWidget *newMyWidget()
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0)
|
||||
const int randomNumber = qrand() % 100 + 1;
|
||||
#else
|
||||
const int randomNumber = QRandomGenerator::global()->bounded(0, 100) + 1;
|
||||
#endif
|
||||
|
||||
if (randomNumber < 50) {
|
||||
if (randomNumber < 33) {
|
||||
return new MyWidget1();
|
||||
@@ -61,16 +55,14 @@ MyMainWindow::MyMainWindow(const QString &uniqueName, KDDockWidgets::MainWindowO
|
||||
, m_maxSizeForDockWidget8(maxSizeForDockWidget8)
|
||||
, m_dockwidget5DoesntCloseBeforeRestore(dockwidget5DoesntCloseBeforeRestore)
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0)
|
||||
qsrand(time(nullptr));
|
||||
#endif
|
||||
|
||||
// qApp->installEventFilter(this);
|
||||
auto menubar = menuBar();
|
||||
auto fileMenu = new QMenu(QStringLiteral("File"));
|
||||
m_toggleMenu = new QMenu(QStringLiteral("Toggle"));
|
||||
auto fileMenu = new QMenu(QStringLiteral("File"), this);
|
||||
m_toggleMenu = new QMenu(QStringLiteral("Toggle"), this);
|
||||
auto miscMenu = new QMenu(QStringLiteral("Misc"), this);
|
||||
|
||||
menubar->addMenu(fileMenu);
|
||||
menubar->addMenu(m_toggleMenu);
|
||||
menubar->addMenu(miscMenu);
|
||||
|
||||
QAction *newAction = fileMenu->addAction(QStringLiteral("New DockWidget"));
|
||||
|
||||
@@ -114,8 +106,19 @@ MyMainWindow::MyMainWindow(const QString &uniqueName, KDDockWidgets::MainWindowO
|
||||
auto quitAction = fileMenu->addAction(QStringLiteral("Quit"));
|
||||
connect(quitAction, &QAction::triggered, qApp, &QApplication::quit);
|
||||
|
||||
QAction *toggleDropIndicatorSupport = miscMenu->addAction(QStringLiteral("Toggle Drop Indicator Support"));
|
||||
toggleDropIndicatorSupport->setCheckable(true);
|
||||
toggleDropIndicatorSupport->setChecked(true);
|
||||
connect(toggleDropIndicatorSupport, &QAction::toggled, this, [](bool checked) {
|
||||
KDDockWidgets::Config::self().setDropIndicatorsInhibited(!checked);
|
||||
});
|
||||
|
||||
setAffinities({ affinityName });
|
||||
createDockWidgets();
|
||||
|
||||
if (options & KDDockWidgets::MainWindowOption_HasCentralWidget) {
|
||||
setPersistentCentralWidget(new MyWidget1());
|
||||
}
|
||||
}
|
||||
|
||||
MyMainWindow::~MyMainWindow()
|
||||
|
||||
86
examples/dockwidgets/MyTitleBar_CSS.h
Normal file
86
examples/dockwidgets/MyTitleBar_CSS.h
Normal file
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2019-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
Author: Sérgio Martins <sergio.martins@kdab.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
|
||||
Contact KDAB at <info@kdab.com> for commercial licensing options.
|
||||
*/
|
||||
|
||||
#ifndef EXAMPLETITLEBAR_CSS_H
|
||||
#define EXAMPLETITLEBAR_CSS_H
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <kddockwidgets/private/widgets/TitleBarWidget_p.h>
|
||||
|
||||
/**
|
||||
* @brief Shows how to implement a custom titlebar which uses "Qt StyleSheets".
|
||||
*
|
||||
* Derive from KDDockWidgets::DefaultWidgetFactory and override the two createTitleBar() methods.
|
||||
*
|
||||
* To try it out, modify examples/dockwidgets/MyFrameworkWidgetFactory.cpp to return a MyTitleBar_CSS instance.
|
||||
* Run the example with: ./bin/kddockwidgets_example -p
|
||||
*
|
||||
* WARNINGS:
|
||||
* - Qt StyleSheets are not recommended for new applications. Often you are able to style 90% of
|
||||
* the application but then hit a road block. QStyle is much more powerful and flexible.
|
||||
* - The Qt maintainers have manifested intention to deprecated stylesheets.
|
||||
* - Stylesheets are supported for built-in QWidgets (QPushButton, QComboBox, etc.), any widget
|
||||
* that's not in Qt needs to be crafted by the user, that includes, for example, having to paint
|
||||
* your background manually. KDDockWidget::TitleBarWidget does this for your convenience though.
|
||||
* - Qt stylesheets don't react to property changes (known old bug in Qt), for example:
|
||||
* QLineEdit[readOnly="true"] { color: gray }
|
||||
* this won't trigger when readOnly changes to false, you need to set/unset. This is QTBUG-51236
|
||||
* - KDDockWidgets::TitleBarWidget::isFocused is a property, there for needs to workaround the
|
||||
* above bug by unsetting the sheet and setting it again.
|
||||
*/
|
||||
class MyTitleBar_CSS : public KDDockWidgets::TitleBarWidget
|
||||
{
|
||||
public:
|
||||
explicit MyTitleBar_CSS(KDDockWidgets::Frame *frame)
|
||||
: KDDockWidgets::TitleBarWidget(frame)
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
explicit MyTitleBar_CSS(KDDockWidgets::FloatingWindow *fw)
|
||||
: KDDockWidgets::TitleBarWidget(fw)
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
~MyTitleBar_CSS() override;
|
||||
|
||||
void initStyleSheet()
|
||||
{
|
||||
// Or use qApp->setStyleSheet(), as you prefer
|
||||
setStyleSheet(QStringLiteral("KDDockWidgets--TitleBarWidget {"
|
||||
"background: blue"
|
||||
"}"
|
||||
"KDDockWidgets--TitleBarWidget:hover {"
|
||||
"background: red"
|
||||
"}"
|
||||
"KDDockWidgets--TitleBarWidget[isFocused=true] {"
|
||||
"background: green"
|
||||
"}"));
|
||||
}
|
||||
|
||||
void init()
|
||||
{
|
||||
initStyleSheet();
|
||||
connect(this, &KDDockWidgets::TitleBar::isFocusedChanged, this, [this] {
|
||||
// Workaround QTBUG-51236, this makes the [isFocused=true] syntax useful
|
||||
setStyleSheet(QString());
|
||||
initStyleSheet();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
MyTitleBar_CSS::~MyTitleBar_CSS()
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -116,9 +116,21 @@ int main(int argc, char **argv)
|
||||
parser.addOption(closeOnlyCurrentTab);
|
||||
|
||||
QCommandLineOption dontCloseBeforeRestore("dont-close-widget-before-restore", //krazy:exclude=spelling
|
||||
QCoreApplication::translate("main", "DockWidget #5 wont be closed before a restore. Illustrates LayoutSaverOption::DontCloseBeforeRestore"));
|
||||
QCoreApplication::translate("main", "DockWidget #5 won't be closed before a restore. Illustrates LayoutSaverOption::DontCloseBeforeRestore"));
|
||||
parser.addOption(dontCloseBeforeRestore);
|
||||
|
||||
QCommandLineOption showButtonsInTabBarIfTitleBarHidden("show-buttons-in-tabbar-if-titlebar-hidden",
|
||||
QCoreApplication::translate("main", "If we're not using title bars we'll still show the close and float button in the tab bar"));
|
||||
parser.addOption(showButtonsInTabBarIfTitleBarHidden);
|
||||
|
||||
QCommandLineOption centralWidget("central-widget",
|
||||
QCoreApplication::translate("main", "The main window will have a non-detachable central widget"));
|
||||
parser.addOption(centralWidget);
|
||||
|
||||
QCommandLineOption ctxtMenuOnTabs("allow-switch-tabs-via-menu",
|
||||
QCoreApplication::translate("main", "Allow switching tabs via context menu in tabs area"));
|
||||
parser.addOption(ctxtMenuOnTabs);
|
||||
|
||||
#if defined(DOCKS_DEVELOPER_MODE)
|
||||
parser.addOption(centralFrame);
|
||||
|
||||
@@ -160,6 +172,9 @@ int main(int argc, char **argv)
|
||||
options = parser.isSet(centralFrame) ? MainWindowOption_HasCentralFrame
|
||||
: MainWindowOption_None;
|
||||
|
||||
if (parser.isSet(centralWidget))
|
||||
options |= MainWindowOption_HasCentralWidget;
|
||||
|
||||
if (parser.isSet(noQtTool))
|
||||
internalFlags |= KDDockWidgets::Config::InternalFlag_DontUseQtToolWindowsForFloatingWindows;
|
||||
|
||||
@@ -188,6 +203,9 @@ int main(int argc, char **argv)
|
||||
if (parser.isSet(closeOnlyCurrentTab))
|
||||
flags |= Config::Flag_CloseOnlyCurrentTab;
|
||||
|
||||
if (parser.isSet(showButtonsInTabBarIfTitleBarHidden))
|
||||
flags |= Config::Flag_ShowButtonsOnTabBarIfTitleBarHidden;
|
||||
|
||||
if (parser.isSet(noTitleBars))
|
||||
flags |= KDDockWidgets::Config::Flag_HideTitleBarWhenTabsVisible;
|
||||
|
||||
@@ -223,6 +241,9 @@ int main(int argc, char **argv)
|
||||
if (parser.isSet(tabsHaveCloseButton))
|
||||
flags |= KDDockWidgets::Config::Flag_TabsHaveCloseButton;
|
||||
|
||||
if (parser.isSet(ctxtMenuOnTabs))
|
||||
flags |= KDDockWidgets::Config::Flag_AllowSwitchingTabsViaMenu;
|
||||
|
||||
|
||||
if (parser.isSet(doubleClickMaximize))
|
||||
flags |= KDDockWidgets::Config::Flag_DoubleClickMaximizes;
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
#include <QQuickView>
|
||||
#include <QGuiApplication>
|
||||
#include <QQmlApplicationEngine>
|
||||
|
||||
class CustomFrameworkWidgetFactory : public KDDockWidgets::DefaultWidgetFactory
|
||||
{
|
||||
@@ -45,15 +46,11 @@ int main(int argc, char *argv[])
|
||||
config.setFlags(flags);
|
||||
config.setFrameworkWidgetFactory(new CustomFrameworkWidgetFactory());
|
||||
|
||||
QQuickView view;
|
||||
view.setObjectName("MainWindow QQuickView");
|
||||
KDDockWidgets::Config::self().setQmlEngine(view.engine());
|
||||
view.resize(1000, 800);
|
||||
view.show();
|
||||
view.setResizeMode(QQuickView::SizeRootObjectToView);
|
||||
QQmlApplicationEngine appEngine;
|
||||
KDDockWidgets::Config::self().setQmlEngine(&appEngine);
|
||||
appEngine.load((QUrl("qrc:/main.qml")));
|
||||
|
||||
auto dw1 = new KDDockWidgets::DockWidgetQuick("Dock #1");
|
||||
view.setSource(QUrl("qrc:/main.qml"));
|
||||
|
||||
dw1->setWidget(QStringLiteral("qrc:/Guest1.qml"));
|
||||
dw1->resize(QSize(800, 800));
|
||||
|
||||
@@ -10,14 +10,18 @@
|
||||
*/
|
||||
|
||||
import QtQuick 2.6
|
||||
import QtQuick.Controls 2.12
|
||||
import com.kdab.dockwidgets 1.0 as KDDW
|
||||
|
||||
KDDW.MainWindow {
|
||||
id: root
|
||||
ApplicationWindow {
|
||||
visible: true
|
||||
width: 1000
|
||||
height: 800
|
||||
|
||||
KDDW.MainWindowLayout {
|
||||
id: dockWidgetArea
|
||||
anchors.fill: parent
|
||||
|
||||
Component.onCompleted: {
|
||||
root.init("MyWindowName-1");
|
||||
uniqueName: "MyMainLayout"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,38 +10,10 @@
|
||||
*/
|
||||
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.12
|
||||
import com.kdab.dockwidgets 1.0 as KDDW
|
||||
|
||||
Guest {
|
||||
anchors.fill: parent
|
||||
background: "qrc:/assets/triangles.png"
|
||||
logo: "qrc:/assets/KDAB_bubble_white.png"
|
||||
|
||||
KDDW.DockWidget {
|
||||
id: another
|
||||
uniqueName: "another1"
|
||||
source: ":/Another.qml"
|
||||
}
|
||||
|
||||
Button {
|
||||
text: "Toggle Another"
|
||||
anchors {
|
||||
bottom: parent.bottom
|
||||
left: parent.left
|
||||
margins: 5
|
||||
}
|
||||
|
||||
onClicked: {
|
||||
|
||||
if (another.dockWidget.visible) {
|
||||
another.dockWidget.close();
|
||||
} else {
|
||||
another.dockWidget.show();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include <kddockwidgets/private/DockRegistry_p.h>
|
||||
#include <kddockwidgets/FrameworkWidgetFactory.h>
|
||||
|
||||
#include <QQuickView>
|
||||
#include <QQmlApplicationEngine>
|
||||
#include <QGuiApplication>
|
||||
#include <QCommandLineParser>
|
||||
|
||||
@@ -23,6 +23,10 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
QGuiApplication::setAttribute(Qt::AA_UseOpenGLES);
|
||||
#endif
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
QGuiApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||
#endif
|
||||
QGuiApplication app(argc, argv);
|
||||
QCommandLineParser parser;
|
||||
@@ -69,20 +73,22 @@ int main(int argc, char *argv[])
|
||||
internalFlags |= KDDockWidgets::Config::InternalFlag_NoAeroSnap;
|
||||
# endif
|
||||
|
||||
// These are debug-only/development flags, which you can ignore.
|
||||
KDDockWidgets::Config::self().setInternalFlags(internalFlags);
|
||||
#endif
|
||||
|
||||
// Set any required flags. The defaults are usually fine.
|
||||
KDDockWidgets::Config::self().setFlags(flags);
|
||||
|
||||
QQuickView view;
|
||||
view.setObjectName("MainWindow QQuickView");
|
||||
KDDockWidgets::Config::self().setQmlEngine(view.engine());
|
||||
view.resize(1000, 800);
|
||||
view.show();
|
||||
view.setResizeMode(QQuickView::SizeRootObjectToView);
|
||||
// Create your engine which loads main.qml. A simple QQuickView would work too.
|
||||
QQmlApplicationEngine appEngine;
|
||||
KDDockWidgets::Config::self().setQmlEngine(&appEngine);
|
||||
appEngine.load((QUrl("qrc:/main.qml")));
|
||||
|
||||
// Below we illustrate usage of our C++ API. Alternative you can use declarative API.
|
||||
// See main.qml for examples of dockwidgets created directly in QML
|
||||
|
||||
auto dw1 = new KDDockWidgets::DockWidgetQuick("Dock #1");
|
||||
view.setSource(QUrl("qrc:/main.qml"));
|
||||
|
||||
dw1->setWidget(QStringLiteral("qrc:/Guest1.qml"));
|
||||
dw1->resize(QSize(800, 800));
|
||||
|
||||
@@ -10,14 +10,130 @@
|
||||
*/
|
||||
|
||||
import QtQuick 2.6
|
||||
import QtQuick.Controls 2.12
|
||||
import com.kdab.dockwidgets 1.0 as KDDW
|
||||
|
||||
KDDW.MainWindow {
|
||||
id: root
|
||||
ApplicationWindow {
|
||||
visible: true
|
||||
width: 1000
|
||||
height: 800
|
||||
|
||||
menuBar: MenuBar {
|
||||
Menu {
|
||||
title: qsTr("&File")
|
||||
|
||||
Component.onCompleted: {
|
||||
root.init("MyWindowName-1");
|
||||
Action {
|
||||
text: qsTr("Save layout")
|
||||
onTriggered: {
|
||||
layoutSaver.saveToFile("mySavedLayout.json");
|
||||
}
|
||||
}
|
||||
|
||||
Action {
|
||||
text: qsTr("Restore layout")
|
||||
onTriggered: {
|
||||
layoutSaver.restoreFromFile("mySavedLayout.json");
|
||||
}
|
||||
}
|
||||
|
||||
Action {
|
||||
text: qsTr("Toggle widget #4")
|
||||
onTriggered: {
|
||||
toggleDockWidget(dock4);
|
||||
}
|
||||
}
|
||||
|
||||
Action {
|
||||
text: qsTr("Toggle widget #5")
|
||||
onTriggered: {
|
||||
toggleDockWidget(dock5);
|
||||
}
|
||||
}
|
||||
|
||||
Action {
|
||||
text: qsTr("Toggle widget #6")
|
||||
onTriggered: {
|
||||
toggleDockWidget(dock6);
|
||||
}
|
||||
}
|
||||
|
||||
Action {
|
||||
text: qsTr("Close All")
|
||||
onTriggered: {
|
||||
_kddwDockRegistry.clear();
|
||||
}
|
||||
}
|
||||
|
||||
MenuSeparator { }
|
||||
Action { text: qsTr("&Quit")
|
||||
onTriggered: {
|
||||
Qt.quit();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
KDDW.MainWindowLayout {
|
||||
anchors.fill: parent
|
||||
|
||||
// Each main layout needs a unique id
|
||||
uniqueName: "MainLayout-1"
|
||||
|
||||
Repeater {
|
||||
model: 3
|
||||
KDDW.DockWidget {
|
||||
uniqueName: "fromRepeater-" + index
|
||||
source: ":/Another.qml"
|
||||
}
|
||||
}
|
||||
|
||||
KDDW.DockWidget {
|
||||
id: dock4
|
||||
uniqueName: "dock4" // Each dock widget needs a unique id
|
||||
source: ":/Another.qml"
|
||||
}
|
||||
|
||||
KDDW.DockWidget {
|
||||
id: dock5
|
||||
uniqueName: "dock5"
|
||||
Rectangle {
|
||||
id: guest
|
||||
color: "pink"
|
||||
}
|
||||
}
|
||||
|
||||
KDDW.DockWidget {
|
||||
id: dock6
|
||||
uniqueName: "dock6"
|
||||
Rectangle {
|
||||
color: "black"
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
// Add dock4 to the Bottom location
|
||||
addDockWidget(dock4, KDDW.KDDockWidgets.Location_OnBottom);
|
||||
|
||||
// Add dock5 to the left of dock4
|
||||
addDockWidget(dock5, KDDW.KDDockWidgets.Location_OnRight, dock4);
|
||||
|
||||
// Adds dock6 but specifies a preferred initial size and it starts hidden
|
||||
// When toggled it will be shown on the desired dock location.
|
||||
// See MainWindowInstantiator_p.h for the API
|
||||
addDockWidget(dock6, KDDW.KDDockWidgets.Location_OnLeft, null,
|
||||
Qt.size(500, 100), KDDW.KDDockWidgets.StartHidden);
|
||||
}
|
||||
}
|
||||
|
||||
KDDW.LayoutSaver {
|
||||
id: layoutSaver
|
||||
}
|
||||
|
||||
function toggleDockWidget(dw) {
|
||||
if (dw.dockWidget.isOpen()) {
|
||||
dw.dockWidget.close();
|
||||
} else {
|
||||
dw.dockWidget.show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#include <kddockwidgets/FrameworkWidgetFactory.h>
|
||||
#include <kddockwidgets/MainWindowMDI.h>
|
||||
|
||||
#include <QQuickView>
|
||||
#include <QQmlApplicationEngine>
|
||||
#include <QGuiApplication>
|
||||
#include <QCommandLineParser>
|
||||
|
||||
@@ -33,16 +33,11 @@ int main(int argc, char *argv[])
|
||||
parser.setApplicationDescription("KDDockWidgets example application");
|
||||
parser.addHelpOption();
|
||||
|
||||
QQuickView view;
|
||||
view.setObjectName("MainWindow QQuickView");
|
||||
KDDockWidgets::Config::self().setQmlEngine(view.engine());
|
||||
view.resize(1000, 1000);
|
||||
view.show();
|
||||
view.setResizeMode(QQuickView::SizeRootObjectToView);
|
||||
QQmlApplicationEngine appEngine;
|
||||
KDDockWidgets::Config::self().setQmlEngine(&appEngine);
|
||||
appEngine.load((QUrl("qrc:/main.qml")));
|
||||
|
||||
auto dw1 = new KDDockWidgets::DockWidgetQuick("Dock #1");
|
||||
view.setSource(QUrl("qrc:/main.qml"));
|
||||
|
||||
dw1->setWidget(QStringLiteral("qrc:/Guest1.qml"));
|
||||
dw1->resize(QSize(400, 400));
|
||||
|
||||
|
||||
@@ -10,14 +10,17 @@
|
||||
*/
|
||||
|
||||
import QtQuick 2.6
|
||||
import QtQuick.Controls 2.12
|
||||
import com.kdab.dockwidgets 1.0 as KDDW
|
||||
|
||||
KDDW.MainWindow {
|
||||
id: root
|
||||
ApplicationWindow {
|
||||
visible: true
|
||||
width: 1000
|
||||
height: 1200
|
||||
|
||||
|
||||
Component.onCompleted: {
|
||||
root.init("MyWindowName-1", 2); // TODO use Q_ENUM_NS
|
||||
KDDW.MainWindowLayout {
|
||||
anchors.fill: parent
|
||||
uniqueName: "MyMainLayout"
|
||||
options: KDDW.KDDockWidgets.MainWindowOption_MDI
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
Format: 1.0
|
||||
Source: kddockwidgets
|
||||
Version: 1.3.0-1
|
||||
Binary: kddockwidgets
|
||||
Maintainer: Allen Winter <allen.winter@kdab.com>
|
||||
Architecture: any
|
||||
Build-Depends: debhelper (>=9), cdbs, cmake, qt5-default, qtbase5-dev, libqt5x11extras5-dev
|
||||
|
||||
Files:
|
||||
00000000000000000000000000000000 00000 kddockwidgets-1.3.0.tar.gz
|
||||
@@ -8,20 +8,35 @@
|
||||
#
|
||||
# Contact KDAB at <info@kdab.com> for commercial licensing options.
|
||||
#
|
||||
set(PYTHON_BINDING_NAMESPACE "PyKDDockWidgets")
|
||||
|
||||
set(PYTHON_VERSION "3.7" CACHE STRING "Use specific python version to build the project.")
|
||||
find_package(Python3 ${PYTHON_VERSION} REQUIRED COMPONENTS Interpreter Development)
|
||||
|
||||
if (${PROJECT_NAME}_QT6)
|
||||
find_package(Shiboken6 REQUIRED)
|
||||
find_package(PySide6 ${Qt5Widgets_VERSION} EXACT REQUIRED)
|
||||
include(PySide6ModuleBuild)
|
||||
set(PYSIDE_MAJOR_VERSION "6")
|
||||
else()
|
||||
find_package(Shiboken2 REQUIRED)
|
||||
find_package(PySide2 ${Qt5Widgets_VERSION} EXACT REQUIRED)
|
||||
include(PySide2ModuleBuild)
|
||||
set(PYSIDE_MAJOR_VERSION "2")
|
||||
# Just to fix warnings with --warn-uninitialized
|
||||
if(NOT DEFINED SHIBOKEN_CUSTOM_PREFIX) #look for shiboken in a custom location
|
||||
set(SHIBOKEN_CUSTOM_PREFIX "")
|
||||
endif()
|
||||
if(NOT DEFINED PYSIDE_CUSTOM_PREFIX) #look for pyside in a custom location
|
||||
set(PYSIDE_CUSTOM_PREFIX "")
|
||||
endif()
|
||||
|
||||
if(${PROJECT_NAME}_QT6)
|
||||
set(PYSIDE_MAJOR_VERSION "6")
|
||||
set(PYTHON_BINDING_NAMESPACE "${PYTHON_BINDING_NAMESPACE}Qt${PYSIDE_MAJOR_VERSION}")
|
||||
set(QtWidgets_VERSION ${Qt6Widgets_VERSION})
|
||||
else()
|
||||
set(PYSIDE_MAJOR_VERSION "2")
|
||||
set(QtWidgets_VERSION ${Qt5Widgets_VERSION})
|
||||
endif()
|
||||
|
||||
find_package(Python3 3.7 REQUIRED COMPONENTS Interpreter Development)
|
||||
find_package(Shiboken${PYSIDE_MAJOR_VERSION} REQUIRED)
|
||||
find_package(PySide${PYSIDE_MAJOR_VERSION} ${QtWidgets_VERSION} EXACT REQUIRED)
|
||||
|
||||
if(NOT ${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX)
|
||||
set(${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
|
||||
endif()
|
||||
set(BINDINGS_DIR "${INSTALL_LIBRARY_DIR}/python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}/site-packages/${PYTHON_BINDING_NAMESPACE}")
|
||||
set(${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX "${${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX}/${BINDINGS_DIR}")
|
||||
|
||||
include(PySide${PYSIDE_MAJOR_VERSION}ModuleBuild)
|
||||
add_subdirectory(PyKDDockWidgets)
|
||||
add_subdirectory(tests)
|
||||
|
||||
@@ -16,6 +16,8 @@ set(PyKDDockWidgets_SRC
|
||||
${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets/kddockwidgets_dockwidgetbase_wrapper.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets/kddockwidgets_dockwidget_wrapper.cpp
|
||||
${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets/kddockwidgets_dockwidget_wrapper.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets/kddockwidgets_initialoption_wrapper.cpp
|
||||
${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets/kddockwidgets_initialoption_wrapper.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets/kddockwidgets_mainwindowbase_wrapper.cpp
|
||||
${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets/kddockwidgets_mainwindowbase_wrapper.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets/kddockwidgets_mainwindow_wrapper.cpp
|
||||
@@ -46,9 +48,10 @@ set(PyKDDockWidgets_target_include_directories
|
||||
# Libraries that will be necessary to link the target, this will used in the command 'target_link_libraries'
|
||||
set(PyKDDockWidgets_target_link_libraries
|
||||
KDAB::kddockwidgets
|
||||
Qt${QT_MAJOR_VERSION}::Core
|
||||
Qt${QT_MAJOR_VERSION}::Gui
|
||||
Qt${QT_MAJOR_VERSION}::Widgets
|
||||
Qt${Qt_VERSION_MAJOR}::Core
|
||||
Qt${Qt_VERSION_MAJOR}::Gui
|
||||
Qt${Qt_VERSION_MAJOR}::Widgets
|
||||
${Python3_LIBRARIES}
|
||||
)
|
||||
|
||||
# changes on these files should trigger a new generation
|
||||
@@ -78,4 +81,19 @@ create_python_bindings(
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/__init__.py.cmake ${CMAKE_CURRENT_BINARY_DIR}/__init__.py @ONLY)
|
||||
|
||||
# install
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/__init__.py DESTINATION ${${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX}/PyKDDockWidgets)
|
||||
install(
|
||||
FILES
|
||||
${CMAKE_CURRENT_BINARY_DIR}/__init__.py
|
||||
$<TARGET_FILE:KDAB::kddockwidgets>
|
||||
DESTINATION
|
||||
${${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX}
|
||||
)
|
||||
if(NOT WIN32)
|
||||
install(
|
||||
FILES
|
||||
$<TARGET_LINKER_FILE:KDAB::kddockwidgets>
|
||||
$<TARGET_SONAME_FILE:KDAB::kddockwidgets>
|
||||
DESTINATION
|
||||
${${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX}
|
||||
)
|
||||
endif()
|
||||
|
||||
@@ -10,10 +10,29 @@
|
||||
#
|
||||
|
||||
import sys
|
||||
import os
|
||||
|
||||
__all__ = ['KDDockWidgets']
|
||||
|
||||
# Preload PySide2 libraries to avoid missing libraries while loading KDDockWidgets
|
||||
def setupLibraryPath():
|
||||
if sys.platform != 'win32':
|
||||
return
|
||||
|
||||
from shiboken2 import shiboken2
|
||||
from PySide@PYSIDE_MAJOR_VERSION@ import QtCore
|
||||
|
||||
extra_dll_dirs = [ os.path.abspath(os.path.dirname(shiboken2.__file__)),
|
||||
os.path.abspath(os.path.dirname(QtCore.__file__)),
|
||||
os.path.abspath(os.path.dirname(__file__)) ]
|
||||
|
||||
if sys.version_info[0] == 3 and sys.version_info[1] >= 8:
|
||||
for dll_dir in extra_dll_dirs:
|
||||
os.add_dll_directory(dll_dir)
|
||||
|
||||
for dll_dir in extra_dll_dirs:
|
||||
os.environ['PATH'] = os.fspath(dll_dir) + os.pathsep + os.environ['PATH']
|
||||
|
||||
# Preload PySide libraries to avoid missing libraries while loading KDDockWidgets
|
||||
try:
|
||||
from PySide@PYSIDE_MAJOR_VERSION@ import QtCore
|
||||
# Create a alias for PySide module so we can use a single import in source files
|
||||
@@ -22,3 +41,5 @@ try:
|
||||
except Exception:
|
||||
print("Failed to load PySide")
|
||||
raise
|
||||
|
||||
setupLibraryPath()
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
otherwise shiboken will ignore the function and will fail to create a wrapper -->
|
||||
<primitive-type name="DropAreaWithCentralFrame"/>
|
||||
<primitive-type name="SideBar"/>
|
||||
<primitive-type name="InitialOption"/>
|
||||
|
||||
<!-- Some plublic enum and flags -->
|
||||
<enum-type name="Location"/>
|
||||
@@ -28,6 +27,9 @@
|
||||
<enum-type name="DropIndicatorType"/>
|
||||
<enum-type name="SideBarLocation"/>
|
||||
<enum-type name="TitleBarButtonType"/>
|
||||
<enum-type name="SuggestedGeometryHint" flags="SuggestedGeometryHints" />
|
||||
<enum-type name="CursorPosition" flags="CursorPositions" />
|
||||
<enum-type name="AddingOption" />
|
||||
|
||||
<!-- our classes
|
||||
For class we can use two types:
|
||||
@@ -35,6 +37,7 @@
|
||||
value-type: class that can be passed as value for functions
|
||||
Here we only use 'object-type' since all our classes are derived from QWidget
|
||||
-->
|
||||
<value-type name="InitialOption"/>
|
||||
<object-type name="MainWindowBase" />
|
||||
<object-type name="MainWindow" />
|
||||
<object-type name="DockWidgetBase" >
|
||||
@@ -42,6 +45,7 @@
|
||||
inside of the object-type -->
|
||||
<enum-type name="Option" flags="Options" />
|
||||
<enum-type name="IconPlace" flags="IconPlaces" />
|
||||
<enum-type name="LayoutSaverOption" flags="LayoutSaverOptions" />
|
||||
</object-type>
|
||||
|
||||
<object-type name="DockWidget" />
|
||||
|
||||
163
python/examples-qt6/MyMainWindow.py
Normal file
163
python/examples-qt6/MyMainWindow.py
Normal file
@@ -0,0 +1,163 @@
|
||||
#
|
||||
# This file is part of KDDockWidgets.
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
# Author: Renato Araujo Oliveira Filho <renato.araujo@kdab.com>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
#
|
||||
# Contact KDAB at <info@kdab.com> for commercial licensing options.
|
||||
#
|
||||
|
||||
from PyKDDockWidgetsQt6 import KDDockWidgets
|
||||
|
||||
from PySide6 import QtCore, QtWidgets, QtGui
|
||||
|
||||
from MyWidget1 import MyWidget1
|
||||
from MyWidget2 import MyWidget2
|
||||
from MyWidget3 import MyWidget3
|
||||
|
||||
def newMyWidget(parent = None):
|
||||
randomNumber = QtCore.QRandomGenerator.global_().bounded(0, 100) + 1
|
||||
if (randomNumber < 50):
|
||||
if (randomNumber < 33):
|
||||
return MyWidget1(parent)
|
||||
else:
|
||||
return MyWidget3(parent)
|
||||
else:
|
||||
return MyWidget2(parent)
|
||||
|
||||
class MyMainWindow(KDDockWidgets.MainWindow):
|
||||
s_count = 0
|
||||
s_menuCount = 0
|
||||
|
||||
def __init__(self, uniqueName, options = KDDockWidgets.MainWindowOption_None, dockWidget0IsNonClosable = False, nonDockableDockWidget9 = False, restoreIsRelative = False, maxSizeForDockWidget8 = False, affinityName = "", parent = None):
|
||||
super().__init__(uniqueName, options, parent)
|
||||
self.m_dockWidget0IsNonClosable = dockWidget0IsNonClosable
|
||||
self.m_dockWidget9IsNonDockable = nonDockableDockWidget9
|
||||
self.m_restoreIsRelative = restoreIsRelative
|
||||
self.m_maxSizeForDockWidget8 = maxSizeForDockWidget8
|
||||
self.m_dockwidgets = []
|
||||
|
||||
menubar = self.menuBar()
|
||||
fileMenu = QtWidgets.QMenu("File")
|
||||
self.m_toggleMenu = QtWidgets.QMenu("Toggle")
|
||||
menubar.addMenu(fileMenu)
|
||||
menubar.addMenu(self.m_toggleMenu)
|
||||
|
||||
newAction = fileMenu.addAction("New DockWidget")
|
||||
newAction.triggered.connect(self._newDockWidget)
|
||||
|
||||
saveLayoutAction = fileMenu.addAction("Save Layout")
|
||||
saveLayoutAction.triggered.connect(self._saveLayout)
|
||||
|
||||
restoreLayoutAction = fileMenu.addAction("Restore Layout")
|
||||
restoreLayoutAction.triggered.connect(self._restoreLayout)
|
||||
|
||||
closeAllAction = fileMenu.addAction("Close All")
|
||||
closeAllAction.triggered.connect(self._closeAll)
|
||||
|
||||
layoutEqually = fileMenu.addAction("Layout Equally")
|
||||
layoutEqually.triggered.connect(self.layoutEqually)
|
||||
|
||||
quitAction = fileMenu.addAction("Quit")
|
||||
quitAction.triggered.connect(QtWidgets.QApplication.instance().quit)
|
||||
|
||||
self.setAffinities([ affinityName ])
|
||||
self.createDockWidgets()
|
||||
|
||||
def _newDockWidget(self):
|
||||
MyMainWindow.s_menuCount += 1
|
||||
w = newMyWidget(self)
|
||||
w.setGeometry(100, 100, 400, 400)
|
||||
dock = KDDockWidgets.DockWidget("new dock %d"%(MyMainWindow.s_menuCount))
|
||||
dock.setWidget(w)
|
||||
dock.resize(600, 600)
|
||||
dock.show()
|
||||
self.m_dockwidgets.append(dock)
|
||||
|
||||
def _saveLayout(self):
|
||||
#saver = KDDockWidgets.LayoutSaver()
|
||||
#result = saver.saveToFile("mylayout.json")
|
||||
#print("Saving layout to disk. Result=", result)
|
||||
print("Not available")
|
||||
|
||||
def _restoreLayout(self):
|
||||
#options = KDDockWidgets.RestoreOption_None
|
||||
#if self.m_restoreIsRelative:
|
||||
# options |= KDDockWidgets.RestoreOption_RelativeToMainWindow
|
||||
#saver = KDDockWidgets.LayoutSaver(options)
|
||||
#saver.restoreFromFile("mylayout.json")
|
||||
print("Not available")
|
||||
|
||||
def _closeAll(self):
|
||||
for dw in self.m_dockwidgets:
|
||||
dw.close()
|
||||
|
||||
def createDockWidgets(self):
|
||||
if self.m_dockWidget9IsNonDockable:
|
||||
numDockWidgets = 10
|
||||
else:
|
||||
numDockWidgets = 9
|
||||
|
||||
# numDockWidgets = 2
|
||||
# Create 9 KDDockWidget::DockWidget and the respective widgets they're hosting (MyWidget instances)
|
||||
for i in range(numDockWidgets):
|
||||
self.m_dockwidgets.append(self.newDockWidget())
|
||||
|
||||
# MainWindow::addDockWidget() attaches a dock widget to the main window:
|
||||
initialOpts = KDDockWidgets.InitialOption(KDDockWidgets.InitialVisibilityOption.StartHidden, QtCore.QSize(500, 500))
|
||||
self.addDockWidget(self.m_dockwidgets[0], KDDockWidgets.Location_OnBottom, None, initialOpts)
|
||||
|
||||
# Here, for finer granularity we specify right of dockwidgets[0]:
|
||||
self.addDockWidget(self.m_dockwidgets[1], KDDockWidgets.Location_OnRight, self.m_dockwidgets[0])
|
||||
|
||||
self.addDockWidget(self.m_dockwidgets[2], KDDockWidgets.Location_OnLeft)
|
||||
self.addDockWidget(self.m_dockwidgets[3], KDDockWidgets.Location_OnBottom)
|
||||
self.addDockWidget(self.m_dockwidgets[4], KDDockWidgets.Location_OnBottom)
|
||||
|
||||
# Tab two dock widgets together
|
||||
self.m_dockwidgets[3].addDockWidgetAsTab(self.m_dockwidgets[5])
|
||||
|
||||
# 6 is floating, as it wasn't added to the main window via MainWindow::addDockWidget().
|
||||
# and we tab 7 with it.
|
||||
self.m_dockwidgets[6].addDockWidgetAsTab(self.m_dockwidgets[7])
|
||||
|
||||
# Floating windows also support nesting, here we add 8 to the bottom of the group
|
||||
self.m_dockwidgets[6].addDockWidgetToContainingWindow(self.m_dockwidgets[8], KDDockWidgets.Location_OnBottom)
|
||||
|
||||
floatingWindow = self.m_dockwidgets[6].window()
|
||||
floatingWindow.move(100, 100)
|
||||
|
||||
def newDockWidget(self):
|
||||
# Passing options is optional, we just want to illustrate Option_NotClosable here
|
||||
options = KDDockWidgets.DockWidget.Option_None
|
||||
if (MyMainWindow.s_count == 0) and self.m_dockWidget0IsNonClosable:
|
||||
options |= KDDockWidgets.DockWidget.Option_NotClosable
|
||||
|
||||
if (MyMainWindow.s_count == 9) and self.m_dockWidget9IsNonDockable:
|
||||
options |= KDDockWidgets.DockWidget.Option_NotDockable
|
||||
|
||||
dock = KDDockWidgets.DockWidget("DockWidget #%d"%(MyMainWindow.s_count), options)
|
||||
dock.setAffinities(self.affinities()); # optional, just to show the feature. Pass -mi to the example to see incompatible dock widgets
|
||||
|
||||
if MyMainWindow.s_count == 1:
|
||||
dock.setIcon(QtGui.QIcon.fromTheme("mail-message"))
|
||||
|
||||
myWidget = newMyWidget(self)
|
||||
if (MyMainWindow.s_count == 8) and self.m_maxSizeForDockWidget8:
|
||||
# Set a maximum size on dock #8
|
||||
myWidget.setMaximumSize(200, 200)
|
||||
|
||||
dock.setWidget(myWidget)
|
||||
|
||||
if dock.options() & KDDockWidgets.DockWidget.Option_NotDockable:
|
||||
dock.setTitle("DockWidget #%d (%s)" %(MyMainWindow.s_count, "non dockable"))
|
||||
else:
|
||||
dock.setTitle("DockWidget #%d"%(MyMainWindow.s_count))
|
||||
|
||||
dock.resize(600, 600)
|
||||
self.m_toggleMenu.addAction(dock.toggleAction())
|
||||
MyMainWindow.s_count += 1
|
||||
return dock
|
||||
|
||||
51
python/examples-qt6/MyWidget.py
Normal file
51
python/examples-qt6/MyWidget.py
Normal file
@@ -0,0 +1,51 @@
|
||||
#
|
||||
# This file is part of KDDockWidgets.
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
# Author: Renato Araujo Oliveira Filho <renato.araujo@kdab.com>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
#
|
||||
# Contact KDAB at <info@kdab.com> for commercial licensing options.
|
||||
#
|
||||
|
||||
import PyKDDockWidgetsQt6
|
||||
|
||||
from PySide6 import QtWidgets, QtGui, QtCore
|
||||
|
||||
class MyWidget(QtWidgets.QWidget):
|
||||
s_images = {}
|
||||
def __init__(self, backgroundFile, logoFile, parent = None):
|
||||
super().__init__(parent)
|
||||
|
||||
self.m_background = self._lookupImage(backgroundFile)
|
||||
self.m_logo = self._lookupImage(logoFile)
|
||||
|
||||
def _lookupImage(self, imageName):
|
||||
if imageName == "":
|
||||
return None
|
||||
|
||||
if imageName not in MyWidget.s_images:
|
||||
MyWidget.s_images[imageName] = QtGui.QImage(imageName)
|
||||
|
||||
return MyWidget.s_images[imageName]
|
||||
|
||||
def drawLogo(self, p):
|
||||
|
||||
if not self.m_logo:
|
||||
return
|
||||
|
||||
ratio = self.m_logo.height() / (self.m_logo.width() * 1.0)
|
||||
maxWidth = int(0.80 * self.size().width())
|
||||
maxHeight = int(0.80 * self.size().height())
|
||||
proposedHeight = int(maxWidth * ratio)
|
||||
if (proposedHeight <= maxHeight):
|
||||
width = maxWidth
|
||||
else:
|
||||
width = int(maxHeight / ratio)
|
||||
|
||||
height = int(width * ratio)
|
||||
targetLogoRect = QtCore.QRect(0,0, width, height)
|
||||
targetLogoRect.moveCenter(self.rect().center() + QtCore.QPoint(0, -int(self.size().height() * 0.00)))
|
||||
p.drawImage(targetLogoRect, self.m_logo, self.m_logo.rect());
|
||||
|
||||
29
python/examples-qt6/MyWidget1.py
Normal file
29
python/examples-qt6/MyWidget1.py
Normal file
@@ -0,0 +1,29 @@
|
||||
#
|
||||
# This file is part of KDDockWidgets.
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
# Author: Renato Araujo Oliveira Filho <renato.araujo@kdab.com>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
#
|
||||
# Contact KDAB at <info@kdab.com> for commercial licensing options.
|
||||
#
|
||||
|
||||
import PyKDDockWidgetsQt6
|
||||
|
||||
from PySide6 import QtWidgets, QtGui
|
||||
|
||||
from MyWidget import MyWidget
|
||||
|
||||
|
||||
class MyWidget1(MyWidget):
|
||||
def __init__(self, parent = None):
|
||||
super().__init__(":/assets/triangles.png", ":/assets/KDAB_bubble_white.png", parent)
|
||||
|
||||
|
||||
def paintEvent(self, ev):
|
||||
p = QtGui.QPainter(self)
|
||||
p.fillRect(self.rect(), QtGui.QColor(0xCC, 0xCC, 0xCC))
|
||||
p.drawImage(self.m_background.rect(), self.m_background, self.m_background.rect())
|
||||
self.drawLogo(p)
|
||||
|
||||
27
python/examples-qt6/MyWidget2.py
Normal file
27
python/examples-qt6/MyWidget2.py
Normal file
@@ -0,0 +1,27 @@
|
||||
#
|
||||
# This file is part of KDDockWidgets.
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
# Author: Renato Araujo Oliveira Filho <renato.araujo@kdab.com>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
#
|
||||
# Contact KDAB at <info@kdab.com> for commercial licensing options.
|
||||
#
|
||||
|
||||
import PyKDDockWidgetsQt6
|
||||
|
||||
from PySide6 import QtWidgets, QtGui, QtCore
|
||||
|
||||
from MyWidget import MyWidget
|
||||
|
||||
class MyWidget2(MyWidget):
|
||||
|
||||
def __init__(self, parent = None):
|
||||
super().__init__("", ":/assets/KDAB_bubble_blue.png", parent)
|
||||
|
||||
def paintEvent(self, ev):
|
||||
p = QtGui.QPainter(self)
|
||||
p.fillRect(self.rect(), QtCore.Qt.white);
|
||||
self.drawLogo(p)
|
||||
|
||||
32
python/examples-qt6/MyWidget3.py
Normal file
32
python/examples-qt6/MyWidget3.py
Normal file
@@ -0,0 +1,32 @@
|
||||
#
|
||||
# This file is part of KDDockWidgets.
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
# Author: Renato Araujo Oliveira Filho <renato.araujo@kdab.com>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
#
|
||||
# Contact KDAB at <info@kdab.com> for commercial licensing options.
|
||||
#
|
||||
|
||||
import PyKDDockWidgetsQt6
|
||||
|
||||
from PySide6 import QtWidgets, QtGui, QtCore
|
||||
|
||||
from MyWidget import MyWidget
|
||||
|
||||
class MyWidget3(MyWidget):
|
||||
|
||||
def __init__(self, parent = None):
|
||||
super().__init__(":/assets/base.png", ":/assets/KDAB_bubble_fulcolor.png", parent)
|
||||
self.m_triangle = QtGui.QImage(":/assets/tri.png")
|
||||
|
||||
def paintEvent(self, ev):
|
||||
p = QtGui.QPainter(self)
|
||||
p.fillRect(self.rect(), QtGui.QColor(0xD5, 0xD5, 0xD5))
|
||||
p.drawImage(self.m_background.rect(), self.m_background, self.m_background.rect())
|
||||
|
||||
targetRect = QtCore.QRect(QtCore.QPoint(self.width() - self.m_triangle.width(), self.height() - self.m_triangle.height()), self.m_triangle.size())
|
||||
|
||||
self.drawLogo(p)
|
||||
|
||||
8
python/examples-qt6/README.txt
Normal file
8
python/examples-qt6/README.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
Running python example
|
||||
======================
|
||||
|
||||
Generate resource file with:
|
||||
~# rcc -g python -o rc_assets.py ../../examples/dockwidgets/resources_example.qrc
|
||||
|
||||
Run the app:
|
||||
~# python3 main.py
|
||||
35
python/examples-qt6/main.py
Normal file
35
python/examples-qt6/main.py
Normal file
@@ -0,0 +1,35 @@
|
||||
#
|
||||
# This file is part of KDDockWidgets.
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
# Author: Renato Araujo Oliveira Filho <renato.araujo@kdab.com>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
#
|
||||
# Contact KDAB at <info@kdab.com> for commercial licensing options.
|
||||
#
|
||||
|
||||
from PyKDDockWidgetsQt6 import KDDockWidgets
|
||||
from MyMainWindow import MyMainWindow
|
||||
|
||||
from PySide6 import QtWidgets, QtCore
|
||||
|
||||
import sys
|
||||
#import rc_assets
|
||||
|
||||
if __name__ == "__main__":
|
||||
QtWidgets.QApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling)
|
||||
QtWidgets.QApplication.setAttribute(QtCore.Qt.AA_UseHighDpiPixmaps)
|
||||
app = QtWidgets.QApplication(sys.argv)
|
||||
|
||||
app.setOrganizationName("KDAB")
|
||||
app.setApplicationName("Test app")
|
||||
app.setStyle(QtWidgets.QStyleFactory.create("Fusion"))
|
||||
|
||||
mainWindow = MyMainWindow("MyMainWindow", )
|
||||
mainWindow.setWindowTitle("Main Window 1")
|
||||
mainWindow.resize(1200, 1200)
|
||||
mainWindow.show()
|
||||
|
||||
app.exec_()
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
from PyKDDockWidgets import KDDockWidgets
|
||||
|
||||
from PySide import QtCore, QtWidgets, QtGui
|
||||
from PySide2 import QtCore, QtWidgets, QtGui
|
||||
|
||||
from MyWidget1 import MyWidget1
|
||||
from MyWidget2 import MyWidget2
|
||||
@@ -106,7 +106,8 @@ class MyMainWindow(KDDockWidgets.MainWindow):
|
||||
self.m_dockwidgets.append(self.newDockWidget())
|
||||
|
||||
# MainWindow::addDockWidget() attaches a dock widget to the main window:
|
||||
self.addDockWidget(self.m_dockwidgets[0], KDDockWidgets.Location_OnTop)
|
||||
initialOpts = KDDockWidgets.InitialOption(KDDockWidgets.InitialVisibilityOption.StartHidden, QtCore.QSize(500, 500))
|
||||
self.addDockWidget(self.m_dockwidgets[0], KDDockWidgets.Location_OnBottom, None, initialOpts)
|
||||
|
||||
# Here, for finer granularity we specify right of dockwidgets[0]:
|
||||
self.addDockWidget(self.m_dockwidgets[1], KDDockWidgets.Location_OnRight, self.m_dockwidgets[0])
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
import PyKDDockWidgets
|
||||
|
||||
from PySide import QtWidgets, QtGui, QtCore
|
||||
from PySide2 import QtWidgets, QtGui, QtCore
|
||||
|
||||
class MyWidget(QtWidgets.QWidget):
|
||||
s_images = {}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
import PyKDDockWidgets
|
||||
|
||||
from PySide import QtWidgets, QtGui
|
||||
from PySide2 import QtWidgets, QtGui
|
||||
|
||||
from MyWidget import MyWidget
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
import PyKDDockWidgets
|
||||
|
||||
from PySide import QtWidgets, QtGui, QtCore
|
||||
from PySide2 import QtWidgets, QtGui, QtCore
|
||||
|
||||
from MyWidget import MyWidget
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
import PyKDDockWidgets
|
||||
|
||||
from PySide import QtWidgets, QtGui, QtCore
|
||||
from PySide2 import QtWidgets, QtGui, QtCore
|
||||
|
||||
from MyWidget import MyWidget
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
from PyKDDockWidgets import KDDockWidgets
|
||||
from MyMainWindow import MyMainWindow
|
||||
|
||||
from PySide import QtWidgets, QtCore
|
||||
from PySide2 import QtWidgets, QtCore
|
||||
|
||||
import sys
|
||||
import rc_assets
|
||||
|
||||
40
python/tests/CMakeLists.txt
Normal file
40
python/tests/CMakeLists.txt
Normal file
@@ -0,0 +1,40 @@
|
||||
#
|
||||
# This file is part of KDDockWidgets.
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
# Author: Renato Araujo Oliveira Filho <renato.araujo@kdab.com>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
#
|
||||
# Contact KDAB at <info@kdab.com> for commercial licensing options.
|
||||
#
|
||||
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.py.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.py @ONLY)
|
||||
|
||||
set(TEST_PYTHONPATH
|
||||
${CMAKE_BINARY_DIR}/python
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
set(TEST_LIBRARYPATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
|
||||
|
||||
if(WIN32)
|
||||
set(TEST_LIBRARY_VAR "PATH")
|
||||
string(REPLACE "\\" "/" TEST_PYTHONPATH "${TEST_PYTHONPATH}")
|
||||
string(REPLACE "\\" "/" TEST_LIBRARYPATH "${TEST_LIBRARYPATH}")
|
||||
list(JOIN TEST_PYTHONPATH "\\;" TEST_PYTHONPATH)
|
||||
list(JOIN TEST_LIBRARYPATH "\\;" TEST_LIBRARYPATH)
|
||||
else()
|
||||
set(TEST_LIBRARY_VAR "LD_LIBRARY_PATH")
|
||||
list(JOIN TEST_PYTHONPATH ":" TEST_PYTHONPATH)
|
||||
list(JOIN TEST_LIBRARYPATH ":" TEST_LIBRARYPATH)
|
||||
endif()
|
||||
|
||||
set(PYTHON_ENV_COMMON "PYTHONPATH=${TEST_PYTHONPATH};${TEST_LIBRARY_VAR}=${TEST_LIBRARYPATH}")
|
||||
|
||||
file(GLOB TEST_FILES ${CMAKE_CURRENT_SOURCE_DIR}/tst_*.py)
|
||||
foreach(test_file ${TEST_FILES})
|
||||
get_filename_component(test_name ${test_file} NAME_WE)
|
||||
add_test(${test_name} ${Python3_EXECUTABLE} ${test_file})
|
||||
set_tests_properties(${test_name} PROPERTIES ENVIRONMENT "${PYTHON_ENV_COMMON}")
|
||||
endforeach()
|
||||
|
||||
19
python/tests/config.py.cmake
Normal file
19
python/tests/config.py.cmake
Normal file
@@ -0,0 +1,19 @@
|
||||
# This file is part of KDDockWidgets.
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
# Author: Renato Araujo <renato.araujo@kdab.com>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
#
|
||||
# Contact KDAB at <info@kdab.com> for commercial licensing options.
|
||||
#
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
class TstConfig(object):
|
||||
bindingsNamespace = "@PYTHON_BINDING_NAMESPACE@"
|
||||
|
||||
def initLibraryPath():
|
||||
if sys.platform == 'win32' and sys.version_info[0] == 3 and sys.version_info[1] >= 8:
|
||||
os.add_dll_directory("@CMAKE_RUNTIME_OUTPUT_DIRECTORY@")
|
||||
30
python/tests/tst_importModule.py
Normal file
30
python/tests/tst_importModule.py
Normal file
@@ -0,0 +1,30 @@
|
||||
# This file is part of KDDockWidgets.
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
# Author: Renato Araujo <renato.araujo@kdab.com>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
#
|
||||
# Contact KDAB at <info@kdab.com> for commercial licensing options.
|
||||
#
|
||||
|
||||
import unittest
|
||||
import importlib
|
||||
import inspect
|
||||
|
||||
from config import TstConfig
|
||||
|
||||
class TestImportModules(unittest.TestCase):
|
||||
def test_importModules(self):
|
||||
m = importlib.import_module(TstConfig.bindingsNamespace + '.KDDockWidgets')
|
||||
moduleSymbols = []
|
||||
for t in inspect.getmembers(m):
|
||||
moduleSymbols.append(t[0])
|
||||
|
||||
symbols = ['MainWindow', 'DockWidget']
|
||||
for symbol in symbols:
|
||||
self.assertIn(symbol, moduleSymbols)
|
||||
|
||||
if __name__ == '__main__':
|
||||
TstConfig.initLibraryPath()
|
||||
unittest.main()
|
||||
@@ -37,7 +37,7 @@ set(DOCKSLIBS_SRCS
|
||||
MainWindowMDI.h
|
||||
LayoutSaver.cpp
|
||||
LayoutSaver.h
|
||||
LayoutSaver_p.h
|
||||
private/LayoutSaver_p.h
|
||||
private/LayoutWidget.cpp
|
||||
private/LayoutWidget_p.h
|
||||
private/MDILayoutWidget.cpp
|
||||
@@ -105,6 +105,8 @@ set(DOCKS_INSTALLABLE_INCLUDES
|
||||
FocusScope.h
|
||||
QWidgetAdapter.h
|
||||
LayoutSaver.h
|
||||
MainWindowMDI.h
|
||||
MainWindowBase.h
|
||||
)
|
||||
|
||||
set(DOCKS_INSTALLABLE_PRIVATE_INCLUDES
|
||||
@@ -114,6 +116,7 @@ set(DOCKS_INSTALLABLE_PRIVATE_INCLUDES
|
||||
private/DropIndicatorOverlayInterface_p.h
|
||||
private/FloatingWindow_p.h
|
||||
private/Frame_p.h
|
||||
private/LayoutSaver_p.h
|
||||
private/MultiSplitter_p.h
|
||||
private/LayoutWidget_p.h
|
||||
private/SideBar_p.h
|
||||
@@ -134,6 +137,10 @@ set(DOCKS_INSTALLABLE_PRIVATE_WIDGET_INCLUDES
|
||||
private/widgets/TabWidgetWidget_p.h
|
||||
)
|
||||
|
||||
set(DOCKS_INSTALLABLE_PRIVATE_QUICK_INCLUDES
|
||||
private/quick/QWidgetAdapter_quick_p.h
|
||||
)
|
||||
|
||||
if(${PROJECT_NAME}_QTQUICK)
|
||||
set(DOCKSLIBS_SRCS ${DOCKSLIBS_SRCS}
|
||||
DockWidgetQuick.cpp
|
||||
@@ -152,14 +159,18 @@ if(${PROJECT_NAME}_QTQUICK)
|
||||
private/quick/TitleBarQuick_p.h
|
||||
private/quick/QmlTypes.cpp
|
||||
private/quick/QmlTypes.h
|
||||
private/quick/Helpers.cpp
|
||||
private/quick/Helpers_p.h
|
||||
private/quick/FrameQuick.cpp
|
||||
private/quick/FrameQuick_p.h
|
||||
private/quick/LayoutSaverInstantiator.cpp
|
||||
private/quick/LayoutSaverInstantiator_p.h
|
||||
private/quick/RubberBandQuick.cpp
|
||||
private/quick/RubberBandQuick.h
|
||||
private/quick/MainWindowQuick.cpp
|
||||
private/quick/MainWindowQuick_p.h
|
||||
private/quick/MainWindowWrapper.cpp
|
||||
private/quick/MainWindowWrapper_p.h
|
||||
private/quick/MainWindowInstantiator.cpp
|
||||
private/quick/MainWindowInstantiator_p.h
|
||||
private/multisplitter/Widget_quick.cpp
|
||||
private/multisplitter/Widget_quick.h
|
||||
private/multisplitter/Separator_quick.cpp
|
||||
@@ -167,6 +178,9 @@ if(${PROJECT_NAME}_QTQUICK)
|
||||
private/multisplitter/Rubberband_quick.cpp
|
||||
private/multisplitter/Rubberband_quick.h
|
||||
kddockwidgets_qtquick.qrc)
|
||||
|
||||
set(DOCKS_INSTALLABLE_INCLUDES ${DOCKS_INSTALLABLE_INCLUDES} DockWidgetQuick.h)
|
||||
|
||||
else()
|
||||
set(DOCKSLIBS_SRCS ${DOCKSLIBS_SRCS}
|
||||
private/DebugWindow.cpp
|
||||
@@ -198,37 +212,52 @@ else()
|
||||
private/indicators/SegmentedIndicators.cpp
|
||||
private/indicators/SegmentedIndicators_p.h
|
||||
# private/indicators/AnimatedIndicators.cpp
|
||||
)
|
||||
)
|
||||
|
||||
set(DOCKS_INSTALLABLE_INCLUDES
|
||||
${DOCKS_INSTALLABLE_INCLUDES}
|
||||
MainWindow.h
|
||||
MainWindowMDI.h
|
||||
MainWindowBase.h
|
||||
DockWidget.h
|
||||
)
|
||||
endif()
|
||||
|
||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
set(IS_CLANG_BUILD TRUE)
|
||||
else()
|
||||
set(IS_CLANG_BUILD FALSE)
|
||||
endif()
|
||||
#Generate C/C++ CamelCase forwarding headers (only public includes)
|
||||
include(ECMGenerateHeaders)
|
||||
ecm_generate_headers(camelcase_HEADERS
|
||||
ORIGINAL
|
||||
CAMELCASE
|
||||
HEADER_NAMES
|
||||
Config
|
||||
DockWidget
|
||||
DockWidgetBase
|
||||
FocusScope
|
||||
FrameworkWidgetFactory,DefaultWidgetFactory
|
||||
LayoutSaver
|
||||
MainWindow
|
||||
MainWindowBase
|
||||
MainWindowMDI
|
||||
)
|
||||
|
||||
set(RESOURCES ${CMAKE_CURRENT_SOURCE_DIR}/kddockwidgets_resources.qrc)
|
||||
|
||||
add_library(kddockwidgets ${KDDockWidgets_LIBRARY_MODE} ${DOCKSLIBS_SRCS} ${DOCKS_INSTALLABLE_INCLUDES} ${RESOURCES} ${RESOURCES_QUICK})
|
||||
add_library(kddockwidgets ${KDDockWidgets_LIBRARY_MODE} ${DOCKSLIBS_SRCS} ${DOCKS_INSTALLABLE_INCLUDES} ${RESOURCES})
|
||||
add_library(KDAB::kddockwidgets ALIAS kddockwidgets)
|
||||
set_target_properties(kddockwidgets PROPERTIES OUTPUT_NAME "kddockwidgets${KDDockWidgets_LIBRARY_QTID}")
|
||||
set_compiler_flags(kddockwidgets)
|
||||
|
||||
if(${PROJECT_NAME}_QT6)
|
||||
set(DOCKS_INCLUDES_INSTALL_PATH "include/kddockwidgets-qt6")
|
||||
else()
|
||||
set(DOCKS_INCLUDES_INSTALL_PATH "include/")
|
||||
endif()
|
||||
|
||||
|
||||
target_include_directories(kddockwidgets
|
||||
PUBLIC
|
||||
$<INSTALL_INTERFACE:include>
|
||||
$<INSTALL_INTERFACE:${DOCKS_INCLUDES_INSTALL_PATH}>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/fwd_headers>
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/private
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/private/multisplitter/
|
||||
)
|
||||
|
||||
target_compile_definitions(kddockwidgets
|
||||
@@ -244,11 +273,18 @@ else()
|
||||
target_compile_definitions(kddockwidgets PRIVATE BUILDING_DOCKS_LIBRARY)
|
||||
endif()
|
||||
|
||||
if(KDDockWidgets_QTQUICK)
|
||||
target_compile_definitions(kddockwidgets PUBLIC KDDOCKWIDGETS_QTQUICK)
|
||||
endif()
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCXX OR IS_CLANG_BUILD)
|
||||
target_compile_options(kddockwidgets PRIVATE -Wshadow -fvisibility=hidden)
|
||||
target_compile_options(kddockwidgets PRIVATE -Wshadow)
|
||||
if(NOT MSVC)
|
||||
target_compile_options(kddockwidgets PRIVATE -fvisibility=hidden)
|
||||
endif()
|
||||
|
||||
# Disable -Wconversion for Qt6. The qsizetype to int conversions are harmless
|
||||
if (NOT ${PROJECT_NAME}_QT6)
|
||||
if(NOT ${PROJECT_NAME}_QT6)
|
||||
target_compile_options(kddockwidgets PRIVATE -Wconversion)
|
||||
endif()
|
||||
|
||||
@@ -258,16 +294,16 @@ if(CMAKE_COMPILER_IS_GNUCXX OR IS_CLANG_BUILD)
|
||||
endif()
|
||||
|
||||
if(${PROJECT_NAME}_QTQUICK)
|
||||
target_link_libraries(kddockwidgets PUBLIC Qt${QT_MAJOR_VERSION}::Widgets Qt${QT_MAJOR_VERSION}::Quick Qt${QT_MAJOR_VERSION}::QuickControls2)
|
||||
target_link_libraries(kddockwidgets PUBLIC Qt${Qt_VERSION_MAJOR}::Widgets Qt${Qt_VERSION_MAJOR}::Quick Qt${Qt_VERSION_MAJOR}::QuickControls2)
|
||||
else()
|
||||
target_link_libraries(kddockwidgets PUBLIC Qt${QT_MAJOR_VERSION}::Widgets)
|
||||
target_link_libraries(kddockwidgets PUBLIC Qt${Qt_VERSION_MAJOR}::Widgets PRIVATE Qt${Qt_VERSION_MAJOR}::WidgetsPrivate)
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
target_link_libraries(kddockwidgets PRIVATE Qt${QT_MAJOR_VERSION}::GuiPrivate dwmapi)
|
||||
elseif(NOT APPLE AND NOT EMSCRIPTEN AND NOT ${PROJECT_NAME}_QT6)
|
||||
find_package(Qt${QT_MAJOR_VERSION}X11Extras)
|
||||
target_link_libraries(kddockwidgets PUBLIC Qt${QT_MAJOR_VERSION}::X11Extras)
|
||||
if(WIN32)
|
||||
target_link_libraries(kddockwidgets PRIVATE Qt${Qt_VERSION_MAJOR}::GuiPrivate dwmapi)
|
||||
elseif(NOT APPLE AND NOT EMSCRIPTEN AND NOT ${PROJECT_NAME}_QT6 AND ${PROJECT_NAME}_X11EXTRAS)
|
||||
find_package(Qt${Qt_VERSION_MAJOR}X11Extras)
|
||||
target_link_libraries(kddockwidgets PUBLIC Qt${Qt_VERSION_MAJOR}::X11Extras)
|
||||
endif()
|
||||
|
||||
set_target_properties(kddockwidgets PROPERTIES
|
||||
@@ -277,7 +313,7 @@ set_target_properties(kddockwidgets PROPERTIES
|
||||
|
||||
#version libraries on Windows
|
||||
if(WIN32)
|
||||
if (CMAKE_BUILD_TYPE)
|
||||
if(CMAKE_BUILD_TYPE)
|
||||
set(postfix ${${PROJECT_NAME}_VERSION_MAJOR})
|
||||
string(TOUPPER ${CMAKE_BUILD_TYPE} UPPER_BUILD_TYPE)
|
||||
if(${UPPER_BUILD_TYPE} MATCHES "^DEBUG")
|
||||
@@ -301,17 +337,25 @@ install(TARGETS kddockwidgets
|
||||
if(MSVC AND NOT ${PROJECT_NAME}_STATIC)
|
||||
install(FILES "$<TARGET_PDB_FILE_DIR:kddockwidgets>/$<TARGET_PDB_FILE_NAME:kddockwidgets>" DESTINATION ${INSTALL_LIBRARY_DIR} CONFIGURATIONS Debug RelWithDebInfo)
|
||||
endif()
|
||||
install(FILES ${DOCKS_INSTALLABLE_INCLUDES} DESTINATION include/kddockwidgets)
|
||||
install(FILES ${DOCKS_INSTALLABLE_PRIVATE_INCLUDES} DESTINATION include/kddockwidgets/private)
|
||||
install(FILES private/multisplitter/Item_p.h DESTINATION include/kddockwidgets/private/multisplitter)
|
||||
install(FILES private/multisplitter/Widget.h DESTINATION include/kddockwidgets/private/multisplitter)
|
||||
install(FILES private/multisplitter/Widget_qwidget.h DESTINATION include/kddockwidgets/private/multisplitter)
|
||||
install(FILES private/multisplitter/Separator_p.h DESTINATION include/kddockwidgets/private/multisplitter)
|
||||
install(FILES private/multisplitter/Separator_qwidget.h DESTINATION include/kddockwidgets/private/multisplitter)
|
||||
install(FILES ${DOCKS_INSTALLABLE_PRIVATE_WIDGET_INCLUDES} DESTINATION include/kddockwidgets/private/widgets)
|
||||
|
||||
install(FILES private/indicators/ClassicIndicators_p.h DESTINATION include/kddockwidgets/private/indicators)
|
||||
install(FILES private/indicators/SegmentedIndicators_p.h DESTINATION include/kddockwidgets/private/indicators)
|
||||
install(FILES ${camelcase_HEADERS} DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets)
|
||||
install(FILES ${DOCKS_INSTALLABLE_INCLUDES} DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets)
|
||||
install(FILES ${DOCKS_INSTALLABLE_PRIVATE_INCLUDES} DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets/private)
|
||||
install(FILES private/multisplitter/Item_p.h DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets/private/multisplitter)
|
||||
install(FILES private/multisplitter/Widget.h DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets/private/multisplitter)
|
||||
install(FILES private/multisplitter/Separator_p.h DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets/private/multisplitter)
|
||||
install(FILES private/indicators/ClassicIndicators_p.h DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets/private/indicators)
|
||||
install(FILES private/indicators/SegmentedIndicators_p.h DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets/private/indicators)
|
||||
|
||||
if(KDDockWidgets_QTQUICK)
|
||||
install(FILES ${DOCKS_INSTALLABLE_PRIVATE_QUICK_INCLUDES} DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets/private/quick)
|
||||
install(FILES private/multisplitter/Separator_quick.h DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets/private/multisplitter)
|
||||
install(FILES private/multisplitter/Widget_quick.h DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets/private/multisplitter)
|
||||
else()
|
||||
install(FILES ${DOCKS_INSTALLABLE_PRIVATE_WIDGET_INCLUDES} DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets/private/widgets)
|
||||
install(FILES private/multisplitter/Separator_qwidget.h DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets/private/multisplitter)
|
||||
install(FILES private/multisplitter/Widget_qwidget.h DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets/private/multisplitter)
|
||||
endif()
|
||||
|
||||
# Generate library version files
|
||||
include(ECMSetupVersion)
|
||||
@@ -319,20 +363,21 @@ ecm_setup_version(
|
||||
${${PROJECT_NAME}_VERSION}
|
||||
VARIABLE_PREFIX KDDOCKWIDGETS
|
||||
VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/kddockwidgets_version.h"
|
||||
PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgetsConfigVersion.cmake"
|
||||
PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets${KDDockWidgets_LIBRARY_QTID}ConfigVersion.cmake"
|
||||
SOVERSION ${${PROJECT_NAME}_SOVERSION}
|
||||
COMPATIBILITY AnyNewerVersion)
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/kddockwidgets_version.h" DESTINATION include/kddockwidgets)
|
||||
COMPATIBILITY AnyNewerVersion
|
||||
)
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/kddockwidgets_version.h" DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets)
|
||||
|
||||
install(EXPORT kddockwidgetsTargets
|
||||
FILE KDDockWidgetsTargets.cmake
|
||||
FILE KDDockWidgets${KDDockWidgets_LIBRARY_QTID}Targets.cmake
|
||||
NAMESPACE KDAB::
|
||||
DESTINATION ${INSTALL_LIBRARY_DIR}/cmake/KDDockWidgets
|
||||
DESTINATION ${INSTALL_LIBRARY_DIR}/cmake/KDDockWidgets${KDDockWidgets_LIBRARY_QTID}
|
||||
)
|
||||
configure_file(KDDockWidgetsConfig.cmake.in KDDockWidgetsConfig.cmake @ONLY)
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgetsConfig.cmake"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgetsConfigVersion.cmake"
|
||||
DESTINATION ${INSTALL_LIBRARY_DIR}/cmake/KDDockWidgets
|
||||
configure_file(KDDockWidgetsConfig.cmake.in KDDockWidgets${KDDockWidgets_LIBRARY_QTID}Config.cmake @ONLY)
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets${KDDockWidgets_LIBRARY_QTID}Config.cmake"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets${KDDockWidgets_LIBRARY_QTID}ConfigVersion.cmake"
|
||||
DESTINATION ${INSTALL_LIBRARY_DIR}/cmake/KDDockWidgets${KDDockWidgets_LIBRARY_QTID}
|
||||
)
|
||||
|
||||
if(${PROJECT_NAME}_DEVELOPER_MODE)
|
||||
@@ -341,9 +386,9 @@ if(${PROJECT_NAME}_DEVELOPER_MODE)
|
||||
|
||||
option(KDDockWidgets_LINTER "Build the layout linter" ON)
|
||||
|
||||
if (NOT ${PROJECT_NAME}_QTQUICK AND KDDockWidgets_LINTER) # TODO: We can support it
|
||||
if(NOT ${PROJECT_NAME}_QTQUICK AND KDDockWidgets_LINTER) # TODO: We can support it
|
||||
add_executable(kddockwidgets_linter layoutlinter_main.cpp)
|
||||
target_link_libraries(kddockwidgets_linter kddockwidgets Qt${QT_MAJOR_VERSION}::Widgets)
|
||||
target_link_libraries(kddockwidgets_linter kddockwidgets Qt${Qt_VERSION_MAJOR}::Widgets)
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
@@ -17,22 +17,23 @@
|
||||
*/
|
||||
|
||||
#include "Config.h"
|
||||
#include "multisplitter/MultiSplitterConfig.h"
|
||||
#include "multisplitter/Widget.h"
|
||||
#include "DockRegistry_p.h"
|
||||
#include "private/multisplitter/MultiSplitterConfig.h"
|
||||
#include "private/multisplitter/Widget.h"
|
||||
#include "private/DockRegistry_p.h"
|
||||
#include "private/Utils_p.h"
|
||||
#include "private/DragController_p.h"
|
||||
#include "FrameworkWidgetFactory.h"
|
||||
#include "Utils_p.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QOperatingSystemVersion>
|
||||
|
||||
#ifdef KDDOCKWIDGETS_QTQUICK
|
||||
# include <QQmlEngine>
|
||||
# include <QQmlContext>
|
||||
#include "private/quick/Helpers_p.h"
|
||||
#include <QQmlEngine>
|
||||
#include <QQmlContext>
|
||||
#endif
|
||||
|
||||
namespace KDDockWidgets
|
||||
{
|
||||
namespace KDDockWidgets {
|
||||
|
||||
class Config::Private
|
||||
{
|
||||
@@ -58,6 +59,11 @@ public:
|
||||
InternalFlags m_internalFlags = InternalFlag_None;
|
||||
CustomizableWidgets m_disabledPaintEvents = CustomizableWidget_None;
|
||||
qreal m_draggedWindowOpacity = Q_QNAN;
|
||||
int m_mdiPopupThreshold = 250;
|
||||
bool m_dropIndicatorsInhibited = false;
|
||||
#ifdef KDDOCKWIDGETS_QTQUICK
|
||||
QtQuickHelpers m_qquickHelpers;
|
||||
#endif
|
||||
};
|
||||
|
||||
Config::Config()
|
||||
@@ -73,7 +79,7 @@ Config::Config()
|
||||
Layouting::Config::self().setSeparatorFactoryFunc(separatorCreator);
|
||||
}
|
||||
|
||||
Config& Config::self()
|
||||
Config &Config::self()
|
||||
{
|
||||
static Config config;
|
||||
return config;
|
||||
@@ -92,7 +98,7 @@ Config::Flags Config::flags() const
|
||||
void Config::setFlags(Flags f)
|
||||
{
|
||||
auto dr = DockRegistry::self();
|
||||
if (!dr->isEmpty(/*excludeBeingDeleted=*/ true)) {
|
||||
if (!dr->isEmpty(/*excludeBeingDeleted=*/true)) {
|
||||
qWarning() << Q_FUNC_INFO << "Only use this function at startup before creating any DockWidget or MainWindow"
|
||||
<< "; These are already created: " << dr->mainWindowsNames()
|
||||
<< dr->dockWidgetNames() << dr->floatingWindows();
|
||||
@@ -146,7 +152,7 @@ int Config::separatorThickness() const
|
||||
|
||||
void Config::setSeparatorThickness(int value)
|
||||
{
|
||||
if (!DockRegistry::self()->isEmpty(/*excludeBeingDeleted=*/ true)) {
|
||||
if (!DockRegistry::self()->isEmpty(/*excludeBeingDeleted=*/true)) {
|
||||
qWarning() << Q_FUNC_INFO << "Only use this function at startup before creating any DockWidget or MainWindow";
|
||||
return;
|
||||
}
|
||||
@@ -176,7 +182,7 @@ TabbingAllowedFunc Config::tabbingAllowedFunc() const
|
||||
|
||||
void Config::setAbsoluteWidgetMinSize(QSize size)
|
||||
{
|
||||
if (!DockRegistry::self()->isEmpty(/*excludeBeingDeleted=*/ false)) {
|
||||
if (!DockRegistry::self()->isEmpty(/*excludeBeingDeleted=*/false)) {
|
||||
qWarning() << Q_FUNC_INFO << "Only use this function at startup before creating any DockWidget or MainWindow";
|
||||
return;
|
||||
}
|
||||
@@ -191,7 +197,7 @@ QSize Config::absoluteWidgetMinSize() const
|
||||
|
||||
void Config::setAbsoluteWidgetMaxSize(QSize size)
|
||||
{
|
||||
if (!DockRegistry::self()->isEmpty(/*excludeBeingDeleted=*/ false)) {
|
||||
if (!DockRegistry::self()->isEmpty(/*excludeBeingDeleted=*/false)) {
|
||||
qWarning() << Q_FUNC_INFO << "Only use this function at startup before creating any DockWidget or MainWindow";
|
||||
return;
|
||||
}
|
||||
@@ -227,14 +233,21 @@ void Config::setQmlEngine(QQmlEngine *qmlEngine)
|
||||
return;
|
||||
}
|
||||
|
||||
d->m_qmlEngine = qmlEngine;
|
||||
|
||||
auto dr = DockRegistry::self(); // make sure our QML types are registered
|
||||
QQmlContext *context = qmlEngine->rootContext();
|
||||
context->setContextProperty(QStringLiteral("_kddwHelpers"), &d->m_qquickHelpers);
|
||||
context->setContextProperty(QStringLiteral("_kddwDockRegistry"), dr);
|
||||
context->setContextProperty(QStringLiteral("_kddwDragController"), DragController::instance());
|
||||
context->setContextProperty(QStringLiteral("_kddw_widgetFactory"), d->m_frameworkWidgetFactory);
|
||||
|
||||
d->m_qmlEngine = qmlEngine;
|
||||
}
|
||||
|
||||
QQmlEngine *Config::qmlEngine() const
|
||||
{
|
||||
if (!d->m_qmlEngine)
|
||||
qWarning() << "Please call KDDockWidgets::Config::self()->setQmlEngine(engine)";
|
||||
|
||||
return d->m_qmlEngine;
|
||||
}
|
||||
#endif
|
||||
@@ -291,6 +304,11 @@ void Config::Private::fixFlags()
|
||||
m_internalFlags |= InternalFlag_DontUseParentForFloatingWindows;
|
||||
m_internalFlags |= InternalFlag_DontUseQtToolWindowsForFloatingWindows;
|
||||
}
|
||||
|
||||
if (m_flags & Flag_ShowButtonsOnTabBarIfTitleBarHidden) {
|
||||
// Flag_ShowButtonsOnTabBarIfTitleBarHidden doesn't make sense if used alone
|
||||
m_flags |= Flag_HideTitleBarWhenTabsVisible;
|
||||
}
|
||||
}
|
||||
|
||||
void Config::setDisabledPaintEvents(CustomizableWidgets widgets)
|
||||
@@ -303,4 +321,27 @@ Config::CustomizableWidgets Config::disabledPaintEvents() const
|
||||
return d->m_disabledPaintEvents;
|
||||
}
|
||||
|
||||
void Config::setMDIPopupThreshold(int threshold)
|
||||
{
|
||||
d->m_mdiPopupThreshold = threshold;
|
||||
}
|
||||
|
||||
int Config::mdiPopupThreshold() const
|
||||
{
|
||||
return d->m_mdiPopupThreshold;
|
||||
}
|
||||
|
||||
void Config::setDropIndicatorsInhibited(bool inhibit) const
|
||||
{
|
||||
if (d->m_dropIndicatorsInhibited != inhibit) {
|
||||
d->m_dropIndicatorsInhibited = inhibit;
|
||||
Q_EMIT DockRegistry::self()->dropIndicatorsInhibitedChanged(inhibit);
|
||||
}
|
||||
}
|
||||
|
||||
bool Config::dropIndicatorsInhibited() const
|
||||
{
|
||||
return d->m_dropIndicatorsInhibited;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
55
src/Config.h
55
src/Config.h
@@ -21,28 +21,29 @@
|
||||
|
||||
#include "docks_export.h"
|
||||
|
||||
#include <qglobal.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QQmlEngine;
|
||||
class QSize;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace KDDockWidgets
|
||||
{
|
||||
namespace KDDockWidgets {
|
||||
|
||||
class DockWidgetBase;
|
||||
class MainWindowBase;
|
||||
class FrameworkWidgetFactory;
|
||||
|
||||
typedef KDDockWidgets::DockWidgetBase* (*DockWidgetFactoryFunc)(const QString &name);
|
||||
typedef KDDockWidgets::MainWindowBase* (*MainWindowFactoryFunc)(const QString &name);
|
||||
typedef KDDockWidgets::DockWidgetBase *(*DockWidgetFactoryFunc)(const QString &name);
|
||||
typedef KDDockWidgets::MainWindowBase *(*MainWindowFactoryFunc)(const QString &name);
|
||||
|
||||
/// @brief Function to allow the user more granularity to disallow dock widgets to tab together
|
||||
/// @param source The dock widgets being dragged
|
||||
/// @param target The dock widgets within an existing docked tab group
|
||||
/// @return true if the docking is allowed.
|
||||
/// @sa setTabbingAllowedFunc
|
||||
typedef bool (*TabbingAllowedFunc)(const QVector<DockWidgetBase*> &source,
|
||||
const QVector<DockWidgetBase*> &target);
|
||||
typedef bool (*TabbingAllowedFunc)(const QVector<DockWidgetBase *> &source,
|
||||
const QVector<DockWidgetBase *> &target);
|
||||
|
||||
/**
|
||||
* @brief Singleton to allow to choose certain behaviours of the framework.
|
||||
@@ -53,7 +54,6 @@ typedef bool (*TabbingAllowedFunc)(const QVector<DockWidgetBase*> &source,
|
||||
class DOCKS_EXPORT Config
|
||||
{
|
||||
public:
|
||||
|
||||
///@brief returns the singleton Config instance
|
||||
static Config &self();
|
||||
|
||||
@@ -61,7 +61,8 @@ public:
|
||||
~Config();
|
||||
|
||||
///@brief Flag enum to tune certain behaviours, the defaults are Flag_Default
|
||||
enum Flag {
|
||||
enum Flag
|
||||
{
|
||||
Flag_None = 0, ///< No option set
|
||||
Flag_NativeTitleBar = 1, ///< Enables the Native OS title bar on OSes that support it (Windows 10, macOS), ignored otherwise.
|
||||
Flag_AeroSnapWithClientDecos = 2, ///< Deprecated. This is now default and cannot be turned off. Moving a window on Windows 10 uses native moving, as that works well across screens with different HDPI settings. There's no reason to use manual client/Qt window moving.
|
||||
@@ -78,15 +79,18 @@ public:
|
||||
Flag_TitleBarHasMinimizeButton = 0x2000 | Flag_DontUseUtilityFloatingWindows, ///< The title bar will have a minimize button when floating. This implies Flag_DontUseUtilityFloatingWindows too, otherwise they wouldn't appear in the task bar.
|
||||
Flag_TitleBarNoFloatButton = 0x4000, ///< The TitleBar won't show the float button
|
||||
Flag_AutoHideSupport = 0x8000 | Flag_TitleBarNoFloatButton, ///< Supports minimizing dock widgets to the side-bar.
|
||||
///< By default it also turns off the float button, but you can remove Flag_TitleBarNoFloatButton to have both.
|
||||
///< By default it also turns off the float button, but you can remove Flag_TitleBarNoFloatButton to have both.
|
||||
Flag_KeepAboveIfNotUtilityWindow = 0x10000, ///< Only meaningful if Flag_DontUseUtilityFloatingWindows is set. If floating windows are normal windows, you might still want them to keep above and not minimize when you focus the main window.
|
||||
Flag_CloseOnlyCurrentTab = 0x20000, ///< The TitleBar's close button will only close the current tab, instead of all of them
|
||||
Flag_ShowButtonsOnTabBarIfTitleBarHidden = 0x40000, ///< When using Flag_HideTitleBarWhenTabsVisible the close/float buttons disappear with the title bar. With Flag_ShowButtonsOnTabBarIfHidden they'll be shown in the tab bar.
|
||||
Flag_AllowSwitchingTabsViaMenu = 0x80000, ///< Allow switching tabs via a context menu when right clicking on the tab area
|
||||
Flag_Default = Flag_AeroSnapWithClientDecos ///< The defaults
|
||||
};
|
||||
Q_DECLARE_FLAGS(Flags, Flag)
|
||||
|
||||
///@brief List of customizable widgets
|
||||
enum CustomizableWidget {
|
||||
enum CustomizableWidget
|
||||
{
|
||||
CustomizableWidget_None = 0, ///< None
|
||||
CustomizableWidget_TitleBar, ///< The title bar
|
||||
CustomizableWidget_DockWidget, ///< The dock widget
|
||||
@@ -96,17 +100,21 @@ public:
|
||||
CustomizableWidget_FloatingWindow, ///< A top-level window. The container for 1 or more Frame nested side by side
|
||||
CustomizableWidget_Separator ///< The draggable separator between dock widgets in a layout
|
||||
};
|
||||
Q_DECLARE_FLAGS(CustomizableWidgets, CustomizableWidget)
|
||||
Q_DECLARE_FLAGS(CustomizableWidgets, CustomizableWidget)
|
||||
|
||||
///@internal
|
||||
///Internal flags for addtional tunning.
|
||||
///Internal flags for additional tuning.
|
||||
///@warning Not for public consumption, support will be limited.
|
||||
enum InternalFlag {
|
||||
enum InternalFlag
|
||||
{
|
||||
InternalFlag_None = 0, ///< The default
|
||||
InternalFlag_NoAeroSnap = 1, ///< Only for development. Disables Aero-snap.
|
||||
InternalFlag_DontUseParentForFloatingWindows = 2, ///< FloatingWindows won't have a parent top-level.
|
||||
InternalFlag_DontUseParentForFloatingWindows = 2, ///< FloatingWindows won't have a parent top-level.
|
||||
InternalFlag_DontUseQtToolWindowsForFloatingWindows = 4, ///< FloatingWindows will use Qt::Window instead of Qt::Tool.
|
||||
InternalFlag_DontShowWhenUnfloatingHiddenWindow = 8 ///< DockWidget::setFloating(false) won't do anything if the window is hidden.
|
||||
InternalFlag_DontShowWhenUnfloatingHiddenWindow = 8, ///< DockWidget::setFloating(false) won't do anything if the window is hidden.
|
||||
InternalFlag_UseTransparentFloatingWindow = 16, ///< For QtQuick only. Allows to have round-corners. It's flaky when used with native Windows drop-shadow.
|
||||
InternalFlag_DisableTranslucency = 32 ///< KDDW tries to detect if your Window Manager doesn't support transparent windows, but the detection might fail
|
||||
/// with more exotic setups. This flag can be used to override.
|
||||
};
|
||||
Q_DECLARE_FLAGS(InternalFlags, InternalFlag)
|
||||
|
||||
@@ -181,6 +189,15 @@ public:
|
||||
///By default it's 1.0, fully opaque
|
||||
qreal draggedWindowOpacity() const;
|
||||
|
||||
/// @brief Allows to disable support for drop indicators while dragging
|
||||
/// By default drop indicators will be shown when dragging dock widgets.
|
||||
/// This functionality can be toggled whenever you need it (it's not a startup-only setting).
|
||||
void setDropIndicatorsInhibited(bool inhibit) const;
|
||||
|
||||
/// @brief Returns whether drop indicators are inhibited.
|
||||
/// by default this is false unless you call setDropIndicatorsInhibited(true)
|
||||
bool dropIndicatorsInhibited() const;
|
||||
|
||||
/**
|
||||
* @brief Allows the user to intercept a docking attempt to center (tabbed) and disallow it.
|
||||
*
|
||||
@@ -237,10 +254,16 @@ public:
|
||||
///@warning Not for public consumption, support will be limited.
|
||||
void setInternalFlags(InternalFlags flags);
|
||||
|
||||
/// @brief Sets the MDI popup threshold. When the layout is MDI and you drag a dock widget
|
||||
/// X pixels behond the window's edge, it will float the dock widget.
|
||||
/// by default this value is 250px. Use -1 to disable
|
||||
void setMDIPopupThreshold(int);
|
||||
int mdiPopupThreshold() const;
|
||||
|
||||
#ifdef KDDOCKWIDGETS_QTQUICK
|
||||
///@brief Sets the QQmlEngine to use. Applicable only when using QtQuick.
|
||||
void setQmlEngine(QQmlEngine *);
|
||||
QQmlEngine* qmlEngine() const;
|
||||
QQmlEngine *qmlEngine() const;
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
||||
@@ -49,8 +49,8 @@ public:
|
||||
* when visible, or stays without a parent when hidden. This allows to support docking
|
||||
* to different main windows.
|
||||
*/
|
||||
explicit DockWidget(const QString &uniqueName, Options options = DockWidgetBase::Options(),
|
||||
LayoutSaverOptions layoutSaverOptions = LayoutSaverOptions());
|
||||
explicit DockWidget(const QString &uniqueName, Options options = KDDockWidgets::DockWidgetBase::Options(),
|
||||
LayoutSaverOptions layoutSaverOptions = KDDockWidgets::DockWidgetBase::LayoutSaverOptions());
|
||||
|
||||
///@brief destructor
|
||||
~DockWidget() override;
|
||||
|
||||
@@ -10,19 +10,21 @@
|
||||
*/
|
||||
|
||||
#include "DockWidgetBase.h"
|
||||
#include "DockWidgetBase_p.h"
|
||||
#include "Frame_p.h"
|
||||
#include "FloatingWindow_p.h"
|
||||
#include "Logging_p.h"
|
||||
#include "Utils_p.h"
|
||||
#include "DockRegistry_p.h"
|
||||
#include "Config.h"
|
||||
#include "TitleBar_p.h"
|
||||
#include "FrameworkWidgetFactory.h"
|
||||
#include "private/DockWidgetBase_p.h"
|
||||
#include "private/DockRegistry_p.h"
|
||||
#include "private/FloatingWindow_p.h"
|
||||
#include "private/Frame_p.h"
|
||||
#include "private/LayoutSaver_p.h"
|
||||
#include "private/Logging_p.h"
|
||||
#include "private/MDILayoutWidget_p.h"
|
||||
#include "private/SideBar_p.h"
|
||||
#include "private/TitleBar_p.h"
|
||||
#include "private/Utils_p.h"
|
||||
#include "private/WindowBeingDragged_p.h"
|
||||
#include "private/Position_p.h"
|
||||
#include "WindowBeingDragged_p.h"
|
||||
#include "SideBar_p.h"
|
||||
#include "LayoutSaver_p.h"
|
||||
|
||||
#include "Config.h"
|
||||
#include "FrameworkWidgetFactory.h"
|
||||
|
||||
#include <QEvent>
|
||||
#include <QCloseEvent>
|
||||
@@ -76,12 +78,18 @@ void DockWidgetBase::addDockWidgetAsTab(DockWidgetBase *other, InitialOption opt
|
||||
return;
|
||||
}
|
||||
|
||||
if ((other->options() & DockWidgetBase::Option_NotDockable) ||
|
||||
(options() & DockWidgetBase::Option_NotDockable)) {
|
||||
if ((other->options() & DockWidgetBase::Option_NotDockable) || (options() & DockWidgetBase::Option_NotDockable)) {
|
||||
qWarning() << Q_FUNC_INFO << "Refusing to dock non-dockable widget" << other;
|
||||
return;
|
||||
}
|
||||
|
||||
if (isPersistentCentralDockWidget()) {
|
||||
qWarning() << Q_FUNC_INFO << "Not supported with MainWindowOption_HasCentralWidget."
|
||||
<< "MainWindowOption_HasCentralWidget can only have 1 widget in the center."
|
||||
<< "Use MainWindowOption_HasCentralFrame instead, which is similar but supports tabbing.";
|
||||
return;
|
||||
}
|
||||
|
||||
Frame *frame = d->frame();
|
||||
|
||||
if (frame) {
|
||||
@@ -110,7 +118,7 @@ void DockWidgetBase::addDockWidgetToContainingWindow(DockWidgetBase *other,
|
||||
DockWidgetBase *relativeTo,
|
||||
InitialOption initialOption)
|
||||
{
|
||||
if (auto mainWindow = qobject_cast<MainWindowBase*>(window())) {
|
||||
if (auto mainWindow = qobject_cast<MainWindowBase *>(window())) {
|
||||
// It's inside a main window. Simply use the main window API.
|
||||
mainWindow->addDockWidget(other, location, relativeTo, initialOption);
|
||||
return;
|
||||
@@ -122,8 +130,7 @@ void DockWidgetBase::addDockWidgetToContainingWindow(DockWidgetBase *other,
|
||||
return;
|
||||
}
|
||||
|
||||
if ((other->options() & DockWidgetBase::Option_NotDockable) ||
|
||||
(options() & DockWidgetBase::Option_NotDockable)) {
|
||||
if ((other->options() & DockWidgetBase::Option_NotDockable) || (options() & DockWidgetBase::Option_NotDockable)) {
|
||||
qWarning() << Q_FUNC_INFO << "Refusing to dock non-dockable widget" << other;
|
||||
return;
|
||||
}
|
||||
@@ -140,7 +147,6 @@ void DockWidgetBase::addDockWidgetToContainingWindow(DockWidgetBase *other,
|
||||
|
||||
void DockWidgetBase::setWidget(QWidgetOrQuick *w)
|
||||
{
|
||||
Q_ASSERT(w);
|
||||
if (w == d->widget)
|
||||
return;
|
||||
|
||||
@@ -154,7 +160,6 @@ void DockWidgetBase::setWidget(QWidgetOrQuick *w)
|
||||
setSizePolicy(w->sizePolicy());
|
||||
|
||||
Q_EMIT widgetChanged(w);
|
||||
setWindowTitle(uniqueName());
|
||||
}
|
||||
|
||||
QWidgetOrQuick *DockWidgetBase::widget() const
|
||||
@@ -184,6 +189,9 @@ bool DockWidgetBase::setFloating(bool floats)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (floats && isPersistentCentralDockWidget())
|
||||
return false;
|
||||
|
||||
if (floats) {
|
||||
d->saveTabIndex();
|
||||
if (isTabbed()) {
|
||||
@@ -203,7 +211,7 @@ bool DockWidgetBase::setFloating(bool floats)
|
||||
auto lastGeo = d->lastPositions().lastFloatingGeometry();
|
||||
if (lastGeo.isValid()) {
|
||||
if (auto fw = floatingWindow())
|
||||
fw->setSuggestedGeometry(lastGeo, /*preserveCenter=*/true);
|
||||
fw->setSuggestedGeometry(lastGeo, SuggestedGeometryHint_PreserveCenter);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
@@ -241,6 +249,15 @@ void DockWidgetBase::setTitle(const QString &title)
|
||||
}
|
||||
}
|
||||
|
||||
QRect DockWidgetBase::frameGeometry() const
|
||||
{
|
||||
if (Frame *f = d->frame())
|
||||
return f->QWidgetAdapter::geometry();
|
||||
|
||||
// Means the dock widget isn't visible. Just fallback to its own geometry
|
||||
return QWidgetAdapter::geometry();
|
||||
}
|
||||
|
||||
DockWidgetBase::Options DockWidgetBase::options() const
|
||||
{
|
||||
return d->options;
|
||||
@@ -280,7 +297,7 @@ bool DockWidgetBase::isTabbed() const
|
||||
bool DockWidgetBase::isCurrentTab() const
|
||||
{
|
||||
if (Frame *frame = d->frame()) {
|
||||
return frame->currentIndex() == frame->indexOfDockWidget(const_cast<DockWidgetBase*>(this));
|
||||
return frame->currentIndex() == frame->indexOfDockWidget(const_cast<DockWidgetBase *>(this));
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
@@ -372,12 +389,15 @@ void DockWidgetBase::raise()
|
||||
if (auto fw = floatingWindow()) {
|
||||
fw->raise();
|
||||
fw->activateWindow();
|
||||
} else if (Frame *frame = d->frame()) {
|
||||
if (frame->isMDI())
|
||||
frame->raise();
|
||||
}
|
||||
}
|
||||
|
||||
bool DockWidgetBase::isMainWindow() const
|
||||
{
|
||||
return qobject_cast<MainWindowBase*>(widget());
|
||||
return qobject_cast<MainWindowBase *>(widget());
|
||||
}
|
||||
|
||||
bool DockWidgetBase::isInMainWindow() const
|
||||
@@ -385,7 +405,7 @@ bool DockWidgetBase::isInMainWindow() const
|
||||
return d->mainWindow() != nullptr;
|
||||
}
|
||||
|
||||
MainWindowBase* DockWidgetBase::mainWindow() const
|
||||
MainWindowBase *DockWidgetBase::mainWindow() const
|
||||
{
|
||||
return d->mainWindow();
|
||||
}
|
||||
@@ -483,7 +503,7 @@ FloatingWindow *DockWidgetBase::Private::morphIntoFloatingWindow()
|
||||
geo = q->geometry();
|
||||
|
||||
if (!q->testAttribute(Qt::WA_PendingMoveEvent)) { // If user already moved it, we don't
|
||||
// interfere
|
||||
// interfere
|
||||
const QPoint center = defaultCenterPosForFloating();
|
||||
if (!center.isNull())
|
||||
geo.moveCenter(center);
|
||||
@@ -492,8 +512,9 @@ FloatingWindow *DockWidgetBase::Private::morphIntoFloatingWindow()
|
||||
|
||||
auto frame = Config::self().frameworkWidgetFactory()->createFrame();
|
||||
frame->addWidget(q);
|
||||
auto floatingWindow = Config::self().frameworkWidgetFactory()->createFloatingWindow(frame);
|
||||
floatingWindow->setSuggestedGeometry(geo);
|
||||
geo.setSize(geo.size().boundedTo(frame->maxSizeHint()));
|
||||
auto floatingWindow =
|
||||
Config::self().frameworkWidgetFactory()->createFloatingWindow(frame, nullptr, geo);
|
||||
floatingWindow->show();
|
||||
|
||||
return floatingWindow;
|
||||
@@ -508,6 +529,14 @@ void DockWidgetBase::Private::maybeMorphIntoFloatingWindow()
|
||||
morphIntoFloatingWindow();
|
||||
}
|
||||
|
||||
MDILayoutWidget *DockWidgetBase::Private::mdiLayout() const
|
||||
{
|
||||
if (auto mw = mainWindow())
|
||||
return mw->mdiLayoutWidget();
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
DockWidgetBase::Private *DockWidgetBase::dptr() const
|
||||
{
|
||||
return d;
|
||||
@@ -539,7 +568,6 @@ void DockWidgetBase::Private::updateTitle()
|
||||
if (q->isFloating())
|
||||
q->window()->setWindowTitle(title);
|
||||
|
||||
|
||||
toggleAction->setText(title);
|
||||
}
|
||||
|
||||
@@ -602,8 +630,21 @@ void DockWidgetBase::Private::close()
|
||||
return;
|
||||
}
|
||||
|
||||
if (!m_isForceClosing && q->isFloating() && q->isVisible()) { // only user-closing is interesting to save the geometry
|
||||
// We check for isVisible so we don't save geometry if you call close() on an already closed dock widget
|
||||
if (m_isPersistentCentralDockWidget)
|
||||
return;
|
||||
|
||||
// If it's overlayed and we're closing, we need to close the overlay
|
||||
if (SideBar *sb = DockRegistry::self()->sideBarForDockWidget(q)) {
|
||||
auto mainWindow = sb->mainWindow();
|
||||
if (mainWindow->overlayedDockWidget() == q) {
|
||||
mainWindow->clearSideBarOverlay(/* deleteFrame=*/false);
|
||||
}
|
||||
}
|
||||
|
||||
if (!m_isForceClosing && q->isFloating()
|
||||
&& q->isVisible()) { // only user-closing is interesting to save the geometry
|
||||
// We check for isVisible so we don't save geometry if you call close() on an already closed
|
||||
// dock widget
|
||||
m_lastPositions.setLastFloatingGeometry(q->window()->geometry());
|
||||
}
|
||||
|
||||
@@ -611,16 +652,18 @@ void DockWidgetBase::Private::close()
|
||||
|
||||
// Do some cleaning. Widget is hidden, but we must hide the tab containing it.
|
||||
if (Frame *frame = this->frame()) {
|
||||
frame->removeWidget(q);
|
||||
q->setParent(nullptr);
|
||||
frame->removeWidget(q);
|
||||
|
||||
if (SideBar *sb = DockRegistry::self()->sideBarForDockWidget(q)) {
|
||||
sb->removeDockWidget(q);
|
||||
}
|
||||
}
|
||||
|
||||
if (!m_isMovingToSideBar && (options & DockWidgetBase::Option_DeleteOnClose))
|
||||
if (!m_isMovingToSideBar && (options & DockWidgetBase::Option_DeleteOnClose)) {
|
||||
Q_EMIT q->aboutToDeleteOnClose();
|
||||
q->deleteLater();
|
||||
}
|
||||
}
|
||||
|
||||
bool DockWidgetBase::Private::restoreToPreviousPosition()
|
||||
@@ -696,6 +739,8 @@ void DockWidgetBase::onParentChanged()
|
||||
#endif
|
||||
d->updateToggleAction();
|
||||
d->updateFloatAction();
|
||||
|
||||
Q_EMIT actualTitleBarChanged();
|
||||
}
|
||||
|
||||
void DockWidgetBase::onShown(bool spontaneous)
|
||||
@@ -744,7 +789,7 @@ void DockWidgetBase::onCloseEvent(QCloseEvent *e)
|
||||
{
|
||||
e->accept(); // By default we accept, means DockWidget closes
|
||||
if (d->widget)
|
||||
qApp->sendEvent(d->widget, e); // Give a chancefor the widget to ignore
|
||||
qApp->sendEvent(d->widget, e); // Give a chance for the widget to ignore
|
||||
|
||||
if (e->isAccepted())
|
||||
d->close();
|
||||
@@ -752,14 +797,8 @@ void DockWidgetBase::onCloseEvent(QCloseEvent *e)
|
||||
|
||||
DockWidgetBase *DockWidgetBase::deserialize(const LayoutSaver::DockWidget::Ptr &saved)
|
||||
{
|
||||
DockWidgetBase *dw = DockRegistry::self()->dockByName(saved->uniqueName);
|
||||
if (!dw) {
|
||||
if (auto factoryFunc = Config::self().dockWidgetFactoryFunc()) {
|
||||
// DockWidget doesn't exist, ask to create it
|
||||
dw = factoryFunc(saved->uniqueName);
|
||||
}
|
||||
}
|
||||
|
||||
auto dr = DockRegistry::self();
|
||||
DockWidgetBase *dw = dr->dockByName(saved->uniqueName, DockRegistry::DockByNameFlag::CreateIfNotFound);
|
||||
if (dw) {
|
||||
if (QWidgetOrQuick *w = dw->widget())
|
||||
w->setVisible(true);
|
||||
@@ -770,14 +809,52 @@ DockWidgetBase *DockWidgetBase::deserialize(const LayoutSaver::DockWidget::Ptr &
|
||||
<< "; to" << saved->affinities;
|
||||
dw->d->affinities = saved->affinities;
|
||||
}
|
||||
|
||||
} else {
|
||||
qWarning() << Q_FUNC_INFO << "Couldn't find dock widget" << saved->uniqueName;
|
||||
}
|
||||
|
||||
return dw;
|
||||
}
|
||||
|
||||
void DockWidgetBase::setUserType(int userType)
|
||||
{
|
||||
d->m_userType = userType;
|
||||
}
|
||||
|
||||
int DockWidgetBase::userType() const
|
||||
{
|
||||
return d->m_userType;
|
||||
}
|
||||
|
||||
void DockWidgetBase::setMDIPosition(QPoint pos)
|
||||
{
|
||||
if (MDILayoutWidget *layout = d->mdiLayout())
|
||||
layout->moveDockWidget(this, pos);
|
||||
}
|
||||
|
||||
void DockWidgetBase::setMDISize(QSize size)
|
||||
{
|
||||
if (MDILayoutWidget *layout = d->mdiLayout())
|
||||
layout->resizeDockWidget(this, size);
|
||||
}
|
||||
|
||||
void DockWidgetBase::setMDIZ(int z)
|
||||
{
|
||||
#ifdef KDDOCKWIDGETS_QTQUICK
|
||||
if (Frame *frame = d->frame()) {
|
||||
if (!frame->isMDI())
|
||||
return;
|
||||
frame->setZ(z);
|
||||
}
|
||||
#else
|
||||
Q_UNUSED(z);
|
||||
qWarning() << Q_FUNC_INFO << "Not implemented for QtQuick";
|
||||
#endif
|
||||
}
|
||||
|
||||
bool DockWidgetBase::isPersistentCentralDockWidget() const
|
||||
{
|
||||
return d->m_isPersistentCentralDockWidget;
|
||||
}
|
||||
|
||||
LayoutSaver::DockWidget::Ptr DockWidgetBase::Private::serialize() const
|
||||
{
|
||||
auto ptr = LayoutSaver::DockWidget::dockWidgetForName(q->uniqueName());
|
||||
@@ -806,8 +883,8 @@ DockWidgetBase::Private::Private(const QString &dockName, DockWidgetBase::Option
|
||||
q->connect(toggleAction, &QAction::toggled, q, [this](bool enabled) {
|
||||
if (!m_updatingToggleAction) { // guard against recursiveness
|
||||
toggleAction->blockSignals(true); // and don't emit spurious toggle. Like when a dock
|
||||
// widget is inserted into a tab widget it might get
|
||||
// hide events, ignore those. The Dock Widget is open.
|
||||
// widget is inserted into a tab widget it might get
|
||||
// hide events, ignore those. The Dock Widget is open.
|
||||
m_processingToggleAction = true;
|
||||
toggle(enabled);
|
||||
toggleAction->blockSignals(false);
|
||||
@@ -859,7 +936,6 @@ Frame *DockWidgetBase::Private::frame() const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
void DockWidgetBase::Private::saveLastFloatingGeometry()
|
||||
{
|
||||
if (q->isFloating() && q->isVisible()) {
|
||||
|
||||
@@ -43,6 +43,7 @@ class TitleBar;
|
||||
class MainWindowBase;
|
||||
class StateDragging;
|
||||
class FrameQuick;
|
||||
class DockWidgetQuick;
|
||||
class LayoutWidget;
|
||||
|
||||
/**
|
||||
@@ -61,27 +62,35 @@ class DOCKS_EXPORT DockWidgetBase : public QWidget
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(bool isFocused READ isFocused NOTIFY isFocusedChanged)
|
||||
Q_PROPERTY(bool isFloating READ isFloating WRITE setFloating NOTIFY isFloatingChanged)
|
||||
Q_PROPERTY(QString uniqueName READ uniqueName CONSTANT)
|
||||
Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged)
|
||||
Q_PROPERTY(QObject *widget READ widget NOTIFY widgetChanged)
|
||||
Q_PROPERTY(KDDockWidgets::DockWidgetBase::Options options READ options WRITE setOptions NOTIFY
|
||||
optionsChanged)
|
||||
public:
|
||||
typedef QVector<DockWidgetBase *> List;
|
||||
|
||||
///@brief DockWidget options to pass at construction time
|
||||
enum Option {
|
||||
enum Option
|
||||
{
|
||||
Option_None = 0, ///< No option, the default
|
||||
Option_NotClosable = 1, ///< The DockWidget can't be closed on the [x], only programatically
|
||||
Option_NotClosable = 1, ///< The DockWidget can't be closed on the [x], only programmatically
|
||||
Option_NotDockable = 2, ///< The DockWidget can't be docked, it's always floating
|
||||
Option_DeleteOnClose = 4 ///< Deletes the DockWidget when closed
|
||||
|
||||
};
|
||||
Q_DECLARE_FLAGS(Options, Option)
|
||||
Q_ENUM(Options);
|
||||
|
||||
/// @brief Options which will affect LayoutSaver save/restore
|
||||
enum class LayoutSaverOption {
|
||||
enum class LayoutSaverOption
|
||||
{
|
||||
None = 0, ///< Just use the defaults
|
||||
Skip = 1, ///< The dock widget won't participate in save/restore. Currently only available for floating windows.
|
||||
};
|
||||
Q_DECLARE_FLAGS(LayoutSaverOptions, LayoutSaverOption)
|
||||
|
||||
enum class IconPlace {
|
||||
enum class IconPlace
|
||||
{
|
||||
TitleBar = 1,
|
||||
TabBar = 2,
|
||||
ToggleAction = 4,
|
||||
@@ -100,8 +109,8 @@ public:
|
||||
* when visible, or stays without a parent when hidden.
|
||||
*/
|
||||
explicit DockWidgetBase(const QString &uniqueName,
|
||||
Options options = DockWidgetBase::Options(),
|
||||
LayoutSaverOptions layoutSaverOptions = LayoutSaverOptions());
|
||||
Options options = KDDockWidgets::DockWidgetBase::Options(),
|
||||
LayoutSaverOptions layoutSaverOptions = KDDockWidgets::DockWidgetBase::LayoutSaverOptions());
|
||||
|
||||
///@brief destructor
|
||||
~DockWidgetBase() override;
|
||||
@@ -114,7 +123,8 @@ public:
|
||||
* shown.
|
||||
* @sa MainWindow::addDockWidget(), DockWidget::addDockWidgetToContainingWindow()
|
||||
*/
|
||||
void addDockWidgetAsTab(DockWidgetBase *other, InitialOption initialOption = {});
|
||||
Q_INVOKABLE void addDockWidgetAsTab(KDDockWidgets::DockWidgetBase *other,
|
||||
KDDockWidgets::InitialOption initialOption = {});
|
||||
|
||||
/**
|
||||
* @brief docks @p other widget into the window that contains this one.
|
||||
@@ -128,9 +138,11 @@ public:
|
||||
* @param initialOption Allows to specify some extra options that are used while docking.
|
||||
* @sa MainWindow::addDockWidget(), DockWidget::addDockWidgetAsTab()
|
||||
*/
|
||||
void addDockWidgetToContainingWindow(DockWidgetBase *other, KDDockWidgets::Location location,
|
||||
DockWidgetBase *relativeTo = nullptr,
|
||||
InitialOption initialOption = {});
|
||||
Q_INVOKABLE void
|
||||
addDockWidgetToContainingWindow(KDDockWidgets::DockWidgetBase *other,
|
||||
KDDockWidgets::Location location,
|
||||
KDDockWidgets::DockWidgetBase *relativeTo = nullptr,
|
||||
KDDockWidgets::InitialOption initialOption = {});
|
||||
|
||||
/**
|
||||
* @brief sets the widget which this dock widget hosts.
|
||||
@@ -169,13 +181,13 @@ public:
|
||||
* @brief Returns the QAction that allows to hide/show the dock widget
|
||||
* Useful to put in menus.
|
||||
*/
|
||||
QAction *toggleAction() const;
|
||||
Q_INVOKABLE QAction *toggleAction() const;
|
||||
|
||||
/**
|
||||
* @brief Returns the QAction that allows to dock/undock the dock widget
|
||||
* Useful to put in menus.
|
||||
*/
|
||||
QAction *floatAction() const;
|
||||
Q_INVOKABLE QAction *floatAction() const;
|
||||
|
||||
/**
|
||||
* @brief the dock widget's unique name.
|
||||
@@ -197,6 +209,18 @@ public:
|
||||
*/
|
||||
void setTitle(const QString &title);
|
||||
|
||||
/**
|
||||
* @brief Returns the size of the dock widget's parent frame.
|
||||
*
|
||||
* This will always be bigger than the DockWidget's size, as there's margins and a title bar.
|
||||
* Also, a frame can contain more than 1 dock widget (tabbed), meaning the geometry will account
|
||||
* for the tab bar and title bar.
|
||||
*
|
||||
* The position of the rect is in layout coordinates. 0,0 is the top-left of the layout
|
||||
* holding the widgets.
|
||||
*/
|
||||
QRect frameGeometry() const;
|
||||
|
||||
/**
|
||||
* @brief Returns the dock widget's options which control behaviour.
|
||||
* @sa setOptions(), optionsChanged()
|
||||
@@ -219,7 +243,7 @@ public:
|
||||
/**
|
||||
* @brief returns if this dock widget is tabbed into another
|
||||
*
|
||||
* Technically a docked DockWidget always lives in a tab widget, but from the user's prespective
|
||||
* Technically a docked DockWidget always lives in a tab widget, but from the user's perspective
|
||||
* it's not tabbed when there's only 1 dock widget, as there are no tabs displayed. Unless
|
||||
* the frame is using Option_AlwaysShowsTabs, in which case this method will return true regardless
|
||||
* if being the single one.
|
||||
@@ -237,7 +261,7 @@ public:
|
||||
/**
|
||||
* @brief Makes this dock widget current in its tab group.
|
||||
*/
|
||||
void setAsCurrentTab();
|
||||
Q_INVOKABLE void setAsCurrentTab();
|
||||
|
||||
|
||||
/**
|
||||
@@ -282,7 +306,7 @@ public:
|
||||
* @brief Returns whether this dock widget is open.
|
||||
* Equivalent to calling toggleAction().isChecked() or isVisible()
|
||||
*/
|
||||
bool isOpen() const;
|
||||
Q_INVOKABLE bool isOpen() const;
|
||||
|
||||
/**
|
||||
* @brief Sets the affinity names. Dock widgets can only dock into dock widgets of the same affinity.
|
||||
@@ -364,7 +388,7 @@ public:
|
||||
* The dockwidget will initially be visible and overlayed on top of the current layout (this is
|
||||
* the auto-hide feature).
|
||||
*/
|
||||
void moveToSideBar();
|
||||
Q_INVOKABLE void moveToSideBar();
|
||||
|
||||
/// @brief Returns whether this dock widget is overlayed from the side-bar.
|
||||
///
|
||||
@@ -396,7 +420,7 @@ public:
|
||||
/// @brief Returns a dock widget by its name
|
||||
/// This is the same name you passed to DockWidget CTOR.
|
||||
/// nullptr is returned if the dock widget isn't found.
|
||||
static DockWidgetBase* byName(const QString &uniqueName);
|
||||
static DockWidgetBase *byName(const QString &uniqueName);
|
||||
|
||||
/// @brief Returns whether this widget has the LayoutSaverOption::Skip flag
|
||||
bool skipsRestore() const;
|
||||
@@ -410,6 +434,26 @@ public:
|
||||
/// added bonus of remembering the requested geometry in case it's still hidden.
|
||||
void setFloatingGeometry(QRect geo);
|
||||
|
||||
///@brief Allows the user to set a type on this dock widget
|
||||
///The type is opaque and will not be interpreted by KDDockWidgets.
|
||||
///This type is passed to FrameWorkWidgetFactory::createTitleBar(), which the user can override
|
||||
///and return different TitleBar subclasses, depending on the type.
|
||||
void setUserType(int userType);
|
||||
int userType() const;
|
||||
|
||||
/// @brief Sets this dock widgets position to pos within the MDI layout
|
||||
/// This only applies if the main window is in MDI mode, which it is not by default
|
||||
void setMDIPosition(QPoint pos);
|
||||
/// @brief like setMDIPosition(), but for the size.
|
||||
void setMDISize(QSize size);
|
||||
/// @brief like setMDIPosition(), but for the Z
|
||||
/// only implemented for QtQuick
|
||||
void setMDIZ(int z);
|
||||
|
||||
///@brief Returns whether this dock widget is the main window persistent central widget
|
||||
///This only applies when using MainWindowOption_HasCentralWidget
|
||||
bool isPersistentCentralDockWidget() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
#ifdef KDDOCKWIDGETS_QTWIDGETS
|
||||
///@brief signal emitted when the parent changed
|
||||
@@ -459,6 +503,12 @@ Q_SIGNALS:
|
||||
/// have it's 'activeWindow' property updated yet at this point.
|
||||
void windowActiveAboutToChange(bool activated);
|
||||
|
||||
///@brief Emitted when the title bar that serves this dock widget changes
|
||||
void actualTitleBarChanged();
|
||||
|
||||
/// @brief Emitted when this dock widget is about to be deleted due to Option_DeleteOnClose
|
||||
void aboutToDeleteOnClose();
|
||||
|
||||
protected:
|
||||
void onParentChanged();
|
||||
void onShown(bool spontaneous);
|
||||
@@ -489,6 +539,7 @@ private:
|
||||
friend class KDDockWidgets::LayoutSaver;
|
||||
friend class KDDockWidgets::MainWindowBase;
|
||||
friend class KDDockWidgets::FrameQuick;
|
||||
friend class KDDockWidgets::DockWidgetQuick;
|
||||
|
||||
/**
|
||||
* @brief Constructs a dock widget from its serialized form.
|
||||
|
||||
@@ -10,6 +10,11 @@
|
||||
*/
|
||||
|
||||
#include "DockWidgetQuick.h"
|
||||
#include "FrameworkWidgetFactory.h"
|
||||
|
||||
#include "private/TitleBar_p.h"
|
||||
#include "private/DockWidgetBase_p.h"
|
||||
#include "private/quick/FrameQuick_p.h"
|
||||
|
||||
#include <Config.h>
|
||||
#include <QQuickItem>
|
||||
@@ -27,9 +32,11 @@ using namespace KDDockWidgets;
|
||||
class DockWidgetQuick::Private
|
||||
{
|
||||
public:
|
||||
Private(DockWidgetQuick *dw)
|
||||
Private(DockWidgetQuick *dw, QQmlEngine *qmlengine)
|
||||
: q(dw)
|
||||
, m_visualItem(q->createItem(Config::self().qmlEngine(), QStringLiteral("qrc:/kddockwidgets/private/quick/qml/DockWidget.qml")))
|
||||
, m_visualItem(q->createItem(qmlengine,
|
||||
Config::self().frameworkWidgetFactory()->dockwidgetFilename().toString()))
|
||||
, m_qmlEngine(qmlengine)
|
||||
{
|
||||
Q_ASSERT(m_visualItem);
|
||||
m_visualItem->setParent(q);
|
||||
@@ -38,11 +45,13 @@ public:
|
||||
|
||||
DockWidgetBase *const q;
|
||||
QQuickItem *const m_visualItem;
|
||||
QQmlEngine *const m_qmlEngine;
|
||||
};
|
||||
|
||||
DockWidgetQuick::DockWidgetQuick(const QString &name, Options options, LayoutSaverOptions layoutSaverOptions)
|
||||
DockWidgetQuick::DockWidgetQuick(const QString &name, Options options,
|
||||
LayoutSaverOptions layoutSaverOptions, QQmlEngine *engine)
|
||||
: DockWidgetBase(name, options, layoutSaverOptions)
|
||||
, d(new Private(this))
|
||||
, d(new Private(this, engine ? engine : Config::self().qmlEngine()))
|
||||
{
|
||||
// To mimic what QtWidgets does when creating a new QWidget.
|
||||
setVisible(false);
|
||||
@@ -55,15 +64,11 @@ DockWidgetQuick::~DockWidgetQuick()
|
||||
|
||||
void DockWidgetQuick::setWidget(const QString &qmlFilename)
|
||||
{
|
||||
QQuickItem *guest = createItem(Config::self().qmlEngine(), qmlFilename);
|
||||
QQuickItem *guest = createItem(d->m_qmlEngine, qmlFilename);
|
||||
if (!guest)
|
||||
return;
|
||||
|
||||
auto adapter = new QWidgetAdapter(this);
|
||||
guest->setParentItem(adapter);
|
||||
guest->setParent(adapter);
|
||||
|
||||
setWidget(adapter);
|
||||
setWidget(guest);
|
||||
}
|
||||
|
||||
void DockWidgetQuick::setWidget(QWidgetAdapter *widget)
|
||||
@@ -73,16 +78,33 @@ void DockWidgetQuick::setWidget(QWidgetAdapter *widget)
|
||||
DockWidgetBase::setWidget(widget);
|
||||
}
|
||||
|
||||
void DockWidgetQuick::setWidget(QQuickItem *guest)
|
||||
{
|
||||
auto adapter = new QWidgetAdapter(this);
|
||||
adapter->setIsWrapper();
|
||||
|
||||
// In case the user app needs to use them:
|
||||
adapter->setProperty("originalParent", QVariant::fromValue(guest->parent()));
|
||||
adapter->setProperty("originalParentItem", QVariant::fromValue(guest->parentItem()));
|
||||
|
||||
guest->setParentItem(adapter);
|
||||
guest->setParent(adapter);
|
||||
QWidgetAdapter::makeItemFillParent(guest);
|
||||
|
||||
setWidget(adapter);
|
||||
}
|
||||
|
||||
bool DockWidgetQuick::event(QEvent *e)
|
||||
{
|
||||
if (e->type() == QEvent::ParentChange) {
|
||||
onParentChanged();
|
||||
Q_EMIT actualTitleBarChanged();
|
||||
} else if (e->type() == QEvent::Show) {
|
||||
onShown(e->spontaneous());
|
||||
} else if (e->type() == QEvent::Hide) {
|
||||
onHidden(e->spontaneous());
|
||||
} else if (e->type() == QEvent::Close) {
|
||||
onCloseEvent(static_cast<QCloseEvent*>(e));
|
||||
onCloseEvent(static_cast<QCloseEvent *>(e));
|
||||
}
|
||||
|
||||
return DockWidgetBase::event(e);
|
||||
@@ -107,3 +129,36 @@ QSize DockWidgetQuick::maximumSize() const
|
||||
|
||||
return DockWidgetBase::maximumSize();
|
||||
}
|
||||
|
||||
TitleBar *DockWidgetQuick::actualTitleBar() const
|
||||
{
|
||||
if (Frame *frame = DockWidgetBase::d->frame())
|
||||
return frame->actualTitleBar();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
QObject *DockWidgetQuick::actualTitleBarObj() const
|
||||
{
|
||||
return actualTitleBar();
|
||||
}
|
||||
|
||||
QQuickItem *DockWidgetQuick::frameVisualItem() const
|
||||
{
|
||||
if (auto frame = qobject_cast<FrameQuick *>(DockWidgetBase::d->frame()))
|
||||
return frame->visualItem();
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void DockWidgetQuick::onGeometryUpdated()
|
||||
{
|
||||
if (auto frame = qobject_cast<FrameQuick *>(DockWidgetBase::d->frame())) {
|
||||
frame->updateConstriants();
|
||||
frame->updateGeometry();
|
||||
}
|
||||
}
|
||||
|
||||
Frame *DockWidgetQuick::frame() const
|
||||
{
|
||||
return qobject_cast<FrameQuick *>(DockWidgetBase::d->frame());
|
||||
}
|
||||
|
||||
@@ -23,10 +23,14 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QCloseEvent;
|
||||
class QQmlEngine;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace KDDockWidgets {
|
||||
|
||||
class Frame;
|
||||
class TitleBar;
|
||||
|
||||
/**
|
||||
* @brief Represents a dock widget.
|
||||
*
|
||||
@@ -35,17 +39,22 @@ namespace KDDockWidgets {
|
||||
class DOCKS_EXPORT DockWidgetQuick : public DockWidgetBase
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QObject *actualTitleBar READ actualTitleBarObj NOTIFY actualTitleBarChanged)
|
||||
public:
|
||||
/**
|
||||
* @brief constructs a new DockWidget
|
||||
* @param uniqueName the name of the dockwidget, should be unique. Use title for user visible text.
|
||||
* @param options optional options controlling behaviour
|
||||
* @param layoutSaverOptions options regarding LayoutSaver behaviour
|
||||
* @param engine the QML engine this dock widget will be created on. If not specified then
|
||||
* Config::self().qmlEngine() will be used
|
||||
*
|
||||
* There's no parent argument. The DockWidget is either parented to FloatingWindow or MainWindow
|
||||
* when visible, or stays without a parent when hidden.
|
||||
*/
|
||||
explicit DockWidgetQuick(const QString &uniqueName, Options options = {},
|
||||
LayoutSaverOptions layoutSaverOptions = LayoutSaverOptions());
|
||||
LayoutSaverOptions layoutSaverOptions = LayoutSaverOptions(),
|
||||
QQmlEngine *engine = nullptr);
|
||||
|
||||
///@brief destructor
|
||||
~DockWidgetQuick() override;
|
||||
@@ -57,12 +66,38 @@ public:
|
||||
/// @reimp
|
||||
void setWidget(QWidgetAdapter *widget) override;
|
||||
|
||||
/// @reimp
|
||||
Q_INVOKABLE void setWidget(QQuickItem *widget);
|
||||
|
||||
/// @reimp
|
||||
QSize minimumSize() const override;
|
||||
|
||||
/// @reimp
|
||||
QSize maximumSize() const override;
|
||||
|
||||
/// @brief Returns the title bar
|
||||
TitleBar *actualTitleBar() const;
|
||||
|
||||
/// @brief Returns the title bar
|
||||
/// Qt6 requires us to include TitleBar_p.h, so instead the Q_PROPERTY uses
|
||||
/// QObject so we don't include private headers in public headers
|
||||
QObject *actualTitleBarObj() const;
|
||||
|
||||
/// @brief Returns the visual item which represents Frame in the screen
|
||||
/// Equivalent to Frame::visualItem().
|
||||
QQuickItem *frameVisualItem() const;
|
||||
|
||||
///@internal
|
||||
Q_INVOKABLE KDDockWidgets::Frame *frame() const;
|
||||
|
||||
/// @brief Called by QtQuick when min-size changes
|
||||
Q_INVOKABLE void onGeometryUpdated();
|
||||
|
||||
Q_SIGNALS:
|
||||
/// @brief The geometry of the frame container this dock widget is in changed
|
||||
/// For example, when dragging a dockwidget
|
||||
void frameGeometryChanged(QRect);
|
||||
|
||||
protected:
|
||||
bool event(QEvent *e) override;
|
||||
|
||||
|
||||
@@ -17,10 +17,11 @@
|
||||
*/
|
||||
|
||||
#include "FocusScope.h"
|
||||
#include "TitleBar_p.h"
|
||||
#include "Frame_p.h"
|
||||
#include "DockWidgetBase.h"
|
||||
#include "DockRegistry_p.h"
|
||||
|
||||
#include "private/TitleBar_p.h"
|
||||
#include "private/Frame_p.h"
|
||||
#include "private/DockRegistry_p.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QGuiApplication>
|
||||
@@ -43,12 +44,27 @@ public:
|
||||
m_inCtor = false;
|
||||
}
|
||||
|
||||
/// @brief Returns whether the last focused widget is the tab widget itself
|
||||
bool lastFocusedIsTabWidget() const
|
||||
{
|
||||
if (!m_lastFocusedInScope)
|
||||
return false;
|
||||
|
||||
if (auto metaObj = m_lastFocusedInScope->metaObject()) {
|
||||
const auto className = QLatin1String(metaObj->className());
|
||||
|
||||
return className == QLatin1String("KDDockWidgets::TabBarWidget")
|
||||
|| className == QLatin1String("KDDockWidgets::TabBarQuick");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
~Private() override;
|
||||
|
||||
void setIsFocused(bool);
|
||||
void onFocusObjectChanged(QObject *);
|
||||
bool isInFocusScope(WidgetType *) const;
|
||||
void emitDockWidgetFocusChanged();
|
||||
|
||||
FocusScope *const q;
|
||||
QWidgetAdapter *const m_thisWidget;
|
||||
@@ -83,10 +99,13 @@ WidgetType *FocusScope::focusedWidget() const
|
||||
|
||||
void FocusScope::focus(Qt::FocusReason reason)
|
||||
{
|
||||
if (d->m_lastFocusedInScope) {
|
||||
if (d->m_lastFocusedInScope && !d->lastFocusedIsTabWidget()) {
|
||||
// When we focus the FocusScope, we give focus to the last focused widget, but let's
|
||||
// do better than focusing a tab widget. The tab widget itself being focused isn't
|
||||
// very useful.
|
||||
d->m_lastFocusedInScope->setFocus(reason);
|
||||
} else {
|
||||
if (auto frame = qobject_cast<Frame*>(d->m_thisWidget)) {
|
||||
if (auto frame = qobject_cast<Frame *>(d->m_thisWidget)) {
|
||||
if (DockWidgetBase *dw = frame->currentDockWidget()) {
|
||||
if (auto guest = dw->widget()) {
|
||||
if (guest->focusPolicy() != Qt::NoFocus)
|
||||
@@ -105,9 +124,6 @@ void FocusScope::Private::setIsFocused(bool is)
|
||||
if (is != m_isFocused) {
|
||||
m_isFocused = is;
|
||||
|
||||
if (is)
|
||||
emitDockWidgetFocusChanged();
|
||||
|
||||
if (!m_inCtor) // Hack so we don't call pure-virtual
|
||||
/* Q_EMIT */ q->isFocusedChangedCallback();
|
||||
}
|
||||
@@ -115,14 +131,14 @@ void FocusScope::Private::setIsFocused(bool is)
|
||||
|
||||
void FocusScope::Private::onFocusObjectChanged(QObject *obj)
|
||||
{
|
||||
auto widget = qobject_cast<WidgetType*>(obj);
|
||||
auto widget = qobject_cast<WidgetType *>(obj);
|
||||
if (!widget) {
|
||||
setIsFocused(false);
|
||||
return;
|
||||
}
|
||||
|
||||
const bool is = isInFocusScope(widget);
|
||||
if (is && m_lastFocusedInScope != widget && !qobject_cast<TitleBar*>(obj)) {
|
||||
if (is && m_lastFocusedInScope != widget && !qobject_cast<TitleBar *>(obj)) {
|
||||
m_lastFocusedInScope = widget;
|
||||
setIsFocused(is);
|
||||
/* Q_EMIT */ q->focusedWidgetChangedCallback();
|
||||
@@ -143,33 +159,3 @@ bool FocusScope::Private::isInFocusScope(WidgetType *widget) const
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void FocusScope::Private::emitDockWidgetFocusChanged()
|
||||
{
|
||||
auto p = qobject_cast<WidgetType*>(qApp->focusObject());
|
||||
if (!p) return;
|
||||
|
||||
// Find the nearest DockWidget and send the focusChangedSignal
|
||||
while (p) {
|
||||
if (auto frame = qobject_cast<Frame*>(p)) {
|
||||
// Special case: The focused widget is inside the frame but not inside the dockwidget.
|
||||
// For example, it's a line edit in the QTabBar. We still need to send the signal for
|
||||
// the current dw in the tab group
|
||||
if (auto dw = frame->currentDockWidget()) {
|
||||
DockRegistry::self()->setFocusedDockWidget(dw);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (p == m_thisWidget)
|
||||
break;
|
||||
|
||||
if (auto dw = qobject_cast<DockWidgetBase*>(p)) {
|
||||
DockRegistry::self()->setFocusedDockWidget(dw);
|
||||
break;
|
||||
}
|
||||
|
||||
p = KDDockWidgets::Private::parentWidget(p);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,8 +22,7 @@
|
||||
#include "docks_export.h"
|
||||
#include "QWidgetAdapter.h"
|
||||
|
||||
namespace KDDockWidgets
|
||||
{
|
||||
namespace KDDockWidgets {
|
||||
///@brief Allows to implement a similar functionality to QtQuick's FocusScope item, in QtWidgets
|
||||
class DOCKS_EXPORT FocusScope
|
||||
{
|
||||
@@ -41,14 +40,14 @@ public:
|
||||
///@brief Returns the widget that's focused in this scope
|
||||
///The widget itself might not have focus as in QWidget::hasFocus(), but will get actual focus
|
||||
///as soon as this scope is focused.
|
||||
WidgetType* focusedWidget() const;
|
||||
WidgetType *focusedWidget() const;
|
||||
|
||||
///@brief Sets focus on this scope.
|
||||
///
|
||||
/// This will call QWidget::focus() on the last QWidget that was focused in this scope.
|
||||
void focus(Qt::FocusReason = Qt::OtherFocusReason);
|
||||
|
||||
/*Q_SIGNALS:*/
|
||||
/*Q_SIGNALS:*/
|
||||
protected:
|
||||
///@brief reimplement in the 1st QObject derived class
|
||||
virtual void isFocusedChangedCallback() = 0;
|
||||
|
||||
@@ -10,37 +10,38 @@
|
||||
*/
|
||||
|
||||
#include "FrameworkWidgetFactory.h"
|
||||
#include "Frame_p.h"
|
||||
#include "TitleBar_p.h"
|
||||
#include "multisplitter/Separator_p.h"
|
||||
#include "FloatingWindow_p.h"
|
||||
#include "Config.h"
|
||||
#include "indicators/ClassicIndicators_p.h"
|
||||
#include "indicators/NullIndicators_p.h"
|
||||
#include "Utils_p.h"
|
||||
#include "TabWidget_p.h"
|
||||
|
||||
#include "private/Frame_p.h"
|
||||
#include "private/TitleBar_p.h"
|
||||
#include "private/multisplitter/Separator_p.h"
|
||||
#include "private/FloatingWindow_p.h"
|
||||
#include "private/indicators/ClassicIndicators_p.h"
|
||||
#include "private/indicators/NullIndicators_p.h"
|
||||
#include "private/Utils_p.h"
|
||||
#include "private/TabWidget_p.h"
|
||||
|
||||
#ifdef KDDOCKWIDGETS_QTWIDGETS
|
||||
# include "widgets/FrameWidget_p.h"
|
||||
# include "widgets/TitleBarWidget_p.h"
|
||||
# include "widgets/TabBarWidget_p.h"
|
||||
# include "widgets/SideBarWidget_p.h"
|
||||
# include "widgets/TabWidgetWidget_p.h"
|
||||
# include "multisplitter/Separator_qwidget.h"
|
||||
# include "widgets/FloatingWindowWidget_p.h"
|
||||
# include "indicators/SegmentedIndicators_p.h"
|
||||
#include "private/widgets/FrameWidget_p.h"
|
||||
#include "private/widgets/TitleBarWidget_p.h"
|
||||
#include "private/widgets/TabBarWidget_p.h"
|
||||
#include "private/widgets/SideBarWidget_p.h"
|
||||
#include "private/widgets/TabWidgetWidget_p.h"
|
||||
#include "private/multisplitter/Separator_qwidget.h"
|
||||
#include "private/widgets/FloatingWindowWidget_p.h"
|
||||
#include "private/indicators/SegmentedIndicators_p.h"
|
||||
|
||||
# include <QRubberBand>
|
||||
# include <QToolButton>
|
||||
#include <QRubberBand>
|
||||
#include <QToolButton>
|
||||
#else
|
||||
# include "DockWidgetQuick.h"
|
||||
# include "quick/FrameQuick_p.h"
|
||||
# include "quick/TitleBarQuick_p.h"
|
||||
# include "quick/TabWidgetQuick_p.h"
|
||||
# include "quick/TabBarQuick_p.h"
|
||||
# include "quick/FloatingWindowQuick_p.h"
|
||||
# include "quick/RubberBandQuick.h"
|
||||
# include "multisplitter/Separator_quick.h"
|
||||
#include "DockWidgetQuick.h"
|
||||
#include "private/quick/FrameQuick_p.h"
|
||||
#include "private/quick/TitleBarQuick_p.h"
|
||||
#include "private/quick/TabWidgetQuick_p.h"
|
||||
#include "private/quick/TabBarQuick_p.h"
|
||||
#include "private/quick/FloatingWindowQuick_p.h"
|
||||
#include "private/quick/RubberBandQuick.h"
|
||||
#include "private/multisplitter/Separator_quick.h"
|
||||
#endif
|
||||
|
||||
// clazy:excludeall=ctor-missing-parent-argument
|
||||
@@ -86,12 +87,12 @@ Layouting::Separator *DefaultWidgetFactory::createSeparator(Layouting::Widget *p
|
||||
|
||||
FloatingWindow *DefaultWidgetFactory::createFloatingWindow(MainWindowBase *parent) const
|
||||
{
|
||||
return new FloatingWindowWidget(parent);
|
||||
return new FloatingWindowWidget(QRect(), parent);
|
||||
}
|
||||
|
||||
FloatingWindow *DefaultWidgetFactory::createFloatingWindow(Frame *frame, MainWindowBase *parent) const
|
||||
FloatingWindow *DefaultWidgetFactory::createFloatingWindow(Frame *frame, MainWindowBase *parent, QRect suggestedGeometry) const
|
||||
{
|
||||
return new FloatingWindowWidget(frame, parent);
|
||||
return new FloatingWindowWidget(frame, suggestedGeometry, parent);
|
||||
}
|
||||
|
||||
DropIndicatorOverlayInterface *DefaultWidgetFactory::createDropIndicatorOverlay(DropArea *dropArea) const
|
||||
@@ -123,7 +124,7 @@ SideBar *DefaultWidgetFactory::createSideBar(SideBarLocation loc, MainWindowBase
|
||||
return new SideBarWidget(loc, parent);
|
||||
}
|
||||
|
||||
QAbstractButton* DefaultWidgetFactory::createTitleBarButton(QWidget *parent, TitleBarButtonType type) const
|
||||
QAbstractButton *DefaultWidgetFactory::createTitleBarButton(QWidget *parent, TitleBarButtonType type) const
|
||||
{
|
||||
if (!parent) {
|
||||
qWarning() << Q_FUNC_INFO << "Parent not provided";
|
||||
@@ -163,9 +164,9 @@ FloatingWindow *DefaultWidgetFactory::createFloatingWindow(MainWindowBase *paren
|
||||
return new FloatingWindowQuick(parent);
|
||||
}
|
||||
|
||||
FloatingWindow *DefaultWidgetFactory::createFloatingWindow(Frame *frame, MainWindowBase *parent) const
|
||||
FloatingWindow *DefaultWidgetFactory::createFloatingWindow(Frame *frame, MainWindowBase *parent, QRect suggestedGeometry) const
|
||||
{
|
||||
return new FloatingWindowQuick(frame, parent);
|
||||
return new FloatingWindowQuick(frame, suggestedGeometry, parent);
|
||||
}
|
||||
|
||||
DropIndicatorOverlayInterface *DefaultWidgetFactory::createDropIndicatorOverlay(DropArea *dropArea) const
|
||||
@@ -217,6 +218,21 @@ QUrl DefaultWidgetFactory::titleBarFilename() const
|
||||
return QUrl(QStringLiteral("qrc:/kddockwidgets/private/quick/qml/TitleBar.qml"));
|
||||
}
|
||||
|
||||
QUrl DefaultWidgetFactory::dockwidgetFilename() const
|
||||
{
|
||||
return QUrl(QStringLiteral("qrc:/kddockwidgets/private/quick/qml/DockWidget.qml"));
|
||||
}
|
||||
|
||||
QUrl DefaultWidgetFactory::frameFilename() const
|
||||
{
|
||||
return QUrl(QStringLiteral("qrc:/kddockwidgets/private/quick/qml/Frame.qml"));
|
||||
}
|
||||
|
||||
QUrl DefaultWidgetFactory::floatingWindowFilename() const
|
||||
{
|
||||
return QUrl(QStringLiteral("qrc:/kddockwidgets/private/quick/qml/FloatingWindow.qml"));
|
||||
}
|
||||
|
||||
#endif // QtQuick
|
||||
|
||||
// iconForButtonType impl is the same for QtQuick and QtWidgets
|
||||
|
||||
@@ -66,9 +66,6 @@ class TabWidgetQuick;
|
||||
*/
|
||||
class DOCKS_EXPORT FrameworkWidgetFactory : public QObject
|
||||
{
|
||||
#ifdef KDDOCKWIDGETS_QTQUICK
|
||||
Q_PROPERTY(QUrl titleBarFilename READ titleBarFilename CONSTANT)
|
||||
#endif
|
||||
Q_OBJECT
|
||||
public:
|
||||
FrameworkWidgetFactory() = default;
|
||||
@@ -83,35 +80,35 @@ public:
|
||||
/// DockWidgets.
|
||||
///@param parent just forward to Frame's constructor
|
||||
///@param options just forward to Frame's constructor
|
||||
virtual Frame* createFrame(QWidgetOrQuick *parent = nullptr, FrameOptions options = FrameOption_None) const = 0;
|
||||
virtual Frame *createFrame(QWidgetOrQuick *parent = nullptr, FrameOptions options = FrameOption_None) const = 0;
|
||||
|
||||
///@brief Called internally by the framework to create a TitleBar
|
||||
/// Override to provide your own TitleBar sub-class. If overridden then
|
||||
/// you also need to override the overload below.
|
||||
///@param frame Just forward to TitleBar's constructor.
|
||||
virtual TitleBar* createTitleBar(Frame *frame) const = 0;
|
||||
virtual TitleBar *createTitleBar(Frame *frame) const = 0;
|
||||
|
||||
///@brief Called internally by the framework to create a TitleBar
|
||||
/// Override to provide your own TitleBar sub-class. If overridden then
|
||||
/// you also need to override the overload above.
|
||||
///@param floatingWindow Just forward to TitleBar's constructor.
|
||||
virtual TitleBar* createTitleBar(FloatingWindow *floatingWindow) const = 0;
|
||||
virtual TitleBar *createTitleBar(FloatingWindow *floatingWindow) const = 0;
|
||||
|
||||
///@brief Called internally by the framework to create a TabWidget
|
||||
/// Override to provide your own TabWidget sub-class.
|
||||
///@param parent Just forward to TabWidget's constructor.
|
||||
virtual TabWidget* createTabWidget(Frame *parent) const = 0;
|
||||
virtual TabWidget *createTabWidget(Frame *parent) const = 0;
|
||||
|
||||
///@brief Called internally by the framework to create a TabBar
|
||||
/// Override to provide your own TabBar sub-class.
|
||||
///@param parent Just forward to TabBar's's constructor.
|
||||
virtual TabBar* createTabBar(TabWidget *parent = nullptr) const = 0;
|
||||
virtual TabBar *createTabBar(TabWidget *parent = nullptr) const = 0;
|
||||
|
||||
///@brief Called internally by the framework to create a Separator
|
||||
/// Override to provide your own Separator sub-class. The Separator allows
|
||||
/// the user to resize nested dock widgets.
|
||||
///@param parent Just forward to Separator's constructor.
|
||||
virtual Layouting::Separator* createSeparator(Layouting::Widget *parent = nullptr) const = 0;
|
||||
virtual Layouting::Separator *createSeparator(Layouting::Widget *parent = nullptr) const = 0;
|
||||
|
||||
///@brief Called internally by the framework to create a FloatingWindow
|
||||
/// Override to provide your own FloatingWindow sub-class. If overridden then
|
||||
@@ -124,7 +121,7 @@ public:
|
||||
/// you also need to override the overloads above.
|
||||
///@param frame Just forward to FloatingWindow's constructor.
|
||||
///@param parent Just forward to FloatingWindow's constructor.
|
||||
virtual FloatingWindow *createFloatingWindow(Frame *frame, MainWindowBase *parent = nullptr) const = 0;
|
||||
virtual FloatingWindow *createFloatingWindow(Frame *frame, MainWindowBase *parent = nullptr, QRect suggestedGeometry = {}) const = 0;
|
||||
|
||||
///@brief Called internally by the framework to create a DropIndicatorOverlayInterface
|
||||
/// Override to provide your own DropIndicatorOverlayInterface sub-class.
|
||||
@@ -143,14 +140,18 @@ public:
|
||||
#ifdef KDDOCKWIDGETS_QTWIDGETS
|
||||
///@brief Called internally by the framework to create a title bar button
|
||||
///@p parent the button's parent
|
||||
virtual QAbstractButton* createTitleBarButton(QWidget *parent, TitleBarButtonType) const = 0;
|
||||
virtual QAbstractButton *createTitleBarButton(QWidget *parent, TitleBarButtonType) const = 0;
|
||||
#else
|
||||
virtual QUrl titleBarFilename() const = 0;
|
||||
virtual QUrl dockwidgetFilename() const = 0;
|
||||
virtual QUrl frameFilename() const = 0;
|
||||
virtual QUrl floatingWindowFilename() const = 0;
|
||||
#endif
|
||||
|
||||
/// @brief Returns the icon to be used with the specified @p type
|
||||
/// @param dpr the device pixel ratio of the button
|
||||
virtual QIcon iconForButtonType(TitleBarButtonType type, qreal dpr) const = 0;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(FrameworkWidgetFactory)
|
||||
};
|
||||
@@ -170,20 +171,24 @@ public:
|
||||
TabBar *createTabBar(TabWidget *parent) const override;
|
||||
Layouting::Separator *createSeparator(Layouting::Widget *parent = nullptr) const override;
|
||||
FloatingWindow *createFloatingWindow(MainWindowBase *parent = nullptr) const override;
|
||||
FloatingWindow *createFloatingWindow(Frame *frame, MainWindowBase *parent = nullptr) const override;
|
||||
DropIndicatorOverlayInterface *createDropIndicatorOverlay(DropArea*) const override;
|
||||
FloatingWindow *createFloatingWindow(Frame *frame, MainWindowBase *parent = nullptr, QRect suggestedGeometry = {}) const override;
|
||||
DropIndicatorOverlayInterface *createDropIndicatorOverlay(DropArea *) const override;
|
||||
QWidgetOrQuick *createRubberBand(QWidgetOrQuick *parent) const override;
|
||||
SideBar *createSideBar(SideBarLocation loc, MainWindowBase *parent) const override;
|
||||
|
||||
#ifdef KDDOCKWIDGETS_QTWIDGETS
|
||||
QAbstractButton* createTitleBarButton(QWidget *parent, TitleBarButtonType) const override;
|
||||
QAbstractButton *createTitleBarButton(QWidget *parent, TitleBarButtonType) const override;
|
||||
#else
|
||||
QUrl titleBarFilename() const override;
|
||||
Q_INVOKABLE QUrl titleBarFilename() const override;
|
||||
QUrl dockwidgetFilename() const override;
|
||||
QUrl frameFilename() const override;
|
||||
QUrl floatingWindowFilename() const override;
|
||||
#endif
|
||||
|
||||
QIcon iconForButtonType(TitleBarButtonType type, qreal dpr) const override;
|
||||
|
||||
static DropIndicatorType s_dropIndicatorType;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(DefaultWidgetFactory)
|
||||
};
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#ifndef KD_KDDOCKWIDGETS_H
|
||||
#define KD_KDDOCKWIDGETS_H
|
||||
|
||||
#include "docks_export.h"
|
||||
#include "Qt5Qt6Compat_p.h"
|
||||
|
||||
#include <QObject>
|
||||
@@ -26,7 +27,7 @@
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
// Only on Windows, where this is popular. On linux the Qt::Tool windows need reparenting. Untested on macOS.
|
||||
# define KDDOCKWIDGETS_SUPPORTS_NESTED_MAINWINDOWS
|
||||
#define KDDOCKWIDGETS_SUPPORTS_NESTED_MAINWINDOWS
|
||||
#endif
|
||||
|
||||
namespace Layouting {
|
||||
@@ -34,105 +35,126 @@ class Item;
|
||||
class ItemBoxContainer;
|
||||
}
|
||||
|
||||
namespace KDDockWidgets
|
||||
namespace KDDockWidgets {
|
||||
DOCKS_EXPORT
|
||||
Q_NAMESPACE
|
||||
class MultiSplitter;
|
||||
class DropArea;
|
||||
|
||||
enum Location
|
||||
{
|
||||
class MultiSplitter;
|
||||
class DropArea;
|
||||
Location_None,
|
||||
Location_OnLeft, ///> Left docking location
|
||||
Location_OnTop, ///> Top docking location
|
||||
Location_OnRight, ///> Right docking location
|
||||
Location_OnBottom ///> Bottom docking location
|
||||
};
|
||||
Q_ENUM_NS(Location)
|
||||
|
||||
enum Location {
|
||||
Location_None,
|
||||
Location_OnLeft, ///> Left docking location
|
||||
Location_OnTop, ///> Top docking location
|
||||
Location_OnRight, ///> Right docking location
|
||||
Location_OnBottom ///> Bottom docking location
|
||||
};
|
||||
enum MainWindowOption
|
||||
{
|
||||
MainWindowOption_None = 0, ///> No option set
|
||||
MainWindowOption_HasCentralFrame = 1, ///> Makes the MainWindow always have a central frame, for tabbing documents
|
||||
MainWindowOption_MDI = 2, ///> The layout will be MDI. DockWidgets can have arbitrary positions, not restricted by any layout
|
||||
MainWindowOption_HasCentralWidget = 4 | MainWindowOption_HasCentralFrame, ///> Similar to MainWindowOption_HasCentralFrame but
|
||||
///> you'll have a central widget which can't be detached (Similar to regular QMainWindow).
|
||||
};
|
||||
Q_DECLARE_FLAGS(MainWindowOptions, MainWindowOption)
|
||||
Q_ENUM_NS(MainWindowOptions)
|
||||
|
||||
enum MainWindowOption {
|
||||
MainWindowOption_None = 0, ///> No option set
|
||||
MainWindowOption_HasCentralFrame = 1, ///> Makes the MainWindow always have a central frame, for tabbing documents
|
||||
MainWindowOption_MDI = 2 ///> EXPERIMENTAL!!1 The layout will be MDI. DockWidgets can have arbitrary positions, not restricted by any layout
|
||||
};
|
||||
Q_DECLARE_FLAGS(MainWindowOptions, MainWindowOption)
|
||||
///@internal
|
||||
///@brief Describes some sizing strategies for the layouting engine.
|
||||
///This is internal. The public API for dealing with sizing is InitialOption.
|
||||
///@sa InitialOption
|
||||
enum class DefaultSizeMode
|
||||
{
|
||||
ItemSize, ///< Simply uses the Item::size() of the item being added. Actual used size might be smaller if our window isn't big enough.
|
||||
Fair, ///< Gives an equal relative size as the items that are already in the layout
|
||||
FairButFloor, ///< Equal to fair, but if the item we're adding is smaller than the fair suggestion, then that small size is used.
|
||||
NoDefaultSizeMode, ///< Don't do any sizing
|
||||
};
|
||||
Q_ENUM_NS(DefaultSizeMode)
|
||||
|
||||
///@internal
|
||||
///@brief Describes some sizing strategies for the layouting engine.
|
||||
///This is internal. The public API for dealing with sizing is InitialOption.
|
||||
///@sa InitialOption
|
||||
enum class DefaultSizeMode {
|
||||
ItemSize, ///< Simply uses the Item::size() of the item being added. Actual used size might be smaller if our window isn't big enough.
|
||||
Fair, ///< Gives an equal relative size as the items that are already in the layout
|
||||
FairButFloor, ///< Equal to fair, but if the item we're adding is smaller than the fair suggestion, then that small size is used.
|
||||
None, ///< Don't do any sizing
|
||||
};
|
||||
///@brief Only here for source-compat with v1.2. Do not use.
|
||||
///Use InitialVisibilityOption instead.
|
||||
enum AddingOption
|
||||
{
|
||||
AddingOption_None = 0,
|
||||
AddingOption_StartHidden
|
||||
};
|
||||
Q_ENUM_NS(AddingOption)
|
||||
|
||||
///@brief Only here for source-compat with v1.2. Do not use.
|
||||
///Use InitialVisibilityOption instead.
|
||||
enum AddingOption {
|
||||
AddingOption_None = 0,
|
||||
AddingOption_StartHidden
|
||||
};
|
||||
enum class InitialVisibilityOption
|
||||
{
|
||||
StartVisible = 0, ///< The dock widget is made visible when docked
|
||||
StartHidden ///< Don't show the dock widget when adding it
|
||||
};
|
||||
Q_ENUM_NS(InitialVisibilityOption)
|
||||
|
||||
enum class InitialVisibilityOption {
|
||||
StartVisible = 0, ///< The dock widget is made visible when docked
|
||||
StartHidden ///< Don't show the dock widget when adding it
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @brief Struct describing the preferred dock widget size and visibility when adding it to a layout
|
||||
*
|
||||
* You can pass this to MainWindowBase::addDockWidget() to give an hint of your preferred size
|
||||
* and visibility.
|
||||
*
|
||||
* See bellow the documentation for InitialOption::visibility and InitialOption::preferredSize.
|
||||
* See below the documentation for InitialOption::visibility and InitialOption::preferredSize.
|
||||
*
|
||||
* @sa MainWindowBase::addDockWidget()
|
||||
*/
|
||||
struct InitialOption
|
||||
struct InitialOption
|
||||
{
|
||||
// Implicit ctors for convenience:
|
||||
|
||||
InitialOption() = default;
|
||||
|
||||
InitialOption(InitialVisibilityOption v)
|
||||
: visibility(v)
|
||||
{
|
||||
// Implicit ctors for convenience:
|
||||
}
|
||||
|
||||
InitialOption() = default;
|
||||
InitialOption(QSize size)
|
||||
: preferredSize(size)
|
||||
{
|
||||
}
|
||||
|
||||
InitialOption(InitialVisibilityOption v)
|
||||
: visibility(v) {}
|
||||
InitialOption(InitialVisibilityOption v, QSize size)
|
||||
: visibility(v)
|
||||
, preferredSize(size)
|
||||
{
|
||||
}
|
||||
|
||||
InitialOption(QSize size)
|
||||
: preferredSize(size) {}
|
||||
QT_DEPRECATED_X("AddingOption is deprecated and will be removed in v1.5. Use InitialVisibilityOption instead.")
|
||||
InitialOption(AddingOption opt)
|
||||
: visibility(opt == AddingOption_StartHidden ? InitialVisibilityOption::StartHidden
|
||||
: InitialVisibilityOption::StartVisible)
|
||||
{
|
||||
}
|
||||
|
||||
InitialOption(InitialVisibilityOption v, QSize size)
|
||||
: visibility(v)
|
||||
, preferredSize(size)
|
||||
{}
|
||||
bool startsHidden() const
|
||||
{
|
||||
return visibility == InitialVisibilityOption::StartHidden;
|
||||
}
|
||||
|
||||
QT_DEPRECATED_X("AddingOption is deprecated and will be removed in v1.5. Use InitialVisibilityOption instead.")
|
||||
InitialOption(AddingOption opt)
|
||||
: visibility(opt == AddingOption_StartHidden ? InitialVisibilityOption::StartHidden
|
||||
: InitialVisibilityOption::StartVisible)
|
||||
{
|
||||
}
|
||||
int preferredLength(Qt::Orientation o) const
|
||||
{
|
||||
return o == Qt::Horizontal ? preferredSize.width()
|
||||
: preferredSize.height();
|
||||
}
|
||||
|
||||
bool startsHidden() const {
|
||||
return visibility == InitialVisibilityOption::StartHidden;
|
||||
}
|
||||
bool hasPreferredLength(Qt::Orientation o) const
|
||||
{
|
||||
return preferredLength(o) > 0;
|
||||
}
|
||||
|
||||
int preferredLength(Qt::Orientation o) const {
|
||||
return o == Qt::Horizontal ? preferredSize.width()
|
||||
: preferredSize.height();
|
||||
}
|
||||
|
||||
bool hasPreferredLength(Qt::Orientation o) const {
|
||||
return preferredLength(o) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* @brief Allows a dock widget to be docked as hidden.
|
||||
*
|
||||
* Next time you call DockWidget::show() it will be shown at that place. This avoids
|
||||
* flickering, as no show()/hide() workarounds are needed.
|
||||
*/
|
||||
const InitialVisibilityOption visibility = InitialVisibilityOption::StartVisible;
|
||||
InitialVisibilityOption visibility = InitialVisibilityOption::StartVisible;
|
||||
|
||||
/**
|
||||
/**
|
||||
* @brief Allows to control the size a dock widget should get when docked.
|
||||
*
|
||||
* If an invalid or empty size is passed then KDDW's default heuristics are applied.
|
||||
@@ -141,102 +163,127 @@ namespace KDDockWidgets
|
||||
* dock widget to the left then only the preferred width will be taken into account, as the
|
||||
* height will simply fill the whole layout.
|
||||
*/
|
||||
const QSize preferredSize;
|
||||
QSize preferredSize;
|
||||
|
||||
private:
|
||||
friend class Layouting::Item;
|
||||
friend class Layouting::ItemBoxContainer;
|
||||
friend class KDDockWidgets::MultiSplitter;
|
||||
friend class KDDockWidgets::DropArea;
|
||||
private:
|
||||
friend class Layouting::Item;
|
||||
friend class Layouting::ItemBoxContainer;
|
||||
friend class KDDockWidgets::MultiSplitter;
|
||||
friend class KDDockWidgets::DropArea;
|
||||
|
||||
InitialOption(DefaultSizeMode mode)
|
||||
: sizeMode(mode) {}
|
||||
|
||||
const DefaultSizeMode sizeMode = DefaultSizeMode::Fair;
|
||||
};
|
||||
|
||||
enum RestoreOption {
|
||||
RestoreOption_None = 0,
|
||||
RestoreOption_RelativeToMainWindow = 1, ///< Skips restoring the main window geometry and the restored dock widgets will use relative sizing.
|
||||
///< Loading layouts won't change the main window geometry and just use whatever the user has at the moment.
|
||||
};
|
||||
Q_DECLARE_FLAGS(RestoreOptions, RestoreOption)
|
||||
|
||||
enum class DropIndicatorType {
|
||||
Classic, ///< The default
|
||||
Segmented, ///< Segmented indicators
|
||||
None ///< Don't show any drop indicators while dragging
|
||||
};
|
||||
|
||||
|
||||
/// @brief Each main window supports 4 sidebars
|
||||
enum class SideBarLocation {
|
||||
None,
|
||||
North,
|
||||
East,
|
||||
West,
|
||||
South
|
||||
};
|
||||
|
||||
///@brief describes a type of button you can have in the title bar
|
||||
enum class TitleBarButtonType {
|
||||
Close,
|
||||
Float,
|
||||
Minimize,
|
||||
Maximize,
|
||||
Normal, // Restore from maximized state
|
||||
AutoHide,
|
||||
UnautoHide
|
||||
};
|
||||
|
||||
///@internal
|
||||
inline Qt5Qt6Compat::qhashtype qHash(SideBarLocation loc, Qt5Qt6Compat::qhashtype seed)
|
||||
InitialOption(DefaultSizeMode mode)
|
||||
: sizeMode(mode)
|
||||
{
|
||||
return ::qHash(static_cast<uint>(loc), seed);
|
||||
}
|
||||
|
||||
///@internal
|
||||
enum CursorPosition {
|
||||
CursorPosition_Undefined = 0,
|
||||
CursorPosition_Left = 1,
|
||||
CursorPosition_Right = 2,
|
||||
CursorPosition_Top = 4,
|
||||
CursorPosition_Bottom = 8,
|
||||
CursorPosition_TopLeft = CursorPosition_Top | CursorPosition_Left,
|
||||
CursorPosition_TopRight = CursorPosition_Top | CursorPosition_Right,
|
||||
CursorPosition_BottomRight = CursorPosition_Bottom | CursorPosition_Right,
|
||||
CursorPosition_BottomLeft = CursorPosition_Bottom | CursorPosition_Left,
|
||||
CursorPosition_All = CursorPosition_Left | CursorPosition_Right | CursorPosition_Top | CursorPosition_Bottom
|
||||
};
|
||||
Q_DECLARE_FLAGS(CursorPositions, CursorPosition)
|
||||
DefaultSizeMode sizeMode = DefaultSizeMode::Fair;
|
||||
};
|
||||
|
||||
///@internal
|
||||
enum FrameOption {
|
||||
FrameOption_None = 0,
|
||||
FrameOption_AlwaysShowsTabs = 1,
|
||||
FrameOption_IsCentralFrame = 2,
|
||||
FrameOption_IsOverlayed = 4
|
||||
};
|
||||
Q_DECLARE_FLAGS(FrameOptions, FrameOption)
|
||||
enum RestoreOption
|
||||
{
|
||||
RestoreOption_None = 0,
|
||||
RestoreOption_RelativeToMainWindow = 1, ///< Skips restoring the main window geometry and the restored dock widgets will use relative sizing.
|
||||
///< Loading layouts won't change the main window geometry and just use whatever the user has at the moment.
|
||||
};
|
||||
Q_DECLARE_FLAGS(RestoreOptions, RestoreOption)
|
||||
Q_ENUM_NS(RestoreOptions)
|
||||
|
||||
///@internal
|
||||
inline QString locationStr(Location loc)
|
||||
{
|
||||
switch (loc) {
|
||||
case KDDockWidgets::Location_None:
|
||||
return QStringLiteral("none");
|
||||
case KDDockWidgets::Location_OnLeft:
|
||||
return QStringLiteral("left");
|
||||
case KDDockWidgets::Location_OnTop:
|
||||
return QStringLiteral("top");
|
||||
case KDDockWidgets::Location_OnRight:
|
||||
return QStringLiteral("right");
|
||||
case KDDockWidgets::Location_OnBottom:
|
||||
return QStringLiteral("bottom");
|
||||
}
|
||||
enum class DropIndicatorType
|
||||
{
|
||||
Classic, ///< The default
|
||||
Segmented, ///< Segmented indicators
|
||||
None ///< Don't show any drop indicators while dragging
|
||||
};
|
||||
Q_ENUM_NS(DropIndicatorType)
|
||||
|
||||
return QString();
|
||||
///@internal
|
||||
enum SuggestedGeometryHint
|
||||
{
|
||||
SuggestedGeometryHint_None,
|
||||
SuggestedGeometryHint_PreserveCenter = 1,
|
||||
SuggestedGeometryHint_GeometryIsFromDocked = 2
|
||||
};
|
||||
Q_DECLARE_FLAGS(SuggestedGeometryHints, SuggestedGeometryHint)
|
||||
Q_ENUM_NS(SuggestedGeometryHint)
|
||||
|
||||
/// @brief Each main window supports 4 sidebars
|
||||
enum class SideBarLocation
|
||||
{
|
||||
None,
|
||||
North,
|
||||
East,
|
||||
West,
|
||||
South
|
||||
};
|
||||
|
||||
///@brief describes a type of button you can have in the title bar
|
||||
enum class TitleBarButtonType
|
||||
{
|
||||
Close,
|
||||
Float,
|
||||
Minimize,
|
||||
Maximize,
|
||||
Normal, // Restore from maximized state
|
||||
AutoHide,
|
||||
UnautoHide
|
||||
};
|
||||
Q_ENUM_NS(TitleBarButtonType)
|
||||
|
||||
///@internal
|
||||
inline Qt5Qt6Compat::qhashtype qHash(SideBarLocation loc, Qt5Qt6Compat::qhashtype seed)
|
||||
{
|
||||
return ::qHash(static_cast<uint>(loc), seed);
|
||||
}
|
||||
|
||||
///@internal
|
||||
enum CursorPosition
|
||||
{
|
||||
CursorPosition_Undefined = 0,
|
||||
CursorPosition_Left = 1,
|
||||
CursorPosition_Right = 2,
|
||||
CursorPosition_Top = 4,
|
||||
CursorPosition_Bottom = 8,
|
||||
CursorPosition_TopLeft = CursorPosition_Top | CursorPosition_Left,
|
||||
CursorPosition_TopRight = CursorPosition_Top | CursorPosition_Right,
|
||||
CursorPosition_BottomRight = CursorPosition_Bottom | CursorPosition_Right,
|
||||
CursorPosition_BottomLeft = CursorPosition_Bottom | CursorPosition_Left,
|
||||
CursorPosition_Horizontal = CursorPosition_Right | CursorPosition_Left,
|
||||
CursorPosition_Vertical = CursorPosition_Top | CursorPosition_Bottom,
|
||||
CursorPosition_All = CursorPosition_Left | CursorPosition_Right | CursorPosition_Top | CursorPosition_Bottom
|
||||
};
|
||||
Q_DECLARE_FLAGS(CursorPositions, CursorPosition)
|
||||
Q_ENUM_NS(CursorPosition)
|
||||
|
||||
///@internal
|
||||
enum FrameOption
|
||||
{
|
||||
FrameOption_None = 0,
|
||||
FrameOption_AlwaysShowsTabs = 1,
|
||||
FrameOption_IsCentralFrame = 2,
|
||||
FrameOption_IsOverlayed = 4,
|
||||
FrameOption_NonDockable = 8 ///> You can't DND and tab things into this Frame
|
||||
};
|
||||
Q_DECLARE_FLAGS(FrameOptions, FrameOption)
|
||||
Q_ENUM_NS(FrameOptions)
|
||||
|
||||
///@internal
|
||||
inline QString locationStr(Location loc)
|
||||
{
|
||||
switch (loc) {
|
||||
case KDDockWidgets::Location_None:
|
||||
return QStringLiteral("none");
|
||||
case KDDockWidgets::Location_OnLeft:
|
||||
return QStringLiteral("left");
|
||||
case KDDockWidgets::Location_OnTop:
|
||||
return QStringLiteral("top");
|
||||
case KDDockWidgets::Location_OnRight:
|
||||
return QStringLiteral("right");
|
||||
case KDDockWidgets::Location_OnBottom:
|
||||
return QStringLiteral("bottom");
|
||||
}
|
||||
|
||||
return QString();
|
||||
}
|
||||
}
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
@@ -11,14 +11,14 @@
|
||||
|
||||
include(CMakeFindDependencyMacro)
|
||||
|
||||
find_dependency(Qt5Widgets REQUIRED)
|
||||
find_dependency(Qt@Qt_VERSION_MAJOR@Widgets REQUIRED)
|
||||
if (@KDDockWidgets_QTQUICK@)
|
||||
find_dependency(Qt5Quick REQUIRED)
|
||||
find_dependency(Qt@Qt_VERSION_MAJOR@Quick REQUIRED)
|
||||
endif()
|
||||
|
||||
if (NOT WIN32 AND NOT APPLE AND NOT EMSCRIPTEN)
|
||||
if (NOT WIN32 AND NOT APPLE AND NOT EMSCRIPTEN AND NOT @KDDockWidgets_QT6@)
|
||||
find_dependency(Qt5X11Extras REQUIRED)
|
||||
endif()
|
||||
|
||||
# Add the targets file
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/KDDockWidgetsTargets.cmake")
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/KDDockWidgets@KDDockWidgets_LIBRARY_QTID@Targets.cmake")
|
||||
|
||||
@@ -18,77 +18,64 @@
|
||||
|
||||
#include "LayoutSaver.h"
|
||||
#include "Config.h"
|
||||
#include "DockRegistry_p.h"
|
||||
#include "DockWidgetBase.h"
|
||||
#include "DockWidgetBase_p.h"
|
||||
#include "FloatingWindow_p.h"
|
||||
#include "Frame_p.h"
|
||||
#include "FrameworkWidgetFactory.h"
|
||||
#include "LayoutSaver_p.h"
|
||||
#include "LayoutWidget_p.h"
|
||||
#include "Logging_p.h"
|
||||
#include "MainWindowBase.h"
|
||||
#include "Position_p.h"
|
||||
#include "DockWidgetBase.h"
|
||||
#include "FrameworkWidgetFactory.h"
|
||||
|
||||
#include "private/LayoutSaver_p.h"
|
||||
#include "private/DockRegistry_p.h"
|
||||
#include "private/DockWidgetBase_p.h"
|
||||
#include "private/FloatingWindow_p.h"
|
||||
#include "private/Frame_p.h"
|
||||
#include "private/LayoutWidget_p.h"
|
||||
#include "private/Logging_p.h"
|
||||
#include "private/Position_p.h"
|
||||
|
||||
#include <qmath.h>
|
||||
#include <QDebug>
|
||||
#include <QSettings>
|
||||
#include <QFile>
|
||||
|
||||
#include <memory>
|
||||
|
||||
/**
|
||||
* Some implementation details:
|
||||
*
|
||||
* Restoring is done in two phases. From the JSON, we construct an intermediate representation,
|
||||
* which doesn't have any GUI types. Finally we then construct the GUI from the intermediate
|
||||
* representation.
|
||||
*
|
||||
* JSON <-> Intermediate rep (bunch non-gui structs) <-> GUI classes
|
||||
*
|
||||
* This is in contrast to many other dock widget frameworks which just do:
|
||||
* serialized <-> GUI
|
||||
*
|
||||
* The advantage of having the intermediate structs is that we can do validations on them and if
|
||||
* we find some corruption we don't even start messing with the GUI.
|
||||
*
|
||||
* See the LayoutSaver::* structs in LayoutSaver_p.h, those are the intermediate structs.
|
||||
* They have methods to convert to/from JSON.
|
||||
* All other gui classes have methods to convert to/from these structs. For example
|
||||
* FloatingWindow::serialize()/deserialize()
|
||||
*/
|
||||
using namespace KDDockWidgets;
|
||||
|
||||
QHash<QString, LayoutSaver::DockWidget::Ptr> LayoutSaver::DockWidget::s_dockWidgets;
|
||||
LayoutSaver::Layout* LayoutSaver::Layout::s_currentLayoutBeingRestored = nullptr;
|
||||
LayoutSaver::Layout *LayoutSaver::Layout::s_currentLayoutBeingRestored = nullptr;
|
||||
|
||||
class KDDockWidgets::LayoutSaver::Private
|
||||
|
||||
inline InternalRestoreOptions internalRestoreOptions(RestoreOptions options)
|
||||
{
|
||||
public:
|
||||
|
||||
struct RAIIIsRestoring
|
||||
{
|
||||
RAIIIsRestoring()
|
||||
{
|
||||
LayoutSaver::Private::s_restoreInProgress = true;
|
||||
}
|
||||
|
||||
~RAIIIsRestoring()
|
||||
{
|
||||
LayoutSaver::Private::s_restoreInProgress = false;
|
||||
}
|
||||
Q_DISABLE_COPY(RAIIIsRestoring)
|
||||
};
|
||||
|
||||
Private(RestoreOptions options)
|
||||
: m_dockRegistry(DockRegistry::self())
|
||||
, m_restoreOptions(options)
|
||||
{
|
||||
if (options == RestoreOption_None) {
|
||||
return InternalRestoreOption::None;
|
||||
} else if (options == RestoreOption_RelativeToMainWindow) {
|
||||
return InternalRestoreOptions(InternalRestoreOption::SkipMainWindowGeometry)
|
||||
| InternalRestoreOption::RelativeFloatingWindowGeometry;
|
||||
} else {
|
||||
qWarning() << Q_FUNC_INFO << "Unknown options" << options;
|
||||
return {};
|
||||
}
|
||||
|
||||
bool matchesAffinity(const QStringList &affinities) const {
|
||||
return m_affinityNames.isEmpty() || affinities.isEmpty() || DockRegistry::self()->affinitiesMatch(m_affinityNames, affinities);
|
||||
}
|
||||
|
||||
|
||||
void floatWidgetsWhichSkipRestore(const QStringList &mainWindowNames);
|
||||
|
||||
template <typename T>
|
||||
void deserializeWindowGeometry(const T &saved, QWidgetOrQuick *topLevel);
|
||||
void deleteEmptyFrames();
|
||||
void clearRestoredProperty();
|
||||
|
||||
std::unique_ptr<QSettings> settings() const;
|
||||
DockRegistry *const m_dockRegistry;
|
||||
const RestoreOptions m_restoreOptions;
|
||||
QStringList m_affinityNames;
|
||||
|
||||
static bool s_restoreInProgress;
|
||||
};
|
||||
}
|
||||
|
||||
bool LayoutSaver::Private::s_restoreInProgress = false;
|
||||
|
||||
|
||||
static QVariantList stringListToVariant(const QStringList &strs)
|
||||
{
|
||||
QVariantList variantList;
|
||||
@@ -166,7 +153,7 @@ QByteArray LayoutSaver::serializeLayout() const
|
||||
layout.mainWindows.push_back(mainWindow->serialize());
|
||||
}
|
||||
|
||||
const QVector<KDDockWidgets::FloatingWindow*> floatingWindows = d->m_dockRegistry->floatingWindows();
|
||||
const QVector<KDDockWidgets::FloatingWindow *> floatingWindows = d->m_dockRegistry->floatingWindows();
|
||||
layout.floatingWindows.reserve(floatingWindows.size());
|
||||
for (KDDockWidgets::FloatingWindow *floatingWindow : floatingWindows) {
|
||||
if (d->matchesAffinity(floatingWindow->affinities()))
|
||||
@@ -203,9 +190,8 @@ bool LayoutSaver::restoreLayout(const QByteArray &data)
|
||||
if (data.isEmpty())
|
||||
return true;
|
||||
|
||||
Private::RAIIIsRestoring isRestoring;
|
||||
|
||||
struct FrameCleanup {
|
||||
struct FrameCleanup
|
||||
{
|
||||
FrameCleanup(LayoutSaver *saver)
|
||||
: m_saver(saver)
|
||||
{
|
||||
@@ -230,11 +216,12 @@ bool LayoutSaver::restoreLayout(const QByteArray &data)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (d->m_restoreOptions & RestoreOption_RelativeToMainWindow)
|
||||
layout.scaleSizes();
|
||||
layout.scaleSizes(d->m_restoreOptions);
|
||||
|
||||
d->floatWidgetsWhichSkipRestore(layout.mainWindowNames());
|
||||
|
||||
Private::RAIIIsRestoring isRestoring;
|
||||
|
||||
// Hide all dockwidgets and unparent them from any layout before starting restore
|
||||
// We only close the stuff that the loaded JSON knows about. Unknown widgets might be newer.
|
||||
|
||||
@@ -245,7 +232,7 @@ bool LayoutSaver::restoreLayout(const QByteArray &data)
|
||||
// 1. Restore main windows
|
||||
for (const LayoutSaver::MainWindow &mw : qAsConst(layout.mainWindows)) {
|
||||
MainWindowBase *mainWindow = d->m_dockRegistry->mainWindowByName(mw.uniqueName);
|
||||
if (!mainWindow ) {
|
||||
if (!mainWindow) {
|
||||
if (auto mwFunc = Config::self().mainWindowFactoryFunc()) {
|
||||
mainWindow = mwFunc(mw.uniqueName);
|
||||
} else {
|
||||
@@ -257,8 +244,14 @@ bool LayoutSaver::restoreLayout(const QByteArray &data)
|
||||
if (!d->matchesAffinity(mainWindow->affinities()))
|
||||
continue;
|
||||
|
||||
if (!(d->m_restoreOptions & RestoreOption_RelativeToMainWindow))
|
||||
if (!(d->m_restoreOptions & InternalRestoreOption::SkipMainWindowGeometry)) {
|
||||
d->deserializeWindowGeometry(mw, mainWindow->window()); // window(), as the MainWindow can be embedded
|
||||
if (mw.windowState != Qt::WindowNoState) {
|
||||
if (auto w = mainWindow->windowHandle()) {
|
||||
w->setWindowState(mw.windowState);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!mainWindow->deserialize(mw))
|
||||
return false;
|
||||
@@ -293,7 +286,8 @@ bool LayoutSaver::restoreLayout(const QByteArray &data)
|
||||
if (!d->matchesAffinity(dw->affinities))
|
||||
continue;
|
||||
|
||||
if (DockWidgetBase *dockWidget = d->m_dockRegistry->dockByName(dw->uniqueName)) {
|
||||
if (DockWidgetBase *dockWidget =
|
||||
d->m_dockRegistry->dockByName(dw->uniqueName, DockRegistry::DockByNameFlag::ConsultRemapping)) {
|
||||
dockWidget->d->lastPositions().deserialize(dw->lastPosition);
|
||||
} else {
|
||||
qWarning() << Q_FUNC_INFO << "Couldn't find dock widget" << dw->uniqueName;
|
||||
@@ -312,6 +306,11 @@ void LayoutSaver::setAffinityNames(const QStringList &affinityNames)
|
||||
}
|
||||
}
|
||||
|
||||
LayoutSaver::Private *LayoutSaver::dptr() const
|
||||
{
|
||||
return d;
|
||||
}
|
||||
|
||||
DockWidgetBase::List LayoutSaver::restoredDockWidgets() const
|
||||
{
|
||||
const DockWidgetBase::List &allDockWidgets = DockRegistry::self()->dockwidgets();
|
||||
@@ -333,13 +332,33 @@ void LayoutSaver::Private::clearRestoredProperty()
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template<typename T>
|
||||
void LayoutSaver::Private::deserializeWindowGeometry(const T &saved, QWidgetOrQuick *topLevel)
|
||||
{
|
||||
topLevel->setGeometry(saved.geometry);
|
||||
// Not simply calling QWidget::setGeometry() here.
|
||||
// For QtQuick we need to modify the QWindow's geometry.
|
||||
|
||||
if (topLevel->isWindow()) {
|
||||
topLevel->setGeometry(saved.geometry);
|
||||
} else {
|
||||
KDDockWidgets::Private::setTopLevelGeometry(saved.geometry, topLevel);
|
||||
}
|
||||
|
||||
topLevel->setVisible(saved.isVisible);
|
||||
}
|
||||
|
||||
LayoutSaver::Private::Private(RestoreOptions options)
|
||||
: m_dockRegistry(DockRegistry::self())
|
||||
, m_restoreOptions(internalRestoreOptions(options))
|
||||
{
|
||||
}
|
||||
|
||||
bool LayoutSaver::Private::matchesAffinity(const QStringList &affinities) const
|
||||
{
|
||||
return m_affinityNames.isEmpty() || affinities.isEmpty()
|
||||
|| DockRegistry::self()->affinitiesMatch(m_affinityNames, affinities);
|
||||
}
|
||||
|
||||
void LayoutSaver::Private::floatWidgetsWhichSkipRestore(const QStringList &mainWindowNames)
|
||||
{
|
||||
// Widgets with the DockWidget::LayoutSaverOption::Skip flag skip restore completely.
|
||||
@@ -355,7 +374,6 @@ void LayoutSaver::Private::floatWidgetsWhichSkipRestore(const QStringList &mainW
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void LayoutSaver::Private::deleteEmptyFrames()
|
||||
@@ -419,7 +437,7 @@ bool LayoutSaver::Layout::fromJson(const QByteArray &jsonData)
|
||||
{
|
||||
QJsonParseError error;
|
||||
QJsonDocument doc = QJsonDocument::fromJson(jsonData, &error);
|
||||
if (error.error == QJsonParseError::NoError) {
|
||||
if (error.error == QJsonParseError::NoError) {
|
||||
fromVariantMap(doc.toVariant().toMap());
|
||||
return true;
|
||||
}
|
||||
@@ -465,25 +483,44 @@ void LayoutSaver::Layout::fromVariantMap(const QVariantMap &map)
|
||||
screenInfo = fromVariantList<LayoutSaver::ScreenInfo>(map.value(QStringLiteral("screenInfo")).toList());
|
||||
}
|
||||
|
||||
void LayoutSaver::Layout::scaleSizes()
|
||||
void LayoutSaver::Layout::scaleSizes(InternalRestoreOptions options)
|
||||
{
|
||||
if (mainWindows.isEmpty())
|
||||
return;
|
||||
|
||||
const bool skipsMainWindowGeometry = options & InternalRestoreOption::SkipMainWindowGeometry;
|
||||
if (!skipsMainWindowGeometry) {
|
||||
// No scaling to do. All windows will be restored with the exact size specified in the
|
||||
// saved JSON layouts.
|
||||
return;
|
||||
}
|
||||
|
||||
// We won't restore MainWindow's geometry, we use whatever the user has now, meaning
|
||||
// we need to scale all dock widgets inside the layout, as the layout might not have
|
||||
// the same size as specified in the saved JSON layout
|
||||
for (auto &mw : mainWindows)
|
||||
mw.scaleSizes();
|
||||
|
||||
for (auto &fw : floatingWindows) {
|
||||
LayoutSaver::MainWindow mw = mainWindowForIndex(fw.parentIndex);
|
||||
if (mw.scalingInfo.isValid())
|
||||
fw.scaleSizes(mw.scalingInfo);
|
||||
|
||||
// MainWindow has a different size than the one in JSON, so we also restore FloatingWindows
|
||||
// relatively to the user set new MainWindow size
|
||||
const bool useRelativeSizesForFloatingWidgets =
|
||||
options & InternalRestoreOption::RelativeFloatingWindowGeometry;
|
||||
|
||||
if (useRelativeSizesForFloatingWidgets) {
|
||||
for (auto &fw : floatingWindows) {
|
||||
LayoutSaver::MainWindow mw = mainWindowForIndex(fw.parentIndex);
|
||||
if (mw.scalingInfo.isValid())
|
||||
fw.scaleSizes(mw.scalingInfo);
|
||||
}
|
||||
}
|
||||
|
||||
const ScalingInfo firstScalingInfo = mainWindows.constFirst().scalingInfo;
|
||||
if (firstScalingInfo.isValid()) {
|
||||
for (auto &dw : allDockWidgets) {
|
||||
// TODO: Determine the best main window. This only interesting for closed dock widget geometry
|
||||
// which was previously floating. But they still have some other main window as parent.
|
||||
// TODO: Determine the best main window. This only interesting for closed dock
|
||||
// widget geometry which was previously floating. But they still have some other
|
||||
// main window as parent.
|
||||
dw->scaleSizes(firstScalingInfo);
|
||||
}
|
||||
}
|
||||
@@ -571,11 +608,6 @@ bool LayoutSaver::Frame::isValid() const
|
||||
return false;
|
||||
}
|
||||
|
||||
if (options > 3) {
|
||||
qWarning() << Q_FUNC_INFO << "Invalid options" << options;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!dockWidgets.isEmpty()) {
|
||||
if (currentTabIndex >= dockWidgets.size() || currentTabIndex < 0) {
|
||||
qWarning() << Q_FUNC_INFO << "Invalid tab index" << currentTabIndex << dockWidgets.size();
|
||||
@@ -598,7 +630,7 @@ bool LayoutSaver::Frame::hasSingleDockWidget() const
|
||||
|
||||
bool LayoutSaver::Frame::skipsRestore() const
|
||||
{
|
||||
return std::all_of(dockWidgets.cbegin(), dockWidgets.cend(), [] (LayoutSaver::DockWidget::Ptr dw) {
|
||||
return std::all_of(dockWidgets.cbegin(), dockWidgets.cend(), [](LayoutSaver::DockWidget::Ptr dw) {
|
||||
return dw->skipsRestore();
|
||||
});
|
||||
}
|
||||
@@ -608,12 +640,7 @@ LayoutSaver::DockWidget::Ptr LayoutSaver::Frame::singleDockWidget() const
|
||||
if (!hasSingleDockWidget())
|
||||
return {};
|
||||
|
||||
return dockWidgets.first();
|
||||
}
|
||||
|
||||
void LayoutSaver::Frame::scaleSizes(const ScalingInfo &scalingInfo)
|
||||
{
|
||||
scalingInfo.applyFactorsTo(geometry);
|
||||
return dockWidgets.first();
|
||||
}
|
||||
|
||||
QVariantMap LayoutSaver::Frame::toVariantMap() const
|
||||
@@ -625,7 +652,7 @@ QVariantMap LayoutSaver::Frame::toVariantMap() const
|
||||
map.insert(QStringLiteral("geometry"), Layouting::rectToMap(geometry));
|
||||
map.insert(QStringLiteral("options"), options);
|
||||
map.insert(QStringLiteral("currentTabIndex"), currentTabIndex);
|
||||
|
||||
map.insert(QStringLiteral("mainWindowUniqueName"), mainWindowUniqueName);
|
||||
map.insert(QStringLiteral("dockWidgets"), dockWidgetNames(dockWidgets));
|
||||
|
||||
return map;
|
||||
@@ -642,8 +669,9 @@ void LayoutSaver::Frame::fromVariantMap(const QVariantMap &map)
|
||||
id = map.value(QStringLiteral("id")).toString();
|
||||
isNull = map.value(QStringLiteral("isNull")).toBool();
|
||||
objectName = map.value(QStringLiteral("objectName")).toString();
|
||||
mainWindowUniqueName = map.value(QStringLiteral("mainWindowUniqueName")).toString();
|
||||
geometry = Layouting::mapToRect(map.value(QStringLiteral("geometry")).toMap());
|
||||
options = map.value(QStringLiteral("options")).toUInt();
|
||||
options = static_cast<QFlags<FrameOption>::Int>(map.value(QStringLiteral("options")).toUInt());
|
||||
currentTabIndex = map.value(QStringLiteral("currentTabIndex")).toInt();
|
||||
|
||||
const QVariantList dockWidgetsV = map.value(QStringLiteral("dockWidgets")).toList();
|
||||
@@ -729,8 +757,7 @@ bool LayoutSaver::FloatingWindow::skipsRestore() const
|
||||
|
||||
void LayoutSaver::FloatingWindow::scaleSizes(const ScalingInfo &scalingInfo)
|
||||
{
|
||||
scalingInfo.applyFactorsTo(/*by-ref*/geometry);
|
||||
multiSplitterLayout.scaleSizes(scalingInfo);
|
||||
scalingInfo.applyFactorsTo(/*by-ref*/ geometry);
|
||||
}
|
||||
|
||||
QVariantMap LayoutSaver::FloatingWindow::toVariantMap() const
|
||||
@@ -739,9 +766,11 @@ QVariantMap LayoutSaver::FloatingWindow::toVariantMap() const
|
||||
map.insert(QStringLiteral("multiSplitterLayout"), multiSplitterLayout.toVariantMap());
|
||||
map.insert(QStringLiteral("parentIndex"), parentIndex);
|
||||
map.insert(QStringLiteral("geometry"), Layouting::rectToMap(geometry));
|
||||
map.insert(QStringLiteral("normalGeometry"), Layouting::rectToMap(normalGeometry));
|
||||
map.insert(QStringLiteral("screenIndex"), screenIndex);
|
||||
map.insert(QStringLiteral("screenSize"), Layouting::sizeToMap(screenSize));
|
||||
map.insert(QStringLiteral("isVisible"), isVisible);
|
||||
map.insert(QStringLiteral("windowState"), windowState);
|
||||
|
||||
if (!affinities.isEmpty())
|
||||
map.insert(QStringLiteral("affinities"), stringListToVariant(affinities));
|
||||
@@ -754,10 +783,12 @@ void LayoutSaver::FloatingWindow::fromVariantMap(const QVariantMap &map)
|
||||
multiSplitterLayout.fromVariantMap(map.value(QStringLiteral("multiSplitterLayout")).toMap());
|
||||
parentIndex = map.value(QStringLiteral("parentIndex")).toInt();
|
||||
geometry = Layouting::mapToRect(map.value(QStringLiteral("geometry")).toMap());
|
||||
normalGeometry = Layouting::mapToRect(map.value(QStringLiteral("normalGeometry")).toMap());
|
||||
screenIndex = map.value(QStringLiteral("screenIndex")).toInt();
|
||||
screenSize = Layouting::mapToSize(map.value(QStringLiteral("screenSize")).toMap());
|
||||
isVisible = map.value(QStringLiteral("isVisible")).toBool();
|
||||
affinities = variantToStringList(map.value(QStringLiteral("affinities")).toList());
|
||||
windowState = Qt::WindowState(map.value(QStringLiteral("windowState"), Qt::WindowNoState).toInt());
|
||||
|
||||
// Compatibility hack. Old json format had a single "affinityName" instead of an "affinities" list:
|
||||
const QString affinityName = map.value(QStringLiteral("affinityName")).toString();
|
||||
@@ -771,11 +802,6 @@ bool LayoutSaver::MainWindow::isValid() const
|
||||
if (!multiSplitterLayout.isValid())
|
||||
return false;
|
||||
|
||||
if (options != MainWindowOption_None && options != MainWindowOption_HasCentralFrame) {
|
||||
qWarning() << Q_FUNC_INFO << "Invalid option" << options;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -788,9 +814,6 @@ void LayoutSaver::MainWindow::scaleSizes()
|
||||
}
|
||||
|
||||
scalingInfo = ScalingInfo(uniqueName, geometry);
|
||||
|
||||
if (scalingInfo.isValid())
|
||||
multiSplitterLayout.scaleSizes(scalingInfo);
|
||||
}
|
||||
|
||||
QVariantMap LayoutSaver::MainWindow::toVariantMap() const
|
||||
@@ -870,18 +893,11 @@ LayoutSaver::DockWidget::Ptr LayoutSaver::MultiSplitter::singleDockWidget() cons
|
||||
|
||||
bool LayoutSaver::MultiSplitter::skipsRestore() const
|
||||
{
|
||||
return std::all_of(frames.cbegin(), frames.cend(), [] (const LayoutSaver::Frame &frame) {
|
||||
return std::all_of(frames.cbegin(), frames.cend(), [](const LayoutSaver::Frame &frame) {
|
||||
return frame.skipsRestore();
|
||||
});
|
||||
}
|
||||
|
||||
void LayoutSaver::MultiSplitter::scaleSizes(const ScalingInfo &)
|
||||
{
|
||||
// scalingInfo.applyFactorsTo(/*by-ref*/size);
|
||||
//for (LayoutSaver::Item &item : items) TODO
|
||||
// item.scaleSizes(scalingInfo);
|
||||
}
|
||||
|
||||
QVariantMap LayoutSaver::MultiSplitter::toVariantMap() const
|
||||
{
|
||||
QVariantMap result;
|
||||
@@ -909,7 +925,7 @@ void LayoutSaver::MultiSplitter::fromVariantMap(const QVariantMap &map)
|
||||
|
||||
void LayoutSaver::Position::scaleSizes(const ScalingInfo &scalingInfo)
|
||||
{
|
||||
scalingInfo.applyFactorsTo(/*by-ref*/lastFloatingGeometry);
|
||||
scalingInfo.applyFactorsTo(/*by-ref*/ lastFloatingGeometry);
|
||||
}
|
||||
|
||||
QVariantMap LayoutSaver::Position::toVariantMap() const
|
||||
@@ -1011,8 +1027,7 @@ void LayoutSaver::ScalingInfo::translatePos(QPoint &pt) const
|
||||
|
||||
void LayoutSaver::ScalingInfo::applyFactorsTo(QPoint &pt) const
|
||||
{
|
||||
pt.setX(qCeil(pt.x() * widthFactor));
|
||||
pt.setY(qCeil(pt.y() * heightFactor));
|
||||
translatePos(pt);
|
||||
}
|
||||
|
||||
void LayoutSaver::ScalingInfo::applyFactorsTo(QSize &sz) const
|
||||
@@ -1029,9 +1044,19 @@ void LayoutSaver::ScalingInfo::applyFactorsTo(QRect &rect) const
|
||||
QPoint pos = rect.topLeft();
|
||||
QSize size = rect.size();
|
||||
|
||||
applyFactorsTo(/*by-ref*/size);
|
||||
applyFactorsTo(/*by-ref*/pos);
|
||||
applyFactorsTo(/*by-ref*/ size);
|
||||
applyFactorsTo(/*by-ref*/ pos);
|
||||
|
||||
rect.moveTopLeft(pos);
|
||||
rect.setSize(size);
|
||||
}
|
||||
|
||||
LayoutSaver::Private::RAIIIsRestoring::RAIIIsRestoring()
|
||||
{
|
||||
LayoutSaver::Private::s_restoreInProgress = true;
|
||||
}
|
||||
|
||||
LayoutSaver::Private::RAIIIsRestoring::~RAIIIsRestoring()
|
||||
{
|
||||
LayoutSaver::Private::s_restoreInProgress = false;
|
||||
}
|
||||
|
||||
@@ -33,6 +33,24 @@ namespace KDDockWidgets {
|
||||
|
||||
class DockWidgetBase;
|
||||
|
||||
|
||||
/**
|
||||
* @brief LayoutSaver allows to save or restore layouts.
|
||||
*
|
||||
* You can save a layout to a file or to a byte array.
|
||||
* JSON is used as the serialized format.
|
||||
*
|
||||
* Example:
|
||||
* LayoutSaver saver;
|
||||
*
|
||||
* // Save to a file:
|
||||
* saver.saveToFile(filename);
|
||||
*
|
||||
* The counterpart of saveToFile() is restoreFromFile().
|
||||
*
|
||||
* You can also save to a QByteArray instead, with serializeLayout().
|
||||
* The counterpart of serializeLayout() is restoreLayout();
|
||||
*/
|
||||
class DOCKS_EXPORT LayoutSaver
|
||||
{
|
||||
public:
|
||||
@@ -86,7 +104,6 @@ public:
|
||||
*/
|
||||
QVector<DockWidgetBase *> restoredDockWidgets() const;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Sets the list of affinity names for which restore and save will be applied on.
|
||||
* Allows to save/restore only a subset of the windows.
|
||||
@@ -95,6 +112,10 @@ public:
|
||||
*/
|
||||
void setAffinityNames(const QStringList &affinityNames);
|
||||
|
||||
/// @internal Returns the private-impl. Not intended for public use.
|
||||
class Private;
|
||||
Private *dptr() const;
|
||||
|
||||
struct Layout;
|
||||
struct MainWindow;
|
||||
struct FloatingWindow;
|
||||
@@ -105,11 +126,11 @@ public:
|
||||
struct Placeholder;
|
||||
struct ScalingInfo;
|
||||
struct ScreenInfo;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(LayoutSaver)
|
||||
friend class ::TestDocks;
|
||||
|
||||
class Private;
|
||||
Private *const d;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -18,44 +18,30 @@
|
||||
|
||||
#include "MainWindow.h"
|
||||
#include "Config.h"
|
||||
#include "DropArea_p.h"
|
||||
#include "Frame_p.h"
|
||||
#include "Logging_p.h"
|
||||
#include "SideBar_p.h"
|
||||
#include "DropAreaWithCentralFrame_p.h"
|
||||
#include "FrameworkWidgetFactory.h"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include "private/DockRegistry_p.h"
|
||||
#include "private/DropAreaWithCentralFrame_p.h"
|
||||
#include "private/DropArea_p.h"
|
||||
#include "private/Frame_p.h"
|
||||
#include "private/Logging_p.h"
|
||||
#include "private/SideBar_p.h"
|
||||
|
||||
#include <QPainter>
|
||||
#include <QScreen>
|
||||
#include <QVBoxLayout>
|
||||
#include <QWindow>
|
||||
|
||||
// clazy:excludeall=ctor-missing-parent-argument,missing-qobject-macro
|
||||
|
||||
using namespace KDDockWidgets;
|
||||
|
||||
class MainWindow::Private
|
||||
{
|
||||
public:
|
||||
|
||||
explicit Private(MainWindowOptions, MainWindowBase *mainWindow)
|
||||
: m_supportsAutoHide(Config::self().flags() & Config::Flag_AutoHideSupport)
|
||||
{
|
||||
if (m_supportsAutoHide) {
|
||||
for (auto location : { SideBarLocation::North, SideBarLocation::East,
|
||||
SideBarLocation::West, SideBarLocation::South}) {
|
||||
m_sideBars.insert(location, Config::self().frameworkWidgetFactory()->createSideBar(location, mainWindow) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const bool m_supportsAutoHide;
|
||||
QHash<SideBarLocation, SideBar*> m_sideBars;
|
||||
};
|
||||
|
||||
namespace KDDockWidgets {
|
||||
class MyCentralWidget : public QWidget
|
||||
{
|
||||
public:
|
||||
explicit MyCentralWidget(QWidget *parent = nullptr) : QWidget(parent)
|
||||
explicit MyCentralWidget(QWidget *parent = nullptr)
|
||||
: QWidget(parent)
|
||||
{
|
||||
setObjectName(QStringLiteral("MyCentralWidget"));
|
||||
}
|
||||
@@ -64,7 +50,41 @@ public:
|
||||
};
|
||||
}
|
||||
|
||||
MyCentralWidget::~MyCentralWidget() {}
|
||||
class MainWindow::Private
|
||||
{
|
||||
public:
|
||||
explicit Private(MainWindowOptions, MainWindow *mainWindow)
|
||||
: q(mainWindow)
|
||||
, m_supportsAutoHide(Config::self().flags() & Config::Flag_AutoHideSupport)
|
||||
, m_centralWidget(new MyCentralWidget(mainWindow))
|
||||
, m_layout(new QHBoxLayout(m_centralWidget)) // 1 level of indirection so we can add some margins
|
||||
{
|
||||
if (m_supportsAutoHide) {
|
||||
for (auto location : { SideBarLocation::North, SideBarLocation::East,
|
||||
SideBarLocation::West, SideBarLocation::South }) {
|
||||
m_sideBars.insert(location, Config::self().frameworkWidgetFactory()->createSideBar(location, mainWindow));
|
||||
}
|
||||
}
|
||||
|
||||
m_layout->setSpacing(0);
|
||||
updateMargins();
|
||||
}
|
||||
|
||||
void updateMargins()
|
||||
{
|
||||
m_layout->setContentsMargins(q->centerWidgetMargins());
|
||||
}
|
||||
|
||||
MainWindow *const q;
|
||||
const bool m_supportsAutoHide;
|
||||
QHash<SideBarLocation, SideBar *> m_sideBars;
|
||||
MyCentralWidget *const m_centralWidget;
|
||||
QHBoxLayout *const m_layout;
|
||||
};
|
||||
|
||||
MyCentralWidget::~MyCentralWidget()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
MainWindow::MainWindow(const QString &name, MainWindowOptions options,
|
||||
@@ -72,26 +92,28 @@ MainWindow::MainWindow(const QString &name, MainWindowOptions options,
|
||||
: MainWindowBase(name, options, parent, flags)
|
||||
, d(new Private(options, this))
|
||||
{
|
||||
auto centralWidget = new MyCentralWidget(this);
|
||||
auto layout = new QHBoxLayout(centralWidget); // 1 level of indirection so we can add some margins
|
||||
layout->setSpacing(0);
|
||||
layout->setContentsMargins(centerWidgetMargins());
|
||||
|
||||
if (d->m_supportsAutoHide) {
|
||||
layout->addWidget(sideBar(SideBarLocation::West));
|
||||
d->m_layout->addWidget(sideBar(SideBarLocation::West));
|
||||
auto innerVLayout = new QVBoxLayout();
|
||||
innerVLayout->setSpacing(0);
|
||||
innerVLayout->setContentsMargins(0, 0, 0, 0);
|
||||
innerVLayout->addWidget(sideBar(SideBarLocation::North));
|
||||
innerVLayout->addWidget(layoutWidget());
|
||||
innerVLayout->addWidget(sideBar(SideBarLocation::South));
|
||||
layout->addLayout(innerVLayout);
|
||||
layout->addWidget(sideBar(SideBarLocation::East));
|
||||
d->m_layout->addLayout(innerVLayout);
|
||||
d->m_layout->addWidget(sideBar(SideBarLocation::East));
|
||||
} else {
|
||||
layout->addWidget(layoutWidget());
|
||||
d->m_layout->addWidget(layoutWidget());
|
||||
}
|
||||
|
||||
setCentralWidget(centralWidget);
|
||||
setCentralWidget(d->m_centralWidget);
|
||||
|
||||
create();
|
||||
connect(windowHandle(), &QWindow::screenChanged, DockRegistry::self(),
|
||||
[this] {
|
||||
d->updateMargins(); // logical dpi might have changed
|
||||
Q_EMIT DockRegistry::self()->windowChangedScreen(windowHandle());
|
||||
});
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
@@ -117,7 +139,8 @@ void MainWindow::resizeEvent(QResizeEvent *ev)
|
||||
|
||||
QMargins MainWindow::centerWidgetMargins() const
|
||||
{
|
||||
return { 1, 5, 1, 1};
|
||||
const QMargins margins = { 1, 5, 1, 1 };
|
||||
return margins * logicalDpiFactor(this);
|
||||
}
|
||||
|
||||
QRect MainWindow::centralAreaGeometry() const
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user