Compare commits
643 Commits
fixing_aer
...
python6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4e79c68a7d | ||
|
|
d80325ec8f | ||
|
|
e9925785ab | ||
|
|
81efda2d11 | ||
|
|
36eef80192 | ||
|
|
306bf26f66 | ||
|
|
e07fb7f121 | ||
|
|
bc86cfcb1f | ||
|
|
63bb7e31cd | ||
|
|
1840d50fc0 | ||
|
|
c6fd4e4bc4 | ||
|
|
46210203f7 | ||
|
|
5a2d000ddd | ||
|
|
c73c26e5cb | ||
|
|
39c3e4fd13 | ||
|
|
011d83b7d9 | ||
|
|
26f1b75976 | ||
|
|
309a90d3a6 | ||
|
|
946e1e977e | ||
|
|
7f1347f15d | ||
|
|
2e498f644b | ||
|
|
ee0272e036 | ||
|
|
4aa87c1758 | ||
|
|
3b1158b82f | ||
|
|
1aee98bebd | ||
|
|
b5a6433950 | ||
|
|
077264fd54 | ||
|
|
bee653cf80 | ||
|
|
e1363aadaa | ||
|
|
43877ca712 | ||
|
|
f7cc54ad38 | ||
|
|
538f318fac | ||
|
|
f0376fa7a2 | ||
|
|
0d2bccc15e | ||
|
|
842b89c36d | ||
|
|
1d74c67bd4 | ||
|
|
ea0dd04bd9 | ||
|
|
a5dbab096b | ||
|
|
f1f555d5ab | ||
|
|
5b60a929ab | ||
|
|
f4404dcbe0 | ||
|
|
dd81e02d94 | ||
|
|
f4643aeefd | ||
|
|
e563ffb673 | ||
|
|
4cceec82ac | ||
|
|
4b868e2078 | ||
|
|
875544a449 | ||
|
|
a2f4c972a6 | ||
|
|
2b0a6e5d06 | ||
|
|
5f7e645ed6 | ||
|
|
59c90c01f9 | ||
|
|
92063ab61b | ||
|
|
003ec5aa5b | ||
|
|
02bf43b468 | ||
|
|
50e1285839 | ||
|
|
3fb6574322 | ||
|
|
fa2501d5e4 | ||
|
|
0fe58fd160 | ||
|
|
01f3042f48 | ||
|
|
6719dd2b9e | ||
|
|
08c058b214 | ||
|
|
e4502d4f64 | ||
|
|
db928a0fca | ||
|
|
5582f37a18 | ||
|
|
a28e152a37 | ||
|
|
d6dea6f426 | ||
|
|
d29f9fdd0d | ||
|
|
a2a80df5df | ||
|
|
48ce3a972f | ||
|
|
9fae250897 | ||
|
|
4dd703dcb2 | ||
|
|
e46b5b2edf | ||
|
|
7febcf2170 | ||
|
|
012ed4cf1d | ||
|
|
18283c4d1a | ||
|
|
2bb46b1cdf | ||
|
|
113263a4a1 | ||
|
|
a6ca44cde6 | ||
|
|
894be60a75 | ||
|
|
244a1bec24 | ||
|
|
51d78ba20b | ||
|
|
8291025dfa | ||
|
|
6ea1d4ca58 | ||
|
|
771bf10951 | ||
|
|
67a3270324 | ||
|
|
cd859d6725 | ||
|
|
092b4afe4a | ||
|
|
f8d0ffe7ba | ||
|
|
10f47a701f | ||
|
|
d3224ed266 | ||
|
|
2ccb5391bb | ||
|
|
5c0c9799a4 | ||
|
|
5ccbb5b056 | ||
|
|
fc04455e93 | ||
|
|
4ae8f461cb | ||
|
|
17539e5b88 | ||
|
|
e53b9c71da | ||
|
|
9275f852d6 | ||
|
|
dd8f46880f | ||
|
|
e9159a08bd | ||
|
|
cf89891e4f | ||
|
|
1cc8824f84 | ||
|
|
b73c526c57 | ||
|
|
add577c46f | ||
|
|
9ddd65ea71 | ||
|
|
b15afa9231 | ||
|
|
f8dfde2784 | ||
|
|
6e0898a31e | ||
|
|
8b98dafba2 | ||
|
|
a123437d03 | ||
|
|
616c871da7 | ||
|
|
925c9725b3 | ||
|
|
1a173a7c72 | ||
|
|
a959da46db | ||
|
|
a9c70d086c | ||
|
|
48bacb2811 | ||
|
|
6b846fcdff | ||
|
|
fdc97fecaf | ||
|
|
86983d58f5 | ||
|
|
58f7edb0bc | ||
|
|
302bbeceb0 | ||
|
|
cd9e16398c | ||
|
|
1e1ea8db34 | ||
|
|
7ac3ea1fcf | ||
|
|
3f661d0322 | ||
|
|
8dad079df5 | ||
|
|
1727e50489 | ||
|
|
1ab9688f58 | ||
|
|
613b1b8524 | ||
|
|
ae5edc9ebf | ||
|
|
d0c15b5da2 | ||
|
|
ccbd15c922 | ||
|
|
7b9673e4e2 | ||
|
|
7fbcbbacdf | ||
|
|
d1f48b0685 | ||
|
|
9ee6b91f61 | ||
|
|
e6c89c0564 | ||
|
|
8b97088c70 | ||
|
|
e5809c06c7 | ||
|
|
23b69d4e9e | ||
|
|
0f468033fb | ||
|
|
468074cda8 | ||
|
|
7acbe0c62e | ||
|
|
2c1a70280a | ||
|
|
d2fa5efafe | ||
|
|
a437bc5d07 | ||
|
|
2447bb12c8 | ||
|
|
1082d5e8e1 | ||
|
|
3b1ac9a2d0 | ||
|
|
4635405fb5 | ||
|
|
c481875e55 | ||
|
|
62f50f9458 | ||
|
|
c86252665c | ||
|
|
d141863ffb | ||
|
|
e99b9678e4 | ||
|
|
e0a034748d | ||
|
|
c3377431cc | ||
|
|
2fb70009cc | ||
|
|
289ddffbe2 | ||
|
|
54738bbea2 | ||
|
|
5c6eb352d6 | ||
|
|
f657399ef8 | ||
|
|
be0f72ca25 | ||
|
|
31598d8334 | ||
|
|
5e64463a8c | ||
|
|
27ffb64eb4 | ||
|
|
c4ffe10e12 | ||
|
|
efcad6d2be | ||
|
|
c7dc7bdb3d | ||
|
|
b6925c928a | ||
|
|
75368d334a | ||
|
|
d39ce8f66e | ||
|
|
805ea41d8a | ||
|
|
d7ed2494be | ||
|
|
0990337cdc | ||
|
|
e41cdb6f78 | ||
|
|
666673a251 | ||
|
|
34cb2ae5f0 | ||
|
|
51d8c2ff3e | ||
|
|
aa9f50d0f4 | ||
|
|
b7c36a2ec9 | ||
|
|
e18fb7ffd8 | ||
|
|
96439339c7 | ||
|
|
04d418b2e9 | ||
|
|
c04d856322 | ||
|
|
1c41c33f33 | ||
|
|
1dae128511 | ||
|
|
eab80c0545 | ||
|
|
288c3df30b | ||
|
|
e8728e8a35 | ||
|
|
94bfc4f2d1 | ||
|
|
d2da07508a | ||
|
|
7082e40cd5 | ||
|
|
2c8bbd10f7 | ||
|
|
ed8a401fe8 | ||
|
|
72428075f0 | ||
|
|
562db7c812 | ||
|
|
3ee15d1307 | ||
|
|
cf232dda34 | ||
|
|
bfeac02a45 | ||
|
|
22f4c36eb0 | ||
|
|
3dc56ea4ef | ||
|
|
cbedc06e97 | ||
|
|
8f85f28ed4 | ||
|
|
b5c2757874 | ||
|
|
46f57ffbbc | ||
|
|
fb6e2afd7b | ||
|
|
f74eb73326 | ||
|
|
ceb796d807 | ||
|
|
9a9488117c | ||
|
|
e55d75ba98 | ||
|
|
742763e6e5 | ||
|
|
d7242f17b7 | ||
|
|
eba395dc4c | ||
|
|
89635d8b98 | ||
|
|
f475312f11 | ||
|
|
9f604829dd | ||
|
|
85f829f97a | ||
|
|
e3bb0b3d48 | ||
|
|
22c0b6f9b6 | ||
|
|
200cb7aded | ||
|
|
4999fdd819 | ||
|
|
76aca4139a | ||
|
|
64276cb872 | ||
|
|
aad63d117b | ||
|
|
bd66af0a9f | ||
|
|
a21d80279e | ||
|
|
4347aefc8f | ||
|
|
b6341154fb | ||
|
|
16f6692b79 | ||
|
|
6c1026956a | ||
|
|
97679abb02 | ||
|
|
e173a4cfff | ||
|
|
26971ef1e2 | ||
|
|
d7bde47105 | ||
|
|
143c82291d | ||
|
|
979b2fdd40 | ||
|
|
46337d900b | ||
|
|
ec1f1bea9a | ||
|
|
d207028d60 | ||
|
|
a237eae508 | ||
|
|
243396f22b | ||
|
|
f240bf5d40 | ||
|
|
785db1b50c | ||
|
|
b6a7048a4f | ||
|
|
52bff59024 | ||
|
|
bba0195196 | ||
|
|
41fdb9c7df | ||
|
|
c1c1da25a8 | ||
|
|
b4e7b97646 | ||
|
|
2c687fe469 | ||
|
|
10e0402afa | ||
|
|
ebb1179167 | ||
|
|
15c196d865 | ||
|
|
e897ce6e8e | ||
|
|
83d9db1b64 | ||
|
|
60331fc654 | ||
|
|
e8f16dd172 | ||
|
|
44bd451362 | ||
|
|
1d2a791dfc | ||
|
|
a4ba45b423 | ||
|
|
12576970c6 | ||
|
|
e0ee7d14b0 | ||
|
|
66f447ad3f | ||
|
|
75db599142 | ||
|
|
a5c65ae039 | ||
|
|
5c055e0b8d | ||
|
|
090483f04e | ||
|
|
953219f6f3 | ||
|
|
8356bb0c3c | ||
|
|
758548f7a2 | ||
|
|
2aa16eb6d9 | ||
|
|
9d6cef24c1 | ||
|
|
52999d4cc9 | ||
|
|
bc2fff2c04 | ||
|
|
40fa4e98f8 | ||
|
|
a07f63a2c7 | ||
|
|
39c9a4da9b | ||
|
|
e0aa547393 | ||
|
|
08eab8882f | ||
|
|
04723ac3a9 | ||
|
|
c25043fa00 | ||
|
|
5372920cd0 | ||
|
|
28ae4c3b8c | ||
|
|
6158ebd520 | ||
|
|
b77430e574 | ||
|
|
fad81d595a | ||
|
|
0980a7f601 | ||
|
|
46830713e0 | ||
|
|
cd796db0ff | ||
|
|
29da5f4a8a | ||
|
|
315bdc71e5 | ||
|
|
a8965bea91 | ||
|
|
bf259c7ffc | ||
|
|
8a990451d7 | ||
|
|
974bdbd637 | ||
|
|
cb9d77cd18 | ||
|
|
af10efa587 | ||
|
|
a0fb47af58 | ||
|
|
598fbdc51b | ||
|
|
81c3f3f0c6 | ||
|
|
b9962b3df0 | ||
|
|
a71386e62a | ||
|
|
812ce1c08b | ||
|
|
189e82450b | ||
|
|
a3dbc3739c | ||
|
|
c8d34375af | ||
|
|
6c3775ea45 | ||
|
|
5a72e1adab | ||
|
|
0f7f310734 | ||
|
|
e8bf2a5222 | ||
|
|
468f545c9a | ||
|
|
a59ff6dfee | ||
|
|
4fa415ba05 | ||
|
|
d851c60b2f | ||
|
|
bf097098e5 | ||
|
|
8c93b85a24 | ||
|
|
f87d67dd59 | ||
|
|
bc3278b218 | ||
|
|
d2c55a67df | ||
|
|
a3414fd92b | ||
|
|
12f3ba9074 | ||
|
|
034d2c8aee | ||
|
|
ad3f4141c8 | ||
|
|
cde2e4e571 | ||
|
|
e0775467b2 | ||
|
|
b20ffcde61 | ||
|
|
43bdb6a4c2 | ||
|
|
929aabdc0d | ||
|
|
6a90a5125f | ||
|
|
77016a619f | ||
|
|
dc328ff7c4 | ||
|
|
dc13665566 | ||
|
|
d1279ab119 | ||
|
|
80bf6032f3 | ||
|
|
22437e75c6 | ||
|
|
801e49de9d | ||
|
|
a847a574ed | ||
|
|
ef8807bc09 | ||
|
|
d441477fa9 | ||
|
|
ece7b22bec | ||
|
|
97d8e4f18b | ||
|
|
9937f5d789 | ||
|
|
675edfe6db | ||
|
|
c23d179385 | ||
|
|
36af020505 | ||
|
|
7b2d195139 | ||
|
|
984ab3bb13 | ||
|
|
0331f90791 | ||
|
|
b19c53d650 | ||
|
|
3670cf2377 | ||
|
|
864670b0a1 | ||
|
|
0cf148b389 | ||
|
|
921d0892a0 | ||
|
|
beb2d9e659 | ||
|
|
59168da231 | ||
|
|
3dbf699c49 | ||
|
|
baa7561b13 | ||
|
|
ac5f4b871c | ||
|
|
52bf449366 | ||
|
|
08a1c4e6df | ||
|
|
156dad6e03 | ||
|
|
b642d2df2f | ||
|
|
5cedfab82c | ||
|
|
af9d62a58c | ||
|
|
0758496b0d | ||
|
|
a452723919 | ||
|
|
774e66ba6f | ||
|
|
f13de89db5 | ||
|
|
1393ae224f | ||
|
|
d92d7c258c | ||
|
|
619ca74051 | ||
|
|
aa39a71ae5 | ||
|
|
f4e33c1409 | ||
|
|
ad96336a36 | ||
|
|
50d1e75709 | ||
|
|
793c4e509b | ||
|
|
e4a33ad8b7 | ||
|
|
52cf53ce5c | ||
|
|
8791870efb | ||
|
|
4f8c47bfa4 | ||
|
|
ad141df6b1 | ||
|
|
72605292b7 | ||
|
|
1443eff1d9 | ||
|
|
22d5db32ce | ||
|
|
e9a321039f | ||
|
|
b93f115b53 | ||
|
|
7faaf2cc69 | ||
|
|
978f9d3a5e | ||
|
|
09793b3481 | ||
|
|
f4d9a96ddb | ||
|
|
4ac892038f | ||
|
|
387ba291be | ||
|
|
5d3d189774 | ||
|
|
a6a1047f75 | ||
|
|
3e70b846e8 | ||
|
|
0a2aebd78d | ||
|
|
ddad0feaf3 | ||
|
|
aba1cce1f6 | ||
|
|
7318675e84 | ||
|
|
cf700f8eb6 | ||
|
|
2c1d099c83 | ||
|
|
91ff29ae64 | ||
|
|
523dfb0d12 | ||
|
|
b84e0f3605 | ||
|
|
f72e8e6a1c | ||
|
|
c6c1fe79c3 | ||
|
|
ea382dcc17 | ||
|
|
c142eb8ecd | ||
|
|
46c039153e | ||
|
|
473f03360c | ||
|
|
3fb3984a72 | ||
|
|
9c5e3cf5af | ||
|
|
7419ca806d | ||
|
|
8a51c31663 | ||
|
|
a586a7894b | ||
|
|
31fcbebaff | ||
|
|
c4cc6b3e6e | ||
|
|
420ac9044e | ||
|
|
392dac5691 | ||
|
|
29744c01c6 | ||
|
|
a16adb9578 | ||
|
|
49e488df24 | ||
|
|
1a3f00eac8 | ||
|
|
c6ea8d5525 | ||
|
|
7738585d01 | ||
|
|
61bc24c6ea | ||
|
|
ae90001d7a | ||
|
|
c0ea3a097c | ||
|
|
abca57be11 | ||
|
|
645201480c | ||
|
|
8cffba3e22 | ||
|
|
8f62004f5b | ||
|
|
4fff6edb7b | ||
|
|
64cff4ba49 | ||
|
|
ce3c4d5661 | ||
|
|
5f333f0934 | ||
|
|
f70722934c | ||
|
|
b9eb9f10d4 | ||
|
|
6f89d94eef | ||
|
|
3a494d706a | ||
|
|
2ffbe07bcf | ||
|
|
371fd361a8 | ||
|
|
97416607e5 | ||
|
|
51ccbe7c7c | ||
|
|
65599399c7 | ||
|
|
c0816d4924 | ||
|
|
2988e97e14 | ||
|
|
046ceae500 | ||
|
|
33c0cda582 | ||
|
|
df7acc1075 | ||
|
|
3859e4b277 | ||
|
|
26253b65c7 | ||
|
|
424453ab57 | ||
|
|
d7de0ebd20 | ||
|
|
bf1c5140cd | ||
|
|
fb7a35db5b | ||
|
|
5872c2fbe3 | ||
|
|
ba04c70d5a | ||
|
|
de1e2d301f | ||
|
|
b67bdf779e | ||
|
|
78a3221395 | ||
|
|
f698b56dad | ||
|
|
4ed18fdf1d | ||
|
|
6e05f13c77 | ||
|
|
cb51d0af11 | ||
|
|
a146cd81b2 | ||
|
|
8dbd6df456 | ||
|
|
ac6d845c8d | ||
|
|
cfc9d1abcd | ||
|
|
a66748f6ca | ||
|
|
e5f46ead3b | ||
|
|
171023558e | ||
|
|
059a424b88 | ||
|
|
307b22deaf | ||
|
|
e405688f67 | ||
|
|
68554119f4 | ||
|
|
86a4a740ef | ||
|
|
0a004b83ca | ||
|
|
4fa47403c5 | ||
|
|
9e418ced53 | ||
|
|
bc04863439 | ||
|
|
77f259a435 | ||
|
|
16bcace663 | ||
|
|
52fddaa1cd | ||
|
|
f3d7400c15 | ||
|
|
7ebc3f3533 | ||
|
|
0ee94b425e | ||
|
|
d44a173945 | ||
|
|
ac001d6f32 | ||
|
|
e3de2df69c | ||
|
|
39d3c90b2f | ||
|
|
bca21defa5 | ||
|
|
dd3116ae7f | ||
|
|
49b3765eae | ||
|
|
1f5dd35bec | ||
|
|
6fce8e6161 | ||
|
|
e57b46979d | ||
|
|
683b67abb0 | ||
|
|
6479bcabfb | ||
|
|
a8c9735652 | ||
|
|
93b25b6a31 | ||
|
|
4eb5a0940e | ||
|
|
c2cc914b5c | ||
|
|
1219ba90af | ||
|
|
beef3c7fb5 | ||
|
|
52184ca72b | ||
|
|
78cd7c56f7 | ||
|
|
7805a1dc25 | ||
|
|
92f426e4c0 | ||
|
|
90f10042fd | ||
|
|
697c140883 | ||
|
|
3369816d31 | ||
|
|
819725351a | ||
|
|
860cbd29bc | ||
|
|
07db9f9a7a | ||
|
|
2fd4f9ce97 | ||
|
|
77d7cd7d58 | ||
|
|
e5cb42c4fe | ||
|
|
1fe1d619a9 | ||
|
|
697cc34c23 | ||
|
|
b00d1d80b0 | ||
|
|
67bb42c5b4 | ||
|
|
d50fcb80c5 | ||
|
|
9571ffc30e | ||
|
|
f4a88276b8 | ||
|
|
4ea254029a | ||
|
|
f5e85c2196 | ||
|
|
926103325c | ||
|
|
20b2988165 | ||
|
|
39aefd312b | ||
|
|
b5478bcb0d | ||
|
|
d403557b9e | ||
|
|
db9884ea64 | ||
|
|
74148aabc3 | ||
|
|
7bfac091ae | ||
|
|
60a68817b6 | ||
|
|
a56e6d7fe8 | ||
|
|
1f0b208922 | ||
|
|
9da147f50e | ||
|
|
c175451284 | ||
|
|
9a88cf3a72 | ||
|
|
d0255e5310 | ||
|
|
2a2fb0a4f2 | ||
|
|
b0ad939db8 | ||
|
|
5abf118b8c | ||
|
|
f5099167b6 | ||
|
|
30949bd4c3 | ||
|
|
63279c187e | ||
|
|
fad03f8e0b | ||
|
|
6edfcc4f02 | ||
|
|
17df7b5b4e | ||
|
|
62cbd823c9 | ||
|
|
bdcc211308 | ||
|
|
ddeb4611a1 | ||
|
|
ad639c8001 | ||
|
|
15dc64d550 | ||
|
|
03b575d16e | ||
|
|
4cacee45e8 | ||
|
|
873b860203 | ||
|
|
128ae2d889 | ||
|
|
b0ec0e22e4 | ||
|
|
6aa4e979dc | ||
|
|
36f225b859 | ||
|
|
48a75b2450 | ||
|
|
2af4f939dd | ||
|
|
b592d21064 | ||
|
|
3cdd5afe7a | ||
|
|
0ef56c1302 | ||
|
|
96f7f38a0e | ||
|
|
689ba7da8f | ||
|
|
951aeece6e | ||
|
|
2ea0d54e6c | ||
|
|
1c98fe04ca | ||
|
|
59a9ab6642 | ||
|
|
7ee5949ae2 | ||
|
|
721f08e29b | ||
|
|
df07133c9d | ||
|
|
b9e3024720 | ||
|
|
d848d3e39a | ||
|
|
3f26f4c8f2 | ||
|
|
dc9d709dd7 | ||
|
|
543f734650 | ||
|
|
3fb723a82f | ||
|
|
71c2f34ed4 | ||
|
|
d4b3bf9de6 | ||
|
|
2b234f313c | ||
|
|
d1b2d17f7d | ||
|
|
f062ab7a64 | ||
|
|
f009f57581 | ||
|
|
f86a818e69 | ||
|
|
bb80c2158d | ||
|
|
86fa6258f6 | ||
|
|
545536fab5 | ||
|
|
ef23553b66 | ||
|
|
fcf56664cc | ||
|
|
d932166bcd | ||
|
|
0c5783774d | ||
|
|
aa42ea15f7 | ||
|
|
9dd778d55d | ||
|
|
ac35a919f4 | ||
|
|
a32c5017e6 | ||
|
|
7995a6d13b | ||
|
|
d4ec2eec88 | ||
|
|
12ad3b3484 | ||
|
|
9a53c36c14 | ||
|
|
8fb3802343 | ||
|
|
c035df7e85 | ||
|
|
92f81e28ca | ||
|
|
7a87db608b | ||
|
|
d42fb81790 | ||
|
|
73934e2f90 | ||
|
|
1c8642298b | ||
|
|
bfc45bb0e9 | ||
|
|
58af9e2516 | ||
|
|
4228c044ea | ||
|
|
ccc0aec968 | ||
|
|
3718d3fe79 | ||
|
|
26ed9b722b | ||
|
|
6751669249 | ||
|
|
c7955dce1e | ||
|
|
2e432f402f | ||
|
|
07791cd901 | ||
|
|
1458da92d9 | ||
|
|
c56f998292 | ||
|
|
991075d69e | ||
|
|
234ca75728 | ||
|
|
e34d62d3e5 | ||
|
|
423be28afd | ||
|
|
eb7bed9601 | ||
|
|
fa09521012 | ||
|
|
bb30f322a3 | ||
|
|
0e35c93ae5 | ||
|
|
603224e553 | ||
|
|
9b82063d52 | ||
|
|
c210a523e3 | ||
|
|
e33151d482 | ||
|
|
835f67a106 | ||
|
|
a50f6ec602 | ||
|
|
4a49dbc6b4 | ||
|
|
05c843397b | ||
|
|
e4871eb340 | ||
|
|
8bd429db4c |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -34,7 +34,6 @@ latex
|
||||
html
|
||||
custom_titlebar
|
||||
libkddockwidgets.so*
|
||||
libkddockwidgets_multisplitter.so*
|
||||
*.depends
|
||||
kddockwidgets_basic_quick
|
||||
/src/KDDockWidgetsConfig.cmake
|
||||
|
||||
4
.vscode/settings.json
vendored
4
.vscode/settings.json
vendored
@@ -4,7 +4,7 @@
|
||||
"qevent": "cpp"
|
||||
},
|
||||
"cmake.configureSettings": {
|
||||
"OPTION_DEVELOPER_MODE" : "ON",
|
||||
"OPTION_QTQUICK" : true
|
||||
"KDDockWidgets_DEVELOPER_MODE" : "ON",
|
||||
"KDDockWidgets_QTQUICK" : true
|
||||
}
|
||||
}
|
||||
|
||||
120
CMakeLists.txt
120
CMakeLists.txt
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# This file is part of KDDockWidgets.
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2019-2020 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: Sergio Martins <sergio.martins@kdab.com>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
@@ -11,12 +11,17 @@
|
||||
|
||||
# Pass the following variables to cmake to control the build:
|
||||
#
|
||||
# -DKDDockWidgets_QT6=[true|false]
|
||||
# Build against Qt6 rather than Qt5
|
||||
# Default=false (Qt5 will be used even if Qt6 is available)
|
||||
#
|
||||
# -DKDDockWidgets_STATIC=[true|false]
|
||||
# Build static versions of the libraries
|
||||
# Default=false
|
||||
#
|
||||
# -DKDDockWidgets_TESTS=[true|false]
|
||||
# Build the test harness.
|
||||
# Currently does nothing unless you also set KDDockWidgets_DEVELOPER_MODE=True
|
||||
# Default=false
|
||||
#
|
||||
# -DKDDockWidgets_EXAMPLES=[true|false]
|
||||
@@ -27,19 +32,28 @@
|
||||
# Build the API documentation.
|
||||
# Default=false
|
||||
#
|
||||
# -DOPTION_DEVELOPER_MODE=[true|false]
|
||||
# -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
|
||||
#
|
||||
# -DOPTION_BUILD_PYTHON_BINDINGS=[true|false]
|
||||
# -DKDDockWidgets_QTQUICK == IN DEVELOPMENT. DO NOT USE! ==
|
||||
# Build for QtQuick instead of QtWidgets
|
||||
# Default=false
|
||||
#
|
||||
# -DKDDockWidgets_PYTHON_BINDINGS=[true|false]
|
||||
# Build/Generate python bindings. Always false for Debug builds
|
||||
# Default=false
|
||||
#
|
||||
# -DPYTHON_BINDINGS_INSTALL_PREFIX=[path]
|
||||
# alternative install path for python bindings
|
||||
# -DKDDockWidgets_PYTHON_BINDINGS_INSTALL_PREFIX=[path]
|
||||
# Set an alternative install path for Python bindings
|
||||
# Default=CMAKE_INSTALL_PREFIX
|
||||
#
|
||||
# -DKDDockWidgets_UNITY_BUILD=[true|false]
|
||||
# Build with CMake's UNITY_BUILD (requires CMake version 3.16 or higher)
|
||||
# Default=true
|
||||
#
|
||||
|
||||
cmake_minimum_required(VERSION 3.7)
|
||||
if(POLICY CMP0020)
|
||||
@@ -49,10 +63,12 @@ if(POLICY CMP0042)
|
||||
cmake_policy(SET CMP0042 NEW)
|
||||
endif()
|
||||
|
||||
if("${CMAKE_INSTALL_PREFIX}" STREQUAL "")
|
||||
set(USE_DEFAULT_INSTALL_LOCATION True)
|
||||
else()
|
||||
set(USE_DEFAULT_INSTALL_LOCATION False)
|
||||
set(KDAB_INSTALL True)
|
||||
if((NOT DEFINED ${USE_DEFAULT_INSTALL_LOCATION}) OR (NOT ${USE_DEFAULT_INSTALL_LOCATION}))
|
||||
if(NOT "${CMAKE_INSTALL_PREFIX}" STREQUAL "")
|
||||
set(KDAB_INSTALL False)
|
||||
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")
|
||||
@@ -65,32 +81,51 @@ else()
|
||||
endif()
|
||||
|
||||
set(${PROJECT_NAME}_VERSION_MAJOR 1)
|
||||
set(${PROJECT_NAME}_VERSION_MINOR 0)
|
||||
set(${PROJECT_NAME}_VERSION_PATCH 95)
|
||||
set(${PROJECT_NAME}_VERSION_MINOR 2)
|
||||
set(${PROJECT_NAME}_VERSION_PATCH 1)
|
||||
set(${PROJECT_NAME}_VERSION ${${PROJECT_NAME}_VERSION_MAJOR}.${${PROJECT_NAME}_VERSION_MINOR}.${${PROJECT_NAME}_VERSION_PATCH})
|
||||
set(${PROJECT_NAME}_SOVERSION "1.1")
|
||||
set(${PROJECT_NAME}_SOVERSION "1.3")
|
||||
|
||||
include(FeatureSummary)
|
||||
|
||||
option(OPTION_DEVELOPER_MODE "Developer Mode" OFF)
|
||||
option(OPTION_BUILD_PYTHON_BINDINGS "Build python bindings" OFF)
|
||||
if(OPTION_BUILD_PYTHON_BINDINGS AND (CMAKE_BUILD_TYPE MATCHES "^[Dd]eb" OR ${PROJECT_NAME}_STATIC))
|
||||
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(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.16.0")
|
||||
option(${PROJECT_NAME}_UNITY_BUILD "Build with CMake's UNITY_BUILD" ON)
|
||||
endif()
|
||||
|
||||
|
||||
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}_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)
|
||||
|
||||
#Always build the test harness in developer-mode
|
||||
if(OPTION_DEVELOPER_MODE)
|
||||
if(${PROJECT_NAME}_DEVELOPER_MODE)
|
||||
set(${PROJECT_NAME}_TESTS ON)
|
||||
set(${PROJECT_NAME}_WERROR ON)
|
||||
endif()
|
||||
|
||||
# option(OPTION_QTQUICK "Build for QtQuick instead of QtWidgets" OFF)
|
||||
#option(${PROJECT_NAME}_QTQUICK "Build for QtQuick instead of QtWidgets" OFF)
|
||||
|
||||
find_package(Qt5Widgets 5.9 REQUIRED)
|
||||
if (${PROJECT_NAME}_QT6)
|
||||
find_package(Qt6Widgets REQUIRED)
|
||||
find_package(Qt6Test REQUIRED)
|
||||
set(QT_MAJOR_VERSION 6)
|
||||
else()
|
||||
find_package(Qt5Widgets 5.9 REQUIRED)
|
||||
find_package(Qt5Test 5.9 REQUIRED)
|
||||
set(QT_MAJOR_VERSION 5)
|
||||
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")
|
||||
@@ -102,17 +137,28 @@ include(InstallLocation)
|
||||
include(QtInstallPaths) #to set QT_INSTALL_FOO variables
|
||||
|
||||
macro(set_compiler_flags targetName)
|
||||
if(OPTION_DEVELOPER_MODE)
|
||||
target_compile_definitions(${targetName} PRIVATE DOCKS_DEVELOPER_MODE QT_FORCE_ASSERTS)
|
||||
if(${PROJECT_NAME}_DEVELOPER_MODE)
|
||||
target_compile_definitions(${targetName} PUBLIC DOCKS_DEVELOPER_MODE PRIVATE QT_FORCE_ASSERTS)
|
||||
|
||||
if(NOT MSVC)
|
||||
target_compile_options(${targetName} PRIVATE -Wall -Wextra -Werror -Wno-error=deprecated-declarations)
|
||||
target_compile_options(${targetName} PRIVATE -Wall -Wextra)
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
target_compile_options(${targetName} PRIVATE -Wweak-vtables)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Enable -Werror
|
||||
if(NOT MSVC AND ${PROJECT_NAME}_WERROR)
|
||||
target_compile_options(${targetName} PRIVATE -Werror -Wno-error=deprecated-declarations)
|
||||
endif()
|
||||
|
||||
endmacro()
|
||||
|
||||
if(OPTION_QTQUICK)
|
||||
find_package(Qt5Quick)
|
||||
find_package(Qt5QuickControls2)
|
||||
if(${PROJECT_NAME}_QTQUICK)
|
||||
find_package(Qt${QT_MAJOR_VERSION}Quick)
|
||||
find_package(Qt${QT_MAJOR_VERSION}QuickControls2)
|
||||
add_definitions(-DKDDOCKWIDGETS_QTQUICK)
|
||||
else()
|
||||
add_definitions(-DKDDOCKWIDGETS_QTWIDGETS)
|
||||
@@ -145,14 +191,13 @@ install(FILES LICENSE.txt README.md DESTINATION ${INSTALL_DOC_DIR})
|
||||
install(DIRECTORY LICENSES DESTINATION ${INSTALL_DOC_DIR})
|
||||
|
||||
add_subdirectory(src)
|
||||
if(OPTION_BUILD_PYTHON_BINDINGS)
|
||||
if(${PROJECT_NAME}_PYTHON_BINDINGS)
|
||||
add_subdirectory(python)
|
||||
endif()
|
||||
|
||||
if(${PROJECT_NAME}_EXAMPLES)
|
||||
if (OPTION_QTQUICK)
|
||||
if (${PROJECT_NAME}_QTQUICK)
|
||||
add_subdirectory(examples/qtquick)
|
||||
set_compiler_flags(kddockwidgets_example_quick)
|
||||
else()
|
||||
add_subdirectory(examples/dockwidgets)
|
||||
add_subdirectory(examples/minimal)
|
||||
@@ -161,16 +206,15 @@ if(${PROJECT_NAME}_EXAMPLES)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(OPTION_DEVELOPER_MODE)
|
||||
if(${PROJECT_NAME}_DEVELOPER_MODE)
|
||||
include(ECMEnableSanitizers)
|
||||
if(${PROJECT_NAME}_TESTS)
|
||||
enable_testing()
|
||||
add_subdirectory(tests)
|
||||
|
||||
if (NOT OPTION_QTQUICK)
|
||||
#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 (140 tests), so split it in 6 runs so we can use threads.
|
||||
# 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)
|
||||
@@ -193,11 +237,11 @@ if(OPTION_DEVELOPER_MODE)
|
||||
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()
|
||||
endif()
|
||||
|
||||
add_test(NAME tst_multisplitter COMMAND tst_multisplitter)
|
||||
add_test(NAME tst_common COMMAND tst_common)
|
||||
if (NOT ${PROJECT_NAME}_QTQUICK)
|
||||
# tst_multisplitter depends on QWidget
|
||||
add_test(NAME tst_multisplitter COMMAND tst_multisplitter)
|
||||
endif()
|
||||
|
||||
endif()
|
||||
endif()
|
||||
@@ -205,3 +249,7 @@ endif()
|
||||
if(${PROJECT_NAME}_DOCS)
|
||||
add_subdirectory(docs) # needs to go last, in case there are build source files
|
||||
endif()
|
||||
|
||||
if (${PROJECT_NAME}_UNITY_BUILD)
|
||||
set_target_properties(kddockwidgets PROPERTIES UNITY_BUILD ON)
|
||||
endif()
|
||||
|
||||
133
CMakePresets.json
Normal file
133
CMakePresets.json
Normal file
@@ -0,0 +1,133 @@
|
||||
{
|
||||
"version": 1,
|
||||
"configurePresets": [
|
||||
{
|
||||
"name": "dev-qtwidgets",
|
||||
"displayName": "dev-qtwidgets",
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build-dev-qtwidgets",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug",
|
||||
"KDDockWidgets_DEVELOPER_MODE": "ON",
|
||||
"ECM_ENABLE_SANITIZERS" : "'address;undefined'"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "clazy-qtwidgets",
|
||||
"displayName": "clazy-qtwidgets",
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build-clazy-qtwidgets",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug",
|
||||
"KDDockWidgets_WERROR": "ON"
|
||||
},
|
||||
"environment": {
|
||||
"CXX": "clazy"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "qtwidgets",
|
||||
"displayName": "qtwidgets",
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build-qtwidgets",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "qtquick",
|
||||
"displayName": "qtquick",
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build-qtquick",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release",
|
||||
"KDDockWidgets_QTQUICK": "ON"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "dev-qtquick",
|
||||
"displayName": "dev-qtquick",
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build-dev-qtquick",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug",
|
||||
"KDDockWidgets_QTQUICK": "ON",
|
||||
"KDDockWidgets_DEVELOPER_MODE": "ON",
|
||||
"ECM_ENABLE_SANITIZERS" : "'address;undefined'"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "python",
|
||||
"displayName": "python",
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build-python",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release",
|
||||
"KDDockWidgets_PYTHON_BINDINGS": "ON"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "static-qtwidgets",
|
||||
"displayName": "static-qtwidgets",
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build-static-qtwidgets",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release",
|
||||
"KDDockWidgets_STATIC": "ON"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "static-qtquick",
|
||||
"displayName": "static-qtquick",
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build-static-qtquick",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release",
|
||||
"KDDockWidgets_STATIC": "ON",
|
||||
"KDDockWidgets_QTQUICK": "ON"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "qtwidgets6",
|
||||
"displayName": "qtwidgets6",
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build-qtwidgets6",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release",
|
||||
"KDDockWidgets_QT6": "ON"
|
||||
},
|
||||
"environment": {
|
||||
"PATH": "$env{HOME}/Qt/6.0.0/gcc_64/bin:$penv{PATH}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "dev-qtwidgets6",
|
||||
"displayName": "dev-qtwidgets6",
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build-dev-qtwidgets6",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug",
|
||||
"KDDockWidgets_QT6": "ON",
|
||||
"KDDockWidgets_DEVELOPER_MODE": "ON",
|
||||
"ECM_ENABLE_SANITIZERS" : "'address;undefined'"
|
||||
},
|
||||
"environment": {
|
||||
"PATH": "$env{HOME}/Qt/6.0.0/gcc_64/bin:$penv{PATH}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "qtquick6",
|
||||
"displayName": "qtquick6",
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build-qtquick6",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release",
|
||||
"KDDockWidgets_QTQUICK": "ON",
|
||||
"KDDockWidgets_QT6": "ON"
|
||||
},
|
||||
"environment": {
|
||||
"PATH": "$env{HOME}/Qt/6.0.0/gcc_64/bin:$penv{PATH}"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
35
Changelog
35
Changelog
@@ -1,5 +1,28 @@
|
||||
* v1.1.0 (unreleased)
|
||||
* v1.3.0 (unreleased)
|
||||
- [TODO] QtQuick support
|
||||
- Added static DockWidgetBase::byName() (#126)
|
||||
- The enum KDDockWidgets::AddingOption has been deprecated, use
|
||||
KDDockWidgets::InitialVisibilityOption instead
|
||||
- You can now pass a preferred initial size to MainWindow::addDockWidget() (#95)
|
||||
|
||||
* v1.2.1 (unreleased)
|
||||
- Support for resizing dock widgets when they are in overlay/popup mode (autohide/sidebar feature)
|
||||
|
||||
* v1.2.0 (17 December 2020)
|
||||
- Wayland support
|
||||
- Added Flag_KeepAboveIfNotUtilityWindow, so you can have keep above even if
|
||||
floating window is shown in the task-bar.
|
||||
- Added DockWidget::windowActiveAboutToChange() signal
|
||||
- Added support for Qt6 (PySide6 support is lacking)
|
||||
- Added WASM support
|
||||
|
||||
* v1.1.1 (11 December 2020)
|
||||
- Windows: Fixed a crash when clicking on the close button for floating windows in some situations (#110)
|
||||
- Don't show dock/undock icon when dockwidget is not dockable (#99)
|
||||
|
||||
* v1.1.0 (26 October 2020)
|
||||
- New drop indicator style type: Segmented Indicators
|
||||
- Windows: Drop Shadow for floating windows
|
||||
- Added AutoHide / SideBar support
|
||||
- Added FocusScope support
|
||||
- Added DockWidget::isFocused() and DockWidgetBase::isFocusedChanged()
|
||||
@@ -8,18 +31,16 @@
|
||||
- Added Config::Flag_TitleBarHasMinimizeButton
|
||||
- Added Config::Flag_TitleBarNoFloatButton
|
||||
- Added Config::Flag_AutoHideSupport
|
||||
- Added Config::setTabbingAllowedFunc(TabbingAllowedFunc func)
|
||||
- HDPI improvements, new high-res icons
|
||||
- Bugfixes:
|
||||
- Windows: Fixed windows not having proper minimum size.
|
||||
- Windows: Fixed moving windows across screens with different DPI (#72)
|
||||
- Don't center floating windows if the user set a custom position (#75)
|
||||
- Fixed floating window's title not being correct (#74)
|
||||
- Fixed focus scope not reacting when clicking on current tab (#71)
|
||||
|
||||
* Roadmap
|
||||
- QtQuick support
|
||||
|
||||
* v1.0.1 (unreleased)
|
||||
- cmake/Python - don't require pkg-config, only use if available (#68)
|
||||
- Fixed floating window borders not being rendered correctly on HDPI due to rounding errors.
|
||||
- cmake/Python - don't require pkg-config, only use if available (#68)
|
||||
|
||||
* v1.0.0 (2 September 2020)
|
||||
- PySide2 bindings
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
The KDDockWidgets software is Copyright (C) 2018-2020 Klaralvdalens Datakonsult AB.
|
||||
The KDDockWidgets software is Copyright (C) 2018-2021 Klaralvdalens Datakonsult AB.
|
||||
|
||||
You may use, distribute and copy the KDDockWidgets software under the terms of
|
||||
the GNU General Public License version 2 or under the terms of GNU General
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
KDDockWidgets is (C) 2018-2020, Klarälvdalens Datakonsult AB, and is licensed
|
||||
KDDockWidgets is (C) 2018-2021, Klarälvdalens Datakonsult AB, and is licensed
|
||||
according to the terms of the:
|
||||
GNU General Public License version 2.0 (see LICENSES/GPL-2.0-only.txt)
|
||||
or the
|
||||
|
||||
33
README-WASM.md
Normal file
33
README-WASM.md
Normal file
@@ -0,0 +1,33 @@
|
||||
WebAssembly
|
||||
===========
|
||||
|
||||
KDDockWidgets works with WebAssembly with the following known limitations:
|
||||
|
||||
- Classic drop indicators are not supported, only the segmented ones. This is because
|
||||
WASM doesn't support windows with translucency.
|
||||
|
||||
- Might be slow on Linux, depending on your browser, while dragging or resizing windows.
|
||||
Please file a bug with Qt, as it's out of scope for KDDW to fix.
|
||||
|
||||
Demo:
|
||||
=====
|
||||
|
||||
A demo is available at https://demos.kdab.com/wasm/kddockwidgets/dockwidgets.html
|
||||
|
||||
Build tips for KDDW:
|
||||
====================
|
||||
|
||||
- Visit https://doc.qt.io/qt-5/wasm.html if you haven't yet
|
||||
- Open a terminal suitable for WASM development (with the correct Qt and toolchain in PATH, etc)
|
||||
- KDDockWidgets can be built with `cmake -DCMAKE_TOOLCHAIN_FILE=/usr/local/emsdk-1.39.8/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -DCMAKE_FIND_ROOT_PATH=~/Qt/5.15.1/wasm_32/ -DKDDockWidgets_EXAMPLES=OFF -DCMAKE_BUILD_TYPE=Release`
|
||||
(Adapt the paths to your own situation)
|
||||
|
||||
Builds tips for your own app:
|
||||
=============================
|
||||
- Link to KDDW (libkddockwidgets.a, or similar)
|
||||
- As the build is static, don't forget to initialize KDDW's resources:
|
||||
```
|
||||
#ifdef QT_STATIC
|
||||
Q_INIT_RESOURCE(kddockwidgets_resources);
|
||||
#endif
|
||||
```
|
||||
34
README-Wayland.md
Normal file
34
README-Wayland.md
Normal file
@@ -0,0 +1,34 @@
|
||||
Wayland support is done and has been tested on KDE (Kwin) and weston.
|
||||
|
||||
Limitations
|
||||
============
|
||||
|
||||
Wayland works very differently than traditional desktops and imposes us some,
|
||||
limitations. Here's a list of different behaviours which KDDockWidgets will have
|
||||
when running on Wayland:
|
||||
|
||||
|
||||
- A title bar can either be used for drag&dock or for moving the window around.
|
||||
|
||||
- For this reason, floating windows now have two title bars.
|
||||
The native one, drawn by the server and the client one, drawn by KDDockWidgets.
|
||||
The native one allows you to drag the window around but not drop/dock.
|
||||
The client title bar allows you to perform a drag and drop/dock but not move the window around.
|
||||
|
||||
- You can detach a window by:
|
||||
- Clicking the title-bar's float button
|
||||
- Double-clicking the title bar of a docked widget
|
||||
- Double-clicking a tab
|
||||
- If no title bar is shown, double-clicking the empty space of the tab bar will detach
|
||||
the entire group of tabbed dock widgets
|
||||
|
||||
- Layout save/restore won't restore the position of floating windows, as wayland
|
||||
doesn't allow us to set geometry.
|
||||
|
||||
- Kwin specific:
|
||||
- The pixmap that's shown during a drag can't be bigger than 250x250. Might be a bug.
|
||||
|
||||
|
||||
|
||||
All in all it's pretty decent and usable. Any further improvements should be done at the server or
|
||||
protocol level now.
|
||||
3
README-troubleshooting
Normal file
3
README-troubleshooting
Normal file
@@ -0,0 +1,3 @@
|
||||
# PySide: `ImportError: DLL load failed while importing KDDockWidgets`
|
||||
|
||||
If you're getting this error with Python see issue #114 and the proposed solution there.
|
||||
62
README.md
62
README.md
@@ -24,6 +24,9 @@ You will find more information in these places:
|
||||
* [online detailed browsable API reference](https://docs.kdab.com/kddockwidgets)
|
||||
* [our example programs](examples/)
|
||||
|
||||
We also have an [in browser demo](https://demos.kdab.com/wasm/kddockwidgets/dockwidgets.html). Note
|
||||
however that this demo isn't fully featured, as it's running on Qt for WebAssembly.
|
||||
|
||||
Features
|
||||
========
|
||||
- Provide advanced docking that QDockWidgets doesn't support
|
||||
@@ -43,6 +46,8 @@ Features
|
||||
- Customize title bars
|
||||
- Customize window frames
|
||||
- Custom widget separators
|
||||
- Crossplatform (macOS, Linux, Windows, WebAssembly, Wayland, X11/XCB, EGLFS are working)
|
||||
See README-Wayland.md and README-WASM.md for platform specific information.
|
||||
- Layouting engine honouring min/max size constraints and some size policies
|
||||
- PySide2 bindings
|
||||
- Clean codebase
|
||||
@@ -59,13 +64,14 @@ Features
|
||||
- Optional minimize and maximize button on the title bar
|
||||
- FloatingWindows can be utility windows or full native
|
||||
|
||||
Screen capture
|
||||
==============
|
||||

|
||||
|
||||
|
||||
Roadmap
|
||||
========
|
||||
- QtQuick support for v1.1
|
||||
- "Minimization bar" for v1.2
|
||||
- QtQuick support
|
||||
|
||||
Trying out the examples
|
||||
=======================
|
||||
@@ -82,15 +88,15 @@ Build and install the KDDockWidgets framework:
|
||||
|
||||
```
|
||||
$ cmake -G Ninja -DCMAKE_INSTALL_PREFIX=/path/where/to/install ../path/to/kddockwidgets
|
||||
$ make
|
||||
$ make install
|
||||
$ cmake --build .
|
||||
$ cmake --build . --target install
|
||||
```
|
||||
|
||||
Now build and run the example:
|
||||
```
|
||||
$ cd path/to/kddockwidgets/examples/dockwidgets/
|
||||
$ cmake -DCMAKE_PREFIX_PATH=/path/where/to/install
|
||||
$ make
|
||||
$ cmake -G Ninja -DCMAKE_PREFIX_PATH=/path/where/to/install
|
||||
$ cmake --build .
|
||||
$ ./kddockwidgets_example
|
||||
|
||||
```
|
||||
@@ -99,29 +105,44 @@ The installation directory defaults to `c:\KDAB\KDDockWidgets-<version>` on Wind
|
||||
and `/usr/local/KDAB/KDDockWidgets-<version>` on non-Windows. You can change this
|
||||
location by passing the option `-DCMAKE_INSTALL_PREFIX=/install/path` to cmake.
|
||||
|
||||
Using
|
||||
=====
|
||||
From your CMake project, add
|
||||
|
||||
find_package(KDDockWidgets 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
|
||||
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
|
||||
|
||||
```
|
||||
% 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 PySide bindings
|
||||
for KDDockwWidgets.
|
||||
|
||||
Next pass `-DOPTION_BUILD_PYTHON_BINDINGS=ON` to CMake, followed by the
|
||||
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 `-DPYTHON_BINDINGS_INSTALL_PREFIX=/usr/lib/python3.8/site-packages`
|
||||
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
|
||||
@@ -133,14 +154,19 @@ $ python3 main.py
|
||||
```
|
||||
|
||||
|
||||
Supported Qt versions
|
||||
======================
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
|
||||
Licensing
|
||||
=========
|
||||
KDDockWidgets is (C) 2018-2020, Klarälvdalens Datakonsult AB, and is licensed according to
|
||||
KDDockWidgets is (C) 2018-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.
|
||||
@@ -171,3 +197,9 @@ to the Qt Project. We can give advanced or standard trainings anywhere
|
||||
around the globe on Qt as well as C++, OpenGL, 3D and more.
|
||||
|
||||
Please visit https://www.kdab.com to meet the people who write code like this.
|
||||
|
||||
Stay up-to-date with KDAB product announcements:
|
||||
|
||||
* [KDAB Newsletter](https://news.kdab.com)
|
||||
* [KDAB Blogs](https://www.kdab.com/category/blogs)
|
||||
* [KDAB on Twitter](https://twitter.com/KDABQt)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2020 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
# 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
|
||||
|
||||
134
cmake/Python/FindPySide6.cmake
Normal file
134
cmake/Python/FindPySide6.cmake
Normal file
@@ -0,0 +1,134 @@
|
||||
#
|
||||
# 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 PySide6 installation
|
||||
# PYSIDE_INCLUDE_DIR - Directories to include to use PySide6
|
||||
# PYSIDE_LIBRARY - Files to link against to use PySide6
|
||||
# PYSIDE_TYPESYSTEMS - Type system files that should be used by other bindings extending PySide6
|
||||
#
|
||||
# You can install PySide6 from Qt repository with
|
||||
# pip3 install --index-url=https://download.qt.io/official_releases/QtForPython --trusted-host download.qt.io pyside6
|
||||
|
||||
set(PYSIDE6_FOUND FALSE)
|
||||
|
||||
# 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 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(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])
|
||||
"
|
||||
OUTPUT_VARIABLE PYSIDE6_SUFFIX
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${Python3_EXECUTABLE} -c "if True:
|
||||
import os
|
||||
import PySide6.QtCore as QtCore
|
||||
print(';'.join(map(str, QtCore.__version_info__)))
|
||||
"
|
||||
OUTPUT_VARIABLE PYSIDE6_SO_VERSION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
list(GET PYSIDE6_SO_VERSION 0 PYSIDE6_SO_MACRO_VERSION)
|
||||
list(GET PYSIDE6_SO_VERSION 1 PYSIDE6_SO_MICRO_VERSION)
|
||||
list(GET PYSIDE6_SO_VERSION 2 PYSIDE6_SO_MINOR_VERSION)
|
||||
string(REPLACE ";" "." PYSIDE6_SO_VERSION "${PYSIDE6_SO_VERSION}")
|
||||
|
||||
if(NOT APPLE)
|
||||
set(PYSIDE6_SUFFIX "${PYSIDE6_SUFFIX}.${PYSIDE6_SO_MACRO_VERSION}.${PYSIDE6_SO_MICRO_VERSION}")
|
||||
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 suffix: ${PYSIDE6_SUFFIX}")
|
||||
endif()
|
||||
|
||||
if (PYSIDE6_FOUND)
|
||||
#PySide
|
||||
#===============================================================================
|
||||
find_path(PYSIDE_INCLUDE_DIR
|
||||
pyside.h
|
||||
PATHS ${PYSIDE6_BASEDIR}/include ${PYSIDE6_CUSTOM_PREFIX}/include/PySide6
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
# Platform specific library names
|
||||
if(MSVC)
|
||||
SET(PYSIDE_LIBRARY_BASENAMES "pyside6.abi3.lib")
|
||||
elseif(CYGWIN)
|
||||
SET(PYSIDE_LIBRARY_BASENAMES "")
|
||||
elseif(WIN32)
|
||||
SET(PYSIDE_LIBRARY_BASENAMES "libpyside6.${PYSIDE6_SUFFIX}")
|
||||
else()
|
||||
SET(PYSIDE_LIBRARY_BASENAMES "libpyside6.${PYSIDE6_SUFFIX}")
|
||||
endif()
|
||||
|
||||
find_file(PYSIDE_LIBRARY
|
||||
${PYSIDE_LIBRARY_BASENAMES}
|
||||
PATHS ${PYSIDE6_BASEDIR} ${PYSIDE6_CUSTOM_PREFIX}/lib
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
find_path(PYSIDE_TYPESYSTEMS
|
||||
typesystem_core.xml
|
||||
PATHS ${PYSIDE6_BASEDIR}/typesystems ${PYSIDE6_CUSTOM_PREFIX}/share/PySide6/typesystems
|
||||
NO_DEFAULT_PATH)
|
||||
endif()
|
||||
|
||||
if(PYSIDE6_FOUND)
|
||||
message(STATUS "PySide include dir: ${PYSIDE_INCLUDE_DIR}")
|
||||
message(STATUS "PySide library: ${PYSIDE_LIBRARY}")
|
||||
message(STATUS "PySide typesystems: ${PYSIDE_TYPESYSTEMS}")
|
||||
message(STATUS "PySide6 version: ${PYSIDE6_SO_VERSION}")
|
||||
|
||||
# Create PySide6 target
|
||||
add_library(PySide6::pyside6 SHARED IMPORTED GLOBAL)
|
||||
if(MSVC)
|
||||
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 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(PySide6
|
||||
REQUIRED_VARS PYSIDE6_BASEDIR PYSIDE_INCLUDE_DIR PYSIDE_LIBRARY PYSIDE_TYPESYSTEMS
|
||||
VERSION_VAR PYSIDE6_SO_VERSION
|
||||
)
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2020 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
# 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
|
||||
@@ -115,7 +115,6 @@ else()
|
||||
set(SHIBOKEN_SEARCH_PATHS ${SHIBOKEN_CUSTOM_PATH})
|
||||
list(APPEND SHIBOKEN_SEARCH_PATHS ${SHIBOKEN_BASEDIR})
|
||||
list(APPEND SHIBOKEN_SEARCH_PATHS ${SHIBOKEN_GENERATOR_BASEDIR})
|
||||
message(STATUS "BOO: ${SHIBOKEN_SEARCH_PATHS}")
|
||||
find_file(SHIBOKEN_LIBRARY
|
||||
${SHIBOKEN_LIBRARY_BASENAMES}
|
||||
PATHS ${SHIBOKEN_SEARCH_PATHS}
|
||||
|
||||
165
cmake/Python/FindShiboken6.cmake
Normal file
165
cmake/Python/FindShiboken6.cmake
Normal file
@@ -0,0 +1,165 @@
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
# SHIBOKEN_INCLUDE_DIR - Directories to include to use SHIBOKEN
|
||||
# SHIBOKEN_LIBRARY - Files to link against to use SHIBOKEN
|
||||
# SHIBOKEN_BINARY - Executable name
|
||||
# SHIBOKEN_BUILD_TYPE - Tells if Shiboken was compiled in Release or Debug mode.
|
||||
|
||||
# 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()
|
||||
"
|
||||
OUTPUT_VARIABLE SHIBOKEN_GENERATOR_BASEDIR
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
execute_process(
|
||||
COMMAND ${Python3_EXECUTABLE} -c "if True:
|
||||
import os
|
||||
try:
|
||||
import shiboken6
|
||||
print(shiboken6.__path__[0])
|
||||
except:
|
||||
exit()
|
||||
"
|
||||
OUTPUT_VARIABLE SHIBOKEN_BASEDIR
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
execute_process(
|
||||
COMMAND ${Python3_EXECUTABLE} -c "if True:
|
||||
import os
|
||||
import shiboken6
|
||||
print(';'.join(filter(None, map(str, shiboken6.__version_info__))))
|
||||
"
|
||||
OUTPUT_VARIABLE SHIBOKEN_VERSION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
list(GET SHIBOKEN_VERSION 0 SHIBOKEN_MACRO_VERSION)
|
||||
list(GET SHIBOKEN_VERSION 1 SHIBOKEN_MICRO_VERSION)
|
||||
list(GET SHIBOKEN_VERSION 2 SHIBOKEN_MINOR_VERSION)
|
||||
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}")
|
||||
|
||||
if(SHIBOKEN_BASEDIR)
|
||||
find_path(SHIBOKEN_INCLUDE_DIR
|
||||
shiboken.h
|
||||
PATHS ${SHIBOKEN_CUSTOM_PATH} ${SHIBOKEN_GENERATOR_BASEDIR}/include
|
||||
NO_DEFAULT_PATH)
|
||||
if(MSVC)
|
||||
SET(SHIBOKEN_LIBRARY_BASENAMES "shiboken6.abi3.lib")
|
||||
elseif(CYGWIN)
|
||||
SET(SHIBOKEN_LIBRARY_BASENAMES "")
|
||||
elseif(WIN32)
|
||||
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
|
||||
)
|
||||
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}
|
||||
)
|
||||
endif()
|
||||
|
||||
if (NOT SHIBOKEN_INCLUDE_DIR)
|
||||
return()
|
||||
endif()
|
||||
set(SHIBOKEN_SEARCH_PATHS ${SHIBOKEN_CUSTOM_PATH})
|
||||
list(APPEND SHIBOKEN_SEARCH_PATHS ${SHIBOKEN_BASEDIR})
|
||||
list(APPEND SHIBOKEN_SEARCH_PATHS ${SHIBOKEN_GENERATOR_BASEDIR})
|
||||
find_file(SHIBOKEN_LIBRARY
|
||||
${SHIBOKEN_LIBRARY_BASENAMES}
|
||||
PATHS ${SHIBOKEN_SEARCH_PATHS}
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
find_program(SHIBOKEN_BINARY
|
||||
shiboken6
|
||||
PATHS ${SHIBOKEN_SEARCH_PATHS}
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
endif()
|
||||
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
|
||||
execute_process(
|
||||
COMMAND ${Python3_EXECUTABLE} -c "if True:
|
||||
for lib in '${Python3_LIBRARIES}'.split(';'):
|
||||
if '/' in lib:
|
||||
prefix, py = lib.rsplit('/', 1)
|
||||
if py.startswith('python3'):
|
||||
print(prefix + '/python3.lib')
|
||||
break
|
||||
"
|
||||
OUTPUT_VARIABLE PYTHON_LIMITED_LIBRARIES
|
||||
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
|
||||
set(PYTHON_LIMITED_LIBRARIES "")
|
||||
endif()
|
||||
|
||||
if (SHIBOKEN_FOUND)
|
||||
message(STATUS "Shiboken include dir: ${SHIBOKEN_INCLUDE_DIR}")
|
||||
message(STATUS "Shiboken library: ${SHIBOKEN_LIBRARY}")
|
||||
message(STATUS "Shiboken binary: ${SHIBOKEN_BINARY}")
|
||||
message(STATUS "Shiboken version: ${SHIBOKEN_VERSION}")
|
||||
|
||||
# Create shiboke2 target
|
||||
add_library(Shiboken6::libshiboken SHARED IMPORTED GLOBAL)
|
||||
if(MSVC)
|
||||
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 APPEND PROPERTY
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${SHIBOKEN_INCLUDE_DIR} ${Python3_INCLUDE_DIRS})
|
||||
set_property(TARGET Shiboken6::libshiboken APPEND PROPERTY
|
||||
INTERFACE_LINK_LIBRARIES ${PYTHON_LIMITED_LIBRARIES})
|
||||
|
||||
# Generator target
|
||||
add_executable(Shiboken6::shiboken IMPORTED GLOBAL)
|
||||
set_property(TARGET Shiboken6::shiboken PROPERTY
|
||||
IMPORTED_LOCATION ${SHIBOKEN_BINARY})
|
||||
endif()
|
||||
|
||||
find_package_handle_standard_args(Shiboken6
|
||||
REQUIRED_VARS SHIBOKEN_BASEDIR SHIBOKEN_INCLUDE_DIR SHIBOKEN_LIBRARY SHIBOKEN_BINARY
|
||||
VERSION_VAR SHIBOKEN_VERSION
|
||||
)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2020 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
# 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
|
||||
@@ -7,11 +7,11 @@
|
||||
# Contact KDAB at <info@kdab.com> for commercial licensing options.
|
||||
#
|
||||
|
||||
if (NOT PYTHON_BINDINGS_INSTALL_PREFIX)
|
||||
SET(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 ${PYTHON_BINDINGS_INSTALL_PREFIX}")
|
||||
message(STATUS "PYTHON INSTALL PREFIX ${${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX}")
|
||||
|
||||
if (WIN32)
|
||||
set(PATH_SEP "\;")
|
||||
@@ -153,5 +153,5 @@ macro(CREATE_PYTHON_BINDINGS
|
||||
LINK_FLAGS "-undefined dynamic_lookup")
|
||||
endif()
|
||||
install(TARGETS ${TARGET_NAME}
|
||||
LIBRARY DESTINATION ${PYTHON_BINDINGS_INSTALL_PREFIX}/${TARGET_NAME})
|
||||
LIBRARY DESTINATION ${${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX}/${TARGET_NAME})
|
||||
endmacro()
|
||||
|
||||
157
cmake/Python/PySide6ModuleBuild.cmake
Normal file
157
cmake/Python/PySide6ModuleBuild.cmake
Normal file
@@ -0,0 +1,157 @@
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
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)
|
||||
set(PATH_SEP "\;")
|
||||
else()
|
||||
set(PATH_SEP ":")
|
||||
endif()
|
||||
if (NOT CMAKE_CXX_STANDARD)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
endif()
|
||||
|
||||
# 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)
|
||||
# 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)
|
||||
|
||||
# QT_INCLUDE_DIR points to the QtCore.framework directory, so we need to adjust this to point
|
||||
# to the actual include directory, which has include files for non-framework parts of Qt.
|
||||
get_filename_component(QT_INCLUDE_DIR "${QT_INCLUDE_DIR}/../../include" ABSOLUTE)
|
||||
endif()
|
||||
|
||||
# Flags that we will pass to shiboken-generator
|
||||
# --generator-set=shiboken: tells the generator that we want to use shiboken to generate code,
|
||||
# a doc generator is also available
|
||||
# --enable-parent-ctor-heuristic: Enable heuristics to detect parent relationship on constructors,
|
||||
# this try to guess parent ownership based on the arguments of the constructors
|
||||
# --enable-pyside-extensionsL: This will generate code for Qt based classes, adding extra attributes,
|
||||
# like signal, slot;
|
||||
# --enable-return-value-heuristic: Similar as --enable-parent-ctor-heuristic this use some logic to guess
|
||||
# parent child relationship based on the returned argument
|
||||
# --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})
|
||||
|
||||
# 2017-04-24 The protected hack can unfortunately not be disabled, because
|
||||
# Clang does produce linker errors when we disable the hack.
|
||||
# But the ugly workaround in Python is replaced by a shiboken change.
|
||||
if(WIN32 OR DEFINED AVOID_PROTECTED_HACK)
|
||||
set(GENERATOR_EXTRA_FLAGS ${GENERATOR_EXTRA_FLAGS} --avoid-protected-hack)
|
||||
add_definitions(-DAVOID_PROTECTED_HACK)
|
||||
endif()
|
||||
|
||||
macro(make_path varname)
|
||||
# accepts any number of path variables
|
||||
string(REPLACE ";" "${PATH_SEP}" ${varname} "${ARGN}")
|
||||
endmacro()
|
||||
|
||||
# Creates a PySide module target based on the arguments
|
||||
# This will:
|
||||
# 1 - Create a Cmake custom-target that call shiboken-generator passign the correct arguments
|
||||
# 2 - Create a Cmake library target called "Py${LIBRARY_NAME}" the output name of this target
|
||||
# will be changed to match PySide template
|
||||
# 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*
|
||||
# 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
|
||||
# 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)
|
||||
|
||||
# Transform the path separators into something shiboken understands.
|
||||
make_path(shiboken_include_dirs ${INCLUDE_PATHS})
|
||||
make_path(shiboken_typesystem_dirs ${TYPESYSTEM_PATHS})
|
||||
get_property(raw_python_dir_include_dirs DIRECTORY PROPERTY INCLUDE_DIRECTORIES)
|
||||
make_path(python_dir_include_dirs ${raw_python_dir_include_dirs})
|
||||
set(shiboken_include_dirs "${shiboken_include_dirs}${PATH_SEP}${python_dir_include_dirs}")
|
||||
|
||||
set(shiboken_framework_include_dirs_option "")
|
||||
if(CMAKE_HOST_APPLE)
|
||||
set(shiboken_framework_include_dirs "${QT_FRAMEWORK_INCLUDE_DIR}")
|
||||
make_path(shiboken_framework_include_dirs ${shiboken_framework_include_dirs})
|
||||
set(shiboken_framework_include_dirs_option "--framework-include-paths=${shiboken_framework_include_dirs}")
|
||||
endif()
|
||||
set_property(SOURCE ${OUTPUT_SOURCES} PROPERTY SKIP_AUTOGEN ON)
|
||||
add_custom_command(OUTPUT ${OUTPUT_SOURCES}
|
||||
COMMAND $<TARGET_PROPERTY:Shiboken6::shiboken,LOCATION> ${GENERATOR_EXTRA_FLAGS}
|
||||
${GLOBAL_INCLUDE}
|
||||
--include-paths=${shiboken_include_dirs}
|
||||
--typesystem-paths=${shiboken_typesystem_dirs}
|
||||
${shiboken_framework_include_dirs_option}
|
||||
--output-directory=${CMAKE_CURRENT_BINARY_DIR}
|
||||
${TYPESYSTEM_XML}
|
||||
DEPENDS ${TYPESYSTEM_XML} ${DEPENDS}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
COMMENT "Running generator for ${LIBRARY_NAME} binding...")
|
||||
|
||||
set(TARGET_NAME "Py${LIBRARY_NAME}")
|
||||
set(MODULE_NAME "${LIBRARY_NAME}")
|
||||
add_library(${TARGET_NAME} MODULE ${OUTPUT_SOURCES})
|
||||
|
||||
set_target_properties(${TARGET_NAME} PROPERTIES
|
||||
PREFIX ""
|
||||
OUTPUT_NAME ${MODULE_NAME}
|
||||
LIBRARY_OUTPUT_DIRECTORY ${MODULE_OUTPUT_DIR}
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
set_target_properties(${TARGET_NAME} PROPERTIES SUFFIX ".pyd")
|
||||
endif()
|
||||
|
||||
target_include_directories(${TARGET_NAME} PUBLIC
|
||||
${TARGET_INCLUDE_DIRS}
|
||||
${PYSIDE_EXTRA_INCLUDES}
|
||||
)
|
||||
|
||||
target_link_libraries(${TARGET_NAME}
|
||||
${TARGET_LINK_LIBRARIES}
|
||||
PySide6::pyside6
|
||||
Shiboken6::libshiboken
|
||||
)
|
||||
target_compile_definitions(${TARGET_NAME}
|
||||
PRIVATE Py_LIMITED_API=0x03050000
|
||||
)
|
||||
if(APPLE)
|
||||
set_property(TARGET ${TARGET_NAME} APPEND PROPERTY
|
||||
LINK_FLAGS "-undefined dynamic_lookup")
|
||||
endif()
|
||||
install(TARGETS ${TARGET_NAME}
|
||||
LIBRARY DESTINATION ${${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX}/${TARGET_NAME})
|
||||
endmacro()
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2016-2020 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
# 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
|
||||
@@ -30,12 +30,12 @@
|
||||
|
||||
#
|
||||
# Create variables for all the various install paths for the Qt version in use
|
||||
# Make sure to have found Qt5 before using this.
|
||||
# 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 Qt5::qmake)
|
||||
get_target_property(QT_QMAKE_EXECUTABLE Qt5::qmake LOCATION)
|
||||
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()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# This file is part of KDDockWidgets.
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2020 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
# SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
#
|
||||
# Contact KDAB at <info@kdab.com> for commercial licensing options.
|
||||
@@ -11,7 +11,7 @@ from conans import ConanFile, CMake, tools
|
||||
|
||||
class KDDockWidgetsConan(ConanFile):
|
||||
name = "kddockwidgets"
|
||||
version = "1.0.0"
|
||||
version = "1.2.0"
|
||||
default_user = "kdab"
|
||||
default_channel = "stable"
|
||||
license = ("https://raw.githubusercontent.com/KDAB/KDDockWidgets/master/LICENSES/GPL-2.0-only.txt",
|
||||
@@ -51,7 +51,7 @@ class KDDockWidgetsConan(ConanFile):
|
||||
self.cmake.definitions["KDDockWidgets_STATIC"] = self.options.build_static
|
||||
self.cmake.definitions["KDDockWidgets_EXAMPLES"] = self.options.build_examples
|
||||
self.cmake.definitions["KDDockWidgets_TESTS"] = self.options.build_tests
|
||||
self.cmake.definitions["OPTION_BUILD_PYTHON_BINDINGS"] = self.options.build_python_bindings
|
||||
self.cmake.definitions["KDDockWidgets_PYTHON_BINDINGS"] = self.options.build_python_bindings
|
||||
self.cmake.configure()
|
||||
self.cmake.build()
|
||||
|
||||
|
||||
@@ -1,3 +1,21 @@
|
||||
kddockwidgets (1.2.0) release candidate; urgency=high
|
||||
|
||||
* 1.2.0 final
|
||||
|
||||
-- Allen Winter <allen.winter@kdab.com> Thu, 17 Dec 2020 12:00:00 -0500
|
||||
|
||||
kddockwidgets (1.1.1) release candidate; urgency=high
|
||||
|
||||
* 1.1.1 final
|
||||
|
||||
-- Allen Winter <allen.winter@kdab.com> Fri, 11 Dec 2020 12:00:00 -0500
|
||||
|
||||
kddockwidgets (1.1.0) release candidate; urgency=high
|
||||
|
||||
* 1.1.0 final
|
||||
|
||||
-- Allen Winter <allen.winter@kdab.com> Mon, 26 Oct 2020 12:00:00 -0500
|
||||
|
||||
kddockwidgets (1.0.0) release candidate; urgency=high
|
||||
|
||||
* 1.0.0 final
|
||||
|
||||
157
dev-scripts/build-all.dart
Normal file
157
dev-scripts/build-all.dart
Normal file
@@ -0,0 +1,157 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2020-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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* This is an helper script which simply reads CMakePresets.json and builds those
|
||||
* presets. It's just for quickly checking that every supported setup builds
|
||||
* without having to wait for CI (or in case you don't have access to KDAB CI)
|
||||
*
|
||||
* Usage:
|
||||
* $ dart build-all.dart <kddw-source-directory> [--unity] [--tests]
|
||||
*/
|
||||
|
||||
import 'dart:io';
|
||||
import 'dart:convert';
|
||||
|
||||
String s_sourceDirectory = "";
|
||||
bool s_testUnityVariations = false;
|
||||
bool s_runTests = true;
|
||||
|
||||
class Preset {
|
||||
final String name;
|
||||
final String buildDir;
|
||||
Preset.fromJson(var jsonData)
|
||||
: name = jsonData['name'],
|
||||
buildDir = jsonData['binaryDir'] {
|
||||
}
|
||||
|
||||
String buildDirectory() {
|
||||
return buildDir.replaceAll("\${sourceDir}", s_sourceDirectory);
|
||||
}
|
||||
|
||||
List<String> cmakeConfigArguments(bool isUnityBuild) {
|
||||
return [
|
||||
"-G",
|
||||
"Ninja",
|
||||
"-B",
|
||||
buildDirectory(),
|
||||
"-S",
|
||||
s_sourceDirectory,
|
||||
"--preset=" + name,
|
||||
'-DKDDockWidgets_UNITY_BUILD=${isUnityBuild ? "ON" : "OFF"}'
|
||||
];
|
||||
}
|
||||
|
||||
List<String> cmakeBuildArguments() {
|
||||
return ["--build", buildDirectory()];
|
||||
}
|
||||
|
||||
// Builds twice. One with unity build and one without.
|
||||
Future<bool> build() async {
|
||||
if (!await buildSingle(true)) return false;
|
||||
if (s_testUnityVariations) if (!await buildSingle(false)) return false;
|
||||
if (s_runTests && !await runTests()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Future<bool> buildSingle(bool isUnityBuild) async {
|
||||
if (!await runCMake(cmakeConfigArguments(isUnityBuild))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!await runCMake(cmakeBuildArguments())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Future<bool> runTests() async {
|
||||
print("Running: ctest");
|
||||
|
||||
final savedCwd = Directory.current;
|
||||
Directory.current = buildDirectory();
|
||||
ProcessResult result = await Process.run('ctest', ["-j8"]);
|
||||
Directory.current = savedCwd;
|
||||
|
||||
if (result.exitCode != 0) {
|
||||
print(result.stdout);
|
||||
print(result.stderr);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the contents of the CMakePresets.json file
|
||||
String cmakePresetsJson(presetsFile) {
|
||||
var file = File(presetsFile);
|
||||
if (!file.existsSync()) {
|
||||
throw Exception('Not existent file');
|
||||
}
|
||||
return file.readAsStringSync();
|
||||
}
|
||||
|
||||
List<Preset> readPresets(var presetsFile) {
|
||||
var presets = List<Preset>();
|
||||
|
||||
final jsonData = jsonDecode(cmakePresetsJson(presetsFile));
|
||||
for (var presetData in jsonData['configurePresets']) {
|
||||
presets.add(Preset.fromJson(presetData));
|
||||
}
|
||||
return presets;
|
||||
}
|
||||
|
||||
Future<bool> runCMake(var cmd) async {
|
||||
print("Running: cmake " + cmd.join(' '));
|
||||
ProcessResult result = await Process.run('cmake', cmd);
|
||||
if (result.exitCode != 0) {
|
||||
print(result.stdout);
|
||||
print(result.stderr);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Future<int> main(List<String> arguments) async {
|
||||
if (arguments.length == 0) {
|
||||
print("Usage: build-all.dart <src-directory> [--unity] [--tests]");
|
||||
return 1;
|
||||
}
|
||||
|
||||
s_sourceDirectory = arguments[0];
|
||||
s_testUnityVariations = arguments.contains("--unity");
|
||||
s_runTests = arguments.contains("--tests");
|
||||
final presetsFile = s_sourceDirectory + '/CMakePresets.json';
|
||||
|
||||
if (FileSystemEntity.typeSync(presetsFile) == FileSystemEntityType.notFound) {
|
||||
print('ERROR: CMakePresets.json file not found in the source directory');
|
||||
return 1;
|
||||
}
|
||||
|
||||
var presets = readPresets(presetsFile);
|
||||
for (var preset in presets) {
|
||||
if (preset.name == 'python')
|
||||
continue; // TODO: blacklisted as it's not building on my setup yet
|
||||
|
||||
if (!await preset.build()) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
print("Success!!");
|
||||
return 0;
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# This file is part of KDDockWidgets.
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2020 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
# SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
# Author: Allen Winter <allen.winter@kdab.com>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
@@ -25,7 +25,7 @@ find_package(Doxygen)
|
||||
set_package_properties(Doxygen PROPERTIES
|
||||
TYPE OPTIONAL
|
||||
DESCRIPTION "API Documentation system"
|
||||
URL "http://www.doxygen.org"
|
||||
URL "https://www.doxygen.org"
|
||||
PURPOSE "Needed to build the API documentation."
|
||||
)
|
||||
if(DOXYGEN_DOT_EXECUTABLE)
|
||||
|
||||
Binary file not shown.
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# This file is part of KDDockWidgets.
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2020 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
# SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
# Author: Allen Winter <allen.winter@kdab.com>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
@@ -31,7 +31,7 @@ add_custom_command(
|
||||
OUTPUT ${DOXYGEN_OUTPUT_DIR}/qch/kddockwidgets-api.qch
|
||||
COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
|
||||
#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_SOURCE_DIR}/screencap.gif ${DOXYGEN_OUTPUT_DIR}/html
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/../../screencap.gif ${DOXYGEN_OUTPUT_DIR}/html
|
||||
DEPENDS ${_dox_deps} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<img src="kdab-logo-16x16.png">
|
||||
<font style="font-weight: bold;">Klarälvdalens Datakonsult AB (KDAB)</font>
|
||||
<br>
|
||||
"The Qt Experts"<br>
|
||||
"The Qt, C++ and OpenGL Experts"<br>
|
||||
<a href="https://www.kdab.com/">https://www.kdab.com/</a>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# This file is part of KDDockWidgets.
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2019-2020 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: Sergio Martins <sergio.martins@kdab.com>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
@@ -13,6 +13,7 @@ cmake_minimum_required(VERSION 3.7)
|
||||
project(kddockwidgets_example)
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
set(CMAKE_INCLUDE_CURRENT_DIRS ON)
|
||||
|
||||
if(NOT TARGET kddockwidgets)
|
||||
@@ -21,7 +22,7 @@ if(NOT TARGET kddockwidgets)
|
||||
find_package(KDDockWidgets REQUIRED)
|
||||
endif()
|
||||
|
||||
qt5_add_resources(RESOURCES_EXAMPLE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/resources_example.qrc)
|
||||
set(RESOURCES_EXAMPLE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/resources_example.qrc)
|
||||
|
||||
add_executable(kddockwidgets_example
|
||||
main.cpp
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2019-2020 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: Sérgio Martins <sergio.martins@kdab.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
@@ -17,6 +17,8 @@
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
// clazy:excludeall=missing-qobject-macro,ctor-missing-parent-argument
|
||||
|
||||
class MyTitleBar : public KDDockWidgets::TitleBarWidget
|
||||
{
|
||||
public:
|
||||
@@ -32,6 +34,8 @@ public:
|
||||
init();
|
||||
}
|
||||
|
||||
~MyTitleBar() override;
|
||||
|
||||
void init()
|
||||
{
|
||||
setFixedHeight(60);
|
||||
@@ -56,6 +60,8 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
MyTitleBar::~MyTitleBar() = default;
|
||||
|
||||
// Inheriting from SeparatorWidget instead of Separator as it handles moving and mouse cursor changing
|
||||
class MySeparator : public Layouting::SeparatorWidget
|
||||
{
|
||||
@@ -65,6 +71,8 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
~MySeparator() override;
|
||||
|
||||
void paintEvent(QPaintEvent *) override
|
||||
{
|
||||
QPainter p(this);
|
||||
@@ -72,6 +80,8 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
MySeparator::~MySeparator() = default;
|
||||
|
||||
KDDockWidgets::TitleBar * CustomWidgetFactory::createTitleBar(KDDockWidgets::Frame *frame) const
|
||||
{
|
||||
return new MyTitleBar(frame);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2019-2020 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: Sérgio Martins <sergio.martins@kdab.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
@@ -15,8 +15,11 @@
|
||||
|
||||
#include <QPainter>
|
||||
|
||||
// clazy:excludeall=ctor-missing-parent-argument
|
||||
|
||||
class CustomWidgetFactory : public KDDockWidgets::DefaultWidgetFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
KDDockWidgets::TitleBar *createTitleBar(KDDockWidgets::Frame *frame) const override;
|
||||
KDDockWidgets::TitleBar *createTitleBar(KDDockWidgets::FloatingWindow *fw) const override;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2019-2020 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: Sérgio Martins <sergio.martins@kdab.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
@@ -24,10 +24,12 @@
|
||||
#include <QRandomGenerator>
|
||||
#endif
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
|
||||
// clazy:excludeall=qstring-allocations
|
||||
// clazy:excludeall=qstring-allocations,ctor-missing-parent-argument,detaching-member
|
||||
|
||||
static MyWidget *newMyWidget()
|
||||
{
|
||||
@@ -133,26 +135,26 @@ void MyMainWindow::createDockWidgets()
|
||||
|
||||
|
||||
// MainWindow::addDockWidget() attaches a dock widget to the main window:
|
||||
addDockWidget(m_dockwidgets[0], KDDockWidgets::Location_OnTop);
|
||||
addDockWidget(m_dockwidgets.at(0), KDDockWidgets::Location_OnTop);
|
||||
|
||||
// Here, for finer granularity we specify right of dockwidgets[0]:
|
||||
addDockWidget(m_dockwidgets[1], KDDockWidgets::Location_OnRight, m_dockwidgets[0]);
|
||||
addDockWidget(m_dockwidgets.at(1), KDDockWidgets::Location_OnRight, m_dockwidgets.at(0));
|
||||
|
||||
addDockWidget(m_dockwidgets[2], KDDockWidgets::Location_OnLeft);
|
||||
addDockWidget(m_dockwidgets[3], KDDockWidgets::Location_OnBottom);
|
||||
addDockWidget(m_dockwidgets[4], KDDockWidgets::Location_OnBottom);
|
||||
addDockWidget(m_dockwidgets.at(2), KDDockWidgets::Location_OnLeft);
|
||||
addDockWidget(m_dockwidgets.at(3), KDDockWidgets::Location_OnBottom);
|
||||
addDockWidget(m_dockwidgets.at(4), KDDockWidgets::Location_OnBottom);
|
||||
|
||||
// Tab two dock widgets together
|
||||
m_dockwidgets[3]->addDockWidgetAsTab(m_dockwidgets[5]);
|
||||
m_dockwidgets[3]->addDockWidgetAsTab(m_dockwidgets.at(5));
|
||||
|
||||
// 6 is floating, as it wasn't added to the main window via MainWindow::addDockWidget().
|
||||
// and we tab 7 with it.
|
||||
m_dockwidgets[6]->addDockWidgetAsTab(m_dockwidgets[7]);
|
||||
m_dockwidgets[6]->addDockWidgetAsTab(m_dockwidgets.at(7));
|
||||
|
||||
// Floating windows also support nesting, here we add 8 to the bottom of the group
|
||||
m_dockwidgets[6]->addDockWidgetToContainingWindow(m_dockwidgets[8], KDDockWidgets::Location_OnBottom);
|
||||
m_dockwidgets[6]->addDockWidgetToContainingWindow(m_dockwidgets.at(8), KDDockWidgets::Location_OnBottom);
|
||||
|
||||
auto floatingWindow = m_dockwidgets[6]->window();
|
||||
auto floatingWindow = m_dockwidgets.at(6)->window();
|
||||
floatingWindow->move(100, 100);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2019-2020 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: Sérgio Martins <sergio.martins@kdab.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2019-2020 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: Sérgio Martins <sergio.martins@kdab.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2019-2020 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: Sérgio Martins <sergio.martins@kdab.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
@@ -34,6 +34,7 @@ protected:
|
||||
|
||||
class MyWidget1 : public MyWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit MyWidget1(QWidget *parent = nullptr);
|
||||
protected:
|
||||
@@ -42,6 +43,7 @@ protected:
|
||||
|
||||
class MyWidget2 : public MyWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit MyWidget2(QWidget *parent = nullptr);
|
||||
protected:
|
||||
@@ -50,6 +52,7 @@ protected:
|
||||
|
||||
class MyWidget3 : public MyWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit MyWidget3(QWidget *parent = nullptr);
|
||||
protected:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2019-2020 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: Sérgio Martins <sergio.martins@kdab.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
@@ -26,8 +26,10 @@ using namespace KDDockWidgets;
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||
#endif
|
||||
QApplication app(argc, argv);
|
||||
|
||||
app.setOrganizationName(QStringLiteral("KDAB"));
|
||||
@@ -37,6 +39,7 @@ int main(int argc, char **argv)
|
||||
parser.setApplicationDescription("KDDockWidgets example application");
|
||||
parser.addHelpOption();
|
||||
|
||||
// Fusion looks better in general, but feel free to change
|
||||
qApp->setStyle(QStyleFactory::create(QStringLiteral("Fusion")));
|
||||
|
||||
QCommandLineOption customStyle("p", QCoreApplication::translate("main", "Shows how to style framework internals via FrameworkWidgetFactory"));
|
||||
@@ -90,6 +93,9 @@ int main(int argc, char **argv)
|
||||
QCommandLineOption noUtilityWindows("u", QCoreApplication::translate("main", "FloatingWindows will be normal windows instead of utility windows"));
|
||||
parser.addOption(noUtilityWindows);
|
||||
|
||||
QCommandLineOption keepAbove("o", QCoreApplication::translate("main", "FloatingWindows will have Qt::WindowStaysOnTopHint. Implies not being an utility window (try it with -u too)"));
|
||||
parser.addOption(keepAbove);
|
||||
|
||||
parser.addPositionalArgument("savedlayout", QCoreApplication::translate("main", "loads the specified json file at startup"));
|
||||
|
||||
#ifdef KDDOCKWIDGETS_SUPPORTS_NESTED_MAINWINDOWS
|
||||
@@ -110,8 +116,13 @@ int main(int argc, char **argv)
|
||||
|
||||
QCommandLineOption noQtTool("no-qttool", QCoreApplication::translate("main", "(internal) Don't use Qt::Tool"));
|
||||
QCommandLineOption noParentForFloating("no-parent-for-floating", QCoreApplication::translate("main", "(internal) FloatingWindows won't have a parent"));
|
||||
QCommandLineOption nativeTitleBar("native-title-bar", QCoreApplication::translate("main", "(internal) FloatingWindows a native title bar"));
|
||||
QCommandLineOption noDropIndicators("no-drop-indicators", QCoreApplication::translate("main", "(internal) Don't use any drop indicators"));
|
||||
|
||||
parser.addOption(noQtTool);
|
||||
parser.addOption(noParentForFloating);
|
||||
parser.addOption(nativeTitleBar);
|
||||
parser.addOption(noDropIndicators);
|
||||
|
||||
# if defined(Q_OS_WIN)
|
||||
QCommandLineOption noAeroSnap("no-aero-snap", QCoreApplication::translate("main", "(internal) Disable AeroSnap"));
|
||||
@@ -136,20 +147,31 @@ int main(int argc, char **argv)
|
||||
MainWindowOptions options = MainWindowOption_None;
|
||||
auto flags = KDDockWidgets::Config::self().flags();
|
||||
#if defined(DOCKS_DEVELOPER_MODE)
|
||||
auto internalFlags = KDDockWidgets::Config::self().internalFlags();
|
||||
|
||||
options = parser.isSet(centralFrame) ? MainWindowOption_HasCentralFrame
|
||||
: MainWindowOption_None;
|
||||
|
||||
if (parser.isSet(noQtTool))
|
||||
flags |= KDDockWidgets::Config::Flag_internal_DontUseQtToolWindowsForFloatingWindows;
|
||||
internalFlags |= KDDockWidgets::Config::InternalFlag_DontUseQtToolWindowsForFloatingWindows;
|
||||
|
||||
if (parser.isSet(keepAbove))
|
||||
flags |= KDDockWidgets::Config::Flag_KeepAboveIfNotUtilityWindow;
|
||||
|
||||
if (parser.isSet(noParentForFloating))
|
||||
flags |= KDDockWidgets::Config::Flag_internal_DontUseParentForFloatingWindows;
|
||||
internalFlags |= KDDockWidgets::Config::InternalFlag_DontUseParentForFloatingWindows;
|
||||
|
||||
if (parser.isSet(nativeTitleBar))
|
||||
flags |= KDDockWidgets::Config::Flag_NativeTitleBar;
|
||||
|
||||
if (parser.isSet(noDropIndicators))
|
||||
KDDockWidgets::DefaultWidgetFactory::s_dropIndicatorType = KDDockWidgets::DropIndicatorType::None;
|
||||
|
||||
# if defined(Q_OS_WIN)
|
||||
if (parser.isSet(noAeroSnap))
|
||||
flags &= ~KDDockWidgets::Config::Flag_AeroSnapWithClientDecos;
|
||||
internalFlags |= KDDockWidgets::Config::InternalFlag_NoAeroSnap;
|
||||
# endif
|
||||
|
||||
Config::self().setInternalFlags(internalFlags);
|
||||
#endif
|
||||
|
||||
if (parser.isSet(autoHideSupport))
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# This file is part of KDDockWidgets.
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2019-2020 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: Sergio Martins <sergio.martins@kdab.com>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
@@ -13,6 +13,7 @@ cmake_minimum_required(VERSION 3.7)
|
||||
project(kddockwidgets_minimal_example)
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
set(CMAKE_INCLUDE_CURRENT_DIRS ON)
|
||||
|
||||
if(NOT TARGET kddockwidgets)
|
||||
@@ -21,7 +22,7 @@ if(NOT TARGET kddockwidgets)
|
||||
find_package(KDDockWidgets REQUIRED)
|
||||
endif()
|
||||
|
||||
qt5_add_resources(RESOURCES_EXAMPLE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/../dockwidgets/resources_example.qrc)
|
||||
set(RESOURCES_EXAMPLE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/../dockwidgets/resources_example.qrc)
|
||||
|
||||
add_executable(kddockwidgets_minimal_example
|
||||
main.cpp
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2019-2020 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: Sérgio Martins <sergio.martins@kdab.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2019-2020 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: Sérgio Martins <sergio.martins@kdab.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
@@ -35,6 +35,7 @@ protected:
|
||||
|
||||
class MyWidget1 : public MyWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit MyWidget1(QWidget *parent = nullptr);
|
||||
protected:
|
||||
@@ -43,6 +44,7 @@ protected:
|
||||
|
||||
class MyWidget2 : public MyWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit MyWidget2(QWidget *parent = nullptr);
|
||||
protected:
|
||||
@@ -51,6 +53,7 @@ protected:
|
||||
|
||||
class MyWidget3 : public MyWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit MyWidget3(QWidget *parent = nullptr);
|
||||
protected:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2019-2020 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: Sérgio Martins <sergio.martins@kdab.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
@@ -14,19 +14,27 @@
|
||||
#include <kddockwidgets/DockWidget.h>
|
||||
#include <kddockwidgets/MainWindow.h>
|
||||
|
||||
#include <QStyleFactory>
|
||||
#include <QApplication>
|
||||
|
||||
// clazy:excludeall=qstring-allocations
|
||||
|
||||
using namespace KDDockWidgets;
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||
#endif
|
||||
QApplication app(argc, argv);
|
||||
|
||||
app.setOrganizationName(QStringLiteral("KDAB"));
|
||||
app.setApplicationName(QStringLiteral("Test app"));
|
||||
|
||||
// Fusion looks better in general, but feel free to change
|
||||
qApp->setStyle(QStyleFactory::create(QStringLiteral("Fusion")));
|
||||
|
||||
// # 1. Create our main window
|
||||
|
||||
KDDockWidgets::MainWindow mainWindow(QStringLiteral("MyMainWindow"));
|
||||
@@ -54,6 +62,10 @@ int main(int argc, char **argv)
|
||||
QStringLiteral(":/assets/KDAB_bubble_fulcolor.png"));
|
||||
dock4->setWidget(widget4);
|
||||
|
||||
auto dock5 = new KDDockWidgets::DockWidget(QStringLiteral("MyDock5"));
|
||||
auto widget5 = new MyWidget(QStringLiteral(":/assets/base.png"),
|
||||
QStringLiteral(":/assets/KDAB_bubble_fulcolor.png"));
|
||||
dock5->setWidget(widget5);
|
||||
|
||||
// 3. Add them to the main window
|
||||
mainWindow.addDockWidget(dock1, KDDockWidgets::Location_OnLeft);
|
||||
@@ -62,8 +74,13 @@ int main(int argc, char **argv)
|
||||
// 4. Add dock3 to the right of dock2
|
||||
mainWindow.addDockWidget(dock3, KDDockWidgets::Location_OnRight, dock2);
|
||||
|
||||
// 5. dock4 will be its own top level (floating window)
|
||||
dock4->show();
|
||||
// 5. dock4 is docked at the bottom, with 200px height
|
||||
const QSize preferredSize(QSize(/*ignored*/0, 200));
|
||||
mainWindow.addDockWidget(dock4, KDDockWidgets::Location_OnBottom, nullptr, preferredSize);
|
||||
|
||||
|
||||
// 5. dock5 will be its own top level (floating window)
|
||||
dock5->show();
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#
|
||||
# This file is part of KDDockWidgets.
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2019-2020 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
# SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
# Author: Sergio Martins <sergio.martins@kdab.com>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
@@ -9,26 +8,8 @@
|
||||
# Contact KDAB at <info@kdab.com> for commercial licensing options.
|
||||
#
|
||||
|
||||
cmake_minimum_required(VERSION 3.7)
|
||||
project(kddockwidgets_example_quick)
|
||||
add_subdirectory(customtitlebar)
|
||||
add_subdirectory(dockwidgets)
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_INCLUDE_CURRENT_DIRS ON)
|
||||
|
||||
if(NOT TARGET kddockwidgets)
|
||||
# This will look for Qt, do find_package yourself manually before
|
||||
# if you want to look for a specific Qt version for instance.
|
||||
find_package(KDDockWidgets REQUIRED)
|
||||
endif()
|
||||
|
||||
qt5_add_resources(RESOURCES_EXAMPLE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/resources_example.qrc)
|
||||
|
||||
add_executable(kddockwidgets_example_quick
|
||||
main.cpp
|
||||
${RESOURCES_EXAMPLE_SRC}
|
||||
)
|
||||
|
||||
target_link_libraries(kddockwidgets_example_quick
|
||||
PRIVATE
|
||||
KDAB::kddockwidgets
|
||||
)
|
||||
set_compiler_flags(kddockwidgets_example_quick)
|
||||
set_compiler_flags(kddockwidgets_customtitlebar_quick)
|
||||
|
||||
37
examples/qtquick/customtitlebar/CMakeLists.txt
Normal file
37
examples/qtquick/customtitlebar/CMakeLists.txt
Normal file
@@ -0,0 +1,37 @@
|
||||
#
|
||||
# This file is part of KDDockWidgets.
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2019-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
# Author: Sergio 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.
|
||||
#
|
||||
|
||||
cmake_minimum_required(VERSION 3.7)
|
||||
project(kddockwidgets_customtitlebar_quick)
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
set(CMAKE_INCLUDE_CURRENT_DIRS ON)
|
||||
|
||||
if(NOT TARGET kddockwidgets)
|
||||
# This will look for Qt, do find_package yourself manually before
|
||||
# if you want to look for a specific Qt version for instance.
|
||||
find_package(KDDockWidgets REQUIRED)
|
||||
endif()
|
||||
|
||||
set(RESOURCES_EXAMPLE_SRC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/resources_qtquick_example.qrc
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../dockwidgets/resources_example.qrc)
|
||||
|
||||
add_executable(kddockwidgets_customtitlebar_quick
|
||||
main.cpp
|
||||
${RESOURCES_EXAMPLE_SRC}
|
||||
)
|
||||
|
||||
target_link_libraries(kddockwidgets_customtitlebar_quick
|
||||
PRIVATE
|
||||
KDAB::kddockwidgets
|
||||
)
|
||||
36
examples/qtquick/customtitlebar/Guest.qml
Normal file
36
examples/qtquick/customtitlebar/Guest.qml
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
Author: Sergio 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.
|
||||
*/
|
||||
|
||||
import QtQuick 2.9
|
||||
|
||||
Item {
|
||||
anchors.fill: parent
|
||||
|
||||
property alias background: background.source
|
||||
property alias logo: logo.source
|
||||
|
||||
|
||||
Image {
|
||||
id: background
|
||||
anchors.fill: parent
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
|
||||
Image {
|
||||
id: logo
|
||||
|
||||
fillMode: Image.PreserveAspectFit
|
||||
anchors {
|
||||
fill: parent
|
||||
margins: 50
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
18
examples/qtquick/customtitlebar/Guest1.qml
Normal file
18
examples/qtquick/customtitlebar/Guest1.qml
Normal file
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
Author: Sergio 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.
|
||||
*/
|
||||
|
||||
import QtQuick 2.9
|
||||
|
||||
Guest {
|
||||
anchors.fill: parent
|
||||
background: "qrc:/assets/triangles.png"
|
||||
logo: "qrc:/assets/KDAB_bubble_white.png"
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2020 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
Author: Sergio Martins <sergio.martins@kdab.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
@@ -11,10 +11,7 @@
|
||||
|
||||
import QtQuick 2.9
|
||||
|
||||
Rectangle {
|
||||
color: "pink"
|
||||
Guest {
|
||||
anchors.fill: parent
|
||||
Text {
|
||||
text: "Guest Widget #2!"
|
||||
}
|
||||
logo: "qrc:/assets/KDAB_bubble_blue.png"
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2020 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
Author: Sergio Martins <sergio.martins@kdab.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
@@ -11,10 +11,8 @@
|
||||
|
||||
import QtQuick 2.9
|
||||
|
||||
Rectangle {
|
||||
color: "lightblue"
|
||||
Guest {
|
||||
anchors.fill: parent
|
||||
Text {
|
||||
text: "Guest Widget #1 !"
|
||||
}
|
||||
background: "qrc:/assets/base.png"
|
||||
logo: "qrc:/assets/KDAB_bubble_fulcolor.png"
|
||||
}
|
||||
54
examples/qtquick/customtitlebar/MyTitleBar.qml
Normal file
54
examples/qtquick/customtitlebar/MyTitleBar.qml
Normal file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
Author: Sergio 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.
|
||||
*/
|
||||
|
||||
import QtQuick 2.6
|
||||
|
||||
// Will be moved to a plugin in the future
|
||||
import "qrc:/kddockwidgets/private/quick/qml/" as KDDW
|
||||
|
||||
KDDW.TitleBarBase {
|
||||
id: root
|
||||
color: "black"
|
||||
border.color: "orange"
|
||||
border.width: 2
|
||||
heightWhenVisible: 50
|
||||
|
||||
Text {
|
||||
color: "orange"
|
||||
font.bold: true
|
||||
text: root.title
|
||||
anchors {
|
||||
left: parent.left
|
||||
leftMargin: 10
|
||||
verticalCenter: root.verticalCenter
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: closeButton
|
||||
enabled: root.closeButtonEnabled
|
||||
radius: 5
|
||||
color: "green"
|
||||
height: root.height - 20
|
||||
width: height
|
||||
anchors {
|
||||
right: root.right
|
||||
rightMargin: 10
|
||||
verticalCenter: root.verticalCenter
|
||||
}
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
root.closeButtonClicked();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2020 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
Author: Sergio Martins <sergio.martins@kdab.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
@@ -10,24 +10,51 @@
|
||||
*/
|
||||
|
||||
|
||||
#include "private/DockRegistry_p.h"
|
||||
#include "private/quick/DockWidgetQuick.h"
|
||||
#include "Config.h"
|
||||
#include <kddockwidgets/Config.h>
|
||||
#include <kddockwidgets/DockWidgetQuick.h>
|
||||
#include <kddockwidgets/private/DockRegistry_p.h>
|
||||
#include <kddockwidgets/FrameworkWidgetFactory.h>
|
||||
|
||||
#include <QQuickView>
|
||||
#include <QGuiApplication>
|
||||
|
||||
class CustomFrameworkWidgetFactory : public KDDockWidgets::DefaultWidgetFactory
|
||||
{
|
||||
public:
|
||||
|
||||
~CustomFrameworkWidgetFactory() override;
|
||||
|
||||
QUrl titleBarFilename() const override
|
||||
{
|
||||
return QUrl("qrc:/MyTitleBar.qml");
|
||||
}
|
||||
};
|
||||
|
||||
CustomFrameworkWidgetFactory::~CustomFrameworkWidgetFactory() = default;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
QGuiApplication::setAttribute(Qt::AA_UseOpenGLES);
|
||||
#endif
|
||||
QGuiApplication app(argc, argv);
|
||||
|
||||
auto &config = KDDockWidgets::Config::self();
|
||||
auto flags = config.flags();
|
||||
|
||||
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);
|
||||
|
||||
auto dw1 = new KDDockWidgets::DockWidgetQuick("Dock #1");
|
||||
view.setSource(QUrl("qrc:/main.qml"));
|
||||
|
||||
dw1->setWidget(QStringLiteral("qrc:/Guest1.qml"));
|
||||
dw1->resize(QSize(800, 800));
|
||||
dw1->show();
|
||||
@@ -39,15 +66,10 @@ int main(int argc, char *argv[])
|
||||
|
||||
auto dw3 = new KDDockWidgets::DockWidgetQuick("Dock #3");
|
||||
dw3->setWidget(QStringLiteral("qrc:/Guest3.qml"));
|
||||
dw3->resize(QSize(800, 800));
|
||||
dw3->show();
|
||||
|
||||
view.setSource(QUrl("qrc:/main.qml"));
|
||||
|
||||
dw1->addDockWidgetToContainingWindow(dw3, KDDockWidgets::Location_OnRight);
|
||||
|
||||
KDDockWidgets::MainWindowBase *mainWindow = KDDockWidgets::DockRegistry::self()->mainwindows().constFirst();
|
||||
mainWindow->addDockWidget(dw2, KDDockWidgets::Location_OnTop);
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2020 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
Author: Sergio Martins <sergio.martins@kdab.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
@@ -0,0 +1,10 @@
|
||||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>main.qml</file>
|
||||
<file>Guest1.qml</file>
|
||||
<file>Guest2.qml</file>
|
||||
<file>Guest3.qml</file>
|
||||
<file>Guest.qml</file>
|
||||
<file>MyTitleBar.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2020 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
Author: Sergio Martins <sergio.martins@kdab.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
@@ -12,9 +12,7 @@
|
||||
import QtQuick 2.9
|
||||
|
||||
Rectangle {
|
||||
color: "blue"
|
||||
id: root
|
||||
color: "green"
|
||||
anchors.fill: parent
|
||||
Text {
|
||||
text: "Guest Widget!"
|
||||
}
|
||||
}
|
||||
37
examples/qtquick/dockwidgets/CMakeLists.txt
Normal file
37
examples/qtquick/dockwidgets/CMakeLists.txt
Normal file
@@ -0,0 +1,37 @@
|
||||
#
|
||||
# This file is part of KDDockWidgets.
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2019-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
# Author: Sergio 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.
|
||||
#
|
||||
|
||||
cmake_minimum_required(VERSION 3.7)
|
||||
project(kddockwidgets_example_quick)
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
set(CMAKE_INCLUDE_CURRENT_DIRS ON)
|
||||
|
||||
if(NOT TARGET kddockwidgets)
|
||||
# This will look for Qt, do find_package yourself manually before
|
||||
# if you want to look for a specific Qt version for instance.
|
||||
find_package(KDDockWidgets REQUIRED)
|
||||
endif()
|
||||
|
||||
set(RESOURCES_EXAMPLE_SRC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/resources_qtquick_example.qrc
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../dockwidgets/resources_example.qrc)
|
||||
|
||||
add_executable(kddockwidgets_example_quick
|
||||
main.cpp
|
||||
${RESOURCES_EXAMPLE_SRC}
|
||||
)
|
||||
|
||||
target_link_libraries(kddockwidgets_example_quick
|
||||
PRIVATE
|
||||
KDAB::kddockwidgets
|
||||
)
|
||||
36
examples/qtquick/dockwidgets/Guest.qml
Normal file
36
examples/qtquick/dockwidgets/Guest.qml
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
Author: Sergio 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.
|
||||
*/
|
||||
|
||||
import QtQuick 2.9
|
||||
|
||||
Item {
|
||||
anchors.fill: parent
|
||||
|
||||
property alias background: background.source
|
||||
property alias logo: logo.source
|
||||
|
||||
|
||||
Image {
|
||||
id: background
|
||||
anchors.fill: parent
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
|
||||
Image {
|
||||
id: logo
|
||||
|
||||
fillMode: Image.PreserveAspectFit
|
||||
anchors {
|
||||
fill: parent
|
||||
margins: 50
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
47
examples/qtquick/dockwidgets/Guest1.qml
Normal file
47
examples/qtquick/dockwidgets/Guest1.qml
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
Author: Sergio 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.
|
||||
*/
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2020 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
Author: Sergio Martins <sergio.martins@kdab.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
@@ -11,10 +11,7 @@
|
||||
|
||||
import QtQuick 2.9
|
||||
|
||||
Rectangle {
|
||||
color: "gray"
|
||||
Guest {
|
||||
anchors.fill: parent
|
||||
Text {
|
||||
text: "Guest Widget #3!"
|
||||
}
|
||||
logo: "qrc:/assets/KDAB_bubble_blue.png"
|
||||
}
|
||||
18
examples/qtquick/dockwidgets/Guest3.qml
Normal file
18
examples/qtquick/dockwidgets/Guest3.qml
Normal file
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
Author: Sergio 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.
|
||||
*/
|
||||
|
||||
import QtQuick 2.9
|
||||
|
||||
Guest {
|
||||
anchors.fill: parent
|
||||
background: "qrc:/assets/base.png"
|
||||
logo: "qrc:/assets/KDAB_bubble_fulcolor.png"
|
||||
}
|
||||
105
examples/qtquick/dockwidgets/main.cpp
Normal file
105
examples/qtquick/dockwidgets/main.cpp
Normal file
@@ -0,0 +1,105 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
Author: Sergio 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.
|
||||
*/
|
||||
|
||||
|
||||
#include <kddockwidgets/Config.h>
|
||||
#include <kddockwidgets/DockWidgetQuick.h>
|
||||
#include <kddockwidgets/private/DockRegistry_p.h>
|
||||
#include <kddockwidgets/FrameworkWidgetFactory.h>
|
||||
|
||||
#include <QQuickView>
|
||||
#include <QGuiApplication>
|
||||
#include <QCommandLineParser>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
QGuiApplication::setAttribute(Qt::AA_UseOpenGLES);
|
||||
#endif
|
||||
QGuiApplication app(argc, argv);
|
||||
QCommandLineParser parser;
|
||||
parser.setApplicationDescription("KDDockWidgets example application");
|
||||
parser.addHelpOption();
|
||||
|
||||
|
||||
#if defined(DOCKS_DEVELOPER_MODE)
|
||||
QCommandLineOption noQtTool("no-qttool", QCoreApplication::translate("main", "(internal) Don't use Qt::Tool"));
|
||||
QCommandLineOption noParentForFloating("no-parent-for-floating", QCoreApplication::translate("main", "(internal) FloatingWindows won't have a parent"));
|
||||
QCommandLineOption nativeTitleBar("native-title-bar", QCoreApplication::translate("main", "(internal) FloatingWindows a native title bar"));
|
||||
QCommandLineOption noDropIndicators("no-drop-indicators", QCoreApplication::translate("main", "(internal) Don't use any drop indicators"));
|
||||
|
||||
parser.addOption(noQtTool);
|
||||
parser.addOption(noParentForFloating);
|
||||
parser.addOption(nativeTitleBar);
|
||||
parser.addOption(noDropIndicators);
|
||||
|
||||
# if defined(Q_OS_WIN)
|
||||
QCommandLineOption noAeroSnap("no-aero-snap", QCoreApplication::translate("main", "(internal) Disable AeroSnap"));
|
||||
parser.addOption(noAeroSnap);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
auto flags = KDDockWidgets::Config::self().flags();
|
||||
|
||||
#if defined(DOCKS_DEVELOPER_MODE)
|
||||
auto internalFlags = KDDockWidgets::Config::self().internalFlags();
|
||||
parser.process(app);
|
||||
|
||||
if (parser.isSet(noQtTool))
|
||||
internalFlags |= KDDockWidgets::Config::InternalFlag_DontUseQtToolWindowsForFloatingWindows;
|
||||
|
||||
if (parser.isSet(noParentForFloating))
|
||||
internalFlags |= KDDockWidgets::Config::InternalFlag_DontUseParentForFloatingWindows;
|
||||
|
||||
if (parser.isSet(nativeTitleBar))
|
||||
flags |= KDDockWidgets::Config::Flag_NativeTitleBar;
|
||||
else if (parser.isSet(noDropIndicators))
|
||||
KDDockWidgets::DefaultWidgetFactory::s_dropIndicatorType = KDDockWidgets::DropIndicatorType::None;
|
||||
|
||||
# if defined(Q_OS_WIN)
|
||||
if (parser.isSet(noAeroSnap))
|
||||
internalFlags |= KDDockWidgets::Config::InternalFlag_NoAeroSnap;
|
||||
# endif
|
||||
|
||||
KDDockWidgets::Config::self().setInternalFlags(internalFlags);
|
||||
#endif
|
||||
|
||||
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);
|
||||
|
||||
auto dw1 = new KDDockWidgets::DockWidgetQuick("Dock #1");
|
||||
view.setSource(QUrl("qrc:/main.qml"));
|
||||
|
||||
dw1->setWidget(QStringLiteral("qrc:/Guest1.qml"));
|
||||
dw1->resize(QSize(800, 800));
|
||||
dw1->show();
|
||||
|
||||
auto dw2 = new KDDockWidgets::DockWidgetQuick("Dock #2");
|
||||
dw2->setWidget(QStringLiteral("qrc:/Guest2.qml"));
|
||||
dw2->resize(QSize(800, 800));
|
||||
dw2->show();
|
||||
|
||||
auto dw3 = new KDDockWidgets::DockWidgetQuick("Dock #3");
|
||||
dw3->setWidget(QStringLiteral("qrc:/Guest3.qml"));
|
||||
|
||||
dw1->addDockWidgetToContainingWindow(dw3, KDDockWidgets::Location_OnRight);
|
||||
|
||||
KDDockWidgets::MainWindowBase *mainWindow = KDDockWidgets::DockRegistry::self()->mainwindows().constFirst();
|
||||
mainWindow->addDockWidget(dw2, KDDockWidgets::Location_OnTop);
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
23
examples/qtquick/dockwidgets/main.qml
Normal file
23
examples/qtquick/dockwidgets/main.qml
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
Author: Sergio 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.
|
||||
*/
|
||||
|
||||
import QtQuick 2.6
|
||||
import com.kdab.dockwidgets 1.0 as KDDW
|
||||
|
||||
KDDW.MainWindow {
|
||||
id: root
|
||||
|
||||
|
||||
Component.onCompleted: {
|
||||
root.init("MyWindowName-1");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,5 +4,7 @@
|
||||
<file>Guest1.qml</file>
|
||||
<file>Guest2.qml</file>
|
||||
<file>Guest3.qml</file>
|
||||
<file>Guest.qml</file>
|
||||
<file>Another.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
1
kddockwidgets-rpmlintrc
Normal file
1
kddockwidgets-rpmlintrc
Normal file
@@ -0,0 +1 @@
|
||||
addFilter("E: shlib-policy-name-error")
|
||||
@@ -1,10 +1,10 @@
|
||||
Format: 1.0
|
||||
Source: kddockwidgets
|
||||
Version: 1.0.0
|
||||
Version: 1.2.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.0.0.tar.gz
|
||||
00000000000000000000000000000000 00000 kddockwidgets-1.2.0.tar.gz
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
Name: kddockwidgets
|
||||
Version: 1.0.0
|
||||
Version: 1.2.0
|
||||
Release: 1
|
||||
Summary: KDAB's Dock Widget Framework for Qt
|
||||
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
|
||||
@@ -75,7 +76,6 @@ cmake . -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release
|
||||
%defattr(-,root,root)
|
||||
%{_prefix}/share/doc/KDDockWidgets
|
||||
%{_libdir}/libkddockwidgets.so.*
|
||||
%{_libdir}/libkddockwidgets_multisplitter.so.*
|
||||
|
||||
%files devel
|
||||
%defattr(-,root,root,-)
|
||||
@@ -85,10 +85,15 @@ cmake . -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release
|
||||
%dir %{_libdir}/cmake/KDDockWidgets
|
||||
%{_libdir}/cmake/KDDockWidgets/*
|
||||
%{_libdir}/libkddockwidgets.so
|
||||
%{_libdir}/libkddockwidgets_multisplitter.so
|
||||
|
||||
%changelog
|
||||
* Wed Sep 02 2020 Allen Winter <allen.winter@kdb.com> 1.0.0
|
||||
* 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@kdb.com> 0.99.9
|
||||
* Thu Aug 06 2020 Allen Winter <allen.winter@kdab.com> 0.99.9
|
||||
1.0.0 release candidate
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# This file is part of KDDockWidgets.
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2020 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
# 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
|
||||
@@ -11,8 +11,17 @@
|
||||
|
||||
set(PYTHON_VERSION "3.7" CACHE STRING "Use specific python version to build the project.")
|
||||
find_package(Python3 ${PYTHON_VERSION} REQUIRED COMPONENTS Interpreter Development)
|
||||
find_package(Shiboken2 REQUIRED)
|
||||
find_package(PySide2 ${Qt5Widgets_VERSION} EXACT REQUIRED)
|
||||
include(PySide2ModuleBuild)
|
||||
|
||||
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")
|
||||
endif()
|
||||
|
||||
add_subdirectory(PyKDDockWidgets)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# This file is part of KDDockWidgets.
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2020 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
# 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
|
||||
@@ -20,9 +20,6 @@ set(PyKDDockWidgets_SRC
|
||||
${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets/kddockwidgets_mainwindowbase_wrapper.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets/kddockwidgets_mainwindow_wrapper.cpp
|
||||
${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets/kddockwidgets_mainwindow_wrapper.h
|
||||
# namespace wrapper
|
||||
${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets/kddockwidgets_wrapper.cpp
|
||||
${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets/kddockwidgets_wrapper.h
|
||||
# global module wrapper
|
||||
${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets/kddockwidgets_module_wrapper.cpp
|
||||
${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets/kddockwidgets_python.h
|
||||
@@ -41,15 +38,15 @@ set(PyKDDockWidgets_typesystem_paths
|
||||
|
||||
# Include flags/path that will be set in 'target_include_directories'
|
||||
set(PyKDDockWidgets_target_include_directories
|
||||
${CMAKE_SOURCE_DIR}
|
||||
${CMAKE_SOURCE_DIR}/src
|
||||
)
|
||||
|
||||
# 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
|
||||
Qt5::Core
|
||||
Qt5::Gui
|
||||
Qt5::Widgets
|
||||
Qt${QT_MAJOR_VERSION}::Core
|
||||
Qt${QT_MAJOR_VERSION}::Gui
|
||||
Qt${QT_MAJOR_VERSION}::Widgets
|
||||
)
|
||||
|
||||
# changes on these files should trigger a new generation
|
||||
@@ -74,8 +71,8 @@ create_python_bindings(
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
|
||||
# Make moduled import from build dir works
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/__init__.py ${CMAKE_CURRENT_BINARY_DIR}/__init__.py)
|
||||
# Make module import from build dir work
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/__init__.py.cmake ${CMAKE_CURRENT_BINARY_DIR}/__init__.py @ONLY)
|
||||
|
||||
# install
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/__init__.py DESTINATION ${PYTHON_BINDINGS_INSTALL_PREFIX}/PyKDDockWidgets)
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/__init__.py DESTINATION ${${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX}/PyKDDockWidgets)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# This file is part of KDDockWidgets.
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2020 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
# 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
|
||||
@@ -9,17 +9,16 @@
|
||||
# Contact KDAB at <info@kdab.com> for commercial licensing options.
|
||||
#
|
||||
|
||||
import sys
|
||||
|
||||
__all__ = ['KDDockWidgets']
|
||||
|
||||
# Preload PySide2 libraries to avoid missing libraries while loading KDDockWidgets
|
||||
try:
|
||||
from PySide2 import QtCore
|
||||
from PySide@PYSIDE_MAJOR_VERSION@ import QtCore
|
||||
# Create a alias for PySide module so we can use a single import in source files
|
||||
import PySide@PYSIDE_MAJOR_VERSION@
|
||||
sys.modules["PySide"] = PySide@PYSIDE_MAJOR_VERSION@
|
||||
except Exception:
|
||||
print("Failed to load PySide")
|
||||
raise
|
||||
|
||||
# avoid duplicate namespace, due the PYSIDE-1325 bug I will have my package like this
|
||||
# PyKDDockWidgets.KDDockWidgets.KDDockWidgets.MainWindow
|
||||
# To avoid this I add a WORKAROUND to reduce it
|
||||
from .KDDockWidgets import KDDockWidgets as _priv
|
||||
KDDockWidgets = _priv
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2020 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
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
|
||||
@@ -17,8 +17,11 @@
|
||||
// Define PYTHON_BINDINGS this will be used in some part of c++ to skip problematic parts
|
||||
#define PYTHON_BINDINGS
|
||||
|
||||
#include <MainWindowBase.h>
|
||||
#include <MainWindow.h>
|
||||
#include <DockWidgetBase.h>
|
||||
#include <DockWidget.h>
|
||||
#ifndef QT_WIDGETS_LIB
|
||||
# define QT_WIDGETS_LIB
|
||||
#endif
|
||||
|
||||
#include <kddockwidgets/MainWindowBase.h>
|
||||
#include <kddockwidgets/MainWindow.h>
|
||||
#include <kddockwidgets/DockWidgetBase.h>
|
||||
#include <kddockwidgets/DockWidget.h>
|
||||
|
||||
@@ -6,19 +6,28 @@
|
||||
typesystem because it already include gui and core typesystem -->
|
||||
<load-typesystem name="typesystem_widgets.xml" generate="no"/>
|
||||
|
||||
<rejection class="KDDockWidgets" function-name="qt_getEnumName"/>
|
||||
<rejection class="KDDockWidgets" function-name="qt_getEnumMetaObject"/>
|
||||
|
||||
<!-- Our classes are declared in a namespace, so we should define this -->
|
||||
<namespace-type name="KDDockWidgets">
|
||||
|
||||
<namespace-type name="KDDockWidgets" visible="no">
|
||||
<!-- this is used in a public virtual pure function we need to declare it
|
||||
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"/>
|
||||
<enum-type name="MainWindowOption" flags="MainWindowOptions"/>
|
||||
<enum-type name="AddingOption"/>
|
||||
<enum-type name="InitialVisibilityOption"/>
|
||||
<enum-type name="RestoreOption" flags="RestoreOptions"/>
|
||||
<enum-type name="DefaultSizeMode"/>
|
||||
<enum-type name="FrameOption" flags="FrameOptions"/>
|
||||
<enum-type name="DropIndicatorType"/>
|
||||
<enum-type name="SideBarLocation"/>
|
||||
<enum-type name="TitleBarButtonType"/>
|
||||
|
||||
<!-- our classes
|
||||
For class we can use two types:
|
||||
@@ -32,6 +41,7 @@
|
||||
<!-- this class contains a internal enum, so it should be declared
|
||||
inside of the object-type -->
|
||||
<enum-type name="Option" flags="Options" />
|
||||
<enum-type name="IconPlace" flags="IconPlaces" />
|
||||
</object-type>
|
||||
|
||||
<object-type name="DockWidget" />
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# This file is part of KDDockWidgets.
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2020 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
# 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
|
||||
@@ -9,9 +9,10 @@
|
||||
# Contact KDAB at <info@kdab.com> for commercial licensing options.
|
||||
#
|
||||
|
||||
from PySide2 import QtCore, QtWidgets, QtGui
|
||||
from PyKDDockWidgets import KDDockWidgets
|
||||
|
||||
from PySide import QtCore, QtWidgets, QtGui
|
||||
|
||||
from MyWidget1 import MyWidget1
|
||||
from MyWidget2 import MyWidget2
|
||||
from MyWidget3 import MyWidget3
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# This file is part of KDDockWidgets.
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2020 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
# 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
|
||||
@@ -9,7 +9,9 @@
|
||||
# Contact KDAB at <info@kdab.com> for commercial licensing options.
|
||||
#
|
||||
|
||||
from PySide2 import QtWidgets, QtGui, QtCore
|
||||
import PyKDDockWidgets
|
||||
|
||||
from PySide import QtWidgets, QtGui, QtCore
|
||||
|
||||
class MyWidget(QtWidgets.QWidget):
|
||||
s_images = {}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# This file is part of KDDockWidgets.
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2020 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
# 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
|
||||
@@ -9,7 +9,9 @@
|
||||
# Contact KDAB at <info@kdab.com> for commercial licensing options.
|
||||
#
|
||||
|
||||
from PySide2 import QtWidgets, QtGui
|
||||
import PyKDDockWidgets
|
||||
|
||||
from PySide import QtWidgets, QtGui
|
||||
|
||||
from MyWidget import MyWidget
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# This file is part of KDDockWidgets.
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2020 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
# 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
|
||||
@@ -9,8 +9,10 @@
|
||||
# Contact KDAB at <info@kdab.com> for commercial licensing options.
|
||||
#
|
||||
|
||||
from PySide2 import QtWidgets, QtGui, QtCore
|
||||
import PyKDDockWidgets
|
||||
|
||||
from PySide import QtWidgets, QtGui, QtCore
|
||||
|
||||
from MyWidget import MyWidget
|
||||
|
||||
class MyWidget2(MyWidget):
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# This file is part of KDDockWidgets.
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2020 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
# 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
|
||||
@@ -9,7 +9,9 @@
|
||||
# Contact KDAB at <info@kdab.com> for commercial licensing options.
|
||||
#
|
||||
|
||||
from PySide2 import QtWidgets, QtGui, QtCore
|
||||
import PyKDDockWidgets
|
||||
|
||||
from PySide import QtWidgets, QtGui, QtCore
|
||||
|
||||
from MyWidget import MyWidget
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# This file is part of KDDockWidgets.
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2020 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
# 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
|
||||
@@ -9,11 +9,11 @@
|
||||
# Contact KDAB at <info@kdab.com> for commercial licensing options.
|
||||
#
|
||||
|
||||
|
||||
from PySide2 import QtWidgets, QtCore
|
||||
from PyKDDockWidgets import KDDockWidgets
|
||||
from MyMainWindow import MyMainWindow
|
||||
|
||||
from PySide import QtWidgets, QtCore
|
||||
|
||||
import sys
|
||||
import rc_assets
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# This file is part of KDDockWidgets.
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2019-2020 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: Sergio Martins <sergio.martins@kdab.com>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
@@ -23,30 +23,68 @@ add_definitions(-DQT_NO_SIGNALS_SLOTS_KEYWORDS
|
||||
|
||||
set(DOCKSLIBS_SRCS
|
||||
Config.cpp
|
||||
Config.h
|
||||
Qt5Qt6Compat_p.h
|
||||
FocusScope.cpp
|
||||
FocusScope.h
|
||||
FrameworkWidgetFactory.cpp
|
||||
FrameworkWidgetFactory.h
|
||||
DockWidgetBase.cpp
|
||||
DockWidgetBase.h
|
||||
MainWindowBase.cpp
|
||||
MainWindowBase.h
|
||||
LayoutSaver.cpp
|
||||
LayoutSaver.h
|
||||
LayoutSaver_p.h
|
||||
private/MultiSplitter.cpp
|
||||
private/MultiSplitter_p.h
|
||||
private/Position.cpp
|
||||
private/ObjectViewer.cpp
|
||||
private/Position_p.h
|
||||
private/DropIndicatorOverlayInterface.cpp
|
||||
private/DropIndicatorOverlayInterface_p.h
|
||||
private/DropArea.cpp
|
||||
private/DropArea_p.h
|
||||
private/FloatingWindow.cpp
|
||||
private/FloatingWindow_p.h
|
||||
private/Logging.cpp
|
||||
private/Logging_p.h
|
||||
private/TabWidget.cpp
|
||||
private/TabWidget_p.h
|
||||
private/TitleBar.cpp
|
||||
private/TitleBar_p.h
|
||||
private/SideBar.cpp
|
||||
private/SideBar_p.h
|
||||
private/DockRegistry.cpp
|
||||
private/DockRegistry_p.h
|
||||
private/Draggable.cpp
|
||||
private/Draggable_p.h
|
||||
private/WindowBeingDragged.cpp
|
||||
private/WindowBeingDragged_p.h
|
||||
private/DragController.cpp
|
||||
private/DragController_p.h
|
||||
private/Frame.cpp
|
||||
private/Frame_p.h
|
||||
private/DropAreaWithCentralFrame.cpp
|
||||
private/DropAreaWithCentralFrame_p.h
|
||||
private/WidgetResizeHandler.cpp
|
||||
private/WidgetResizeHandler_p.h
|
||||
private/indicators/NullIndicators.cpp
|
||||
private/indicators/NullIndicators_p.h
|
||||
private/indicators/ClassicIndicators.cpp
|
||||
private/indicators/ClassicIndicators_p.h
|
||||
private/indicators/ClassicIndicatorsWindow.cpp
|
||||
private/indicators/ClassicIndicatorsWindow_p.h
|
||||
|
||||
private/multisplitter/Item.cpp
|
||||
private/multisplitter/Item_p.h
|
||||
private/multisplitter/Logging.cpp
|
||||
private/multisplitter/Logging_p.h
|
||||
private/multisplitter/MultiSplitterConfig.cpp
|
||||
private/multisplitter/MultiSplitterConfig.h
|
||||
private/multisplitter/Separator.cpp
|
||||
private/multisplitter/Separator_p.h
|
||||
private/multisplitter/Widget.cpp
|
||||
private/multisplitter/Widget.h
|
||||
)
|
||||
|
||||
set(DOCKS_INSTALLABLE_INCLUDES
|
||||
@@ -55,6 +93,7 @@ set(DOCKS_INSTALLABLE_INCLUDES
|
||||
FrameworkWidgetFactory.h
|
||||
DockWidgetBase.h
|
||||
KDDockWidgets.h
|
||||
Qt5Qt6Compat_p.h
|
||||
FocusScope.h
|
||||
QWidgetAdapter.h
|
||||
LayoutSaver.h
|
||||
@@ -62,12 +101,16 @@ set(DOCKS_INSTALLABLE_INCLUDES
|
||||
)
|
||||
|
||||
set(DOCKS_INSTALLABLE_PRIVATE_INCLUDES
|
||||
private/DragController_p.h
|
||||
private/Draggable_p.h
|
||||
private/DropIndicatorOverlayInterface_p.h
|
||||
private/FloatingWindow_p.h
|
||||
private/Frame_p.h
|
||||
private/SideBar_p.h
|
||||
private/TitleBar_p.h
|
||||
private/WindowBeingDragged_p.h
|
||||
private/DockRegistry_p.h
|
||||
private/TabWidget_p.h
|
||||
)
|
||||
|
||||
set(DOCKS_INSTALLABLE_PRIVATE_WIDGET_INCLUDES
|
||||
@@ -78,38 +121,73 @@ set(DOCKS_INSTALLABLE_PRIVATE_WIDGET_INCLUDES
|
||||
private/widgets/FrameWidget_p.h
|
||||
private/widgets/TabBarWidget_p.h
|
||||
private/widgets/TabWidgetWidget_p.h
|
||||
private/widgets/TabWidget_p.h
|
||||
)
|
||||
|
||||
if(OPTION_QTQUICK)
|
||||
if(${PROJECT_NAME}_QTQUICK)
|
||||
set(DOCKSLIBS_SRCS ${DOCKSLIBS_SRCS}
|
||||
private/quick/DockWidgetQuick.cpp
|
||||
DockWidgetQuick.cpp
|
||||
DockWidgetQuick.h
|
||||
private/quick/DockWidgetInstantiator.cpp
|
||||
private/quick/DockWidgetInstantiator_p.h
|
||||
private/quick/QWidgetAdapter_quick.cpp
|
||||
private/quick/QWidgetAdapter_quick_p.h
|
||||
private/quick/FloatingWindowQuick.cpp
|
||||
private/quick/FloatingWindowQuick_p.h
|
||||
private/quick/TabWidgetQuick.cpp
|
||||
private/quick/TabWidgetQuick_p.h
|
||||
private/quick/TabBarQuick.cpp
|
||||
private/quick/TabBarQuick_p.h
|
||||
private/quick/TitleBarQuick.cpp
|
||||
private/quick/TitleBarQuick_p.h
|
||||
private/quick/QmlTypes.cpp
|
||||
private/quick/QmlTypes.h
|
||||
private/quick/FrameQuick.cpp
|
||||
private/quick/FrameQuick_p.h
|
||||
private/quick/RubberBandQuick.cpp
|
||||
private/quick/RubberBandQuick.h
|
||||
private/quick/MainWindowQuick.cpp
|
||||
private/quick/MainWindowQuick_p.h
|
||||
private/quick/MainWindowWrapper.cpp
|
||||
)
|
||||
|
||||
qt5_add_resources(RESOURCES_QUICK ${CMAKE_CURRENT_SOURCE_DIR}/qtquick.qrc)
|
||||
private/quick/MainWindowWrapper_p.h
|
||||
private/multisplitter/Widget_quick.cpp
|
||||
private/multisplitter/Widget_quick.h
|
||||
private/multisplitter/Separator_quick.cpp
|
||||
private/multisplitter/Separator_quick.h
|
||||
private/multisplitter/Rubberband_quick.cpp
|
||||
private/multisplitter/Rubberband_quick.h
|
||||
kddockwidgets_qtquick.qrc)
|
||||
else()
|
||||
set(DOCKSLIBS_SRCS ${DOCKSLIBS_SRCS}
|
||||
private/DebugWindow.cpp
|
||||
private/DebugWindow_p.h
|
||||
private/ObjectViewer.cpp
|
||||
private/ObjectViewer_p.h
|
||||
MainWindow.cpp
|
||||
private/widgets/TabWidget.cpp
|
||||
MainWindow.h
|
||||
DockWidget.h
|
||||
private/multisplitter/Widget_qwidget.cpp
|
||||
private/multisplitter/Widget_qwidget.h
|
||||
private/multisplitter/Separator_qwidget.cpp
|
||||
private/multisplitter/Separator_qwidget.h
|
||||
private/widgets/TabBarWidget.cpp
|
||||
private/widgets/TabBarWidget_p.h
|
||||
private/widgets/FloatingWindowWidget.cpp
|
||||
private/widgets/FloatingWindowWidget_p.h
|
||||
private/widgets/FrameWidget.cpp
|
||||
private/widgets/FrameWidget_p.h
|
||||
private/widgets/SideBarWidget.cpp
|
||||
private/widgets/SideBarWidget_p.h
|
||||
private/widgets/TabWidgetWidget.cpp
|
||||
private/widgets/TabWidgetWidget_p.h
|
||||
private/widgets/TitleBarWidget.cpp
|
||||
private/widgets/TitleBarWidget_p.h
|
||||
private/widgets/DockWidget.cpp
|
||||
private/widgets/QWidgetAdapter_widgets.cpp
|
||||
private/widgets/QWidgetAdapter_widgets_p.h
|
||||
private/indicators/SegmentedIndicators.cpp
|
||||
private/indicators/SegmentedIndicators_p.h
|
||||
# private/indicators/AnimatedIndicators.cpp
|
||||
)
|
||||
)
|
||||
|
||||
set(DOCKS_INSTALLABLE_INCLUDES
|
||||
${DOCKS_INSTALLABLE_INCLUDES}
|
||||
@@ -125,9 +203,7 @@ else()
|
||||
set(IS_CLANG_BUILD FALSE)
|
||||
endif()
|
||||
|
||||
add_subdirectory(private/multisplitter)
|
||||
|
||||
qt5_add_resources(RESOURCES ${CMAKE_CURRENT_SOURCE_DIR}/resources.qrc)
|
||||
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(KDAB::kddockwidgets ALIAS kddockwidgets)
|
||||
@@ -136,12 +212,11 @@ set_compiler_flags(kddockwidgets)
|
||||
target_include_directories(kddockwidgets
|
||||
PUBLIC
|
||||
$<INSTALL_INTERFACE:include>
|
||||
$<INSTALL_INTERFACE:include/kddockwidgets>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||
$<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
|
||||
@@ -158,25 +233,36 @@ else()
|
||||
endif()
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCXX OR IS_CLANG_BUILD)
|
||||
target_compile_options(kddockwidgets PRIVATE -Wshadow -Wconversion -fvisibility=hidden)
|
||||
target_compile_options(kddockwidgets PRIVATE -Wshadow -fvisibility=hidden)
|
||||
|
||||
# Disable -Wconversion for Qt6. The qsizetype to int conversions are harmless
|
||||
if (NOT ${PROJECT_NAME}_QT6)
|
||||
target_compile_options(kddockwidgets PRIVATE -Wconversion)
|
||||
endif()
|
||||
|
||||
if(IS_CLANG_BUILD)
|
||||
target_compile_options(kddockwidgets PRIVATE -Wweak-vtables)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(OPTION_QTQUICK)
|
||||
target_link_libraries(kddockwidgets PUBLIC Qt5::Widgets Qt5::Quick Qt5::QuickControls2 kddockwidgets_multisplitter PRIVATE Qt5::GuiPrivate)
|
||||
if(${PROJECT_NAME}_QTQUICK)
|
||||
target_link_libraries(kddockwidgets PUBLIC Qt${QT_MAJOR_VERSION}::Widgets Qt${QT_MAJOR_VERSION}::Quick Qt${QT_MAJOR_VERSION}::QuickControls2)
|
||||
else()
|
||||
target_link_libraries(kddockwidgets PUBLIC Qt5::Widgets kddockwidgets_multisplitter PRIVATE Qt5::GuiPrivate)
|
||||
target_link_libraries(kddockwidgets PUBLIC Qt${QT_MAJOR_VERSION}::Widgets)
|
||||
endif()
|
||||
|
||||
if(NOT WIN32 AND NOT APPLE)
|
||||
find_package(Qt5X11Extras)
|
||||
target_link_libraries(kddockwidgets PUBLIC Qt5::X11Extras)
|
||||
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)
|
||||
endif()
|
||||
|
||||
set_target_properties(kddockwidgets PROPERTIES VERSION ${${PROJECT_NAME}_SOVERSION})
|
||||
set_target_properties(kddockwidgets PROPERTIES
|
||||
SOVERSION ${${PROJECT_NAME}_SOVERSION}
|
||||
VERSION ${${PROJECT_NAME}_VERSION}
|
||||
)
|
||||
|
||||
#version libraries on Windows
|
||||
if(WIN32)
|
||||
set(postfix ${${PROJECT_NAME}_VERSION_MAJOR})
|
||||
@@ -204,7 +290,6 @@ install(FILES private/multisplitter/Widget.h DESTINATION include/kddockwidgets/p
|
||||
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 private/multisplitter/multisplitter_export.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)
|
||||
@@ -228,12 +313,15 @@ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgetsConfig.cmake"
|
||||
DESTINATION ${INSTALL_LIBRARY_DIR}/cmake/KDDockWidgets
|
||||
)
|
||||
|
||||
if(OPTION_DEVELOPER_MODE)
|
||||
if(${PROJECT_NAME}_DEVELOPER_MODE)
|
||||
# Under developer mode since kddw might be a sub-folder of a project setting a different value for QT_DISABLE_DEPRECATED_BEFORE
|
||||
target_compile_definitions(kddockwidgets PRIVATE QT_DISABLE_DEPRECATED_BEFORE=0x060000)
|
||||
|
||||
if (NOT OPTION_QTQUICK) # TODO: We can support it
|
||||
option(KDDockWidgets_LINTER "Build the layout linter" ON)
|
||||
|
||||
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 kddockwidgets_multisplitter Qt5::Widgets)
|
||||
target_link_libraries(kddockwidgets_linter kddockwidgets Qt${QT_MAJOR_VERSION}::Widgets)
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
120
src/Config.cpp
120
src/Config.cpp
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2019-2020 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: Sérgio Martins <sergio.martins@kdab.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
@@ -18,14 +18,19 @@
|
||||
|
||||
#include "Config.h"
|
||||
#include "multisplitter/MultiSplitterConfig.h"
|
||||
#include "multisplitter/Widget_qwidget.h"
|
||||
#include "multisplitter/Widget.h"
|
||||
#include "DockRegistry_p.h"
|
||||
#include "FrameworkWidgetFactory.h"
|
||||
#include "Utils_p.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QDebug>
|
||||
#include <QOperatingSystemVersion>
|
||||
|
||||
#ifdef KDDOCKWIDGETS_QTQUICK
|
||||
# include <QQmlEngine>
|
||||
# include <QQmlContext>
|
||||
#endif
|
||||
|
||||
namespace KDDockWidgets
|
||||
{
|
||||
|
||||
@@ -47,8 +52,10 @@ public:
|
||||
QQmlEngine *m_qmlEngine = nullptr;
|
||||
DockWidgetFactoryFunc m_dockWidgetFactoryFunc = nullptr;
|
||||
MainWindowFactoryFunc m_mainWindowFactoryFunc = nullptr;
|
||||
FrameworkWidgetFactory *m_frameworkWidgetFactory;
|
||||
TabbingAllowedFunc m_tabbingAllowedFunc = nullptr;
|
||||
FrameworkWidgetFactory *m_frameworkWidgetFactory = nullptr;
|
||||
Flags m_flags = Flag_Default;
|
||||
InternalFlags m_internalFlags = InternalFlag_None;
|
||||
qreal m_draggedWindowOpacity = Q_QNAN;
|
||||
};
|
||||
|
||||
@@ -83,8 +90,11 @@ Config::Flags Config::flags() const
|
||||
|
||||
void Config::setFlags(Flags f)
|
||||
{
|
||||
if (!DockRegistry::self()->isEmpty()) {
|
||||
qWarning() << Q_FUNC_INFO << "Only use this function at startup before creating any DockWidget or MainWindow";
|
||||
auto dr = DockRegistry::self();
|
||||
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();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -135,7 +145,7 @@ int Config::separatorThickness() const
|
||||
|
||||
void Config::setSeparatorThickness(int value)
|
||||
{
|
||||
if (!DockRegistry::self()->isEmpty()) {
|
||||
if (!DockRegistry::self()->isEmpty(/*excludeBeingDeleted=*/ true)) {
|
||||
qWarning() << Q_FUNC_INFO << "Only use this function at startup before creating any DockWidget or MainWindow";
|
||||
return;
|
||||
}
|
||||
@@ -153,6 +163,57 @@ qreal Config::draggedWindowOpacity() const
|
||||
return d->m_draggedWindowOpacity;
|
||||
}
|
||||
|
||||
void Config::setTabbingAllowedFunc(TabbingAllowedFunc func)
|
||||
{
|
||||
d->m_tabbingAllowedFunc = func;
|
||||
}
|
||||
|
||||
TabbingAllowedFunc Config::tabbingAllowedFunc() const
|
||||
{
|
||||
return d->m_tabbingAllowedFunc;
|
||||
}
|
||||
|
||||
void Config::setAbsoluteWidgetMinSize(QSize size)
|
||||
{
|
||||
if (!DockRegistry::self()->isEmpty(/*excludeBeingDeleted=*/ false)) {
|
||||
qWarning() << Q_FUNC_INFO << "Only use this function at startup before creating any DockWidget or MainWindow";
|
||||
return;
|
||||
}
|
||||
|
||||
Layouting::Item::hardcodedMinimumSize = size;
|
||||
}
|
||||
|
||||
QSize Config::absoluteWidgetMinSize() const
|
||||
{
|
||||
return Layouting::Item::hardcodedMinimumSize;
|
||||
}
|
||||
|
||||
void Config::setAbsoluteWidgetMaxSize(QSize size)
|
||||
{
|
||||
if (!DockRegistry::self()->isEmpty(/*excludeBeingDeleted=*/ false)) {
|
||||
qWarning() << Q_FUNC_INFO << "Only use this function at startup before creating any DockWidget or MainWindow";
|
||||
return;
|
||||
}
|
||||
|
||||
Layouting::Item::hardcodedMaximumSize = size;
|
||||
}
|
||||
|
||||
QSize Config::absoluteWidgetMaxSize() const
|
||||
{
|
||||
return Layouting::Item::hardcodedMaximumSize;
|
||||
}
|
||||
|
||||
Config::InternalFlags Config::internalFlags() const
|
||||
{
|
||||
return d->m_internalFlags;
|
||||
}
|
||||
|
||||
void Config::setInternalFlags(InternalFlags flags)
|
||||
{
|
||||
d->m_internalFlags = flags;
|
||||
}
|
||||
|
||||
#ifdef KDDOCKWIDGETS_QTQUICK
|
||||
void Config::setQmlEngine(QQmlEngine *qmlEngine)
|
||||
{
|
||||
if (d->m_qmlEngine) {
|
||||
@@ -160,13 +221,22 @@ void Config::setQmlEngine(QQmlEngine *qmlEngine)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!qmlEngine) {
|
||||
qWarning() << Q_FUNC_INFO << "Null QML engine";
|
||||
return;
|
||||
}
|
||||
|
||||
d->m_qmlEngine = qmlEngine;
|
||||
|
||||
QQmlContext *context = qmlEngine->rootContext();
|
||||
context->setContextProperty(QStringLiteral("_kddw_widgetFactory"), d->m_frameworkWidgetFactory);
|
||||
}
|
||||
|
||||
QQmlEngine *Config::qmlEngine() const
|
||||
{
|
||||
return d->m_qmlEngine;
|
||||
}
|
||||
#endif
|
||||
|
||||
void Config::Private::fixFlags()
|
||||
{
|
||||
@@ -174,6 +244,9 @@ void Config::Private::fixFlags()
|
||||
if (QOperatingSystemVersion::current().majorVersion() < 10) {
|
||||
// Aero-snap requires Windows 10
|
||||
m_flags = m_flags & ~Flag_AeroSnapWithClientDecos;
|
||||
} else {
|
||||
// Unconditional now
|
||||
m_flags |= Flag_AeroSnapWithClientDecos;
|
||||
}
|
||||
|
||||
// These are mutually exclusive:
|
||||
@@ -185,15 +258,38 @@ void Config::Private::fixFlags()
|
||||
// Not supported on macOS:
|
||||
m_flags = m_flags & ~Flag_AeroSnapWithClientDecos;
|
||||
#else
|
||||
// Not supported on linux.
|
||||
// On Linux, dragging the title bar of a window doesn't generate NonClientMouseEvents
|
||||
m_flags = m_flags & ~Flag_NativeTitleBar;
|
||||
if (KDDockWidgets::isWayland()) {
|
||||
// Native title bar is forced on Wayland. Needed for moving the window.
|
||||
// The inner KDDW title bar is used for DnD.
|
||||
m_flags |= Flag_NativeTitleBar;
|
||||
} else {
|
||||
// Not supported on linux/X11
|
||||
// On Linux, dragging the title bar of a window doesn't generate NonClientMouseEvents
|
||||
// at least with KWin anyway. We can make this more granular and allow it for other
|
||||
// X11 window managers
|
||||
m_flags = m_flags & ~Flag_NativeTitleBar;
|
||||
m_flags = m_flags & ~Flag_AeroSnapWithClientDecos;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (!defined(Q_OS_WIN) && !defined(Q_OS_MACOS))
|
||||
// QtQuick doesn't support AeroSnap yet. Some problem with the native events not being received...
|
||||
m_flags = m_flags & ~Flag_AeroSnapWithClientDecos;
|
||||
#endif
|
||||
|
||||
#if !defined(Q_OS_WIN) && !defined(Q_OS_MACOS)
|
||||
m_flags = m_flags & ~Flag_AeroSnapWithClientDecos;
|
||||
|
||||
#if defined(DOCKS_DEVELOPER_MODE)
|
||||
// We allow to disable aero-snap during development
|
||||
if (m_internalFlags & InternalFlag_NoAeroSnap) {
|
||||
// The only way to disable AeroSnap
|
||||
m_flags = m_flags & ~Flag_AeroSnapWithClientDecos;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (m_flags & Flag_DontUseUtilityFloatingWindows) {
|
||||
m_internalFlags |= InternalFlag_DontUseParentForFloatingWindows;
|
||||
m_internalFlags |= InternalFlag_DontUseQtToolWindowsForFloatingWindows;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
116
src/Config.h
116
src/Config.h
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2019-2020 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: Sérgio Martins <sergio.martins@kdab.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QQmlEngine;
|
||||
class QSize;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace KDDockWidgets
|
||||
@@ -35,6 +36,14 @@ class FrameworkWidgetFactory;
|
||||
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);
|
||||
|
||||
/**
|
||||
* @brief Singleton to allow to choose certain behaviours of the framework.
|
||||
*
|
||||
@@ -53,32 +62,40 @@ public:
|
||||
|
||||
///@brief Flag enum to tune certain behaviours, the defaults are Flag_Default
|
||||
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. This is mutually exclusive with Flag_AeroSnap
|
||||
Flag_AeroSnapWithClientDecos = 2, ///> Enables AeroSnap even if we're not using the native title bar. Only supported on Windows 10.
|
||||
Flag_AlwaysTitleBarWhenFloating = 4, ///> Floating windows will have a title bar even if Flag_HideTitleBarWhenTabsVisible is specified. Unneeded if Flag_HideTitleBarWhenTabsVisible isn't specified, as that's the default already.
|
||||
Flag_HideTitleBarWhenTabsVisible = 8, ///> Hides the title bar if there's tabs visible. The empty space in the tab bar becomes draggable.
|
||||
Flag_AlwaysShowTabs = 16, ///> Always show tabs, even if there's only one,
|
||||
Flag_AllowReorderTabs = 32, /// Allows user to re-order tabs by dragging them
|
||||
Flag_TabsHaveCloseButton = 64, /// Tabs will have a close button. Equivalent to QTabWidget::setTabsClosable(true).
|
||||
Flag_DoubleClickMaximizes = 128, /// Double clicking the titlebar will maximize a floating window instead of re-docking it
|
||||
Flag_TitleBarHasMaximizeButton = 256, /// The title bar will have a maximize/restore button when floating. This is mutually-exclusive with the floating button (since many apps behave that way).
|
||||
Flag_TitleBarIsFocusable = 512, /// You can click the title bar and it will focus the last focused widget in the focus scope. If no previously focused widget then it focuses the user's dock widget guest, which should accept focus or use a focus proxy.
|
||||
Flag_LazyResize = 1024, /// The dock widgets are resized in a lazy manner. The actual resize only happens when you release the mouse button.
|
||||
|
||||
// These two are internal, for testing purposes across platforms. Use Flag_DontUseUtilityFloatingWindows instead.
|
||||
Flag_internal_DontUseQtToolWindowsForFloatingWindows = 0x800, ///> FloatingWindows will use Qt::Window instead of Qt::Tool. Internal, use Flag_DontUseUtilityFloatingWindows instead.
|
||||
Flag_internal_DontUseParentForFloatingWindows = 0x1000, ///> FloatingWindows won't have a parent top-level. Internal, use Flag_DontUseUtilityFloatingWindows instead.
|
||||
|
||||
Flag_DontUseUtilityFloatingWindows = Flag_internal_DontUseQtToolWindowsForFloatingWindows | Flag_internal_DontUseParentForFloatingWindows,
|
||||
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.
|
||||
Flag_Default = Flag_AeroSnapWithClientDecos ///> The defaults
|
||||
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. This is mutually exclusive with Flag_AeroSnap
|
||||
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.
|
||||
Flag_AlwaysTitleBarWhenFloating = 4, ///< Floating windows will have a title bar even if Flag_HideTitleBarWhenTabsVisible is specified. Unneeded if Flag_HideTitleBarWhenTabsVisible isn't specified, as that's the default already.
|
||||
Flag_HideTitleBarWhenTabsVisible = 8, ///< Hides the title bar if there's tabs visible. The empty space in the tab bar becomes draggable.
|
||||
Flag_AlwaysShowTabs = 16, ///< Always show tabs, even if there's only one,
|
||||
Flag_AllowReorderTabs = 32, ///< Allows user to re-order tabs by dragging them
|
||||
Flag_TabsHaveCloseButton = 64, ///< Tabs will have a close button. Equivalent to QTabWidget::setTabsClosable(true).
|
||||
Flag_DoubleClickMaximizes = 128, ///< Double clicking the titlebar will maximize a floating window instead of re-docking it
|
||||
Flag_TitleBarHasMaximizeButton = 256, ///< The title bar will have a maximize/restore button when floating. This is mutually-exclusive with the floating button (since many apps behave that way).
|
||||
Flag_TitleBarIsFocusable = 512, ///< You can click the title bar and it will focus the last focused widget in the focus scope. If no previously focused widget then it focuses the user's dock widget guest, which should accept focus or use a focus proxy.
|
||||
Flag_LazyResize = 1024, ///< The dock widgets are resized in a lazy manner. The actual resize only happens when you release the mouse button.
|
||||
Flag_DontUseUtilityFloatingWindows = 0x1000,
|
||||
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.
|
||||
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_Default = Flag_AeroSnapWithClientDecos ///< The defaults
|
||||
};
|
||||
Q_DECLARE_FLAGS(Flags, Flag)
|
||||
|
||||
///@internal
|
||||
///Internal flags for addtional tunning.
|
||||
///@warning Not for public consumption, support will be limited.
|
||||
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_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.
|
||||
};
|
||||
Q_DECLARE_FLAGS(InternalFlags, InternalFlag)
|
||||
|
||||
///@brief returns the chosen flags
|
||||
Flags flags() const;
|
||||
|
||||
@@ -150,9 +167,60 @@ public:
|
||||
///By default it's 1.0, fully opaque
|
||||
qreal draggedWindowOpacity() const;
|
||||
|
||||
/**
|
||||
* @brief Allows the user to intercept a docking attempt to center (tabbed) and disallow it.
|
||||
*
|
||||
* Whenever the user tries to tab two widgets together, the framework will call @p func. If
|
||||
* it returns true, then tabbing is allowed, otherwise not.
|
||||
*
|
||||
* Example:
|
||||
* @code
|
||||
* #include <kddockwidgets/Config.h>
|
||||
* (...)
|
||||
*
|
||||
* auto func = [] (const KDDockWidgets::DockWidgetBase::List &source,
|
||||
* const KDDockWidgets::DockWidgetBase::List &target)
|
||||
* {
|
||||
* // disallows dockFoo to be tabbed with dockBar.
|
||||
* return !(source.contains(dockFoo) && target.contains(dockBar));
|
||||
* }
|
||||
* @endcode
|
||||
* KDDockWidgets::Config::self()->setTabbingAllowedFunc(func);
|
||||
*/
|
||||
void setTabbingAllowedFunc(TabbingAllowedFunc func);
|
||||
|
||||
///@brief Used internally by the framework. Returns the function which was passed to setTabbingAllowedFunc()
|
||||
///By default it's nullptr.
|
||||
///@sa setTabbingAllowedFunc().
|
||||
TabbingAllowedFunc tabbingAllowedFunc() const;
|
||||
|
||||
///@brief Sets the minimum size a dock widget can have.
|
||||
/// Widgets can still provide their own min-size and it will be respected, however it can never be
|
||||
/// smaller than this one.
|
||||
void setAbsoluteWidgetMinSize(QSize size);
|
||||
QSize absoluteWidgetMinSize() const;
|
||||
|
||||
///@brief Sets the maximum size a dock widget can have.
|
||||
/// Widgets can still provide their own max-size and it will be respected, however it can never be
|
||||
/// bigger than this one.
|
||||
void setAbsoluteWidgetMaxSize(QSize size);
|
||||
QSize absoluteWidgetMaxSize() const;
|
||||
|
||||
///@internal
|
||||
///@brief returns the internal flags.
|
||||
///@warning Not for public consumption, support will be limited.
|
||||
InternalFlags internalFlags() const;
|
||||
|
||||
///@internal
|
||||
///@brief setter for the internal flags
|
||||
///@warning Not for public consumption, support will be limited.
|
||||
void setInternalFlags(InternalFlags flags);
|
||||
|
||||
#ifdef KDDOCKWIDGETS_QTQUICK
|
||||
///@brief Sets the QQmlEngine to use. Applicable only when using QtQuick.
|
||||
void setQmlEngine(QQmlEngine *);
|
||||
QQmlEngine* qmlEngine() const;
|
||||
#endif
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(Config)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2019-2020 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: Sérgio Martins <sergio.martins@kdab.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
@@ -25,6 +25,8 @@ QT_BEGIN_NAMESPACE
|
||||
class QCloseEvent;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
// clazy:excludeall=ctor-missing-parent-argument
|
||||
|
||||
namespace KDDockWidgets {
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2019-2020 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: Sérgio Martins <sergio.martins@kdab.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
@@ -16,7 +16,6 @@
|
||||
#include "Utils_p.h"
|
||||
#include "DockRegistry_p.h"
|
||||
#include "DropArea_p.h"
|
||||
#include "multisplitter/Item_p.h"
|
||||
#include "Config.h"
|
||||
#include "TitleBar_p.h"
|
||||
#include "FrameworkWidgetFactory.h"
|
||||
@@ -24,7 +23,6 @@
|
||||
#include "WindowBeingDragged_p.h"
|
||||
#include "SideBar_p.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QEvent>
|
||||
#include <QCloseEvent>
|
||||
#include <QTimer>
|
||||
@@ -58,10 +56,12 @@ public:
|
||||
}
|
||||
});
|
||||
|
||||
q->connect(floatAction, &QAction::toggled, q, [this] (bool enabled) {
|
||||
q->connect(floatAction, &QAction::toggled, q, [this] (bool checked) {
|
||||
if (!m_updatingFloatAction) { // guard against recursiveness
|
||||
q->setFloating(enabled);
|
||||
q->setFloating(checked);
|
||||
}
|
||||
|
||||
Q_EMIT q->isFloatingChanged(checked);
|
||||
});
|
||||
|
||||
toggleAction->setCheckable(true);
|
||||
@@ -108,7 +108,7 @@ public:
|
||||
void onDockWidgetHidden();
|
||||
void show();
|
||||
void close();
|
||||
void restoreToPreviousPosition();
|
||||
bool restoreToPreviousPosition();
|
||||
void maybeRestoreToPreviousPosition();
|
||||
int currentTabIndex() const;
|
||||
|
||||
@@ -132,6 +132,7 @@ public:
|
||||
bool m_updatingToggleAction = false;
|
||||
bool m_updatingFloatAction = false;
|
||||
bool m_isForceClosing = false;
|
||||
QSize m_lastOverlayedSize = QSize(0, 0);
|
||||
};
|
||||
|
||||
DockWidgetBase::DockWidgetBase(const QString &name, Options options)
|
||||
@@ -140,22 +141,22 @@ DockWidgetBase::DockWidgetBase(const QString &name, Options options)
|
||||
{
|
||||
d->init();
|
||||
DockRegistry::self()->registerDockWidget(this);
|
||||
qCDebug(creation) << "DockWidget" << this;
|
||||
|
||||
if (name.isEmpty())
|
||||
qWarning() << Q_FUNC_INFO << "Name can't be null";
|
||||
|
||||
setAttribute(Qt::WA_PendingMoveEvent, false);
|
||||
qApp->installEventFilter(this);
|
||||
}
|
||||
|
||||
DockWidgetBase::~DockWidgetBase()
|
||||
{
|
||||
DockRegistry::self()->unregisterDockWidget(this);
|
||||
qCDebug(creation) << "~DockWidget" << this;
|
||||
delete d;
|
||||
}
|
||||
|
||||
void DockWidgetBase::addDockWidgetAsTab(DockWidgetBase *other, AddingOption addingOption)
|
||||
void DockWidgetBase::addDockWidgetAsTab(DockWidgetBase *other, InitialOption option)
|
||||
{
|
||||
qCDebug(addwidget) << Q_FUNC_INFO << other;
|
||||
if (other == this) {
|
||||
qWarning() << Q_FUNC_INFO << "Refusing to add dock widget into itself" << other;
|
||||
return;
|
||||
@@ -181,7 +182,7 @@ void DockWidgetBase::addDockWidgetAsTab(DockWidgetBase *other, AddingOption addi
|
||||
Frame *frame = this->frame();
|
||||
|
||||
if (frame) {
|
||||
if (frame->contains(other)) {
|
||||
if (frame->containsDockWidget(other)) {
|
||||
qWarning() << Q_FUNC_INFO << "Already contains" << other;
|
||||
return;
|
||||
}
|
||||
@@ -198,14 +199,17 @@ void DockWidgetBase::addDockWidgetAsTab(DockWidgetBase *other, AddingOption addi
|
||||
}
|
||||
|
||||
other->setParent(nullptr);
|
||||
frame->addWidget(other, addingOption);
|
||||
frame->addWidget(other, option);
|
||||
}
|
||||
|
||||
void DockWidgetBase::addDockWidgetToContainingWindow(DockWidgetBase *other, Location location, DockWidgetBase *relativeTo)
|
||||
void DockWidgetBase::addDockWidgetToContainingWindow(DockWidgetBase *other,
|
||||
Location location,
|
||||
DockWidgetBase *relativeTo,
|
||||
InitialOption initialOption)
|
||||
{
|
||||
qCDebug(addwidget) << Q_FUNC_INFO << other << location << relativeTo;
|
||||
if (qobject_cast<MainWindowBase*>(window())) {
|
||||
qWarning() << Q_FUNC_INFO << "Just use MainWindow::addWidget() directly. This function is for floating nested windows only.";
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -225,7 +229,7 @@ void DockWidgetBase::addDockWidgetToContainingWindow(DockWidgetBase *other, Loca
|
||||
morphIntoFloatingWindow();
|
||||
|
||||
if (auto fw = floatingWindow()) {
|
||||
fw->dropArea()->addDockWidget(other, location, relativeTo);
|
||||
fw->dropArea()->addDockWidget(other, location, relativeTo, initialOption);
|
||||
} else {
|
||||
qWarning() << Q_FUNC_INFO << "Couldn't find floating nested window";
|
||||
}
|
||||
@@ -234,7 +238,6 @@ void DockWidgetBase::addDockWidgetToContainingWindow(DockWidgetBase *other, Loca
|
||||
void DockWidgetBase::setWidget(QWidgetOrQuick *w)
|
||||
{
|
||||
Q_ASSERT(w);
|
||||
qCDebug(addwidget) << Q_FUNC_INFO << w;
|
||||
if (w == d->widget)
|
||||
return;
|
||||
|
||||
@@ -265,15 +268,18 @@ bool DockWidgetBase::isFloating() const
|
||||
return fw && fw->hasSingleDockWidget();
|
||||
}
|
||||
|
||||
void DockWidgetBase::setFloating(bool floats)
|
||||
bool DockWidgetBase::setFloating(bool floats)
|
||||
{
|
||||
const bool alreadyFloating = isFloating();
|
||||
|
||||
qCDebug(docking) << Q_FUNC_INFO << "yes=" << floats
|
||||
<< "; already floating=" << alreadyFloating;
|
||||
|
||||
if ((floats && alreadyFloating) || (!floats && !alreadyFloating))
|
||||
return; // Nothing to do
|
||||
return true; // Nothing to do
|
||||
|
||||
if (!floats && (Config::self().internalFlags() & Config::InternalFlag_DontShowWhenUnfloatingHiddenWindow) && !isVisible()) {
|
||||
// Mimics behaviour of QDockWidget, which you might need during porting.
|
||||
// Not something we suggest though. For KDDW, setFloating(false) means dock, and that implies showing.
|
||||
return false;
|
||||
}
|
||||
|
||||
if (floats) {
|
||||
d->saveTabIndex();
|
||||
@@ -283,6 +289,7 @@ void DockWidgetBase::setFloating(bool floats)
|
||||
qWarning() << "DockWidget::setFloating: Tabbed but no frame exists"
|
||||
<< this;
|
||||
Q_ASSERT(false);
|
||||
return false;
|
||||
}
|
||||
|
||||
frame->detachTab(this);
|
||||
@@ -295,9 +302,10 @@ void DockWidgetBase::setFloating(bool floats)
|
||||
if (auto fw = floatingWindow())
|
||||
fw->setSuggestedGeometry(lastGeo, /*preserveCenter=*/true);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
saveLastFloatingGeometry();
|
||||
d->restoreToPreviousPosition();
|
||||
return d->restoreToPreviousPosition();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -384,6 +392,9 @@ void DockWidgetBase::setIcon(const QIcon &icon, IconPlaces places)
|
||||
if (places & IconPlace::TabBar)
|
||||
d->tabBarIcon = icon;
|
||||
|
||||
if (places & IconPlace::ToggleAction)
|
||||
d->toggleAction->setIcon(icon);
|
||||
|
||||
Q_EMIT iconChanged();
|
||||
}
|
||||
|
||||
@@ -395,6 +406,9 @@ QIcon DockWidgetBase::icon(IconPlace place) const
|
||||
if (place == IconPlace::TabBar)
|
||||
return d->tabBarIcon;
|
||||
|
||||
if (place == IconPlace::ToggleAction)
|
||||
return d->toggleAction->icon();
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -509,11 +523,23 @@ SideBarLocation DockWidgetBase::sideBarLocation() const
|
||||
return DockRegistry::self()->sideBarLocationForDockWidget(this);
|
||||
}
|
||||
|
||||
bool DockWidgetBase::hasPreviousDockedLocation() const
|
||||
{
|
||||
return d->m_lastPositions.isValid();
|
||||
}
|
||||
|
||||
QSize DockWidgetBase::lastOverlayedSize() const
|
||||
{
|
||||
return d->m_lastOverlayedSize;
|
||||
}
|
||||
|
||||
DockWidgetBase *DockWidgetBase::byName(const QString &uniqueName)
|
||||
{
|
||||
return DockRegistry::self()->dockByName(uniqueName);
|
||||
}
|
||||
|
||||
FloatingWindow *DockWidgetBase::morphIntoFloatingWindow()
|
||||
{
|
||||
qCDebug(creation) << "DockWidget::morphIntoFloatingWindow() this=" << this
|
||||
<< "; visible=" << isVisible();
|
||||
|
||||
if (auto fw = floatingWindow())
|
||||
return fw; // Nothing to do
|
||||
|
||||
@@ -522,7 +548,7 @@ FloatingWindow *DockWidgetBase::morphIntoFloatingWindow()
|
||||
if (geo.isNull()) {
|
||||
geo = geometry();
|
||||
|
||||
if (!testAttribute(Qt::WA_Moved)) { // If user already moved it, we don't interfere
|
||||
if (!testAttribute(Qt::WA_PendingMoveEvent)) { // If user already moved it, we don't interfere
|
||||
const QPoint center = d->defaultCenterPosForFloating();
|
||||
if (!center.isNull())
|
||||
geo.moveCenter(center);
|
||||
@@ -565,7 +591,6 @@ FloatingWindow *DockWidgetBase::floatingWindow() const
|
||||
|
||||
void DockWidgetBase::addPlaceholderItem(Layouting::Item *item)
|
||||
{
|
||||
qCDebug(placeholder) << Q_FUNC_INFO << this << item;
|
||||
Q_ASSERT(item);
|
||||
d->m_lastPositions.addPosition(item);
|
||||
}
|
||||
@@ -588,6 +613,16 @@ void DockWidgetBase::updateFloatAction()
|
||||
d->updateFloatAction();
|
||||
}
|
||||
|
||||
bool DockWidgetBase::eventFilter(QObject *watched, QEvent *event)
|
||||
{
|
||||
const bool isWindowActivate = event->type() == QEvent::WindowActivate;
|
||||
const bool isWindowDeactivate = event->type() == QEvent::WindowDeactivate;
|
||||
if ((isWindowActivate || isWindowDeactivate) && watched == window())
|
||||
Q_EMIT windowActiveAboutToChange(isWindowActivate);
|
||||
|
||||
return QWidgetAdapter::eventFilter(watched, event);
|
||||
}
|
||||
|
||||
QPoint DockWidgetBase::Private::defaultCenterPosForFloating()
|
||||
{
|
||||
MainWindowBase::List mainWindows = DockRegistry::self()->mainwindows();
|
||||
@@ -647,14 +682,12 @@ void DockWidgetBase::Private::onDockWidgetShown()
|
||||
{
|
||||
updateToggleAction();
|
||||
updateFloatAction();
|
||||
qCDebug(hiding) << Q_FUNC_INFO << "parent=" << q->parentWidget();
|
||||
}
|
||||
|
||||
void DockWidgetBase::Private::onDockWidgetHidden()
|
||||
{
|
||||
updateToggleAction();
|
||||
updateFloatAction();
|
||||
qCDebug(hiding) << Q_FUNC_INFO << "parent=" << q->parentWidget();
|
||||
}
|
||||
|
||||
void DockWidgetBase::Private::close()
|
||||
@@ -664,7 +697,6 @@ void DockWidgetBase::Private::close()
|
||||
m_lastPositions.setLastFloatingGeometry(q->window()->geometry());
|
||||
}
|
||||
|
||||
qCDebug(hiding) << "DockWidget::close" << this;
|
||||
saveTabIndex();
|
||||
|
||||
// Do some cleaning. Widget is hidden, but we must hide the tab containing it.
|
||||
@@ -678,16 +710,17 @@ void DockWidgetBase::Private::close()
|
||||
}
|
||||
}
|
||||
|
||||
void DockWidgetBase::Private::restoreToPreviousPosition()
|
||||
bool DockWidgetBase::Private::restoreToPreviousPosition()
|
||||
{
|
||||
if (!m_lastPositions.isValid())
|
||||
return;
|
||||
return false;
|
||||
|
||||
Layouting::Item *item = m_lastPositions.lastItem();
|
||||
|
||||
MultiSplitter *layout = DockRegistry::self()->layoutForItem(item);
|
||||
Q_ASSERT(layout);
|
||||
layout->restorePlaceholder(q, item, m_lastPositions.lastTabIndex());
|
||||
return true;
|
||||
}
|
||||
|
||||
void DockWidgetBase::Private::maybeRestoreToPreviousPosition()
|
||||
@@ -698,7 +731,6 @@ void DockWidgetBase::Private::maybeRestoreToPreviousPosition()
|
||||
return;
|
||||
|
||||
Layouting::Item *layoutItem = m_lastPositions.lastItem();
|
||||
qCDebug(placeholder) << Q_FUNC_INFO << layoutItem << m_lastPositions;
|
||||
if (!layoutItem)
|
||||
return; // nothing to do, no last position
|
||||
|
||||
@@ -710,7 +742,6 @@ void DockWidgetBase::Private::maybeRestoreToPreviousPosition()
|
||||
if (frame && frame->QWidgetAdapter::parentWidget() == DockRegistry::self()->layoutForItem(layoutItem)) {
|
||||
// There's a frame already. Means the DockWidget was hidden instead of closed.
|
||||
// Nothing to do, the dock widget will simply be shown
|
||||
qCDebug(placeholder) << Q_FUNC_INFO << "Already had frame.";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -718,7 +749,6 @@ void DockWidgetBase::Private::maybeRestoreToPreviousPosition()
|
||||
|
||||
if (q->parentWidget()) {
|
||||
// The QEvent::Show is due to it being made floating. Nothing to restore.
|
||||
qCDebug(placeholder) << Q_FUNC_INFO << "Already had parentWidget";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -745,7 +775,12 @@ void DockWidgetBase::Private::show()
|
||||
|
||||
void DockWidgetBase::onParentChanged()
|
||||
{
|
||||
#ifdef KDDOCKWIDGETS_QTWIDGETS
|
||||
// TODO: In v1.4, remove this part and use the signal emitting the arg
|
||||
Q_EMIT parentChanged();
|
||||
#else
|
||||
Q_EMIT parentChanged(this);
|
||||
#endif
|
||||
d->updateToggleAction();
|
||||
d->updateFloatAction();
|
||||
}
|
||||
@@ -779,7 +814,20 @@ void DockWidgetBase::onHidden(bool spontaneous)
|
||||
}
|
||||
}
|
||||
|
||||
void DockWidgetBase::onClosed(QCloseEvent *e)
|
||||
bool DockWidgetBase::onResize(QSize newSize)
|
||||
{
|
||||
if (isOverlayed()) {
|
||||
if (auto frame = this->frame()) {
|
||||
d->m_lastOverlayedSize = frame->QWidgetAdapter::size();
|
||||
} else {
|
||||
qWarning() << Q_FUNC_INFO << "Overlayed dock widget without frame shouldn't happen";
|
||||
}
|
||||
}
|
||||
|
||||
return QWidgetAdapter::onResize(newSize);
|
||||
}
|
||||
|
||||
void DockWidgetBase::onCloseEvent(QCloseEvent *e)
|
||||
{
|
||||
e->accept(); // By default we accept, means DockWidget closes
|
||||
if (d->widget)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2019-2020 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: Sérgio Martins <sergio.martins@kdab.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
@@ -26,10 +26,14 @@
|
||||
|
||||
#include <QVector>
|
||||
|
||||
// clazy:excludeall=ctor-missing-parent-argument
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QAction;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
class TestDocks;
|
||||
|
||||
namespace Layouting {
|
||||
class Item;
|
||||
}
|
||||
@@ -46,6 +50,7 @@ class TabWidget;
|
||||
class TitleBar;
|
||||
class MainWindowBase;
|
||||
class StateDragging;
|
||||
class FrameQuick;
|
||||
|
||||
/**
|
||||
* @brief The DockWidget base-class. DockWidget and DockWidgetBase are only
|
||||
@@ -61,13 +66,15 @@ class DOCKS_EXPORT DockWidgetBase : public QWidget
|
||||
#endif
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(bool isFocused READ isFocused NOTIFY isFocusedChanged)
|
||||
Q_PROPERTY(bool isFloating READ isFloating WRITE setFloating NOTIFY isFloatingChanged)
|
||||
public:
|
||||
typedef QVector<DockWidgetBase *> List;
|
||||
|
||||
///@brief DockWidget options to pass at construction time
|
||||
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 programatically
|
||||
Option_NotDockable = 2 ///< The DockWidget can't be docked, it's always floating
|
||||
};
|
||||
Q_DECLARE_FLAGS(Options, Option)
|
||||
@@ -75,7 +82,8 @@ public:
|
||||
enum class IconPlace {
|
||||
TitleBar = 1,
|
||||
TabBar = 2,
|
||||
All = TitleBar | TabBar
|
||||
ToggleAction = 4,
|
||||
All = ToggleAction | TitleBar | TabBar
|
||||
};
|
||||
Q_ENUM(IconPlace)
|
||||
Q_DECLARE_FLAGS(IconPlaces, IconPlace)
|
||||
@@ -93,26 +101,15 @@ public:
|
||||
///@brief destructor
|
||||
~DockWidgetBase() override;
|
||||
|
||||
/**
|
||||
* @brief Constructs a dock widget from its serialized form.
|
||||
* @internal
|
||||
*/
|
||||
static DockWidgetBase *deserialize(const LayoutSaver::DockWidget::Ptr &);
|
||||
|
||||
/**
|
||||
* @brief Serializes this dock widget into an intermediate form
|
||||
*/
|
||||
LayoutSaver::DockWidget::Ptr serialize() const;
|
||||
|
||||
/**
|
||||
* @brief docks @p other widget into this one. Tabs will be shown if not already.
|
||||
* @param other The other dock widget to dock into this one.
|
||||
* @param addingOption Allows to specify an AddingOption. Which is useful to add the dock widget
|
||||
* @param initialOption Allows to specify an InitialOption. Which is useful to add the dock widget
|
||||
* as hidden, recording only a placeholder in the tab. So it's restored to tabbed when eventually
|
||||
* shown.
|
||||
* @sa MainWindow::addDockWidget(), DockWidget::addDockWidgetToContainingWindow()
|
||||
*/
|
||||
void addDockWidgetAsTab(DockWidgetBase *other, AddingOption addingOption = AddingOption_None);
|
||||
void addDockWidgetAsTab(DockWidgetBase *other, InitialOption initialOption = {});
|
||||
|
||||
/**
|
||||
* @brief docks @p other widget into the window that contains this one.
|
||||
@@ -122,11 +119,13 @@ public:
|
||||
*
|
||||
* @param other The other dock widget to dock into the window.
|
||||
* @param location The location to dock.
|
||||
* @param relativeTo The dock widget that the @p location is relative to. If null then the window is considered.
|
||||
* @param relativeTo The dock widget that the @p location is relative to. If null then the window is considered
|
||||
* @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);
|
||||
DockWidgetBase *relativeTo = nullptr,
|
||||
InitialOption initialOption = {});
|
||||
|
||||
/**
|
||||
* @brief sets the widget which this dock widget hosts.
|
||||
@@ -137,7 +136,7 @@ public:
|
||||
* call setWidget(A) followed by setWidget(B) then A will have to be deleted by you, while B is
|
||||
* owned by the dock widget.
|
||||
*/
|
||||
void setWidget(QWidgetOrQuick *widget);
|
||||
virtual void setWidget(QWidgetOrQuick *widget);
|
||||
|
||||
/**
|
||||
* @brief returns the widget which this dock widget hosts
|
||||
@@ -156,8 +155,10 @@ public:
|
||||
/**
|
||||
* @brief setter to make the dock widget float or dock.
|
||||
* @param floats If true makes the dock widget float, otherwise docks it.
|
||||
*
|
||||
* Returns true if the request was accomplished
|
||||
*/
|
||||
void setFloating(bool floats);
|
||||
bool setFloating(bool floats);
|
||||
|
||||
/**
|
||||
* @brief Returns the QAction that allows to hide/show the dock widget
|
||||
@@ -231,7 +232,7 @@ public:
|
||||
|
||||
/**
|
||||
* @brief Sets an icon to show on title bars and tab bars.
|
||||
* @param places Specifies where the icon will be shown (TitleBar, TabBar or both)
|
||||
* @param places Specifies where the icon will be shown (TitleBar, TabBar, ToggleAction, or All)
|
||||
*
|
||||
* By default there's no icon set.
|
||||
*
|
||||
@@ -240,7 +241,7 @@ public:
|
||||
void setIcon(const QIcon &icon, IconPlaces places = IconPlace::All);
|
||||
|
||||
/**
|
||||
* @brief Returns the dock widget's titlebar or tabbar icon (depending on the passed @p place)
|
||||
* @brief Returns the dock widget's titlebar, tabbar, or toggle action icon (depending on the passed @p place)
|
||||
*
|
||||
* By default it's null.
|
||||
*
|
||||
@@ -252,7 +253,7 @@ public:
|
||||
* @brief Like QWidget::close() but the hosted widget won't be asked if we
|
||||
* should close.
|
||||
*/
|
||||
void forceClose();
|
||||
Q_INVOKABLE void forceClose();
|
||||
|
||||
/**
|
||||
* @brief Returns this dock widget's title bar.
|
||||
@@ -297,7 +298,7 @@ public:
|
||||
QStringList affinities() const;
|
||||
|
||||
/// @brief Equivalent to QWidget::show(), but it's optimized to reduce flickering on some platforms
|
||||
void show();
|
||||
Q_INVOKABLE void show();
|
||||
|
||||
/// @brief Brings the dock widget to the front.
|
||||
///
|
||||
@@ -306,7 +307,7 @@ public:
|
||||
/// - If the dock widget is floating, QWindow::raise() is called.
|
||||
///
|
||||
/// This only applies if the dock widget is already open. If closed, does nothing.
|
||||
void raise();
|
||||
Q_INVOKABLE void raise();
|
||||
|
||||
/**
|
||||
* @brief Returns whether widget() is a KDDockWidget::MainWindow
|
||||
@@ -358,9 +359,27 @@ public:
|
||||
/// This is only relevant when using the auto-hide and side-bar feature.
|
||||
SideBarLocation sideBarLocation() const;
|
||||
|
||||
/// @brief Returns whether this floating dock widget knows its previous docked location
|
||||
/// Result only makes sense if it's floating.
|
||||
///
|
||||
/// When you call dockWidget->setFloating(false) it will only dock if it knows where to.
|
||||
bool hasPreviousDockedLocation() const;
|
||||
|
||||
/// @brief returns the last size the widget has when overlayed
|
||||
/// Empty otherwise
|
||||
QSize lastOverlayedSize() const;
|
||||
|
||||
|
||||
/// @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);
|
||||
|
||||
Q_SIGNALS:
|
||||
#ifdef KDDOCKWIDGETS_QTWIDGETS
|
||||
///@brief signal emitted when the parent changed
|
||||
void parentChanged();
|
||||
#endif
|
||||
|
||||
///@brief signal emitted when the DockWidget is shown. As in QEvent::Show.
|
||||
void shown();
|
||||
@@ -390,15 +409,30 @@ Q_SIGNALS:
|
||||
///@sa isOverlayed
|
||||
void isOverlayedChanged(bool);
|
||||
|
||||
///@brief emitted when isFloating changes
|
||||
void isFloatingChanged(bool);
|
||||
|
||||
///@brief emitted when this dock widget is removed from a side-bar.
|
||||
///Only relevant for the auto-hide/sidebar feature
|
||||
void removedFromSideBar();
|
||||
|
||||
///@brief Emitted when the top-level window this dock widget is in is activated or deactivated
|
||||
///This is convenience to replace tracking dockWidget->window(), since the window changes when
|
||||
///docking and undocking
|
||||
///
|
||||
/// It's called 'aboutTo' because it's done in an event filter and the target window doesn't
|
||||
/// have it's 'activeWindow' property updated yet at this point.
|
||||
void windowActiveAboutToChange(bool activated);
|
||||
|
||||
protected:
|
||||
void onParentChanged();
|
||||
void onShown(bool spontaneous);
|
||||
void onHidden(bool spontaneous);
|
||||
void onClosed(QCloseEvent *e);
|
||||
|
||||
#ifndef PYTHON_BINDINGS //Pyside bug: https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-1327
|
||||
void onCloseEvent(QCloseEvent *e) override;
|
||||
bool onResize(QSize newSize) override;
|
||||
#endif
|
||||
|
||||
#if defined(DOCKS_DEVELOPER_MODE)
|
||||
public Q_SLOTS:
|
||||
@@ -424,7 +458,7 @@ private:
|
||||
friend class MultiSplitter;
|
||||
friend class Frame;
|
||||
friend class DropArea;
|
||||
friend class TestDocks;
|
||||
friend class ::TestDocks;
|
||||
friend class StateDragging;
|
||||
friend class KDDockWidgets::TabWidget;
|
||||
friend class KDDockWidgets::TitleBar;
|
||||
@@ -432,6 +466,18 @@ private:
|
||||
friend class KDDockWidgets::DockRegistry;
|
||||
friend class KDDockWidgets::LayoutSaver;
|
||||
friend class KDDockWidgets::MainWindowBase;
|
||||
friend class KDDockWidgets::FrameQuick;
|
||||
|
||||
/**
|
||||
* @brief Constructs a dock widget from its serialized form.
|
||||
* @internal
|
||||
*/
|
||||
static DockWidgetBase *deserialize(const LayoutSaver::DockWidget::Ptr &);
|
||||
|
||||
/**
|
||||
* @brief Serializes this dock widget into an intermediate form
|
||||
*/
|
||||
LayoutSaver::DockWidget::Ptr serialize() const;
|
||||
|
||||
/**
|
||||
* @brief the Frame which contains this dock widgets.
|
||||
@@ -463,6 +509,9 @@ private:
|
||||
///@brief Updates the floatAction state
|
||||
void updateFloatAction();
|
||||
|
||||
///@reimp
|
||||
bool eventFilter(QObject *, QEvent *) override;
|
||||
|
||||
class Private;
|
||||
Private *const d;
|
||||
};
|
||||
@@ -470,4 +519,73 @@ private:
|
||||
}
|
||||
Q_DECLARE_METATYPE(KDDockWidgets::Location)
|
||||
|
||||
#if defined(QT_WIDGETS_LIB)
|
||||
# include <QAction>
|
||||
#else
|
||||
// A QAction for QtQuick. Just so it compiles, for now
|
||||
class QAction : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
using QObject::QObject;
|
||||
|
||||
bool isChecked() const {
|
||||
return m_isChecked ;
|
||||
}
|
||||
|
||||
void setCheckable(bool is) {
|
||||
m_isCheckable = is;
|
||||
}
|
||||
|
||||
void setText(const QString &text) {
|
||||
m_text = text;
|
||||
}
|
||||
|
||||
void setToolTip(const QString &text) {
|
||||
m_toolTip = text;
|
||||
}
|
||||
|
||||
QString toolTip() const {
|
||||
returm m_toolTip;
|
||||
}
|
||||
|
||||
bool enabled() const {
|
||||
return m_enabled;
|
||||
}
|
||||
|
||||
void setEnabled(bool enabled) {
|
||||
m_enabled = enabled;
|
||||
}
|
||||
|
||||
bool checked() const {
|
||||
return m_checked;
|
||||
}
|
||||
|
||||
void setChecked(bool checked) {
|
||||
m_checked = checked;
|
||||
}
|
||||
|
||||
bool isEnabled() const {
|
||||
return m_enabled;
|
||||
}
|
||||
|
||||
void toggle() {
|
||||
m_enabled = !m_enabled;
|
||||
Q_EMIT toggled(m_enabled);
|
||||
}
|
||||
|
||||
Q_SIGNALS:
|
||||
bool toggled(bool);
|
||||
private:
|
||||
QString m_text;
|
||||
QString m_toolTip;
|
||||
|
||||
bool m_isChecked = false;
|
||||
bool m_isCheckable = false;
|
||||
bool m_enabled = false;
|
||||
bool m_checked = false;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2019-2020 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: Sérgio Martins <sergio.martins@kdab.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
@@ -44,6 +44,8 @@ DockWidgetQuick::DockWidgetQuick(const QString &name, Options options)
|
||||
: DockWidgetBase(name, options)
|
||||
, d(new Private(this))
|
||||
{
|
||||
// To mimic what QtWidgets does when creating a new QWidget.
|
||||
setVisible(false);
|
||||
}
|
||||
|
||||
DockWidgetQuick::~DockWidgetQuick()
|
||||
@@ -60,9 +62,15 @@ void DockWidgetQuick::setWidget(const QString &qmlFilename)
|
||||
auto adapter = new QWidgetAdapter(this);
|
||||
guest->setParentItem(adapter);
|
||||
guest->setParent(adapter);
|
||||
QWidgetAdapter::makeItemFillParent(adapter);
|
||||
|
||||
DockWidgetBase::setWidget(adapter);
|
||||
setWidget(adapter);
|
||||
}
|
||||
|
||||
void DockWidgetQuick::setWidget(QWidgetAdapter *widget)
|
||||
{
|
||||
widget->QWidgetAdapter::setParent(this);
|
||||
QWidgetAdapter::makeItemFillParent(widget);
|
||||
DockWidgetBase::setWidget(widget);
|
||||
}
|
||||
|
||||
bool DockWidgetQuick::event(QEvent *e)
|
||||
@@ -74,8 +82,28 @@ bool DockWidgetQuick::event(QEvent *e)
|
||||
} else if (e->type() == QEvent::Hide) {
|
||||
onHidden(e->spontaneous());
|
||||
} else if (e->type() == QEvent::Close) {
|
||||
onClosed(static_cast<QCloseEvent*>(e));
|
||||
onCloseEvent(static_cast<QCloseEvent*>(e));
|
||||
}
|
||||
|
||||
return DockWidgetBase::event(e);
|
||||
}
|
||||
|
||||
QSize DockWidgetQuick::minimumSize() const
|
||||
{
|
||||
if (QWidgetAdapter *guestWidget = widget()) {
|
||||
// The guests min-size is the same as the widget's, there's no spacing or margins.
|
||||
return guestWidget->minimumSize();
|
||||
}
|
||||
|
||||
return DockWidgetBase::minimumSize();
|
||||
}
|
||||
|
||||
QSize DockWidgetQuick::maximumSize() const
|
||||
{
|
||||
if (QWidgetAdapter *guestWidget = widget()) {
|
||||
// The guests max-size is the same as the widget's, there's no spacing or margins.
|
||||
return guestWidget->maximumSize();
|
||||
}
|
||||
|
||||
return DockWidgetBase::maximumSize();
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2019-2020 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: Sérgio Martins <sergio.martins@kdab.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
@@ -54,6 +54,15 @@ public:
|
||||
/// Similar to DockWidgetBase::setWidget(QQuickItem*)
|
||||
void setWidget(const QString &qmlFilename);
|
||||
|
||||
/// @reimp
|
||||
void setWidget(QWidgetAdapter *widget) override;
|
||||
|
||||
/// @reimp
|
||||
QSize minimumSize() const override;
|
||||
|
||||
/// @reimp
|
||||
QSize maximumSize() const override;
|
||||
|
||||
protected:
|
||||
bool event(QEvent *e) override;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2019-2020 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: Sérgio Martins <sergio.martins@kdab.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
@@ -18,15 +18,18 @@
|
||||
|
||||
#include "FocusScope.h"
|
||||
#include "TitleBar_p.h"
|
||||
#include "Frame_p.h"
|
||||
#include "DockWidgetBase.h"
|
||||
#include "DockRegistry_p.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QApplication>
|
||||
#include <QGuiApplication>
|
||||
#include <QPointer>
|
||||
|
||||
using namespace KDDockWidgets;
|
||||
|
||||
// Our Private inherits from QObject since FocusScope can't (Since Frame is already QObject)
|
||||
class FocusScope::Private : public QObject
|
||||
class FocusScope::Private : public QObject //clazy:exclude=missing-qobject-macro (breaks unity build with earlier cmake due to including .moc here.)
|
||||
{
|
||||
public:
|
||||
Private(FocusScope *qq, QWidgetAdapter *thisWidget)
|
||||
@@ -40,9 +43,12 @@ public:
|
||||
m_inCtor = false;
|
||||
}
|
||||
|
||||
~Private() override;
|
||||
|
||||
void setIsFocused(bool);
|
||||
void onFocusObjectChanged(QObject *);
|
||||
bool isInFocusScope(WidgetType *) const;
|
||||
void emitDockWidgetFocusChanged();
|
||||
|
||||
FocusScope *const q;
|
||||
QWidgetAdapter *const m_thisWidget;
|
||||
@@ -51,6 +57,9 @@ public:
|
||||
QPointer<WidgetType> m_lastFocusedInScope;
|
||||
};
|
||||
|
||||
FocusScope::Private::~Private()
|
||||
{
|
||||
}
|
||||
|
||||
FocusScope::FocusScope(QWidgetAdapter *thisWidget)
|
||||
: d(new Private(this, thisWidget))
|
||||
@@ -96,24 +105,30 @@ 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->isFocusedChanged();
|
||||
/* Q_EMIT */ q->isFocusedChangedCallback();
|
||||
}
|
||||
}
|
||||
|
||||
void FocusScope::Private::onFocusObjectChanged(QObject *obj)
|
||||
{
|
||||
auto widget = qobject_cast<WidgetType*>(obj);
|
||||
if (!widget)
|
||||
if (!widget) {
|
||||
setIsFocused(false);
|
||||
return;
|
||||
}
|
||||
|
||||
const bool is = isInFocusScope(widget);
|
||||
if (is && m_lastFocusedInScope != widget && !qobject_cast<TitleBar*>(obj)) {
|
||||
m_lastFocusedInScope = widget;
|
||||
Q_EMIT q->focusedWidgetChanged();
|
||||
setIsFocused(is);
|
||||
/* Q_EMIT */ q->focusedWidgetChangedCallback();
|
||||
} else {
|
||||
setIsFocused(is);
|
||||
}
|
||||
|
||||
setIsFocused(is);
|
||||
}
|
||||
|
||||
bool FocusScope::Private::isInFocusScope(WidgetType *widget) const
|
||||
@@ -128,3 +143,33 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2019-2020 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: Sérgio Martins <sergio.martins@kdab.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
@@ -25,12 +25,13 @@
|
||||
namespace KDDockWidgets
|
||||
{
|
||||
///@brief Allows to implement a similar functionality to QtQuick's FocusScope item, in QtWidgets
|
||||
class FocusScope
|
||||
class DOCKS_EXPORT FocusScope
|
||||
{
|
||||
Q_DISABLE_COPY(FocusScope)
|
||||
public:
|
||||
///@brief constructor
|
||||
explicit FocusScope(QWidgetAdapter *thisWidget);
|
||||
~FocusScope();
|
||||
virtual ~FocusScope();
|
||||
|
||||
///@brief Returns true if this FocusScope is focused.
|
||||
///This is similar to the QWidget::hasFocus(), except that it counts with the children being focused too.
|
||||
@@ -48,9 +49,10 @@ public:
|
||||
void focus(Qt::FocusReason = Qt::OtherFocusReason);
|
||||
|
||||
/*Q_SIGNALS:*/
|
||||
protected:
|
||||
///@brief reimplement in the 1st QObject derived class
|
||||
virtual void isFocusedChanged() = 0;
|
||||
virtual void focusedWidgetChanged() = 0;
|
||||
virtual void isFocusedChangedCallback() = 0;
|
||||
virtual void focusedWidgetChangedCallback() = 0;
|
||||
|
||||
private:
|
||||
class Private;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2019-2020 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: Sérgio Martins <sergio.martins@kdab.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
@@ -16,10 +16,11 @@
|
||||
#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"
|
||||
|
||||
#ifdef KDDOCKWIDGETS_QTWIDGETS
|
||||
# include "indicators/ClassicIndicators_p.h"
|
||||
# include "widgets/TabWidget_p.h"
|
||||
# include "widgets/FrameWidget_p.h"
|
||||
# include "widgets/TitleBarWidget_p.h"
|
||||
# include "widgets/TabBarWidget_p.h"
|
||||
@@ -30,14 +31,20 @@
|
||||
# include "indicators/SegmentedIndicators_p.h"
|
||||
|
||||
# include <QRubberBand>
|
||||
# include <QToolButton>
|
||||
#else
|
||||
# include "DockWidgetQuick.h"
|
||||
# include "quick/FrameQuick_p.h"
|
||||
# include "quick/DockWidgetQuick.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"
|
||||
#endif
|
||||
|
||||
// clazy:excludeall=ctor-missing-parent-argument
|
||||
|
||||
using namespace KDDockWidgets;
|
||||
|
||||
DropIndicatorType DefaultWidgetFactory::s_dropIndicatorType = DropIndicatorType::Classic;
|
||||
@@ -89,11 +96,18 @@ FloatingWindow *DefaultWidgetFactory::createFloatingWindow(Frame *frame, MainWin
|
||||
|
||||
DropIndicatorOverlayInterface *DefaultWidgetFactory::createDropIndicatorOverlay(DropArea *dropArea) const
|
||||
{
|
||||
#ifdef Q_OS_WASM
|
||||
// On WASM windows don't support translucency, which is required for the classic indicators.
|
||||
return new SegmentedIndicators(dropArea);
|
||||
#endif
|
||||
|
||||
switch (s_dropIndicatorType) {
|
||||
case DropIndicatorType::Classic:
|
||||
return new ClassicIndicators(dropArea);
|
||||
case DropIndicatorType::Segmented:
|
||||
return new SegmentedIndicators(dropArea);
|
||||
case DropIndicatorType::None:
|
||||
return new NullIndicators(dropArea);
|
||||
}
|
||||
|
||||
return new ClassicIndicators(dropArea);
|
||||
@@ -109,6 +123,19 @@ SideBar *DefaultWidgetFactory::createSideBar(SideBarLocation loc, MainWindowBase
|
||||
return new SideBarWidget(loc, parent);
|
||||
}
|
||||
|
||||
QAbstractButton* DefaultWidgetFactory::createTitleBarButton(QWidget *parent, TitleBarButtonType type) const
|
||||
{
|
||||
if (!parent) {
|
||||
qWarning() << Q_FUNC_INFO << "Parent not provided";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto button = new Button(parent);
|
||||
button->setIcon(iconForButtonType(type, parent->devicePixelRatioF()));
|
||||
|
||||
return button;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
Frame *DefaultWidgetFactory::createFrame(QWidgetOrQuick *parent, FrameOptions options) const
|
||||
@@ -143,21 +170,27 @@ FloatingWindow *DefaultWidgetFactory::createFloatingWindow(Frame *frame, MainWin
|
||||
|
||||
DropIndicatorOverlayInterface *DefaultWidgetFactory::createDropIndicatorOverlay(DropArea *dropArea) const
|
||||
{
|
||||
switch (s_dropIndicatorType) {
|
||||
case DropIndicatorType::Classic:
|
||||
return new ClassicIndicators(dropArea);
|
||||
case DropIndicatorType::Segmented:
|
||||
qWarning() << "Segmented indicators not supported for QtQuick yet";
|
||||
return new NullIndicators(dropArea);
|
||||
case DropIndicatorType::None:
|
||||
return new NullIndicators(dropArea);
|
||||
}
|
||||
|
||||
return new ClassicIndicators(dropArea);
|
||||
}
|
||||
|
||||
TabBar *DefaultWidgetFactory::createTabBar(TabWidget *parent) const
|
||||
{
|
||||
Q_UNUSED(parent)
|
||||
Q_ASSERT(false);
|
||||
return nullptr;
|
||||
return new TabBarQuick(parent);
|
||||
}
|
||||
|
||||
TabWidget *DefaultWidgetFactory::createTabWidget(Frame *parent) const
|
||||
{
|
||||
Q_UNUSED(parent)
|
||||
Q_ASSERT(false);
|
||||
return nullptr;
|
||||
return new TabWidgetQuick(parent);
|
||||
}
|
||||
|
||||
Layouting::Separator *DefaultWidgetFactory::createSeparator(Layouting::Widget *parent) const
|
||||
@@ -167,7 +200,78 @@ Layouting::Separator *DefaultWidgetFactory::createSeparator(Layouting::Widget *p
|
||||
|
||||
QWidgetOrQuick *DefaultWidgetFactory::createRubberBand(QWidgetOrQuick *parent) const
|
||||
{
|
||||
return new QWidgetOrQuick(parent);
|
||||
return new RubberBandQuick(parent);
|
||||
}
|
||||
|
||||
SideBar *DefaultWidgetFactory::createSideBar(SideBarLocation loc, MainWindowBase *parent) const
|
||||
{
|
||||
Q_UNUSED(loc);
|
||||
Q_UNUSED(parent);
|
||||
|
||||
qWarning() << Q_FUNC_INFO << "Not implemented yet";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
QUrl DefaultWidgetFactory::titleBarFilename() const
|
||||
{
|
||||
return QUrl(QStringLiteral("qrc:/kddockwidgets/private/quick/qml/TitleBar.qml"));
|
||||
}
|
||||
|
||||
#endif // QtQuick
|
||||
|
||||
// iconForButtonType impl is the same for QtQuick and QtWidgets
|
||||
QIcon DefaultWidgetFactory::iconForButtonType(TitleBarButtonType type, qreal dpr) const
|
||||
{
|
||||
QString iconName;
|
||||
switch (type) {
|
||||
case TitleBarButtonType::AutoHide:
|
||||
iconName = QStringLiteral("auto-hide");
|
||||
break;
|
||||
case TitleBarButtonType::UnautoHide:
|
||||
iconName = QStringLiteral("unauto-hide");
|
||||
break;
|
||||
case TitleBarButtonType::Close:
|
||||
iconName = QStringLiteral("close");
|
||||
break;
|
||||
case TitleBarButtonType::Minimize:
|
||||
iconName = QStringLiteral("min");
|
||||
break;
|
||||
case TitleBarButtonType::Maximize:
|
||||
iconName = QStringLiteral("max");
|
||||
break;
|
||||
case TitleBarButtonType::Normal:
|
||||
// We're using the same icon as dock/float
|
||||
iconName = QStringLiteral("dock-float");
|
||||
break;
|
||||
case TitleBarButtonType::Float:
|
||||
iconName = QStringLiteral("dock-float");
|
||||
break;
|
||||
}
|
||||
|
||||
if (iconName.isEmpty())
|
||||
return {};
|
||||
|
||||
QIcon icon(QStringLiteral(":/img/%1.png").arg(iconName));
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 2)
|
||||
const bool isFractional = int(dpr) != dpr;
|
||||
if (isFractional) {
|
||||
// We don't support 1.5x yet.
|
||||
// Problem with Linux is that rendering is off due to a rounding bug only fixed in 5.15.2
|
||||
// Will enable for fractional later.
|
||||
// QTBUG-86170
|
||||
// Mostly affects Linux. Unless you're using Qt::HighDpiScaleFactorRoundingPolicy::PassThrough, in which case it will
|
||||
// affect other OSes too.
|
||||
return icon;
|
||||
}
|
||||
#else
|
||||
// Not using Qt's sugar syntax, which doesn't support 1.5x anyway when we need it.
|
||||
// Simply add the high-res files and Qt will pick them when needed
|
||||
|
||||
icon.addFile(QStringLiteral(":/img/%1-1.5x.png").arg(iconName));
|
||||
Q_UNUSED(dpr);
|
||||
#endif
|
||||
icon.addFile(QStringLiteral(":/img/%1-2x.png").arg(iconName));
|
||||
|
||||
return icon;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2019-2020 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: Sérgio Martins <sergio.martins@kdab.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
@@ -16,6 +16,8 @@
|
||||
#include "KDDockWidgets.h"
|
||||
#include "QWidgetAdapter.h"
|
||||
|
||||
// clazy:excludeall=ctor-missing-parent-argument
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief A factory class for allowing the user to customize some internal widgets.
|
||||
@@ -23,6 +25,10 @@
|
||||
* @author Sérgio Martins \<sergio.martins@kdab.com\>
|
||||
*/
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QAbstractButton;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Layouting {
|
||||
class Separator;
|
||||
class Widget;
|
||||
@@ -39,6 +45,7 @@ class Frame;
|
||||
class DropArea;
|
||||
class SideBar;
|
||||
class TabBar;
|
||||
class TabWidgetQuick;
|
||||
|
||||
/**
|
||||
* @brief A factory class for allowing the user to customize some internal widgets.
|
||||
@@ -57,7 +64,12 @@ class TabBar;
|
||||
*
|
||||
* @sa Config::setFrameworkWidgetFactory()
|
||||
*/
|
||||
class DOCKS_EXPORT FrameworkWidgetFactory {
|
||||
class DOCKS_EXPORT FrameworkWidgetFactory : public QObject
|
||||
{
|
||||
#ifdef KDDOCKWIDGETS_QTQUICK
|
||||
Q_PROPERTY(QUrl titleBarFilename READ titleBarFilename CONSTANT)
|
||||
#endif
|
||||
Q_OBJECT
|
||||
public:
|
||||
FrameworkWidgetFactory() = default;
|
||||
|
||||
@@ -85,16 +97,16 @@ public:
|
||||
///@param floatingWindow Just forward to TitleBar's constructor.
|
||||
virtual TitleBar* createTitleBar(FloatingWindow *floatingWindow) 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;
|
||||
|
||||
///@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;
|
||||
|
||||
///@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;
|
||||
|
||||
///@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.
|
||||
@@ -128,6 +140,17 @@ public:
|
||||
///@param parent The MainWindow. Just forward into your SideBar sub-class ctor.
|
||||
virtual SideBar *createSideBar(SideBarLocation loc, MainWindowBase *parent) const = 0;
|
||||
|
||||
#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;
|
||||
#else
|
||||
virtual QUrl titleBarFilename() 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)
|
||||
};
|
||||
@@ -137,13 +160,14 @@ private:
|
||||
*/
|
||||
class DOCKS_EXPORT DefaultWidgetFactory : public FrameworkWidgetFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
DefaultWidgetFactory() = default;
|
||||
Frame *createFrame(QWidgetOrQuick *parent, FrameOptions) const override;
|
||||
TitleBar *createTitleBar(Frame *) const override;
|
||||
TitleBar *createTitleBar(FloatingWindow *) const override;
|
||||
TabBar *createTabBar(TabWidget *parent) const override;
|
||||
TabWidget *createTabWidget(Frame *parent) const override;
|
||||
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;
|
||||
@@ -151,6 +175,14 @@ public:
|
||||
QWidgetOrQuick *createRubberBand(QWidgetOrQuick *parent) const override;
|
||||
SideBar *createSideBar(SideBarLocation loc, MainWindowBase *parent) const override;
|
||||
|
||||
#ifdef KDDOCKWIDGETS_QTWIDGETS
|
||||
QAbstractButton* createTitleBarButton(QWidget *parent, TitleBarButtonType) const override;
|
||||
#else
|
||||
QUrl titleBarFilename() const override;
|
||||
#endif
|
||||
|
||||
QIcon iconForButtonType(TitleBarButtonType type, qreal dpr) const override;
|
||||
|
||||
static DropIndicatorType s_dropIndicatorType;
|
||||
private:
|
||||
Q_DISABLE_COPY(DefaultWidgetFactory)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2019-2020 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: Sérgio Martins <sergio.martins@kdab.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
@@ -19,17 +19,26 @@
|
||||
#ifndef KD_KDDOCKWIDGETS_H
|
||||
#define KD_KDDOCKWIDGETS_H
|
||||
|
||||
#include "Qt5Qt6Compat_p.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QDebug>
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
// Only on Windows, where this is popular. On linux it the Qt::Tool windows need reparenting. Untested on macOS.
|
||||
// Only on Windows, where this is popular. On linux the Qt::Tool windows need reparenting. Untested on macOS.
|
||||
# define KDDOCKWIDGETS_SUPPORTS_NESTED_MAINWINDOWS
|
||||
#endif
|
||||
|
||||
|
||||
namespace Layouting {
|
||||
class Item;
|
||||
class ItemBoxContainer;
|
||||
}
|
||||
|
||||
namespace KDDockWidgets
|
||||
{
|
||||
class MultiSplitter;
|
||||
class DropArea;
|
||||
|
||||
enum Location {
|
||||
Location_None,
|
||||
Location_OnLeft, ///> Left docking location
|
||||
@@ -44,9 +53,105 @@ namespace KDDockWidgets
|
||||
};
|
||||
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.
|
||||
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, ///> No option set
|
||||
AddingOption_StartHidden ///< Don't show the dock widget when adding it
|
||||
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
|
||||
};
|
||||
|
||||
/**
|
||||
* @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.
|
||||
*
|
||||
* @sa MainWindowBase::addDockWidget()
|
||||
*/
|
||||
struct InitialOption
|
||||
{
|
||||
// Implicit ctors for convenience:
|
||||
|
||||
InitialOption() = default;
|
||||
|
||||
InitialOption(InitialVisibilityOption v)
|
||||
: visibility(v) {}
|
||||
|
||||
InitialOption(QSize size)
|
||||
: preferredSize(size) {}
|
||||
|
||||
InitialOption(InitialVisibilityOption v, QSize size)
|
||||
: visibility(v)
|
||||
, 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)
|
||||
{
|
||||
}
|
||||
|
||||
bool startsHidden() const {
|
||||
return visibility == InitialVisibilityOption::StartHidden;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* @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.
|
||||
*
|
||||
* Note that usually only the width or the height will be honoured: For example, when adding a
|
||||
* 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;
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
///@internal
|
||||
@@ -65,18 +170,10 @@ namespace KDDockWidgets
|
||||
};
|
||||
Q_DECLARE_FLAGS(RestoreOptions, RestoreOption)
|
||||
|
||||
///@brief When a widget is added we need to figure out what's a decent size for it
|
||||
///This enum specifies the different ways to calculate it
|
||||
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 is smaller than the fair suggestion, then that small size is used.
|
||||
SizePolicy, ///< Uses the item's sizeHint() and sizePolicy()
|
||||
};
|
||||
|
||||
enum class DropIndicatorType {
|
||||
Classic, ///< The default
|
||||
Segmented
|
||||
Segmented, ///< Segmented indicators
|
||||
None ///< Don't show any drop indicators while dragging
|
||||
};
|
||||
|
||||
///@internal
|
||||
@@ -107,13 +204,34 @@ namespace KDDockWidgets
|
||||
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 uint qHash(SideBarLocation loc, uint seed)
|
||||
inline Qt5Qt6Compat::qhashtype qHash(SideBarLocation loc, Qt5Qt6Compat::qhashtype seed)
|
||||
{
|
||||
return ::qHash(static_cast<uint>(loc), seed);
|
||||
}
|
||||
}
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
///@internal
|
||||
inline QDebug operator<<(QDebug d, KDDockWidgets::InitialOption o)
|
||||
{
|
||||
d << o.startsHidden();
|
||||
return d;
|
||||
}
|
||||
QT_END_NAMESPACE
|
||||
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(KDDockWidgets::FrameOptions)
|
||||
Q_DECLARE_METATYPE(KDDockWidgets::InitialVisibilityOption)
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# This file is part of KDDockWidgets.
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2019-2020 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: Jean-Michaël Celerier <jean-michael.celerier@kdab.com>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
@@ -12,7 +12,7 @@
|
||||
include(CMakeFindDependencyMacro)
|
||||
|
||||
find_dependency(Qt5Widgets REQUIRED)
|
||||
if (@OPTION_QTQUICK@)
|
||||
if (@KDDockWidgets_QTQUICK@)
|
||||
find_dependency(Qt5Quick REQUIRED)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2019-2020 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: Sérgio Martins <sergio.martins@kdab.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
@@ -25,14 +25,13 @@
|
||||
#include "Logging_p.h"
|
||||
#include "Frame_p.h"
|
||||
#include "Position_p.h"
|
||||
#include "multisplitter/Item_p.h"
|
||||
#include "FrameworkWidgetFactory.h"
|
||||
#include "MainWindowBase.h"
|
||||
#include "FloatingWindow_p.h"
|
||||
|
||||
#include <qmath.h>
|
||||
#include <QDebug>
|
||||
#include <QSettings>
|
||||
#include <QApplication>
|
||||
#include <QFile>
|
||||
|
||||
#include <memory>
|
||||
@@ -163,7 +162,7 @@ QByteArray LayoutSaver::serializeLayout() const
|
||||
layout.mainWindows.push_back(mainWindow->serialize());
|
||||
}
|
||||
|
||||
const QVector<KDDockWidgets::FloatingWindow*> floatingWindows = d->m_dockRegistry->nestedwindows();
|
||||
const QVector<KDDockWidgets::FloatingWindow*> floatingWindows = d->m_dockRegistry->floatingWindows();
|
||||
layout.floatingWindows.reserve(floatingWindows.size());
|
||||
for (KDDockWidgets::FloatingWindow *floatingWindow : floatingWindows) {
|
||||
if (d->matchesAffinity(floatingWindow->affinities()))
|
||||
@@ -700,6 +699,12 @@ QVariantMap LayoutSaver::MainWindow::toVariantMap() const
|
||||
map.insert(QStringLiteral("isVisible"), isVisible);
|
||||
map.insert(QStringLiteral("affinities"), stringListToVariant(affinities));
|
||||
|
||||
for (SideBarLocation loc : { SideBarLocation::North, SideBarLocation::East, SideBarLocation::West, SideBarLocation::South }) {
|
||||
const QStringList dockWidgets = dockWidgetsPerSideBar.value(loc);
|
||||
if (!dockWidgets.isEmpty())
|
||||
map.insert(QStringLiteral("sidebar-%1").arg(int(loc)), stringListToVariant(dockWidgets));
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
@@ -720,6 +725,13 @@ void LayoutSaver::MainWindow::fromVariantMap(const QVariantMap &map)
|
||||
affinities.push_back(affinityName);
|
||||
}
|
||||
|
||||
// Load the SideBars:
|
||||
dockWidgetsPerSideBar.clear();
|
||||
for (SideBarLocation loc : { SideBarLocation::North, SideBarLocation::East, SideBarLocation::West, SideBarLocation::South }) {
|
||||
const QVariantList dockWidgets = map.value(QStringLiteral("sidebar-%1").arg(int(loc))).toList();
|
||||
if (!dockWidgets.isEmpty())
|
||||
dockWidgetsPerSideBar.insert(loc, variantToStringList(dockWidgets));
|
||||
}
|
||||
}
|
||||
|
||||
bool LayoutSaver::MultiSplitter::isValid() const
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2019-2020 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: Sérgio Martins <sergio.martins@kdab.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
@@ -27,6 +27,8 @@ QT_BEGIN_NAMESPACE
|
||||
class QByteArray;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
class TestDocks;
|
||||
|
||||
namespace KDDockWidgets {
|
||||
|
||||
class DockWidgetBase;
|
||||
@@ -105,7 +107,7 @@ public:
|
||||
struct ScreenInfo;
|
||||
private:
|
||||
Q_DISABLE_COPY(LayoutSaver)
|
||||
friend class TestDocks;
|
||||
friend class ::TestDocks;
|
||||
|
||||
class Private;
|
||||
Private *const d;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2019-2020 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: Sérgio Martins <sergio.martins@kdab.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
@@ -18,7 +18,7 @@
|
||||
#include <QRect>
|
||||
#include <QDebug>
|
||||
#include <QScreen>
|
||||
#include <QApplication>
|
||||
#include <QGuiApplication>
|
||||
#include <QJsonDocument>
|
||||
|
||||
#include <memory>
|
||||
@@ -236,6 +236,7 @@ public:
|
||||
QVariantMap toVariantMap() const;
|
||||
void fromVariantMap(const QVariantMap &map);
|
||||
|
||||
QHash<SideBarLocation, QStringList> dockWidgetsPerSideBar;
|
||||
KDDockWidgets::MainWindowOptions options;
|
||||
LayoutSaver::MultiSplitter multiSplitterLayout;
|
||||
QString uniqueName;
|
||||
@@ -271,7 +272,9 @@ public:
|
||||
s_currentLayoutBeingRestored = this;
|
||||
|
||||
const QList<QScreen*> screens = qApp->screens();
|
||||
for (int i = 0; i < screens.size(); ++i) {
|
||||
const int numScreens = screens.size();
|
||||
screenInfo.reserve(numScreens);
|
||||
for (int i = 0; i < numScreens; ++i) {
|
||||
ScreenInfo info;
|
||||
info.index = i;
|
||||
info.geometry = screens[i]->geometry();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2019-2020 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: Sérgio Martins <sergio.martins@kdab.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
@@ -25,10 +25,11 @@
|
||||
#include "DropAreaWithCentralFrame_p.h"
|
||||
#include "FrameworkWidgetFactory.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QVBoxLayout>
|
||||
#include <QPainter>
|
||||
|
||||
// clazy:excludeall=ctor-missing-parent-argument,missing-qobject-macro
|
||||
|
||||
using namespace KDDockWidgets;
|
||||
|
||||
class MainWindow::Private
|
||||
@@ -99,8 +100,6 @@ MainWindow::MainWindow(const QString &name, MainWindowOptions options,
|
||||
}
|
||||
|
||||
setCentralWidget(centralWidget);
|
||||
|
||||
// qApp->installEventFilter(this);
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
@@ -128,3 +127,8 @@ QMargins MainWindow::centerWidgetMargins() const
|
||||
{
|
||||
return { 1, 5, 1, 1};
|
||||
}
|
||||
|
||||
QRect MainWindow::centralAreaGeometry() const
|
||||
{
|
||||
return centralWidget()->geometry();
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2019-2020 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: Sérgio Martins <sergio.martins@kdab.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
@@ -53,6 +53,7 @@ public:
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *) override;
|
||||
QMargins centerWidgetMargins() const override;
|
||||
QRect centralAreaGeometry() const override;
|
||||
private:
|
||||
using QMainWindow::setCentralWidget;
|
||||
void setCentralWidget(QWidget *); // overridden just to make it private
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2019-2020 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: Sérgio Martins <sergio.martins@kdab.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
@@ -24,7 +24,7 @@
|
||||
#include "Utils_p.h"
|
||||
#include "SideBar_p.h"
|
||||
#include "Logging_p.h"
|
||||
#include "Item_p.h"
|
||||
#include "WidgetResizeHandler_p.h"
|
||||
#include "FrameworkWidgetFactory.h"
|
||||
#include "DropAreaWithCentralFrame_p.h"
|
||||
|
||||
@@ -45,9 +45,12 @@ public:
|
||||
return m_options & MainWindowOption_HasCentralFrame;
|
||||
}
|
||||
|
||||
WidgetResizeHandler::CursorPositions allowedResizeSides(SideBarLocation loc) const;
|
||||
|
||||
QRect rectForOverlay(Frame *, SideBarLocation) const;
|
||||
SideBarLocation preferredSideBar(DockWidgetBase *) const;
|
||||
void updateOverlayGeometry();
|
||||
void updateOverlayGeometry(bool reusePreviousSize = false);
|
||||
void clearSideBars();
|
||||
|
||||
QString name;
|
||||
QStringList affinities;
|
||||
@@ -58,7 +61,7 @@ public:
|
||||
};
|
||||
|
||||
MainWindowBase::MainWindowBase(const QString &uniqueName, KDDockWidgets::MainWindowOptions options,
|
||||
QWidgetOrQuick *parent, Qt::WindowFlags flags)
|
||||
WidgetType *parent, Qt::WindowFlags flags)
|
||||
: QMainWindowOrQuick(parent, flags)
|
||||
, d(new Private(this, options))
|
||||
{
|
||||
@@ -94,7 +97,8 @@ void MainWindowBase::addDockWidgetAsTab(DockWidgetBase *widget)
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindowBase::addDockWidget(DockWidgetBase *dw, Location location, DockWidgetBase *relativeTo, AddingOption option)
|
||||
void MainWindowBase::addDockWidget(DockWidgetBase *dw, Location location,
|
||||
DockWidgetBase *relativeTo, InitialOption option)
|
||||
{
|
||||
if (dw->options() & DockWidgetBase::Option_NotDockable) {
|
||||
qWarning() << Q_FUNC_INFO << "Refusing to dock non-dockable widget" << dw;
|
||||
@@ -157,13 +161,34 @@ void MainWindowBase::layoutParentContainerEqually(DockWidgetBase *dockWidget)
|
||||
dropArea()->layoutParentContainerEqually(dockWidget);
|
||||
}
|
||||
|
||||
WidgetResizeHandler::CursorPositions MainWindowBase::Private::allowedResizeSides(SideBarLocation loc) const
|
||||
{
|
||||
// When a sidebar is on top, you can only resize its bottom.
|
||||
// and so forth...
|
||||
|
||||
switch (loc) {
|
||||
case SideBarLocation::North:
|
||||
return WidgetResizeHandler::CursorPosition_Bottom;
|
||||
case SideBarLocation::East:
|
||||
return WidgetResizeHandler::CursorPosition_Left;
|
||||
case SideBarLocation::West:
|
||||
return WidgetResizeHandler::CursorPosition_Right;
|
||||
case SideBarLocation::South:
|
||||
return WidgetResizeHandler::CursorPosition_Top;
|
||||
case SideBarLocation::None:
|
||||
return WidgetResizeHandler::CursorPosition_Undefined;
|
||||
}
|
||||
|
||||
return WidgetResizeHandler::CursorPosition_Undefined;
|
||||
}
|
||||
|
||||
QRect MainWindowBase::Private::rectForOverlay(Frame *frame, SideBarLocation location) const
|
||||
{
|
||||
SideBar *sb = q->sideBar(location);
|
||||
if (!sb)
|
||||
return {};
|
||||
|
||||
const QWidget *centralWidget = q->centralWidget();
|
||||
const QRect centralAreaGeo = q->centralAreaGeometry();
|
||||
const QMargins centerWidgetMargins = q->centerWidgetMargins();
|
||||
|
||||
QRect rect;
|
||||
@@ -179,12 +204,12 @@ QRect MainWindowBase::Private::rectForOverlay(Frame *frame, SideBarLocation loca
|
||||
const int rightSideBarWidth = (rightSideBar && rightSideBar->isVisible()) ? rightSideBar->width()
|
||||
: 0;
|
||||
rect.setHeight(qMax(300, frame->minSize().height()));
|
||||
rect.setWidth(centralWidget->width() - margin * 2 - leftSideBarWidth - rightSideBarWidth);
|
||||
rect.setWidth(centralAreaGeo.width() - margin * 2 - leftSideBarWidth - rightSideBarWidth);
|
||||
rect.moveLeft(margin + leftSideBarWidth);
|
||||
if (location == SideBarLocation::South) {
|
||||
rect.moveTop(centralWidget->geometry().bottom() - centerWidgetMargins.bottom() - rect.height() - sb->height());
|
||||
rect.moveTop(centralAreaGeo.bottom() - centerWidgetMargins.bottom() - rect.height() - sb->height());
|
||||
} else {
|
||||
rect.moveTop(centralWidget->y() + sb->height() + centerWidgetMargins.top());
|
||||
rect.moveTop(centralAreaGeo.y() + sb->height() + centerWidgetMargins.top());
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -197,12 +222,12 @@ QRect MainWindowBase::Private::rectForOverlay(Frame *frame, SideBarLocation loca
|
||||
const int bottomSideBarHeight = (bottomSideBar && bottomSideBar->isVisible()) ? bottomSideBar->height()
|
||||
: 0;
|
||||
rect.setWidth(qMax(300, frame->minSize().width()));
|
||||
rect.setHeight(centralWidget->height() - topSideBarHeight - bottomSideBarHeight - centerWidgetMargins.top() - centerWidgetMargins.bottom());
|
||||
rect.setHeight(centralAreaGeo.height() - topSideBarHeight - bottomSideBarHeight - centerWidgetMargins.top() - centerWidgetMargins.bottom());
|
||||
rect.moveTop(sb->mapTo(q, QPoint(0, 0)).y() + topSideBarHeight - 1);
|
||||
if (location == SideBarLocation::East) {
|
||||
rect.moveLeft(centralWidget->width() - rect.width() - sb->width() - centerWidgetMargins.right() - margin);
|
||||
rect.moveLeft(centralAreaGeo.width() - rect.width() - sb->width() - centerWidgetMargins.right() - margin);
|
||||
} else {
|
||||
rect.moveLeft(margin + centralWidget->x() + centerWidgetMargins.left() + sb->width());
|
||||
rect.moveLeft(margin + centralAreaGeo.x() + centerWidgetMargins.left() + sb->width());
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -214,33 +239,116 @@ QRect MainWindowBase::Private::rectForOverlay(Frame *frame, SideBarLocation loca
|
||||
return rect;
|
||||
}
|
||||
|
||||
static SideBarLocation opposedSideBarLocationForBorder(Layouting::LayoutBorderLocation loc)
|
||||
{
|
||||
switch (loc) {
|
||||
case Layouting::LayoutBorderLocation_North:
|
||||
return SideBarLocation::South;
|
||||
case Layouting::LayoutBorderLocation_East:
|
||||
return SideBarLocation::West;
|
||||
case Layouting::LayoutBorderLocation_West:
|
||||
return SideBarLocation::East;
|
||||
case Layouting::LayoutBorderLocation_South:
|
||||
return SideBarLocation::North;
|
||||
case Layouting::LayoutBorderLocation_All:
|
||||
case Layouting::LayoutBorderLocation_Verticals:
|
||||
case Layouting::LayoutBorderLocation_Horizontals:
|
||||
case Layouting::LayoutBorderLocation_None:
|
||||
break;
|
||||
}
|
||||
|
||||
qWarning() << Q_FUNC_INFO << "Unknown loc" << loc;
|
||||
return SideBarLocation::None;
|
||||
}
|
||||
|
||||
static SideBarLocation sideBarLocationForBorder(Layouting::LayoutBorderLocations loc)
|
||||
{
|
||||
switch (loc) {
|
||||
case Layouting::LayoutBorderLocation_North:
|
||||
return SideBarLocation::North;
|
||||
case Layouting::LayoutBorderLocation_East:
|
||||
return SideBarLocation::East;
|
||||
case Layouting::LayoutBorderLocation_West:
|
||||
return SideBarLocation::West;
|
||||
case Layouting::LayoutBorderLocation_South:
|
||||
return SideBarLocation::South;
|
||||
case Layouting::LayoutBorderLocation_All:
|
||||
case Layouting::LayoutBorderLocation_Verticals:
|
||||
case Layouting::LayoutBorderLocation_Horizontals:
|
||||
case Layouting::LayoutBorderLocation_None:
|
||||
break;
|
||||
}
|
||||
|
||||
return SideBarLocation::None;
|
||||
}
|
||||
|
||||
SideBarLocation MainWindowBase::Private::preferredSideBar(DockWidgetBase *dw) const
|
||||
{
|
||||
// TODO: Algorithm can still be made smarter
|
||||
|
||||
Layouting::Item *item = q->multiSplitter()->itemForFrame(dw->frame());
|
||||
if (!item) {
|
||||
qWarning() << Q_FUNC_INFO << "No item for dock widget";
|
||||
return SideBarLocation::None;
|
||||
}
|
||||
|
||||
const Layouting::Item::LayoutBorderLocations borders = item->adjacentLayoutBorders();
|
||||
const Layouting::LayoutBorderLocations borders = item->adjacentLayoutBorders();
|
||||
const qreal aspectRatio = dw->width() / (dw->height() * 1.0);
|
||||
|
||||
// Simple algorithm for now.
|
||||
if (borders & Layouting::Item::LayoutBorderLocation_South)
|
||||
/// 1. It's touching all borders
|
||||
if (borders == Layouting::LayoutBorderLocation_All) {
|
||||
return aspectRatio > 1.0 ? SideBarLocation::South
|
||||
: SideBarLocation::East;
|
||||
}
|
||||
|
||||
/// 2. It's touching 3 borders
|
||||
for (auto borderLoc : { Layouting::LayoutBorderLocation_North, Layouting::LayoutBorderLocation_East,
|
||||
Layouting::LayoutBorderLocation_West, Layouting::LayoutBorderLocation_South }) {
|
||||
if (borders == (Layouting::LayoutBorderLocation_All & ~borderLoc))
|
||||
return opposedSideBarLocationForBorder(borderLoc);
|
||||
}
|
||||
|
||||
/// 3. It's touching left and right borders
|
||||
if ((borders & Layouting::LayoutBorderLocation_Verticals) == Layouting::LayoutBorderLocation_Verticals) {
|
||||
// We could measure the distance to the top though.
|
||||
return SideBarLocation::South;
|
||||
}
|
||||
|
||||
if (borders & Layouting::Item::LayoutBorderLocation_North)
|
||||
return SideBarLocation::North;
|
||||
|
||||
if (borders & Layouting::Item::LayoutBorderLocation_East)
|
||||
/// 4. It's touching top and bottom borders
|
||||
if ((borders & Layouting::LayoutBorderLocation_Horizontals) == Layouting::LayoutBorderLocation_Horizontals) {
|
||||
// We could measure the distance to the left though.
|
||||
return SideBarLocation::East;
|
||||
}
|
||||
|
||||
if (borders & Layouting::Item::LayoutBorderLocation_West)
|
||||
return SideBarLocation::West;
|
||||
// 5. It's in a corner
|
||||
if (borders == (Layouting::LayoutBorderLocation_West | Layouting::LayoutBorderLocation_South)) {
|
||||
return aspectRatio > 1.0 ? SideBarLocation::South
|
||||
: SideBarLocation::West;
|
||||
} else if (borders == (Layouting::LayoutBorderLocation_East | Layouting::LayoutBorderLocation_South)) {
|
||||
return aspectRatio > 1.0 ? SideBarLocation::South
|
||||
: SideBarLocation::East;
|
||||
} else if (borders == (Layouting::LayoutBorderLocation_West | Layouting::LayoutBorderLocation_North)) {
|
||||
return aspectRatio > 1.0 ? SideBarLocation::North
|
||||
: SideBarLocation::West;
|
||||
} else if (borders == (Layouting::LayoutBorderLocation_East | Layouting::LayoutBorderLocation_North)) {
|
||||
return aspectRatio > 1.0 ? SideBarLocation::North
|
||||
: SideBarLocation::East;
|
||||
}
|
||||
|
||||
return SideBarLocation::South;
|
||||
|
||||
{
|
||||
// 6. It's only touching 1 border
|
||||
SideBarLocation loc = sideBarLocationForBorder(borders);
|
||||
if (loc != SideBarLocation::None)
|
||||
return loc;
|
||||
}
|
||||
|
||||
// It's not touching any border, use aspect ratio.
|
||||
return aspectRatio > 1.0 ? SideBarLocation::South
|
||||
: SideBarLocation::West;
|
||||
}
|
||||
|
||||
void MainWindowBase::Private::updateOverlayGeometry()
|
||||
void MainWindowBase::Private::updateOverlayGeometry(bool reusePreviousSize)
|
||||
{
|
||||
if (!m_overlayedDockWidget)
|
||||
return;
|
||||
@@ -251,7 +359,55 @@ void MainWindowBase::Private::updateOverlayGeometry()
|
||||
return;
|
||||
}
|
||||
|
||||
m_overlayedDockWidget->frame()->QWidgetAdapter::setGeometry(rectForOverlay(m_overlayedDockWidget->frame(), sb->location()));
|
||||
const QRect defaultGeometry = rectForOverlay(m_overlayedDockWidget->frame(), sb->location());
|
||||
QRect newGeometry = defaultGeometry;
|
||||
|
||||
Frame *frame = m_overlayedDockWidget->frame();
|
||||
|
||||
if (reusePreviousSize) {
|
||||
// Let's try to honour the previous overlay size
|
||||
switch (sb->location()) {
|
||||
case SideBarLocation::North: {
|
||||
const int maxHeight = q->height() - frame->pos().y() - 10; // gap
|
||||
newGeometry.setHeight(qMin(frame->height(), maxHeight));
|
||||
break;
|
||||
}
|
||||
case SideBarLocation::South: {
|
||||
const int maxHeight = sb->pos().y() - m_dropArea->pos().y() - 10; // gap
|
||||
const int bottom = newGeometry.bottom();
|
||||
newGeometry.setHeight(qMin(frame->height(), maxHeight));
|
||||
newGeometry.moveBottom(bottom);
|
||||
break;
|
||||
}
|
||||
case SideBarLocation::East: {
|
||||
const int maxWidth = sb->pos().x() - m_dropArea->pos().x() - 10; // gap
|
||||
const int right = newGeometry.right();
|
||||
newGeometry.setWidth(qMin(frame->width(), maxWidth));
|
||||
newGeometry.moveRight(right);
|
||||
break;
|
||||
}
|
||||
case SideBarLocation::West: {
|
||||
const int maxWidth = q->width() - frame->pos().x() - 10; // gap
|
||||
newGeometry.setWidth(qMin(frame->height(), maxWidth));
|
||||
break;
|
||||
}
|
||||
case SideBarLocation::None:
|
||||
qWarning() << Q_FUNC_INFO << "Unexpected sidebar value";
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
m_overlayedDockWidget->frame()->QWidgetAdapter::setGeometry(newGeometry);
|
||||
}
|
||||
|
||||
void MainWindowBase::Private::clearSideBars()
|
||||
{
|
||||
for (auto loc : { SideBarLocation::North, SideBarLocation::South,
|
||||
SideBarLocation::East, SideBarLocation::West }) {
|
||||
if (SideBar *sb = q->sideBar(loc))
|
||||
sb->clear();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindowBase::moveToSideBar(DockWidgetBase *dw)
|
||||
@@ -293,7 +449,7 @@ void MainWindowBase::overlayOnSideBar(DockWidgetBase *dw)
|
||||
return;
|
||||
|
||||
const SideBar *sb = sideBarForDockWidget(dw);
|
||||
if (sb == nullptr) {
|
||||
if (!sb) {
|
||||
qWarning() << Q_FUNC_INFO << "You need to add the dock widget to the sidebar before you can overlay it";
|
||||
return;
|
||||
}
|
||||
@@ -309,7 +465,12 @@ void MainWindowBase::overlayOnSideBar(DockWidgetBase *dw)
|
||||
auto frame = Config::self().frameworkWidgetFactory()->createFrame(this, FrameOption_IsOverlayed);
|
||||
d->m_overlayedDockWidget = dw;
|
||||
frame->addWidget(dw);
|
||||
d->updateOverlayGeometry();
|
||||
d->updateOverlayGeometry(/*reusePreviousSize=*/ false);
|
||||
|
||||
// Uncomment once I'm happy with the resizing
|
||||
auto resizeHandler = new WidgetResizeHandler(true, frame);
|
||||
resizeHandler->setAllowedResizeSides(d->allowedResizeSides(sb->location()));
|
||||
|
||||
frame->QWidgetAdapter::show();
|
||||
|
||||
Q_EMIT dw->isOverlayedChanged(true);
|
||||
@@ -318,7 +479,7 @@ void MainWindowBase::overlayOnSideBar(DockWidgetBase *dw)
|
||||
void MainWindowBase::toggleOverlayOnSideBar(DockWidgetBase *dw)
|
||||
{
|
||||
const bool wasOverlayed = d->m_overlayedDockWidget == dw;
|
||||
clearSideBarOverlay();
|
||||
clearSideBarOverlay(); // Because only 1 dock widget can be overlayed each time
|
||||
if (!wasOverlayed) {
|
||||
overlayOnSideBar(dw);
|
||||
}
|
||||
@@ -342,7 +503,7 @@ SideBar *MainWindowBase::sideBarForDockWidget(const DockWidgetBase *dw) const
|
||||
SideBarLocation::East, SideBarLocation::West }) {
|
||||
|
||||
if (SideBar *sb = sideBar(loc)) {
|
||||
if (sb->contains(const_cast<DockWidgetBase *>(dw)))
|
||||
if (sb->containsDockWidget(const_cast<DockWidgetBase *>(dw)))
|
||||
return sb;
|
||||
}
|
||||
}
|
||||
@@ -357,8 +518,20 @@ DockWidgetBase *MainWindowBase::overlayedDockWidget() const
|
||||
|
||||
bool MainWindowBase::sideBarIsVisible(SideBarLocation loc) const
|
||||
{
|
||||
if (SideBar *sb = sideBar(loc))
|
||||
return sb->isVisible();
|
||||
if (SideBar *sb = sideBar(loc)) {
|
||||
return !sb->isEmpty(); // isVisible() is always true, but its height is 0 when empty.
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool MainWindowBase::anySideBarIsVisible() const
|
||||
{
|
||||
for (auto loc : { SideBarLocation::North, SideBarLocation::South,
|
||||
SideBarLocation::East, SideBarLocation::West }) {
|
||||
if (sideBarIsVisible(loc))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -380,7 +553,7 @@ void MainWindowBase::setUniqueName(const QString &uniqueName)
|
||||
void MainWindowBase::onResized(QResizeEvent *)
|
||||
{
|
||||
if (d->m_overlayedDockWidget)
|
||||
d->updateOverlayGeometry();
|
||||
d->updateOverlayGeometry(/*reusePreviousSize=*/ true);
|
||||
}
|
||||
|
||||
bool MainWindowBase::deserialize(const LayoutSaver::MainWindow &mw)
|
||||
@@ -398,7 +571,34 @@ bool MainWindowBase::deserialize(const LayoutSaver::MainWindow &mw)
|
||||
d->affinities = mw.affinities;
|
||||
}
|
||||
|
||||
return dropArea()->deserialize(mw.multiSplitterLayout);
|
||||
const bool success = dropArea()->deserialize(mw.multiSplitterLayout);
|
||||
|
||||
// Restore the SideBars
|
||||
d->clearSideBars();
|
||||
for (SideBarLocation loc : { SideBarLocation::North, SideBarLocation::East, SideBarLocation::West, SideBarLocation::South }) {
|
||||
SideBar *sb = sideBar(loc);
|
||||
if (!sb)
|
||||
continue;
|
||||
|
||||
const QStringList dockWidgets = mw.dockWidgetsPerSideBar.value(loc);
|
||||
for (const QString &uniqueName : dockWidgets) {
|
||||
|
||||
DockWidgetBase *dw = DockRegistry::self()->dockByName(uniqueName);
|
||||
if (!dw) {
|
||||
qWarning() << Q_FUNC_INFO << "Could not find dock widget" << uniqueName
|
||||
<< ". Won't restore it to sidebar";
|
||||
continue;
|
||||
}
|
||||
|
||||
sb->addDockWidget(dw);
|
||||
}
|
||||
}
|
||||
|
||||
// Commented-out for now, we dont' want to restore the popup/overlay. popups are perishable
|
||||
//if (!mw.overlayedDockWidget.isEmpty())
|
||||
// overlayOnSideBar(DockRegistry::self()->dockByName(mw.overlayedDockWidget));
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
LayoutSaver::MainWindow MainWindowBase::serialize() const
|
||||
@@ -414,5 +614,13 @@ LayoutSaver::MainWindow MainWindowBase::serialize() const
|
||||
m.multiSplitterLayout = dropArea()->serialize();
|
||||
m.affinities = d->affinities;
|
||||
|
||||
for (SideBarLocation loc : { SideBarLocation::North, SideBarLocation::East, SideBarLocation::West, SideBarLocation::South }) {
|
||||
if (SideBar *sb = sideBar(loc)) {
|
||||
const QStringList dockwidgets = sb->serialize();
|
||||
if (!dockwidgets.isEmpty())
|
||||
m.dockWidgetsPerSideBar.insert(loc, dockwidgets);
|
||||
}
|
||||
}
|
||||
|
||||
return m;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2019-2020 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: Sérgio Martins <sergio.martins@kdab.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
@@ -28,6 +28,8 @@
|
||||
#include <QVector>
|
||||
#include <QMargins>
|
||||
|
||||
class TestDocks;
|
||||
|
||||
namespace KDDockWidgets {
|
||||
|
||||
class DockWidgetBase;
|
||||
@@ -54,7 +56,7 @@ class DOCKS_EXPORT MainWindowBase : public QMainWindow
|
||||
public:
|
||||
typedef QVector<MainWindowBase*> List;
|
||||
explicit MainWindowBase(const QString &uniqueName, MainWindowOptions options = MainWindowOption_HasCentralFrame,
|
||||
QWidgetOrQuick *parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags());
|
||||
WidgetType *parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags());
|
||||
|
||||
~MainWindowBase() override;
|
||||
|
||||
@@ -72,11 +74,14 @@ public:
|
||||
* @param dockWidget The dock widget to add into this MainWindow
|
||||
* @param location the location where to dock
|
||||
* @param relativeTo In case we're docking in relation to another dock widget
|
||||
* @param option AddingOptions
|
||||
* @param initialOption Allows to specify an InitialOption. Which is useful to add the dock widget
|
||||
* as hidden, recording only a placeholder in the tab. So it's restored to tabbed when eventually
|
||||
* shown.
|
||||
*/
|
||||
void addDockWidget(DockWidgetBase *dockWidget,
|
||||
KDDockWidgets::Location location,
|
||||
DockWidgetBase *relativeTo = nullptr, AddingOption option = KDDockWidgets::AddingOption());
|
||||
DockWidgetBase *relativeTo = nullptr,
|
||||
InitialOption initialOption = {});
|
||||
|
||||
/**
|
||||
* @brief Returns the unique name that was passed via constructor.
|
||||
@@ -166,12 +171,15 @@ public:
|
||||
/// @brief Returns whether the specified sidebar is visible
|
||||
bool sideBarIsVisible(SideBarLocation) const;
|
||||
|
||||
/// @brief Returns whether any side bar is visible
|
||||
bool anySideBarIsVisible() const;
|
||||
|
||||
protected:
|
||||
void setUniqueName(const QString &uniqueName);
|
||||
void onResized(QResizeEvent *); // Because QtQuick doesn't have resizeEvent()
|
||||
virtual QMargins centerWidgetMargins() const = 0;
|
||||
|
||||
virtual SideBar* sideBar(SideBarLocation) const = 0;
|
||||
virtual QRect centralAreaGeometry() const { return {}; }
|
||||
|
||||
Q_SIGNALS:
|
||||
void uniqueNameChanged();
|
||||
@@ -180,6 +188,7 @@ private:
|
||||
class Private;
|
||||
Private *const d;
|
||||
|
||||
friend class ::TestDocks;
|
||||
friend class LayoutSaver;
|
||||
bool deserialize(const LayoutSaver::MainWindow &);
|
||||
LayoutSaver::MainWindow serialize() const;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2019-2020 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: Sérgio Martins <sergio.martins@kdab.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
@@ -73,12 +73,15 @@ namespace KDDockWidgets {
|
||||
class LayoutGuestWidget : public KDDockWidgets::QWidgetAdapter
|
||||
, public LayoutGuestWidgetBase
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit LayoutGuestWidget(QWidgetOrQuick *parent)
|
||||
: QWidgetAdapter(parent)
|
||||
, LayoutGuestWidgetBase(this)
|
||||
{
|
||||
}
|
||||
|
||||
~LayoutGuestWidget() override;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2020 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
SPDX-FileCopyrightText: 2020-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
|
||||
@@ -13,20 +13,42 @@
|
||||
#define KDDOCKWIDGETS_QT5QT6_COMPAT_P_H
|
||||
|
||||
#include <QMouseEvent>
|
||||
#include <QDropEvent>
|
||||
|
||||
namespace KDDockWidgets {
|
||||
namespace Qt5Qt6Compat {
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
|
||||
#define QQUICKITEMgeometryChanged geometryChange
|
||||
|
||||
using QEnterEvent = QEnterEvent;
|
||||
using qintptr = ::qintptr;
|
||||
using qhashtype = size_t;
|
||||
|
||||
inline QPoint eventPos(QDropEvent *ev)
|
||||
{
|
||||
return ev->position().toPoint();
|
||||
}
|
||||
|
||||
inline QPoint eventGlobalPos(QMouseEvent *ev)
|
||||
{
|
||||
return ev->globalPosition().toPoint();
|
||||
}
|
||||
|
||||
#else
|
||||
#else // Qt 5:
|
||||
|
||||
#define QQUICKITEMgeometryChanged geometryChanged
|
||||
|
||||
using QEnterEvent = QEvent;
|
||||
using qintptr = long;
|
||||
using qhashtype = uint;
|
||||
|
||||
inline QPoint eventPos(QDropEvent *ev)
|
||||
{
|
||||
return ev->pos();
|
||||
}
|
||||
|
||||
// Qt 5:
|
||||
inline QPoint eventGlobalPos(QMouseEvent *ev)
|
||||
{
|
||||
return ev->globalPos();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2019-2020 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: Sérgio Martins <sergio.martins@kdab.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2020 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
Author: Sergio Martins <sergio.martins@kdab.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2020 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
Author: Sergio Martins <sergio.martins@kdab.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
|
||||
12
src/fwd_headers/kddockwidgets/DockWidgetBase.h
Normal file
12
src/fwd_headers/kddockwidgets/DockWidgetBase.h
Normal file
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
Author: Sergio 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.
|
||||
*/
|
||||
|
||||
#include "../../DockWidgetBase.h"
|
||||
12
src/fwd_headers/kddockwidgets/DockWidgetQuick.h
Normal file
12
src/fwd_headers/kddockwidgets/DockWidgetQuick.h
Normal file
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
Author: Sergio 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.
|
||||
*/
|
||||
|
||||
#include "../../DockWidgetQuick.h"
|
||||
12
src/fwd_headers/kddockwidgets/FocusScope.h
Normal file
12
src/fwd_headers/kddockwidgets/FocusScope.h
Normal file
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
Author: Sergio 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.
|
||||
*/
|
||||
|
||||
#include "../../FocusScope.h"
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2020 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
Author: Sergio Martins <sergio.martins@kdab.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user