Compare commits

...

762 Commits

Author SHA1 Message Date
Renato Araujo Oliveira Filho
4e79c68a7d Added PySide6 support
Task-Id: KDDW-27
2021-01-11 16:31:49 -03:00
Sergio Martins
d80325ec8f Merge branch '1.2' into master 2021-01-10 23:11:17 +00:00
Sergio Martins
e9925785ab Cancel the drag if the draggable is destroyed
Can be destroyed for reasons we can't control or simply destroyed
because the draggable was docked/undocked

Fixes #120
2021-01-10 23:07:57 +00:00
Sergio Martins
81efda2d11 Add a QPointer guard for the draggable
So we can detect if it was deleted meanwhile
2021-01-10 23:00:19 +00:00
Sergio Martins
36eef80192 Also pass InitialOption to addDockWidgetToContainingWindow()
So you can control initial size and such
2021-01-09 13:58:56 +00:00
Sergio Martins
306bf26f66 Remove some qCDebug I never needed 2021-01-09 13:27:30 +00:00
Sergio Martins
e07fb7f121 DockWidget::addDockWidgetToContainingWindow() now accepts docking to main window
Was already stated in the docs that it would work with a main window but implementation
only allowed floating window.

Fixes #132
2021-01-09 13:24:06 +00:00
Sergio Martins
bc86cfcb1f Move Item::insertItem() to the derived class
Item itself doesn't know how to insert into the layout.
We'll soon have a new derived class which will do things differently
2021-01-09 00:11:59 +00:00
Sergio Martins
63bb7e31cd Remove unused method 2021-01-08 22:32:42 +00:00
Sergio Martins
1840d50fc0 Move LayoutBorderLocation out of Item
It only affect the box layout
2021-01-08 22:24:53 +00:00
Sergio Martins
c6fd4e4bc4 Remove duplicate Location enum
No longer needed
2021-01-08 22:11:03 +00:00
Sergio Martins
46210203f7 Rename ItemContainer to ItemBoxContainer 2021-01-08 22:02:02 +00:00
Sergio Martins
5a2d000ddd qtquick: Fix weak vtable 2021-01-08 18:25:14 +00:00
Sergio Martins
c73c26e5cb tests: Fix overloaded signal "parentChanged()" 2021-01-08 18:24:51 +00:00
Sérgio Martins
39c3e4fd13 Fix flags being compared against internal flag enum 2021-01-08 17:09:49 +00:00
Sergio Martins
011d83b7d9 tests: Also restore the internal flags 2021-01-08 09:03:24 -08:00
Sergio Martins
26f1b75976 tests: delete the dockwidgets when each test ends
Will save us from doing manual cleanup.
2021-01-08 08:45:28 -08:00
Sergio Martins
309a90d3a6 tests: Fix a test on windows 2021-01-08 08:28:41 -08:00
Sérgio Martins
946e1e977e tests: Make sure our own stuff is deleted
but don't care about other stuff.
Other QWindows might be deleted delayed. We care more about
DockWidget and MainWindow due to their unique names. They need to
be deleted before the next test starts.
2021-01-08 15:43:04 +00:00
Sergio Martins
7f1347f15d Overload DragRegistry::floatingWindows() to return windows being deleted too 2021-01-08 15:38:18 +00:00
Sergio Martins
2e498f644b Remove unneeded multisplitter examples
We use the top-level examples instead
2021-01-07 16:45:29 +00:00
Sergio Martins
ee0272e036 Merge pull request #129 from mateoconlechuga/master
Add support for setting toggle action icon
2021-01-07 16:09:34 +00:00
Sergio Martins
4aa87c1758 Merge branch '1.2' 2021-01-07 11:15:29 +00:00
Sergio Martins
3b1158b82f Fix potential crash uncovered by UBSAN
m_inCtor might be read before being initialized since when
the earlier members are initialized they can call back into
Frame.
2021-01-07 11:13:56 +00:00
Sergio Martins
1aee98bebd README-WASM: Minor correction, library is static 2021-01-07 11:13:56 +00:00
Allen Winter
b5a6433950 Merge branch '1.2' 2021-01-06 10:55:54 -05:00
Allen Winter
077264fd54 CopyrightAssignmentForm.docx - update email address 2021-01-06 10:55:26 -05:00
Kevin Funk
bee653cf80 Streamline README.md a bit 2021-01-06 16:04:14 +01:00
Sergio Martins
e1363aadaa Remove inclusion of moc from .cpp file
doesn't play nice with cmake unity build on older cmake
2021-01-06 14:40:40 +00:00
Sergio Martins
43877ca712 README: Added url of our WASM demo 2021-01-06 14:35:46 +00:00
Sergio Martins
f7cc54ad38 Merge branch '1.2' 2021-01-06 12:00:13 +00:00
Sergio Martins
538f318fac README-WASM: Minor correction, library is static 2021-01-06 11:07:52 +00:00
Sergio Martins
f0376fa7a2 Disable unity build on the stable branch
Fixes a build failure on ubuntu.
Will probably only enabled for development.
2021-01-06 10:59:13 +00:00
Sergio Martins
0d2bccc15e Deprecate AddingOption
Will probably be removed in v1.5
2021-01-05 20:32:14 +00:00
Sergio Martins
842b89c36d Restore source-compat with 1.2
It's not very hard. Just added the old enum and an implicit ctor.
2021-01-05 19:09:11 +00:00
Sergio Martins
1d74c67bd4 Merge pull request #130 from dangelog/more-build-fixups
More build fixups
2021-01-04 15:23:55 +00:00
Sergio Martins
ea0dd04bd9 Fix build with installed KDDW 2021-01-04 14:48:26 +00:00
Giuseppe D'Angelo
a5dbab096b More build fixups 2021-01-04 15:17:47 +01:00
mateoconlechuga
f1f555d5ab Add support for setting toggle action icon
This adds support for a custom icon to be displayed in a QMenu.
2021-01-03 19:36:56 -07:00
Sergio Martins
5b60a929ab Merge branch '1.2' 2021-01-04 00:20:56 +00:00
Sergio Martins
f4404dcbe0 qt6: disable -Wconversion
the long long int to int conversions due to the Qt6 containers
are harmless
2021-01-04 00:12:55 +00:00
Sergio Martins
dd81e02d94 Fix Qt6 build 2021-01-03 22:17:25 +00:00
Sergio Martins
f4643aeefd Merge branch '1.2' 2021-01-03 22:15:33 +00:00
Sergio Martins
e563ffb673 Add presets for Qt6 dev build 2021-01-03 22:12:56 +00:00
Sergio Martins
4cceec82ac Remove unused variable
Should fix MingW build with -Werror
2021-01-03 21:24:21 +00:00
Sergio Martins
4b868e2078 README: Mention that Qt6 is supported and MSVC 2013 won't be 2021-01-03 21:22:41 +00:00
Allen Winter
875544a449 Merge branch '1.2' 2021-01-02 09:32:20 -05:00
Allen Winter
a2f4c972a6 update copyright year 2021-01-02 09:27:50 -05:00
Sergio Martins
2b0a6e5d06 README: Mention VS 2013 isn't supported anymore
We're getting an ICE
2020-12-28 22:42:24 +00:00
Sergio Martins
5f7e645ed6 Merge branch '1.2' 2020-12-28 22:28:15 +00:00
Sergio Martins
59c90c01f9 README: Mention that Qt6 is supported and MSVC 2013 won't be 2020-12-28 22:27:38 +00:00
Sergio Martins
92063ab61b Remove some duplicate code, Qt does the same already
Recently Qt implemented something similar. Since we only support
aero snap with Qt 5.15 we dont need KDDW's native win32 code anymore

cc issue #121
2020-12-28 13:06:37 -08:00
Sergio Martins
003ec5aa5b Probably fix namespaced build 2020-12-28 19:35:03 +00:00
Sergio Martins
02bf43b468 Add InternalFlag_DontShowWhenUnfloatingHiddenWindow
It's an internal knob you can turn so that setFloating(false)
doesn't show the dockwidget. Only adding this flag in case you need
to support both KDDW and QDW at the same time, or during porting/evaluation.

Fixes #125
2020-12-28 19:19:46 +00:00
Sergio Martins
50e1285839 Move more internal enumerators into the internal enum
the public enum is now clean
2020-12-28 14:36:42 +00:00
Sergio Martins
3fb6574322 Move Flag_internal_NoAeroSnap into its own enum
Enumerators not intended for the public shouldn't be in the
public enum. Move it to a private enum.
2020-12-28 14:01:16 +00:00
Sergio Martins
fa2501d5e4 Merge branch '1.2' 2020-12-28 12:35:04 +00:00
Jacob Young
0fe58fd160 Fix filename case so that it will build on a case-sensitive filesystem. 2020-12-28 12:34:03 +00:00
Sergio Martins
01f3042f48 Merge pull request #127 from CE-Programming/fix/case
Fix filename case so that it will build on a case-sensitive filesystem.
2020-12-28 12:24:23 +00:00
Sergio Martins
6719dd2b9e Allow to pass a preferred initial size to MainWindow::addDockWidget()
fixes #95
2020-12-28 11:59:09 +00:00
Sergio Martins
08c058b214 Remove unimplemented DefaultSizeMode::SizePolicy
It's public API so don't expose enumerators that don't work
2020-12-28 10:58:37 +00:00
Jacob Young
e4502d4f64 Fix filename case so that it will build on a case-sensitive filesystem. 2020-12-28 03:07:30 -05:00
Sergio Martins
db928a0fca refactor: Move the DefaultSizingMode enum into InitialSizingOption
It's another enum that affects the initial sizing.
No behaviour was change in this commit.

Needed for issue #95
2020-12-28 00:17:13 +00:00
Sergio Martins
5582f37a18 Introduce InitialOption struct
addDockWidget() received a AddingOption enumerator. But that
enum isn't enough, as we also want to be able to specify an initial
QSize.

So, instead of adding yet another parameter to addDockWidget(), we
create a struct to old those "initial settings".

Implies a minor source break, but trivial to fix in user code,
just rename the enumerator.

Honouring preferredSize will be a followup.

Needed for issue #95
2020-12-27 20:22:02 +00:00
Sergio Martins
a28e152a37 Remove duplicate DefaultSizeMode enum
It's already in Item_p.h
2020-12-27 13:56:58 +00:00
Sergio Martins
d6dea6f426 TabWidget: Remove paint event hack
Origin unknown, came from "initial commit".
Can't notice any difference without it. Users can do such hacks
by overriding it
2020-12-27 12:58:12 +00:00
Sergio Martins
d29f9fdd0d Fix install location of TabWidget_p.h
It moved location in the repo recently
2020-12-27 12:39:08 +00:00
Sergio Martins
a2a80df5df Add static function DockWidgetBase::byName()
So users don't have to use private API.

Fixes issue #126
2020-12-27 11:41:16 +00:00
Sergio Martins
48ce3a972f DockWidget: Move some clutter to the end of the file
So users not using doxygen can quickly see the API
2020-12-27 11:34:44 +00:00
Sergio Martins
9fae250897 DockWidget: Make the serialization methods private
They are not for the public
2020-12-27 11:32:38 +00:00
Sergio Martins
4dd703dcb2 Remove another unneeded qWait 2020-12-24 11:57:18 +00:00
Sergio Martins
e46b5b2edf tests: Remove a few unneeded qWaits regarding QStateMachine
We don't use QStateMachine anymore
2020-12-24 11:55:45 +00:00
Sergio Martins
7febcf2170 qtquick: Uncomment another TabBar that passes now 2020-12-24 11:53:13 +00:00
Sergio Martins
012ed4cf1d qtquick: Uncomment another test regarding tab widget 2020-12-24 11:43:13 +00:00
Sergio Martins
18283c4d1a qtquick: Enable another QTabBar test 2020-12-23 23:37:37 +00:00
Sergio Martins
2bb46b1cdf Uncomment another tab test 2020-12-23 23:11:09 +00:00
Sergio Martins
113263a4a1 qtquick: Enable one more QTabBar test 2020-12-23 22:47:36 +00:00
Sergio Martins
a6ca44cde6 qtquick: double-clicking a tab will detach it now 2020-12-23 20:37:59 +00:00
Sergio Martins
894be60a75 tests: Add pressOn/doubleClickOn that receives a QWindow
Easier as we don't need to know the actual QWidget/QQuickItem
receiver. The QWindow will deliver it.
2020-12-23 20:36:50 +00:00
Sergio Martins
244a1bec24 Merge branch '1.2' 2020-12-23 14:34:39 +00:00
Sergio Martins
51d78ba20b cmake: Allow to not build the fuzzer
Slight build improvement locally.
Still build by the CI anyway.

Did the same for the linter.
2020-12-23 13:36:43 +00:00
Sérgio Martins
8291025dfa tests: Make the tests run much faster
tst_docks is already run in parallel. Then it was running
again sequentially!
2020-12-23 13:32:15 +00:00
Sergio Martins
6ea1d4ca58 Minor coding style 2020-12-22 18:58:51 +00:00
Sergio Martins
771bf10951 Merge branch '1.2' 2020-12-22 18:48:22 +00:00
Sergio Martins
67a3270324 cmake: Add a setting to enable -Werror without developer build
Enabled for clazy, for example
2020-12-22 18:16:35 +00:00
Sergio Martins
cd859d6725 Fix a bunch of clazy warnings 2020-12-22 17:01:50 +00:00
Sergio Martins
092b4afe4a Add a clazy preset 2020-12-22 16:05:10 +00:00
Sergio Martins
f8d0ffe7ba Fix a few clazy warnings 2020-12-22 16:02:55 +00:00
Sergio Martins
10f47a701f Fix -Wclazy-copyable-polymorphic 2020-12-22 15:38:50 +00:00
Sergio Martins
d3224ed266 Fix -Wclazy-qstring-arg 2020-12-22 15:28:29 +00:00
Sergio Martins
2ccb5391bb Fix -Wclazy-detaching-temporary 2020-12-22 15:14:28 +00:00
Sergio Martins
5c0c9799a4 Fix build with clang -Wsigness 2020-12-22 15:14:13 +00:00
Sergio Martins
5ccbb5b056 build-all.dart: no need to pass the cmake variables
they are already in the preset
2020-12-22 12:28:32 +00:00
Sergio Martins
fc04455e93 build-all.dart: Update the usage comment 2020-12-22 12:15:15 +00:00
Sergio Martins
4ae8f461cb Merge branch '1.2' 2020-12-22 11:56:45 +00:00
Giuseppe D'Angelo
17539e5b88 Frame: stop using "virtual" signals
They don't work as expected across DLL boundaries on MSVC: connecting
to Frame::isFocusedChanged using the PMF syntax fails.

The reason has to do with how MSVC implements pointers to virtual
function members: they are "regular" function pointers to a DLL-local
stub that implements the virtual call. For that reason, a connect()
happening in client code would generate a pointer for the signal that
doesn't compare equal to the same pointer generated from inside KDDW;
and moc-generated code relies on this comparison to find the index of
the signal.

Just avoid the whole thing: rename the non-signal virtual call into a
"callback", and reimplement it in the first QObject subclass to turn it
into a proper signal.
2020-12-22 11:54:44 +00:00
Sergio Martins
e53b9c71da Update build-all.dart with the contents from master
Adding the --tests option should have been done in 1.2 branch
2020-12-21 20:19:59 +00:00
Sergio Martins
9275f852d6 CMakePresets: Enable sanitizers for our developer builds 2020-12-21 20:06:40 +00:00
Sergio Martins
dd8f46880f qtquick: Implement TabBarQuick::tabAt()
Also redirect the mouse press event to our C++ counterpart.
2020-12-21 17:09:55 +00:00
Sergio Martins
e9159a08bd Fix build when usign installed TabWidget_p.h 2020-12-21 13:31:10 +00:00
Sergio Martins
cf89891e4f Merge branch '1.2' 2020-12-21 12:43:31 +00:00
Sergio Martins
1cc8824f84 Workaround shiboken crash, found by Milian 2020-12-21 12:41:09 +00:00
Sergio Martins
b73c526c57 qtquick: Move the event redirector to the base class
Instead of having it in TitleBarQuick.
It will be needed by the TabWidget too
2020-12-20 17:12:44 +00:00
Sergio Martins
add577c46f qtquick: Fix title not changing when we changed current tab
added unit-test too
2020-12-20 16:30:25 +00:00
Sergio Martins
9ddd65ea71 qtquick: tidy some connects 2020-12-20 15:37:17 +00:00
Sergio Martins
b15afa9231 Move TabWidget instantiation to base class Frame
Instead of being instantiated by both FrameQuick and FrameWidget
2020-12-20 14:21:39 +00:00
Allen Winter
f8dfde2784 README.md - add a "Using" section 2020-12-20 08:27:00 -05:00
Sergio Martins
6e0898a31e Remove some methods from TabWidgetQuick
Reuse more from base class.
2020-12-20 13:19:07 +00:00
Sergio Martins
8b98dafba2 TabBar::numDockWidgets() doesn't need to be virtual 2020-12-20 12:32:50 +00:00
Sergio Martins
a123437d03 qtquick: Implement the TabWidget backend
Not yet connected to the GUI.
2020-12-20 12:06:29 +00:00
Sergio Martins
616c871da7 qtquick: initialize the tab widget via the factory 2020-12-20 11:25:50 +00:00
Sergio Martins
925c9725b3 qtquick: Build TabBarQuick too 2020-12-20 01:09:02 +00:00
Sergio Martins
1a173a7c72 Add a TabWidgetQuick.cpp
Doesn't do much yet
2020-12-20 01:02:55 +00:00
Sergio Martins
a959da46db qtquick: Build TabWidget.cpp too
Not being used yet though.
2020-12-20 01:01:20 +00:00
Sergio Martins
a9c70d086c qtquick: Move TabWidget_p.h out of widgets/
To be shared with qtquick
2020-12-20 00:07:07 +00:00
Sergio Martins
48bacb2811 build-all: Add option to run the tests 2020-12-19 23:30:09 +00:00
Sergio Martins
6b846fcdff qt6: Use more 'auto' to fix some Wconversion errors 2020-12-19 22:54:06 +00:00
Sergio Martins
fdc97fecaf build-all: Don't test the unity variations by default 2020-12-19 22:16:29 +00:00
Sergio Martins
86983d58f5 Merge branch '1.2' 2020-12-19 20:05:19 +00:00
Sergio Martins
58f7edb0bc build-all: Build with unity turned off too
As it often finds builds failures to do missing includes
2020-12-19 20:00:05 +00:00
Sergio Martins
302bbeceb0 Merge branch '1.2' 2020-12-19 19:02:46 +00:00
Sergio Martins
cd9e16398c qtquick: Fix the build for Qt6
And added cmake presets for Qt6
2020-12-19 18:59:33 +00:00
Sergio Martins
1e1ea8db34 qtquick: fix build 2020-12-19 18:04:54 +00:00
Sergio Martins
7ac3ea1fcf Merge branch '1.2' 2020-12-19 17:52:52 +00:00
Sergio Martins
3f661d0322 Add dev-scripts/build-all.dart
This script builds all our supported configurations.
Useful if you don't have access to KDAB CI, or if you don't want
to wait for the results.
2020-12-19 17:51:29 +00:00
Sergio Martins
8dad079df5 Add a CMakePresets.json
Contains the configrations we support:
    QtWidgets, QtQuick, static, Python and developer-build
2020-12-19 16:07:49 +00:00
Sergio Martins
1727e50489 Merge branch '1.2' 2020-12-19 15:44:59 +00:00
Sergio Martins
1ab9688f58 Fix Python build 2020-12-19 15:44:44 +00:00
Sergio Martins
613b1b8524 Allow the user to change the absolute min and max widget sizes.
It's not hardcoded anymore
2020-12-19 15:34:37 +00:00
Sergio Martins
ae5edc9ebf Added README-troubleshooting
Fixes issue #114
2020-12-19 14:59:40 +00:00
Sergio Martins
d0c15b5da2 Add missing include 2020-12-19 14:59:04 +00:00
Sergio Martins
ccbd15c922 Merge branch '1.2' 2020-12-19 14:12:10 +00:00
Sergio Martins
7b9673e4e2 Shrink the overlay popup when we shrink the main window
Should be enough for issue #118
2020-12-19 14:10:01 +00:00
Sergio Martins
7fbcbbacdf Preserve overlay size when resizing main window
For issue #118
2020-12-19 14:09:27 +00:00
Sergio Martins
d1f48b0685 Save the last overlayed size
We might want to restore it
2020-12-19 14:09:27 +00:00
Allen Winter
9ee6b91f61 Merge branch '1.2' 2020-12-18 13:04:02 -05:00
Allen Winter
e6c89c0564 setup for 1.2.1 2020-12-18 13:02:49 -05:00
Sergio Martins
8b97088c70 Fix QtQuick build 2020-12-18 17:39:24 +00:00
Sergio Martins
e5809c06c7 Enable resizing the overlayed dock widgets
Fixed WidgetResizeHandler to not allow it to resize the overlay
bigger than its parent

For issue #116

The size isn't remembered though. Next time you open the overlay
it will have the previous size.
2020-12-18 17:15:54 +00:00
Sergio Martins
23b69d4e9e Fix overlay disappearing when we were resizing
We allow the user to click 4px outside of the overlay for better
resizing. But we also had code that would hide the overlay if we
clicked elsewhere. So these two requirements were in conflict.

So, before hidding, check if the frame accepted the press.

Also for issue #118
2020-12-18 16:02:35 +00:00
Sergio Martins
0f468033fb Commit the code needed for resizing overlays/popups
Still not happy with it, so the actual part that enables it
is commented out

Also for issue #118
2020-12-18 15:35:43 +00:00
Sergio Martins
468074cda8 Fix min/max not being respected when resizing overlay popup
While the min size wasn't set the min size hint was.
Use our wrapper which honours the size hint.

Also for isssue #118
2020-12-18 15:32:43 +00:00
Sergio Martins
7acbe0c62e Make the WidgetResizeHandler margin public 2020-12-18 15:23:52 +00:00
Sergio Martins
2c1a70280a WidgetResizeHandler: Fix the geometry calculation for non-toplevels 2020-12-18 15:20:58 +00:00
Sergio Martins
d2fa5efafe Add Utils::globalGeometry() 2020-12-18 14:29:44 +00:00
Sergio Martins
a437bc5d07 Minor WidgetResizeHandler cleanups 2020-12-18 12:11:28 +00:00
Sergio Martins
2447bb12c8 WidgetResizeHandler: Dont' accept the release if we're not resizing 2020-12-18 11:58:08 +00:00
Sergio Martins
1082d5e8e1 Added WidgetResizeHandler::setAllowedResizeSides() 2020-12-18 10:43:36 +00:00
Sergio Martins
3b1ac9a2d0 Merge branch '1.2' 2020-12-17 20:38:49 +00:00
Sergio Martins
4635405fb5 Allow WidgetResizeHandler to act on global event filter
Needed for widgets which are not top-levels
2020-12-17 19:47:19 +00:00
Sergio Martins
c481875e55 Fix WidgetResizeHandler::cursorPosition() for negative positions
Usually we don't get negative relative positions, since we're
tracking top-level widgets which wouldn't receive exterior mouse
events to begin with.
But we want the WidgetResizeHandler to work for embedded widgets
too, for example for the sidebar overlays.
2020-12-17 19:47:19 +00:00
Sergio Martins
62f50f9458 Minor coding style 2020-12-17 19:47:19 +00:00
Sergio Martins
c86252665c Make WidgetResizeHandler::mouseMoveEvent() return bool
Returns true if it consumed the event
2020-12-17 19:47:19 +00:00
Sergio Martins
d141863ffb Make a method private 2020-12-17 19:47:19 +00:00
Sergio Martins
e99b9678e4 Add WidgetResizeHandler::restoreMouseCursor() 2020-12-17 19:47:19 +00:00
Sergio Martins
e0a034748d Factor out setting the mouse cursor
We'll soon also need to call qApp's set cursor
2020-12-17 19:47:19 +00:00
Sergio Martins
c3377431cc docs++ 2020-12-17 19:47:19 +00:00
Allen Winter
2fb70009cc OBS - updates 2020-12-17 14:40:16 -05:00
Allen Winter
289ddffbe2 prep for 1.2.0 release 2020-12-17 14:40:16 -05:00
Sergio Martins
54738bbea2 Simplify WidgetResizeHandler::cursorPosition() impl 2020-12-17 18:51:40 +00:00
Sergio Martins
5c6eb352d6 Use the CursorPosition enum as flags 2020-12-17 18:46:31 +00:00
Sergio Martins
f657399ef8 Make enum public so we can use Q_ENUM 2020-12-17 18:44:48 +00:00
Sergio Martins
be0f72ca25 Remove unneeded method 2020-12-17 17:05:55 +00:00
Sergio Martins
31598d8334 Make a variable private 2020-12-17 16:59:21 +00:00
Sergio Martins
5e64463a8c Remove some Item_p.h/multisplitter includes
that's private API for the layouts, don't want them exposed higher
in the stack
2020-12-17 13:48:50 +00:00
Sergio Martins
27ffb64eb4 Merge branch '1.2' 2020-12-17 12:45:33 +00:00
Sergio Martins
c4ffe10e12 Fix non unity build 2020-12-17 12:24:12 +00:00
Sergio Martins
efcad6d2be Update ChangeLog 2020-12-17 11:53:12 +00:00
Sergio Martins
c7dc7bdb3d Bump so version on master 2020-12-17 11:15:42 +00:00
Sergio Martins
b6925c928a Clear sidebars before restoring them
If restoring a state without a sidebar, the existing sidebars
should hide

Fixes issue #116
2020-12-17 10:51:16 +00:00
Sergio Martins
75368d334a Don't restore the popup/overlay state
popups are perishable
2020-12-17 10:15:39 +00:00
Allen Winter
d39ce8f66e tests/Testing.cpp - include <QTest>, not <QtTest> 2020-12-16 17:10:07 -05:00
Allen Winter
805ea41d8a Rubberband_quick.h, RubberBandQuick.h - adjust include guard 2020-12-16 17:04:06 -05:00
Allen Winter
d7ed2494be CMakeLists.txt - add documentation for the new options 2020-12-16 17:01:47 -05:00
Allen Winter
0990337cdc examples/qtquick/CMakeLists.txt - add license+copyright header 2020-12-16 16:51:03 -05:00
Allen Winter
e41cdb6f78 various - fix misspellings 2020-12-16 16:49:22 -05:00
Sergio Martins
666673a251 Added a comment 2020-12-16 18:46:56 +00:00
Sergio Martins
34cb2ae5f0 Restore the SideBars when restoring a layout
For issue #116
2020-12-16 18:27:29 +00:00
Sergio Martins
51d8c2ff3e tests: Group the "Save/restore" tests together 2020-12-16 18:15:06 +00:00
Sergio Martins
aa9f50d0f4 Serialize the SideBar to JSON too
Part 1 of 2 for issue #116
2020-12-16 17:58:05 +00:00
Sergio Martins
b7c36a2ec9 Stabilize a test with 5.9
Minor differences in the frame's min-sizes, no point in spending
more time on such old Qt version just so tests pass.
2020-12-16 17:24:33 +00:00
Sergio Martins
e18fb7ffd8 Remove unneeded private moc include
Doesn't play nice with unity builds
2020-12-16 15:48:32 +00:00
Sergio Martins
96439339c7 cmake: Add a missing QtQuick header to the source list 2020-12-16 15:46:31 +00:00
Sergio Martins
04d418b2e9 same for QtQuick 2020-12-16 15:42:48 +00:00
Sergio Martins
c04d856322 cmake: Add the header files to the source list too
So they are automoced with unity build
2020-12-16 15:40:25 +00:00
Sergio Martins
1c41c33f33 Merge the two qrc files that are only for QtQuick 2020-12-16 11:53:36 +00:00
Sergio Martins
1dae128511 Fix the static build
The other library qrc is only needed for QtQuick
2020-12-16 11:41:15 +00:00
Sergio Martins
eab80c0545 Fix a -Wmismatched-tag warning 2020-12-16 10:54:47 +00:00
Sergio Martins
288c3df30b Add missing include 2020-12-15 23:11:52 +00:00
Sergio Martins
e8728e8a35 qtquick: Fix the qrc not being included 2020-12-15 23:07:11 +00:00
Sergio Martins
94bfc4f2d1 qtquick: Fix build 2020-12-15 23:02:13 +00:00
Sergio Martins
d2da07508a Replaced an include with a fwd decl 2020-12-15 22:58:10 +00:00
Sergio Martins
7082e40cd5 Fix non-developer build
These exports are needed
2020-12-15 21:56:22 +00:00
Sergio Martins
2c8bbd10f7 Remove the export macros from the old library
We now use only 1 library, so use the same export macros
2020-12-15 21:41:10 +00:00
Sergio Martins
ed8a401fe8 Meld kddockwidgets__multisplitter into kddockwidgets lib
It's overkill to have it in a separate library.
Simplifies deployment.
Speeds up build, as it was breaking paralellism.
2020-12-15 21:00:41 +00:00
Sergio Martins
72428075f0 Fix -Wshadow warnings 2020-12-15 20:38:20 +00:00
Sergio Martins
562db7c812 qtquick: Fix build
Missing include guards
2020-12-15 13:38:35 +00:00
Sergio Martins
3ee15d1307 Give python a bit of help building KDDW 2020-12-15 12:15:23 +00:00
Sergio Martins
cf232dda34 Enable Unity Builds unconditionally
Projects using KDDW won't need to modify KDDW, so there's no impact
on incremental builds
2020-12-15 11:13:41 +00:00
Sergio Martins
bfeac02a45 cmake: Make KDDW build faster with a unity build 2020-12-12 15:18:39 +00:00
Sergio Martins
22f4c36eb0 cmake: remove duplicate set of qtquick/qtwidget cmake options
Let's simply things and only use one set. If the top-level requires
QtQuick then so will multisplitter. It's not mix-and-match.
2020-12-12 14:11:26 +00:00
Allen Winter
3dc56ea4ef Merge branch '1.1' 2020-12-12 08:20:10 -05:00
Allen Winter
cbedc06e97 various - prep for 1.1.1 release 2020-12-11 16:56:04 -05:00
Sergio Martins
8f85f28ed4 Merge branch '1.1' 2020-12-11 16:44:07 +00:00
Sergio Martins
b5c2757874 Updated Changelog with v1.1.1 2020-12-11 16:36:37 +00:00
Sergio Martins
46f57ffbbc Merge branch '1.1' 2020-12-10 21:39:54 +00:00
Sergio Martins
fb6e2afd7b Windows: Don't start a drag when it's a resize
There were a few pixels where you could click where, very near the
border where it would start a drag while it shouldn't.

The drag state machine then was in an invalid state which could lead to
a crash.

Fixes issue #110
2020-12-10 21:16:42 +00:00
Sergio Martins
f74eb73326 qt6: Use only one CMake option for Qt6
We still had OPTION_QT6 leftovers
2020-12-09 14:09:20 +00:00
Sergio Martins
ceb796d807 qt6: Don't set the HDPI attributes
They don't do anything on Qt6, but warn.
2020-12-09 12:23:17 +00:00
Sergio Martins
9a9488117c Add a State dtor, fixes a -Wweak-vtables warning 2020-12-09 11:13:55 +00:00
Sergio Martins
e55d75ba98 qt6: Fix build on Windows 2020-12-08 23:21:51 +00:00
Sergio Martins
742763e6e5 qt6: Remove unneeded Qt5Test find
It's already found in the root CMakeLists.txt
2020-12-08 22:56:59 +00:00
Sergio Martins
d7242f17b7 examples: Add AUTORCC
Fixes standalone examples not showing images
2020-12-08 22:36:23 +00:00
Sergio Martins
eba395dc4c Fix build 2020-12-08 22:31:21 +00:00
Sergio Martins
89635d8b98 qt6: build is fixed now 2020-12-08 21:47:35 +00:00
Sergio Martins
f475312f11 qt6: Port away from QStateMachine
QStateMachine was moved to qtsxml module, which is not ported to
Qt6 yet.

We use QStateMachine for the semantics it gives us, not because of
its implementation. The implementation is trivial, so do it outselves.
We used very little from QStateMachine.
2020-12-08 19:55:52 +00:00
Sergio Martins
9f604829dd qt6: Use AUTORCC instead of qt5_add_resources
As this works with both Qt5 and Qt6
2020-12-08 18:11:34 +00:00
Sergio Martins
85f829f97a qt6: Remove an hardcoded Qt5 lib 2020-12-08 16:38:08 +00:00
Sergio Martins
e3bb0b3d48 qt6: Link to StateMachine 2020-12-08 16:36:00 +00:00
Sergio Martins
22c0b6f9b6 qt6: Fix build of FloatingWindow.cpp
QWidget::nativeEvent() changed signature
2020-12-08 16:33:35 +00:00
Sergio Martins
200cb7aded qtquick: Fix build with gcc 2020-12-08 15:06:21 +00:00
Sergio Martins
4999fdd819 qtquick: Remove the native child widget case
This can only happen for QtWidgets. With QtQuick all items are
alien, never native
2020-12-06 15:48:31 +00:00
Sergio Martins
76aca4139a Minor cleanup 2020-12-05 23:37:56 +00:00
Sergio Martins
64276cb872 qtquick: Fix clicking on close button of floating window
Since we're using native events on windows we were using the whole
title bar for dragging, but obviously the buttons don't serve for
window dragging
2020-12-05 23:28:04 +00:00
Sergio Martins
aad63d117b qtquick: Enable aero-snap on Windows
The events simply need to be forward from QWindow to the FloatingWindow.
That happens automatically for QWindow/QWidget, but not with
QWindow/QQuickItem, so add this behaviour to QtQuick too, so it behaves
the same as QtWidgets and we have a single code path for aero snap
2020-12-05 15:20:26 +00:00
Sergio Martins
bd66af0a9f Remove unused logging categories 2020-12-05 14:29:13 +00:00
Sergio Martins
a21d80279e qtquick: Fix background of indicator being black on macOS 2020-12-03 19:15:34 +00:00
Sergio Martins
4347aefc8f Fix a -Wweak-vtable warning on macOS 2020-12-03 18:45:08 +00:00
Sergio Martins
b6341154fb qtquick: Fix a test
The tests are not prepared for the min-size of the floating window
to change (QLayout helped with that). We need to write some kind
of constraint propagation first, until then we use a static
size for the non-contents
2020-12-03 18:24:26 +00:00
Sergio Martins
16f6692b79 qtquick: Add an example of how to instantiate a dock widget from QML
Instead of using C++
2020-12-03 14:58:59 +00:00
Sergio Martins
6c1026956a qtquick: titlebar's height is reduced to 0 when invisible
otherwise we see an empty space when it's not visible
2020-12-02 23:33:04 +00:00
Sergio Martins
97679abb02 qtquick: silence warning
not worth it
2020-12-02 23:29:15 +00:00
Sergio Martins
e173a4cfff qtquick: Also allow for custom titlebar for the Frame 2020-12-02 23:24:28 +00:00
Sergio Martins
26971ef1e2 qtquick: Add an example of a custom title bar 2020-12-02 23:20:44 +00:00
Sergio Martins
d7bde47105 qtquick: Don't hardcode the title bar height in C++
It's now in QML and the user is allowed to change it
2020-12-02 22:58:11 +00:00
Sergio Martins
143c82291d qtquick: The user can now choose another titlebar file 2020-12-02 22:43:01 +00:00
Sergio Martins
979b2fdd40 qtquick: Set the frameworkwidget factory as a context prop 2020-12-02 22:38:17 +00:00
Sergio Martins
46337d900b qtquick: Load the titlebars with a loader
in followup commit the source will be user configurable
2020-12-02 21:43:57 +00:00
Sergio Martins
ec1f1bea9a qtquick: Move some style code to TitleBar.qml
Doesn't belong in the base component
2020-12-02 21:30:55 +00:00
Sergio Martins
d207028d60 qtquick: Document and add proper interface to TitleBarBase.qml 2020-12-02 16:17:46 +00:00
Sergio Martins
a237eae508 qtuick: Add a customtitlebar example stub
Not custom yet.
2020-12-02 15:48:51 +00:00
Sergio Martins
243396f22b qtquick: Move the example into a sub-directory
We'll have other qtquick examples
2020-12-02 14:52:10 +00:00
Sergio Martins
f240bf5d40 Disable Aero-snap for QtQuick, for now 2020-12-01 20:33:52 +00:00
Sergio Martins
785db1b50c qtquick: Fix detaching windows not working smoothly
Use the global event filter, as grabing isn't reliable in QtQuick.

Either not the same item is getting the mouse moves and release, or
it's because QtQuick internally is also setting/unsetting grabbers,
as seen in the source code
2020-12-01 20:14:46 +00:00
Sergio Martins
b6a7048a4f Fwd declare QWidget, no need to include in the header 2020-12-01 19:48:41 +00:00
Sergio Martins
52bff59024 Remove duplicated logic regarding mouse events 2020-11-30 23:14:00 +00:00
Sergio Martins
bba0195196 Move "mouseEvent()" function to Utils_p.h
So it can be reused
2020-11-30 23:00:30 +00:00
Sergio Martins
41fdb9c7df qtquick: Fix non-developer build 2020-11-30 18:37:39 +00:00
Sergio Martins
c1c1da25a8 Fix build with vs2013 2020-11-30 14:11:21 +00:00
Sergio Martins
b4e7b97646 examples: Fix non-developer build 2020-11-30 12:25:29 +00:00
Sergio Martins
2c687fe469 qtquick: Implement the rubber band
When hovering a drop indicator we now see the blue rubberband
2020-11-29 22:31:11 +00:00
Sergio Martins
10e0402afa Fix build 2020-11-29 19:51:37 +00:00
Sergio Martins
ebb1179167 fix namespace 2020-11-29 19:41:30 +00:00
Sergio Martins
15c196d865 qtquick: Move Rubberband to its own file 2020-11-29 19:23:10 +00:00
Sergio Martins
e897ce6e8e qtquick: Add a replacement for QAction
So we don't depend on QtWidgets lib
2020-11-29 18:44:00 +00:00
Sergio Martins
83d9db1b64 qtquick: multisplitter lib no longer depends on QtWidgets
Added a QSizePolicy replacement.
KDDW for QtQuick still needs to link to QtWidgets, but it's a
step forward
2020-11-29 18:08:49 +00:00
Sergio Martins
60331fc654 qtquick: Remove some unneeded QtWidget includes 2020-11-29 17:57:14 +00:00
Sergio Martins
e8f16dd172 qtquick: Don't build ObjectViewer 2020-11-29 17:50:51 +00:00
Sergio Martins
44bd451362 qtquick: stabilize tests with offscreen QPA 2020-11-29 15:17:29 +00:00
Sergio Martins
1d2a791dfc qtquick: Fix DND operation never ending
When double-clicking a title bar we're getting: Press, Release,
Press and never the Release. We get the MouseDblClickEvent instead,
so handle that
2020-11-29 14:40:03 +00:00
Sergio Martins
a4ba45b423 qtquick: Fix flickering the first time we drag over 2020-11-28 19:27:18 +00:00
Sergio Martins
12576970c6 qtquick: Fix dragged window being behind in Z order
For QtWidgets, when we raise something that's not a top-level
it won't raise. So do the same thing for QtQuick
2020-11-28 18:28:43 +00:00
Sergio Martins
e0ee7d14b0 qtquick: Remove warning about we not implementing keyboard ungrab
I don't see it in QQuickItem API, so we also don't grab it to
begin with
2020-11-28 17:53:39 +00:00
Sergio Martins
66f447ad3f qtquick: Fix crash when hovering over titlebar
It would think we were over a drag indicator, because during an instant
the overlay window has 0x0 size but the indicators are still visible.

Fix by only showing the overlay window (visible property) when it has
the correct size
2020-11-28 17:11:46 +00:00
Sergio Martins
75db599142 tests: Make DropArea::hover() return the chosen drop location
Just for tests.
2020-11-28 16:47:19 +00:00
Sergio Martins
a5c65ae039 Introduce NullIndicators and a Config option for it
Mostly for debugging purposes, but also useful if anyone doesn't
want to display indicators
2020-11-28 14:11:39 +00:00
Sergio Martins
5c055e0b8d examples: Add a flag to disable aero-snap
For development/debugging purposes only
2020-11-28 00:39:30 +00:00
Sergio Martins
090483f04e qtquick: Add some flags to the example
Mostly for debugging at this point
2020-11-28 00:18:41 +00:00
Sergio Martins
953219f6f3 qtquick: Minor refactoring
Removed some hardcoded QLineEdit casts, that code is now generic.
2020-11-27 18:47:03 +00:00
Sergio Martins
8356bb0c3c Introduce KDDockWidgets::widgetAt()
Only repro for QtWidgets for now, but already useful to remove some
QApplication includes
2020-11-27 18:29:46 +00:00
Sergio Martins
758548f7a2 qtquick: Only Windows needs Angle 2020-11-27 17:11:45 +00:00
Sergio Martins
2aa16eb6d9 examples: comment out the old multisplitter example
It's not for end users. Might even delete it
2020-11-27 17:07:44 +00:00
Sergio Martins
9d6cef24c1 qtquick: Use Angle on Windows
It's aero-snap friendly. Otherwise shows black artifacts.
We can however use normal GL and use FramelessWindowhint instead
2020-11-27 16:46:21 +00:00
Sergio Martins
52999d4cc9 qtquick: Don't process native events when being deleted 2020-11-27 15:03:55 +00:00
Sergio Martins
bc2fff2c04 qtquick: Window resizing works on Linux/mac now 2020-11-27 13:59:27 +00:00
Sergio Martins
40fa4e98f8 qtquick: Fix tests
Mouse tracking isn't implemented, so warns
2020-11-27 11:06:47 +00:00
Sergio Martins
a07f63a2c7 qtquick: Fix build on Windows 2020-11-26 23:30:55 +00:00
Sergio Martins
39c9a4da9b qtquick: Enable native event handling for the floating windows
Same as done with QtWidgets, now hopefully we have native window
resize
2020-11-26 23:26:15 +00:00
Sergio Martins
e0aa547393 qtquick: Start using the WidgetResizeHandler
It's no longer commented out in FloatingWindow.
Doesn't do much for QtQuick, but at least we don't have different
code paths

Making it work is next.
2020-11-26 23:13:46 +00:00
Sergio Martins
08eab8882f qtquick: Call FloatingWindow::setupWindow() at the correct time
We need a QWindow. While that's done very early, and automatically
for QtWidgets, for QtQuick it's done later, by us, manually
2020-11-26 22:52:23 +00:00
Sergio Martins
04723ac3a9 Minor refactoring, moved code into a function 2020-11-26 22:46:14 +00:00
Sergio Martins
c25043fa00 qtquick: Enable more QtWidget paths that compile fine
Just needed a dummy create() function
2020-11-26 22:28:57 +00:00
Sergio Martins
5372920cd0 qtquick: Port NCHITTESTEventFilter 2020-11-26 21:53:48 +00:00
Sergio Martins
28ae4c3b8c Add helper to get FloatingWindow by its WId 2020-11-26 21:42:45 +00:00
Sergio Martins
6158ebd520 qtquick: Fix our QtQuick QLineEdit clashing with the QWidgets one
Some indirect include is making it clash. Cleaner to use a different
name anyway
2020-11-26 21:28:01 +00:00
Sergio Martins
b77430e574 Remove two more unneeded QApplication includes 2020-11-26 19:35:46 +00:00
Sergio Martins
fad81d595a qtquick: Remove some dependencies to QApplication 2020-11-26 19:31:32 +00:00
Sergio Martins
0980a7f601 qtquick: Port qtTopLevelForHWND() to Windows
Deals in QWindow instead of QWidget
2020-11-26 18:54:58 +00:00
Sergio Martins
46830713e0 stabilize test on Windows 2020-11-26 18:27:17 +00:00
Sergio Martins
cd796db0ff Add helper topLevelForHandle() 2020-11-26 17:53:28 +00:00
Sergio Martins
29da5f4a8a qtquick: Fix another include
Fixes the multisplitter build on Windows, which has a more picky
linker
2020-11-26 17:18:55 +00:00
Sergio Martins
315bdc71e5 qtquick: Include the correct include
Not the widget one
2020-11-26 17:17:18 +00:00
Sergio Martins
a8965bea91 Fix a unit-test
Broke it by mistake
2020-11-26 17:00:10 +00:00
Sergio Martins
bf259c7ffc qtquick: Fix build on mac
Mostly due to -Werror and clang having more warnings
2020-11-26 16:45:12 +00:00
Sergio Martins
8a990451d7 Fix casting -1 to WId on mac 2020-11-26 15:59:32 +00:00
Sergio Martins
974bdbd637 Fix a -Wweak-vtable warning 2020-11-26 15:55:52 +00:00
Sergio Martins
cb9d77cd18 Fix more -Woverloaded-virtual 2020-11-26 15:17:33 +00:00
Sergio Martins
af10efa587 Fix more -Woverloaded-virtual 2020-11-26 15:15:37 +00:00
Sergio Martins
a0fb47af58 Fix -Woverloaded-virtual 2020-11-26 14:52:04 +00:00
Sergio Martins
598fbdc51b qtquick: Fix build on mac
RubberBand was being compiled twice. We shouldn't compile the
_widget* multisplitter files when using QtQuick.

Also implies tst_multisplitter shouldn't be run when compiling
for QtQuick.
2020-11-26 14:29:17 +00:00
Sergio Martins
81c3f3f0c6 Fix a -Wweak-vtables warning 2020-11-26 13:28:15 +00:00
Sergio Martins
b9962b3df0 qtquick: Make the QWinWidget case specific to QtWidgets
With QtQuick we don't have QWinWidget
2020-11-26 13:23:06 +00:00
Sergio Martins
a71386e62a Fix using qAbs(bool)
detected by msvc
2020-11-26 12:59:51 +00:00
Sergio Martins
812ce1c08b qtquick: Fix floating dock #3 in the example
It would go to its previous place (0,0), so don't show it at
start.

Added a unit-test as thought it was a bug, but code is correct.
2020-11-26 12:31:50 +00:00
Sergio Martins
189e82450b qtquick: Add 2px margin for the the tab widget
Mimics QtWidgets
2020-11-26 12:06:52 +00:00
Sergio Martins
a3dbc3739c qtquick: Make title bar look nicer 2020-11-26 12:02:58 +00:00
Sergio Martins
c8d34375af qtquick: Add margin to Frame 2020-11-26 11:43:30 +00:00
Sergio Martins
6c3775ea45 qtquick: floating window now has a border and 4px margin
Just like the QtWidget one
2020-11-26 11:36:36 +00:00
Sergio Martins
5a72e1adab qtquick: Fix some colors 2020-11-25 23:52:56 +00:00
Sergio Martins
0f7f310734 qtquick|example: Use the KDAB logs, as we have for QtWidgets 2020-11-25 23:09:53 +00:00
Sergio Martins
e8bf2a5222 qtquick: Remove dummy background color 2020-11-25 22:59:30 +00:00
Sergio Martins
468f545c9a qtquick: Enable more tests
these pass now, too
2020-11-25 22:15:52 +00:00
Sergio Martins
a59ff6dfee qtquick: Build tests with ctest too 2020-11-25 21:41:46 +00:00
Sergio Martins
4fa415ba05 qtquick: Comment out a few tests
We don't support max-size yet
2020-11-25 21:01:37 +00:00
Sergio Martins
d851c60b2f qtquick: Don't allow the initial window size to be smaller than its min
Fixes a test
2020-11-25 20:52:29 +00:00
Sergio Martins
bf097098e5 qtquick: Fix pointer comparison in test 2020-11-25 20:10:32 +00:00
Sergio Martins
8c93b85a24 qtquick: Remove unneeded code 2020-11-25 20:10:13 +00:00
Sergio Martins
f87d67dd59 qtquick: Remove unneeded code 2020-11-25 20:07:08 +00:00
Sergio Martins
bc3278b218 qtquick: tst_positionWhenShown 2020-11-25 17:01:37 +00:00
Sergio Martins
d2c55a67df qtquick: Fix more tests 2020-11-25 16:28:54 +00:00
Sergio Martins
a3414fd92b qtquick: Fix tst_addToSmallMainWindow1 2020-11-25 16:10:04 +00:00
Sergio Martins
12f3ba9074 qtquick: Fix some tests 2020-11-25 16:02:42 +00:00
Sergio Martins
034d2c8aee README: Mention Qt6 2020-11-25 12:31:29 +00:00
Sergio Martins
ad3f4141c8 qtquick|tests: Fix main window QWindow not being resized 2020-11-24 18:40:22 +00:00
Sergio Martins
cde2e4e571 qtquick: Fix tst_constraintsAfterPlaceholder
The resize happens sync for QtQuick, so that wait isn't needed
2020-11-24 13:36:10 +00:00
Sergio Martins
e0775467b2 qtquick|tests: Fix verifying frame min size 2020-11-24 13:12:53 +00:00
Sergio Martins
b20ffcde61 tst_negativeAnchorPosition: Fix typo
we need to subtract from height(), not width()
2020-11-24 12:44:00 +00:00
Sergio Martins
43bdb6a4c2 qtquick: Bunch of fixes for min-size support 2020-11-24 11:38:13 +00:00
Sergio Martins
929aabdc0d example: Add --native-title-bar
Behind developer mode for now
2020-11-23 21:37:59 +00:00
Sergio Martins
6a90a5125f TitleBar: these 4 getters are only for development mode 2020-11-23 20:22:45 +00:00
David Faure
77016a619f Fixes for being used as a subproject
* Don't use CMAKE_SOURCE_DIR, always use CMAKE_CURRENT_SOURCE_DIR
* -Werror=undef found that #if was used instead of #ifdef
2020-11-23 21:16:40 +01:00
Sergio Martins
dc328ff7c4 Fix developer mode build on Windows
developer mode will make some 'private' in headers be 'public', this
affects name mangling on MSVC.

kddockwidgets_linter didn't have the developer mode macro enabled,
so there was a mangling mismatch when linking
2020-11-23 17:40:06 +00:00
Sergio Martins
dc13665566 Fix forward declaration 2020-11-23 16:53:52 +00:00
Sergio Martins
d1279ab119 Merge branch '1.1' 2020-11-23 15:57:42 +00:00
Sergio Martins
80bf6032f3 Fix FloatingWindow's title when shown in the taskbar
The window title isn't only important when using native title bar,
it's also important for showing the correct title in the taskbar
or alt-tab.

For example, if using "minimize support", they'll show in the task bar

Fixes issue #101
2020-11-23 15:52:50 +00:00
Sergio Martins
22437e75c6 qtquick: Override min size for FrameQuick
Fixes constriants not propagating from dock widget to frame
2020-11-23 15:45:06 +00:00
Sergio Martins
801e49de9d Make DockWidgetQuick::minimumSize()/max virtual
While for QtWidgets we have layouts which propagate the constraints
up, for QtQuick we don't, so we need to override minimumSize instead
2020-11-23 15:45:06 +00:00
Sergio Martins
a847a574ed qtquick: Delete the frame visual item delayed
If we're in a QML event handler we can't delete the QML item,
it's a QML limitation. We still want to delete the dockwidgets now though
since all tests depend on that.
2020-11-23 15:45:06 +00:00
Sergio Martins
ef8807bc09 Minor style 2020-11-23 15:45:06 +00:00
Allen Winter
d441477fa9 Merge branch '1.1' 2020-11-22 12:25:28 -05:00
Allen Winter
ece7b22bec apidox - fix doc for enum KDDockWidgets::Config::Flag
doxygen likes "///<"  (not "///>")

Issue#106
2020-11-22 12:17:38 -05:00
Sergio Martins
97d8e4f18b qtquick|tests: Be able to deliver a double-click event to a titlebar
Needed for tests
2020-11-20 21:44:06 +00:00
Sergio Martins
9937f5d789 qtquick: Fix floating windows having a parentItem
they are top-level windows, so shouldn't have a parent item.
Only a QObject::parent()
2020-11-20 16:55:00 +00:00
Sergio Martins
675edfe6db qtquick: Move the floating button logic one level up, to the base class
So QtQuick can use the same logic.

Fixes tst_nonDockable too.
2020-11-20 15:35:46 +00:00
Sérgio Martins
c23d179385 Add support for Qt6
Adds the -DKDDockWidgets_QT6=ON option
Also you'll need to port any required Qt6 module first (For example QStateMachine).
2020-11-20 12:36:11 +00:00
Sergio Martins
36af020505 Fix two scoped value rollback being temporaries 2020-11-20 09:55:31 +00:00
Sergio Martins
7b2d195139 qtquick: Put the failing QtQuick tests at the end
So they don't corrupt the passing ones.
Approx 40 need to pass now.
2020-11-19 22:59:00 +00:00
Sergio Martins
984ab3bb13 qtquick: Add support for disabling close button
For when dockwidget isnt' closable.
Fixes tst_nonClosable() too
2020-11-19 22:12:49 +00:00
Sergio Martins
0331f90791 Move title bar logic regarding close button to base class
So QtQuick can use it too
2020-11-19 22:09:40 +00:00
Sergio Martins
b19c53d650 qtquick: Implement some title bar helpers for tests
Mostly getters that return the title button state
2020-11-19 21:45:29 +00:00
Sergio Martins
3670cf2377 qtquick: Comment the embedded main window test
We don't support that yet
2020-11-19 17:49:27 +00:00
Sergio Martins
864670b0a1 qtquick: Fix some cases where floating windows didn't have parent
Happened because floatingWindow->parentWidget() was null. On QtWidgets
this works because QWidget::parentWidget() will return the transient parent
without a problem.
2020-11-19 17:47:02 +00:00
Sergio Martins
0cf148b389 tests: Check for the existence of QWindow at exit, not QWidget
So we're clean for QtQuick too
2020-11-19 16:34:30 +00:00
Sergio Martins
921d0892a0 qtquick: Fix tst_setVisibleFalseWhenSideBySide
Was also broken (but passed) for QtWidgets.
We don't support hidding widgets with setVisible(false).
2020-11-19 11:59:09 +00:00
Sergio Martins
beb2d9e659 qtquick: Add support for non-closable windows
fixes tst_preventClose
2020-11-18 18:13:35 +00:00
Sergio Martins
59168da231 qtquick: Fix crash at exit
Don't delete our QWindow if the QWindow is currently deleting us
2020-11-18 18:10:32 +00:00
Sergio Martins
3dbf699c49 qtquick: Fix QtQuick parenting
Mimic QtWidgets so we have similar behaviour:

- When a MainWindow is deleted, its associated QWindow is deleted
too.
- When a MainWindow is deleted, it deletes any FloatingWindows
which have it as a transient parent
2020-11-18 16:18:42 +00:00
Sergio Martins
baa7561b13 qtquick: Fix tst_addAndReadd
Wasn't even correct for QtWidgets and just passing because the
widget wasn't getting dropped QtWidgets, since the indicator was hidden.

For QtQuick the indicator is also hidden but it's accepting it. To fix.
2020-11-18 14:42:34 +00:00
Sergio Martins
ac5f4b871c qtquick: Fix tst_honourGeometryOfHiddenWindow
We want the geometry of the QWindow
2020-11-18 14:30:08 +00:00
Sergio Martins
52bf449366 qtquick: Fixes for focusing
Fixes tst_focus too, and  maybe a few other tests
2020-11-18 14:01:55 +00:00
Sergio Martins
08a1c4e6df qtquick: Implement focus policy
fixes tst_dockWidgetGetsFocusWhenDocked
2020-11-18 12:35:46 +00:00
Sergio Martins
156dad6e03 qtquick: Fix IndicatorWindow::posForIndicator()
Wasn't even implemented. Should make some tests pass.
2020-11-18 12:06:20 +00:00
Sergio Martins
b642d2df2f qtquick: Fix dropped widget not being the current tab 2020-11-18 11:44:55 +00:00
Sergio Martins
5cedfab82c Make DropIndicatorOverlay::posForIndicator() pure virtual 2020-11-18 11:44:02 +00:00
Sergio Martins
af9d62a58c qtquick: Fix FloatingWindows not being destroyed when empty
Also fixes tst_createFloatingWindow
2020-11-17 23:15:33 +00:00
Sergio Martins
0758496b0d Fix QtQuick build without developer mode 2020-11-17 21:15:07 +00:00
Sergio Martins
a452723919 Fix tests running with a nullptr state machine 2020-11-17 21:08:05 +00:00
Sergio Martins
774e66ba6f Minor: add an assert
Provides a nicer backtrace when it happens.
Currently repro on QtQuick only
2020-11-17 21:04:32 +00:00
Sergio Martins
f13de89db5 tests. Fix utils.h draggableFor() for QtQuick 2020-11-17 20:44:04 +00:00
Sergio Martins
1393ae224f Fix DockWidget::windowActiveAboutToChange() being emitted too much
Was being emitted even when it didn't affect our window.
This caused an explosion of signals when we had many dock widgets.
2020-11-17 18:52:54 +00:00
Sergio Martins
d92d7c258c tests: Remove stray qDebug 2020-11-17 18:15:38 +00:00
Sergio Martins
619ca74051 Use QFAIL instead of qFatal
more elegant, and test can continue, so we see the whole result
2020-11-17 18:15:03 +00:00
Sergio Martins
aa39a71ae5 Rename tst_common to tst_docks
Now that tst_docks was all ported let's have the old name again.
Also cmake -jN now works, as tst_docks is called by the tests_launcher
while tst_common was not
2020-11-17 15:44:49 +00:00
Sergio Martins
f4e33c1409 tests: Port the remaining tests to QtQuick
Tests now build with QtQuick too.
2020-11-17 15:26:14 +00:00
Sergio Martins
ad96336a36 Also init resources if QT_STATIC is defined
Should help with WASM, so you don't need to manually call
Q_INIT_RESOURCE
2020-11-17 11:35:37 +00:00
Sergio Martins
50d1e75709 Fully scope the qrc resource files
So they don't clash when KDDW is a static library
2020-11-17 11:33:22 +00:00
Sergio Martins
793c4e509b Fix crash regarding edge case of dragging window to itself
If we're not showing a title bar, then the draggable is the tabbar,
not the floating window.
2020-11-16 22:55:45 +00:00
Sergio Martins
e4a33ad8b7 Added README for wasm
Fixes issue #100
2020-11-13 18:45:58 +00:00
Sergio Martins
52cf53ce5c example: init resources if static
Fixes title bar not having icons on WASM
For issue #100
2020-11-13 18:33:13 +00:00
Sergio Martins
8791870efb Blacklist classical indicators on WASM
Use segmented indicators.
Wasm doesn't support top-level windows with translucency, which
is required for the classical indicators

For issue #100
2020-11-13 18:18:25 +00:00
Sergio Martins
4f8c47bfa4 Don't require Qt5X11Extras for web assembly
For issue #100
2020-11-13 17:43:38 +00:00
Sergio Martins
ad141df6b1 Merge branch '1.1' 2020-11-13 16:00:49 +00:00
Sergio Martins
72605292b7 Don't show dock/undock icon when dockwidget is not dockable
Fixes issue #99
2020-11-13 15:51:26 +00:00
Sergio Martins
1443eff1d9 tests: Port some tests to QtQuick
15 to go
2020-11-10 18:00:19 +00:00
Sergio Martins
22d5db32ce FocusScope: Remove focus when nothing is focused 2020-11-09 15:25:32 +00:00
Sergio Martins
e9a321039f Renamed signal to windowActiveAboutToChange()
Added the 'aboutTo', as the event hasn't been caught by the top-level
window yet
2020-11-09 13:46:16 +00:00
Sergio Martins
b93f115b53 Added DockWidget::windowActiveChanged() signal
Tracking the top-level window's 'isActiveWindow' property is difficult
since the dock widget's top-level window is changing all the time
when docking and undocking. So added a convenience signal
2020-11-09 13:35:05 +00:00
Sergio Martins
7faaf2cc69 tests: Port more tests to QtQuick
18 to go before we start fixing them
2020-11-08 15:18:16 +00:00
Sergio Martins
978f9d3a5e tests: Port another test to QtQuick
29 to go
2020-11-06 23:52:48 +00:00
Sergio Martins
09793b3481 tests: Port more tests to QtQuick
31 to go
2020-11-06 23:33:02 +00:00
Sergio Martins
f4d9a96ddb Added Config::Flag_KeepAboveIfNotUtilityWindow
Which sets Qt::WindowStaysOnTopHint for floating windows.
Usually unneeded, as floating windows are Qt::Tool with a transient
parent, but in case you're using Flag_DontUseUtilityFloatingWindows
then you might want (or not) to keep them above.
2020-11-05 12:11:48 +00:00
Sergio Martins
4ac892038f Fix QtQuick build 2020-11-04 11:34:35 +00:00
Colin Ogilvie
387ba291be export FocusScope 2020-11-04 11:32:42 +00:00
Sergio Martins
5d3d189774 tests: Port 1 test to QtQuick 2020-11-03 17:22:50 +00:00
Sergio Martins
a6a1047f75 FocusScope: Also honour widgets embedded in the tab bar
A widget embedded in a tab bar (like a line edit) lives outside
the DockWidget but inside the Frame. It should still focus the
current dockwidget.
2020-11-03 17:12:21 +00:00
Sergio Martins
3e70b846e8 FocusScope: Modify the member variable before emitting signal 2020-11-03 16:19:47 +00:00
Sergio Martins
0a2aebd78d FocusScope: Also focus when the user clicks on tab widget background
Relevant when you don't have a title bar
2020-11-03 15:29:13 +00:00
Sergio Martins
ddad0feaf3 tests: Additional 5 tests build for QtQuick now
37 to go
2020-11-02 20:04:14 +00:00
Sergio Martins
aba1cce1f6 Merge branch '1.1' into master 2020-11-02 11:37:56 +00:00
Sergio Martins
7318675e84 Clarify comment about fractionaly scalling factors
The problem can happen on Windows too.

Fixes issue #94

Nothing more we can do here, it's fixed for Qt 5.15.2.
2020-11-02 11:36:24 +00:00
Sergio Martins
cf700f8eb6 tests: port more tests to QtQuick
43 to go
2020-10-30 18:29:59 +00:00
Sergio Martins
2c1d099c83 Fix include here too 2020-10-30 12:27:50 +00:00
Sergio Martins
91ff29ae64 Fix build when KDDW is embedded within a project 2020-10-30 12:21:25 +00:00
Renato Araujo Oliveira Filho
523dfb0d12 Fix python bindings build 2020-10-30 08:36:15 -03:00
Sergio Martins
b84e0f3605 tests: More tests are now building with QtQuick
56 to go
2020-10-29 18:11:24 +00:00
Sergio Martins
f72e8e6a1c tests: Port 5 more tests 2020-10-28 22:57:28 +00:00
Sergio Martins
c6c1fe79c3 Fix QtQuick build
src/ is no longer in the include path
2020-10-28 22:15:32 +00:00
Sergio Martins
ea382dcc17 cmake: Install DockRegistry_p.h
It's available as private API if anyone wants to use it
2020-10-28 21:55:02 +00:00
Sergio Martins
c142eb8ecd trying to fix the python build
after the include paths changes
2020-10-27 21:40:51 +00:00
Sergio Martins
46c039153e cmake: Don't export src/ to include path
Otherwise applications can't have files named MainWindow.h or
DockWidget.h.

Now all kddockwidgets includes need to be scoped, example:
2020-10-27 17:01:18 +00:00
Sergio Martins
473f03360c tests: Fix Wweak-vtables warnings 2020-10-26 18:59:21 +00:00
Sergio Martins
3fb3984a72 Merge branch '1.1' 2020-10-26 18:23:17 +00:00
Sergio Martins
9c5e3cf5af tests: Port another test to QtQuick 2020-10-26 18:22:01 +00:00
Sergio Martins
7419ca806d tests: Port 2 more tests to QtQuick 2020-10-26 17:32:13 +00:00
Allen Winter
8a51c31663 OBS - update for 1.1.0 release 2020-10-26 12:14:46 -04:00
Sergio Martins
a586a7894b cmake: Qt5::GuiPrivate is only needed on Windows 2020-10-26 16:14:07 +00:00
Sergio Martins
31fcbebaff ChangeLog: Add the date of 1.1 release 2020-10-26 15:29:47 +00:00
Sergio Martins
c4cc6b3e6e tests: Port more tests to QtQuick 2020-10-25 22:39:10 +00:00
Sergio Martins
420ac9044e Merge branch '1.1' into master 2020-10-23 17:11:45 +01:00
Sergio Martins
392dac5691 Use Qt::WA_PendingMoveEvent instead of Qt::WA_Moved
We check if the user provided position before putting a floating
window in a default position. Qt::WA_Moved however has the problem
that it's not cleared, so second time you show a window, it will
have it, even if user didn't set geometry.

Use Qt::WA_PendingMoveEvent instead, which was made for tracking
moves made before the first show.
2020-10-23 17:07:14 +01:00
Sergio Martins
29744c01c6 ChangeLog: Added Config::setTabbingAllowedFunc 2020-10-23 10:33:37 +01:00
Sergio Martins
a16adb9578 Merge branch '1.1' 2020-10-23 10:32:10 +01:00
Sergio Martins
49e488df24 remove roadmap from 1.1 ChangeLog
We only have it for master
2020-10-23 10:29:57 +01:00
Sergio Martins
1a3f00eac8 ChangeLog: Added HDPI improvements 2020-10-23 10:29:00 +01:00
Sérgio Martins
c6ea8d5525 ChangeLog: Remove mention to 1.0.1 release
We're releasing 1.1 asap
2020-10-23 10:23:52 +01:00
Sergio Martins
7738585d01 tests: Enabled another batch of tests for QtQuick
83 of 175 are now building with QtQuick
2020-10-22 20:54:39 +01:00
Sergio Martins
61bc24c6ea tests: A bunch of drag/mouse functions are not compatible with qtquick
In the sense that they build.
2020-10-21 22:43:08 +01:00
Sergio Martins
ae90001d7a tests: Remove some QWidget ifdefs
Works fine for QtQuick too
2020-10-21 21:08:03 +01:00
Sergio Martins
c0ea3a097c tests: Port a test to qtquick 2020-10-21 21:05:03 +01:00
Sergio Martins
abca57be11 qtquick: Fix tst_stealFrame
Now has the same behaviour as with QWidgets
2020-10-20 22:36:45 +01:00
Sergio Martins
645201480c qtquick: Port two tests 2020-10-20 22:05:29 +01:00
Sergio Martins
8cffba3e22 Merge branch '1.1' into master 2020-10-19 21:25:39 +01:00
Sergio Martins
8f62004f5b cmake: Remove QTQUICK option for 1.1
Leave it in master only.
2020-10-19 21:23:44 +01:00
Sergio Martins
4fff6edb7b qtquick: Port another test 2020-10-19 21:03:47 +01:00
Sergio Martins
64cff4ba49 qtquick|tests: use auto instead of QPointer<QWidget> 2020-10-19 21:00:18 +01:00
Sergio Martins
ce3c4d5661 qtquick|tests: pass parent to main window
Those tests pass now
2020-10-19 20:58:00 +01:00
Sergio Martins
5f333f0934 qtquick: port more tests 2020-10-19 20:53:40 +01:00
Sergio Martins
f70722934c qtquick: Port more tests 2020-10-19 20:47:09 +01:00
Sergio Martins
b9eb9f10d4 qtquick: Port more tests 2020-10-19 20:26:09 +01:00
Sergio Martins
6f89d94eef qtquick: Emit Frame::layoutInvalidated() when needed
When min/max size changes it needs to be emitted, so layout
notices
2020-10-19 20:06:29 +01:00
Sergio Martins
3a494d706a qtquick: Implement missing QWidgetAdapter::floatingWindow() 2020-10-19 19:05:10 +01:00
Sergio Martins
2ffbe07bcf Updated README-Wayland.md 2020-10-19 11:46:22 +01:00
Sergio Martins
371fd361a8 Detach when double-click on tab bar background, if no title bar
When a title bar isn't visible, we need a way to detach an entire
group of tabs by double clicking, required for wayland.

Implemented for all platforms, as it makes sense
2020-10-19 11:42:39 +01:00
Sergio Martins
97416607e5 qtquick: Allow to set min-sizes on items 2020-10-18 23:27:10 +01:00
Sergio Martins
51ccbe7c7c Move TabBar::detachTab() to Frame
As the code doesn't have anything specific to QTabBar.
Means QtQuick can reuse it without needing a TabBarQuick.

tst_crash now passes for QtQuick too
2020-10-18 23:07:13 +01:00
Sergio Martins
65599399c7 qtquick: port a bunch of tests 2020-10-18 22:23:51 +01:00
Sergio Martins
c0816d4924 qtquick: Fix tst_negativeAnchorPosition5
min sizes weren't bounded
2020-10-18 21:58:46 +01:00
Sergio Martins
2988e97e14 qtquick: Fix build 2020-10-18 20:29:44 +01:00
Sergio Martins
046ceae500 Remove unneeded null check from DropArea::drop() 2020-10-18 12:31:04 +01:00
Sergio Martins
33c0cda582 Minor readability, just call setWindowBeingDragged(true)
It's always true here.
2020-10-18 12:28:10 +01:00
Sergio Martins
df7acc1075 Added README-Wayland.md to explain some differences
Fixes issue #10
2020-10-17 12:30:57 +01:00
Sergio Martins
3859e4b277 Added Wayland to the README 2020-10-17 12:18:05 +01:00
Sergio Martins
26253b65c7 wayland: Silence warning about qpa not supporting activating
"qt.qpa.wayland: Wayland does not support QWindow::requestActivate()"
2020-10-17 12:13:58 +01:00
Sergio Martins
424453ab57 Double clicking on a tab will make it float
Also really required for Wayland, where we don't another way to
float a single tab, as the float button affects all of them.
2020-10-17 12:09:47 +01:00
Sergio Martins
d7de0ebd20 Updated ChangeLog
- Added wayland for 1.2, it's done. Might need more polishing.
- Removed 1.0.1, let's release 1.1 instead
- Moved QtQuick to 1.3. The december target is still there, but I want
to release 1.2 sooner, since the wayland support is done.
2020-10-17 11:44:45 +01:00
Sergio Martins
bf1c5140cd Wayland: Fix another missing mapToGlobal
Hovering indicators was fine, but dropping was off by a few pixels
vertically due to the menu bar
2020-10-17 11:41:19 +01:00
Sergio Martins
fb7a35db5b Wayland: Fix indicator hover being off
Drag events are in local coords, while DropArea wants it in
global
2020-10-17 11:05:56 +01:00
Sergio Martins
5872c2fbe3 Wayland: Support classical indicators too
The Indicator Window is top-level, but on Wayland that can't do,
as we have no way to position it. So parent it. The indicators
are now under the window being dragged, but that's no so bad, as it's
smi-transparent, so you still see the indicator.
2020-10-17 11:02:49 +01:00
Sergio Martins
ba04c70d5a Minor code re-ordering 2020-10-17 10:30:26 +01:00
Sergio Martins
de1e2d301f wayland: Support affinities too 2020-10-17 10:27:43 +01:00
Sergio Martins
b67bdf779e Don't dereference windowBeingDragged->floatingWindow()
Add a level of indirection instead, and support for the wayland case
2020-10-16 23:06:30 +01:00
Sergio Martins
78a3221395 Merge branch '1.1' into master 2020-10-16 22:05:14 +01:00
Sergio Martins
f698b56dad relax test
Seems to happen with 5.15 static. It's benign anyway
2020-10-16 22:02:45 +01:00
Sergio Martins
4ed18fdf1d Introduce Config::setTabbingAllowedFunc(<lambda>)
This gives a lot of power to the user to disallow tabbing two dock
widgets, while still allowing them to be docked side by side. As
this can't be achieved with affinities.

Instead of adding API which might not be enough soon, just allow
the user to pass a lambda and implement his very custom requirement.

Fixes #91
2020-10-16 21:56:33 +01:00
Sergio Martins
6e05f13c77 Added FloatingWindow::dockWidgets() 2020-10-16 21:48:47 +01:00
Sergio Martins
cb51d0af11 Merge branch '1.1' into master 2020-10-16 20:53:17 +01:00
Sergio Martins
a146cd81b2 Fix mac tests build 2020-10-16 20:52:22 +01:00
Sergio Martins
8dbd6df456 Merge branch '1.1' into master 2020-10-16 20:35:56 +01:00
Sergio Martins
ac6d845c8d Skip tests on macOS+offscreen if Qt <= 5.15.0
There's a bug in Qt qpa only fixed in 5.15.1
2020-10-16 20:35:04 +01:00
Sergio Martins
cfc9d1abcd cmake: Fix indentation 2020-10-16 19:43:50 +01:00
Sergio Martins
a66748f6ca relax test
Seems to happen with 5.15 static. It's benign anyway
2020-10-16 17:10:40 +01:00
Sergio Martins
e5f46ead3b qtquick: Fix build 2020-10-16 17:08:36 +01:00
Sergio Martins
171023558e Introduce WindowBeingDraggedWayland
This is just a cleanup. Instead of having WindowBeingDragged
having both code paths, let's keep the non-wayland platforms code
small and clean.
2020-10-16 17:08:36 +01:00
Allen Winter
059a424b88 Merge branch '1.1' 2020-10-16 08:39:26 -04:00
Sergio Martins
307b22deaf Wayland: Also allow to drag by tab widget
For when we don't have title bar
2020-10-16 13:30:20 +01:00
Sergio Martins
e405688f67 Fixing build with msvc 2013
error C2876: 'QMimeData' : not all overloads are accessible
2020-10-16 13:16:13 +01:00
Sergio Martins
68554119f4 Fix -Werror build on mac 2020-10-16 11:46:02 +01:00
Sergio Martins
86a4a740ef wayland: dropping a single tab or frame now works too 2020-10-16 11:33:09 +01:00
Sergio Martins
0a004b83ca Add WindowBeingDragged::draggable() getter 2020-10-16 11:16:49 +01:00
Sergio Martins
4fa47403c5 Make DragArea::drop() deal in WindowBeingDragged()
Preparing for wayland case.
2020-10-16 10:49:42 +01:00
Sergio Martins
9e418ced53 wayland: Finish WindowBeingDragged::maxSize() and minSize
Supports now single dock widgets or single frames
2020-10-16 10:40:34 +01:00
Sergio Martins
bc04863439 Wayland: Dragging a tab or a nested dock widget now shows pixmap
TODO: Supporting a drop for those two cases
2020-10-16 10:33:01 +01:00
Allen Winter
77f259a435 README.md - contact info 2020-10-15 16:06:26 -04:00
Sergio Martins
16bcace663 Add some transparency to the QDrag pixmap
Looks better
2020-10-15 19:15:40 +01:00
Sergio Martins
52fddaa1cd wayland: Set a pixmap while DND
Since our source window isn't moving, let's at least show a copy
of it on the pixmap

A bunch of tearing going on kwin_wayland/nvidia though.
Weston/nvidia is fine.
Haven't tried kwin_wayland/Intel yet
2020-10-15 19:11:12 +01:00
Sergio Martins
f3d7400c15 wayland: End the drag properly when user cancels the drag 2020-10-15 19:02:46 +01:00
Allen Winter
7ebc3f3533 src/DockWidgetBase.h - fix compile after merge from master 2020-10-15 12:43:29 -04:00
Renato Araujo Oliveira Filho
0ee94b425e Fixed python bindings generation 2020-10-15 12:38:32 -04:00
Sergio Martins
d44a173945 Wayland: Really end the drag after dropping
Fixes a crash on shutdown
2020-10-15 17:27:12 +01:00
Sergio Martins
ac001d6f32 wayland: Don't allow to drop onto itself
It was showing the drop indicators in the window being dragged
2020-10-15 16:50:46 +01:00
Sergio Martins
e3de2df69c wayland: Add initial drag and drop support
You can drag a floating window and drop it somewhere

- Only works with segmented indicator style. Classical indicators
require us being able to positioning an overlay, which wayland
doesn't allow us to.
- Detaching inner tabs and dock widgets not implemented yet.
- polishing needed
2020-10-15 16:50:46 +01:00
Sergio Martins
39d3c90b2f Minor variable rename for readability 2020-10-15 16:50:46 +01:00
Sergio Martins
bca21defa5 wayland: Don't grab mouse or set window opacity
Not supported by the QPA and not needed for wayland anyway
2020-10-15 16:50:46 +01:00
Sergio Martins
dd3116ae7f Minor: remove const, need to pass it somewhere else 2020-10-15 16:50:46 +01:00
Allen Winter
49b3765eae Merge branch '1.1' 2020-10-15 10:53:41 -04:00
Allen Winter
1f5dd35bec Merge pull request #93 from KDAB/fix-python-binding
Fixed python bindings generation
2020-10-15 10:52:44 -04:00
Renato Araujo Oliveira Filho
6fce8e6161 Fixed python bindings generation 2020-10-15 09:55:32 -03:00
Allen Winter
e57b46979d buildsystem - fix installation path for Python bindings 2020-10-14 16:27:18 -04:00
Allen Winter
683b67abb0 buildsystem - install libs with symlinks for the major vers 2020-10-14 15:59:53 -04:00
Sergio Martins
6479bcabfb Make DropArea::drop() receive WindowBeingDragged instead
In prep for wayland support
2020-10-14 20:42:51 +01:00
Sergio Martins
a8c9735652 wayland: Add needed API to WindowBeingDragged
So it can act as a substitute for FloatingWindow, which we don't
always have during a drag
2020-10-14 20:34:55 +01:00
Sergio Martins
93b25b6a31 Make MultiSplitter::rectForDrop() receive WindowBeingDragged
Instead of FloatingWindow, which won't exist on wayland while a
drag is in progress.
2020-10-14 20:25:09 +01:00
Sergio Martins
4eb5a0940e dont' cast pointer to bool 2020-10-14 19:44:27 +01:00
Sergio Martins
c2cc914b5c indicators: Depend less on FloatingWindow
Deal in terms of WindowBeingDragged instead, as wayland won't have
a floating window being dragged
2020-10-14 19:39:51 +01:00
Sergio Martins
1219ba90af Add WindowBeingDragged::affinities()
So we can deal in WindowBeingDragged instead of FloatingWindow.
For wayland we won't have floating window whilst dragging
2020-10-14 19:22:13 +01:00
Sergio Martins
beef3c7fb5 Specialize StateDragging for wayland
Introduces StateDraggingWayland. Wayland is the alien, so don't want
to introduce hacks in the existing clean code.

StateDraggingWayland will deal with the wayland workarounds.

Although the impl only has placeholders for now I'm committing it
because it's already an improvement: broken detachment is no longer
possible. Detached windows were going to a random place on screen.
2020-10-14 18:12:25 +01:00
Sergio Martins
52184ca72b Added StateBase::isActiveState() 2020-10-14 18:01:48 +01:00
Sergio Martins
78cd7c56f7 Minor: Switch order of ifdefs
Will want to add a case for wayland too.
2020-10-14 16:41:17 +01:00
Sergio Martins
7805a1dc25 wayland: Use both client and native titlebar
native will be used for moving while client for DND
2020-10-14 16:32:10 +01:00
Sergio Martins
92f426e4c0 wayland: Allow floating windows to properly move
They move now, but don't drag yet.
2020-10-14 16:25:05 +01:00
Sergio Martins
90f10042fd Merge branch '1.1' into master 2020-10-14 15:22:04 +01:00
Allen Winter
697c140883 set version to 1.1.0 2020-10-14 10:07:48 -04:00
Sergio Martins
3369816d31 Merge branch '1.1' into master 2020-10-14 14:59:44 +01:00
Sergio Martins
819725351a Fix -Wweak-vtables warnings 2020-10-14 14:55:28 +01:00
Allen Winter
860cbd29bc Merge branch '1.1' 2020-10-13 13:24:03 -04:00
Allen Winter
07db9f9a7a cmake/Python/FindShiboken2.cmake - clean 2020-10-13 13:23:39 -04:00
Allen Winter
2fd4f9ce97 Merge branch '1.1' 2020-10-13 12:51:38 -04:00
Allen Winter
77d7cd7d58 buildsystem - namespace CMake options
OPTION_DEVELOPER_MODE => KDDockWidgets_DEVELOPER_MODE
OPTION_BUILD_PYTHON_BINDINGS => KDDockWidgets_PYTHON_BINDINGS
PYTHON_BINDINGS_INSTALL_PREFIX =>
  KDDockWidgets_PYTHON_BINDINGS_INSTALL_PREFIX
OPTION_QTQUICK => KDDockWidgets_QTQUICK
2020-10-13 12:28:49 -04:00
Allen Winter
e5cb42c4fe CMakeLists.txt - improve installing to non-KDAB location 2020-10-13 11:32:12 -04:00
Allen Winter
1fe1d619a9 footer.html - update tag line 2020-10-13 11:30:14 -04:00
Sergio Martins
697cc34c23 Merge branch '1.1' into master 2020-10-12 18:10:53 +01:00
Sergio Martins
b00d1d80b0 Merge branch '1.0' into 1.1 2020-10-12 18:09:54 +01:00
Sergio Martins
67bb42c5b4 Fix infinite loop when updating title bar visibility
Not exactly infinite, just exponential growth or worse
Fixes #92
2020-10-12 18:09:32 +01:00
Sergio Martins
d50fcb80c5 qtquick: Fixed all the layouting spam/warnings
Don't layout a view with 0x0.
2020-10-12 17:07:30 +01:00
Sergio Martins
9571ffc30e Remove unneeded qDebug 2020-10-12 17:05:39 +01:00
Sergio Martins
f4a88276b8 qtquick|tests: ported two more tests 2020-10-11 13:05:51 +01:00
Sergio Martins
4ea254029a qtquick: Fix tst_negativeAnchorPosition3
MainWindow needed a parent.
Also normalized deletion of the floating window.
2020-10-11 13:00:09 +01:00
Sergio Martins
f5e85c2196 qtquick|tests: Add a few more tests 2020-10-11 12:55:25 +01:00
Sergio Martins
926103325c qtquick: Fix close events not being delivered
Also ported some tests from tst_docks to tst_common, which
were failing due to close events not working. Fixed now
2020-10-11 12:42:20 +01:00
Sergio Martins
20b2988165 Unfold an assert into a qWarning+assert
Just to print some debug data
2020-10-11 11:58:32 +01:00
Sergio Martins
39aefd312b qtquick|tests: Don't abort tests due to binding loop warnings
Don't want to care about it right now
2020-10-11 11:53:55 +01:00
Sergio Martins
b5478bcb0d tests: Enable a bunch of tests for QtQuick
only one is failing
2020-10-11 11:44:47 +01:00
Sergio Martins
d403557b9e tests: Abstract QPushButton somewhat
Anything refering QPushButton will simply compile with QtQuick.
2020-10-10 21:07:18 +01:00
Sergio Martins
db9884ea64 qtquick: Enable tst_setFloatingSimple and tst_restoreSimple 2020-10-10 20:53:27 +01:00
Sergio Martins
74148aabc3 tests: Don't complain there's a leak if the FloatingWindow is being deleted already 2020-10-10 20:52:56 +01:00
Sergio Martins
7bfac091ae Rename DockRegistry::nestedwindows() to DockRegistry::floatingWindow
which is the naming we use everywhere else
2020-10-10 20:41:42 +01:00
Sergio Martins
60a68817b6 qt_quick: Enable tst_restoreCentralFrame too
Removes a warning from FrameQuick. It's benign.
For QtWidgets we also set a -1 tab index to clear
2020-10-10 20:25:46 +01:00
Sergio Martins
a56e6d7fe8 qtquick: Enable tst_simple2 2020-10-10 20:10:43 +01:00
Sergio Martins
1f0b208922 qtquick: Enable tst_resizeWindow too 2020-10-10 12:15:18 +01:00
Sergio Martins
9da147f50e qtquick: Enable tst_floatingWindowTitleBug too 2020-10-10 11:52:38 +01:00
Sergio Martins
c175451284 qtquick: Fix user geometry not being honoured
QtQuick doesn't set Qt::WA_Moved, which we expect. Set this attribute
in the wrappers then.

Fixes the unit-test too.
2020-10-10 11:46:24 +01:00
Sergio Martins
9a88cf3a72 tests: Enable tst_honourUserGeometry for QtQuick
It's failing. Will fix.
2020-10-10 11:36:16 +01:00
Sergio Martins
d0255e5310 tests: Use DockWidgetType instead of DockWidget
Will be easier to enable QtQuick support
2020-10-10 11:24:32 +01:00
Sergio Martins
2a2fb0a4f2 tests: Enable tst_sizeAfterRedock for QtQuick too 2020-10-10 11:18:40 +01:00
Sergio Martins
b0ad939db8 tests: Enable tst_tabbingWithAffinities for QtQuick 2020-10-10 11:18:40 +01:00
Allen Winter
5abf118b8c Merge branch '1.1' 2020-10-10 05:30:38 -04:00
Allen Winter
f5099167b6 misspelling-- 2020-10-10 05:29:08 -04:00
Sergio Martins
30949bd4c3 quick: Fix test, don't leak window 2020-10-09 19:15:55 +01:00
Sergio Martins
63279c187e quick: Fix QtQuick not reacting to parent change events
- We were calling event() directly, which skiped event filters.
- The handler was calling parent(), but the setParent() call is done
later. So first call setParentItem()
2020-10-09 19:09:45 +01:00
Sergio Martins
fad03f8e0b Debug++ 2020-10-09 19:08:51 +01:00
Sergio Martins
6edfcc4f02 Install DragController_p.h
Still private. It's for advanced used only.
2020-10-09 17:26:00 +01:00
Sergio Martins
17df7b5b4e Install DragController_p.h
Still private. It's for advanced used only.
2020-10-09 16:56:43 +01:00
Sergio Martins
62cbd823c9 quick: Assert that we're not using this QtWidgets only function 2020-10-08 16:25:29 +01:00
Sergio Martins
bdcc211308 quick: Resize FloatingWindow and it's QWindow immediately
So it matches QtWidgets behaviour, otherwise tests will
break a lot if they have to wait for an event loop for FloatingWindow
to be resized
2020-10-08 16:20:12 +01:00
Sergio Martins
ddeb4611a1 quick: Fix an invalid cast to QWidget
We don't have QtWidgets in QtQuick.
Will try to fix it at a build-system level so we catch these
cases sooner.
2020-10-08 16:15:56 +01:00
Allen Winter
ad639c8001 CMakeLists.txt - increase version number for 1.2 2020-10-08 09:48:16 -04:00
Sergio Martins
15dc64d550 quick: Fix positioning windows when floating them
- Resizing the FloatingWindow wasn't resizing the QQuickView
- QQuickItems were being created as visible, while QWidgets are
created invisible. Fixed this difference in behaviour
2020-10-07 19:43:40 +01:00
Sergio Martins
03b575d16e quick: Fix MultiSplitter()::mainWindow()
Works now for QtQuick
2020-10-06 21:04:25 +01:00
Sergio Martins
4cacee45e8 Export MultiSplitter
Has powerful private api which could be useful
2020-10-06 11:03:52 +01:00
Sergio Martins
873b860203 ItemContainer: Make some getters public
They're decent private api for some very custom use cases
2020-10-06 10:53:15 +01:00
Sergio Martins
128ae2d889 Fix separators not being deleted
Bug found with QtQuick but also reproducible with QtWidgets.
Added unit-test for both stacks.
2020-10-05 18:25:33 +01:00
Sergio Martins
b0ec0e22e4 quick: Remove unused Separator.qml
We have one in multisplitter/ already
2020-10-05 17:34:27 +01:00
Sergio Martins
6aa4e979dc Added DockWidgetBase::hasPreviousDockedLocation() 2020-10-05 13:52:36 +01:00
Sergio Martins
36f225b859 Fix build with MinGW, no pragma link
Instead use cmake to link, which is cleaner anyway.

As a drive-by, remove the QtWidget check from the headers includes,
as QtQuick also needs Dwm lib
2020-10-05 03:15:36 -07:00
Sergio Martins
48a75b2450 Fix namespaced build 2020-10-05 10:21:20 +01:00
Sergio Martins
2af4f939dd tests|quick: Fix leak 2020-10-04 20:37:00 +01:00
Sergio Martins
b592d21064 quick: Also run tst_resizeWindow2 for QtQuick 2020-10-04 20:22:43 +01:00
Sergio Martins
3cdd5afe7a quick: Fix ownership of the floating view
Not nice to delete it in two places.
2020-10-04 20:16:30 +01:00
Sergio Martins
0ef56c1302 quick: Fix the overlay from minimizing windows being dragged 2020-10-04 19:41:26 +01:00
Sergio Martins
96f7f38a0e tests|quick: Set a source in the view, so we have a root item 2020-10-04 19:39:13 +01:00
Sergio Martins
689ba7da8f quick: Make dealing with window flags more stable
There's only one place where we need to set the flags, it's when
creating the FloatingWindowQuick. So no need to complex machinery
which is bug propne
2020-10-04 11:12:35 +01:00
Sergio Martins
951aeece6e quick: Make DockWidgetBase::setWidget() virtual
The QtQuick counter-part needs to do some specific things, like
settings anchors.parent: fill on it, and parenting it
2020-10-04 00:01:32 +01:00
Sergio Martins
2ea0d54e6c quick: Fix floating windows not having the correct window flags
Add a unit-test too.
2020-10-03 23:30:13 +01:00
Sergio Martins
1c98fe04ca Fix build 2020-10-03 23:11:40 +01:00
Sergio Martins
59a9ab6642 tests: Remove org.kde.desktop from warning blacklist
It's now solved by not using the kde QQC2 style. So no need to polute
the warning list
2020-10-03 23:07:49 +01:00
Sergio Martins
7ee5949ae2 tests|quick: Fix memory leaks 2020-10-03 23:07:04 +01:00
Sergio Martins
721f08e29b tests: Show the QQuickView and cleanit up
Also commit main.qml I forgot
2020-10-03 22:49:27 +01:00
Sergio Martins
df07133c9d tests: Silence some QML warnings from KDE theme plugin Kirigami
We don't want tests to abort because of that
2020-10-03 22:48:28 +01:00
Sergio Martins
b9e3024720 tst_common now passes for QtQuick
Needed a view
2020-10-03 22:10:38 +01:00
Sergio Martins
d848d3e39a MainWindow: Receive either QWidget or QQuickItem as parent
No need to receive the more complex adapters
2020-10-03 22:09:56 +01:00
Sergio Martins
3f26f4c8f2 Remove unused variable 2020-10-03 22:09:26 +01:00
Sergio Martins
dc9d709dd7 quick: Use proper icons for close and float
No more red rectangles
2020-10-03 18:55:33 +01:00
Sergio Martins
543f734650 Added DragController::enableFallbackMouseGrabber()
So it's easier to test the fallback mouse grabber
2020-10-03 18:37:26 +01:00
Sergio Martins
3fb723a82f quick: Fix QtQuick build 2020-10-03 18:27:22 +01:00
Sergio Martins
71c2f34ed4 quick: Add needed pure virtual FrameQuick::renameTab()
Not needed to have much of an impl, it's just to fix the build.
For QtQuick the tab's titles are updated via bindings
2020-10-03 18:15:56 +01:00
Sergio Martins
d4b3bf9de6 quick: Added support for showMinimized() 2020-10-03 18:11:33 +01:00
Sergio Martins
2b234f313c quick: Remove some QWidget specific code from MainWindowBase 2020-10-03 18:10:23 +01:00
Sergio Martins
d1b2d17f7d Allow the normal/restore icon to be different than float/dock
Allow we use the same icon, the user might now want to, so allow
them to use a different icon
2020-10-03 14:58:07 +01:00
Sergio Martins
f062ab7a64 TitleBar: Move button construction into the FrameWorkWidgetFactory
So it can be more easily overridden by the user.
A virtual in TitleBarWidget is not good enough as we can't call virtuals
when in the ctor
2020-10-03 14:52:44 +01:00
Sergio Martins
f009f57581 Move TitleBarButtonType next to all other enums 2020-10-03 14:29:36 +01:00
Sergio Martins
f86a818e69 TitleBar: Add an enum to describe each button type 2020-10-03 14:24:40 +01:00
Sergio Martins
bb80c2158d Fix outter_bottom_active.png
Was missing an outline for some reason
2020-10-03 13:57:32 +01:00
Sergio Martins
86fa6258f6 Comment++ 2020-10-03 13:56:51 +01:00
Sergio Martins
545536fab5 Support high-res icons when on 1.5x scaling and Qt >= 5.15.2
Icons look nice now on linux with 1.5x. Windows and macOS don't use
fractional scaling, so not affected

Fixes #11

Will open a separate bug report to get high-res docking indicators.
2020-10-03 13:21:06 +01:00
Sergio Martins
ef23553b66 Fix high-res unauto-hide icon
We had it but we were still using the old one in C++
2020-10-03 12:04:39 +01:00
Sergio Martins
fcf56664cc Add high-res icons for minimize and maximize 2020-10-03 11:50:33 +01:00
Sergio Martins
d932166bcd Add high-res icons for dock/float 2020-10-03 11:43:15 +01:00
Sergio Martins
0c5783774d Added high-res close icon 2020-10-03 11:38:26 +01:00
Sergio Martins
aa42ea15f7 Add high-res versions for auto-hide and unauto-hide png
1.5x is disabled for now, as Qt < 5.15.2 has a rounding bug
rendering them
2020-10-03 11:28:21 +01:00
Sergio Martins
9dd778d55d Pass the correct icon size when rendering a button
Needed when rendering with different scaling
2020-10-03 10:57:54 +01:00
Sergio Martins
ac35a919f4 Don't show center/tab docking indicator when there's no affinity
If the dock widget can't dock there as tabbed, don't show the
indicator
2020-10-02 17:35:15 +01:00
Sergio Martins
a32c5017e6 Minor: Remove unneeded variable 2020-10-02 17:24:50 +01:00
Sergio Martins
7995a6d13b Windows: Fix dragging sometimes not showing indicators
DragController thought there was a resize going on.
The hardcoded margins in FloatingWindow::isInDragArea() arent
needed anymore.

iPlease enter the commit message for your changes. Lines starting
2020-10-02 17:05:16 +01:00
Sergio Martins
d4ec2eec88 Windows: Added support for drop shadow for floating windows 2020-10-01 18:31:46 +01:00
Sergio Martins
12ad3b3484 Fix floating window's border, was appearing black
QPen was unused
2020-10-01 18:22:07 +01:00
Sergio Martins
9a53c36c14 Also honour affinities when dropping into a dock widget as tabbed
Fixes #89
2020-10-01 17:55:19 +01:00
Sergio Martins
8fb3802343 tests: Add an xfail for an affinities bug
This is for #89. They shouldn't be allowed to tab
together since they have different affinities

Minor refactoring in drop area so we can call DropArea::drop()
directly without having to move the mouse, as that's not relevant
for this test.
2020-10-01 17:45:53 +01:00
Sergio Martins
c035df7e85 Improve the heuristics for auto-hide prefered side bar
Now it counts the number of borders it's touching to decide.
Then checks aspect ratio too.

Can still be improved, but it's a start. Will gather feedback
before changing it further.
2020-10-01 17:16:41 +01:00
Sergio Martins
92f81e28ca Merge branch '1.0' into master 2020-10-01 11:08:39 +01:00
Sergio Martins
7a87db608b README: Updated build instructions
use cmake to call the generator, this way it's generic and
works with any generator
2020-10-01 11:07:11 +01:00
Sergio Martins
d42fb81790 Windows: Fix artifacts when dragging window to another screen
Qt does its best to honour our custom WM_NCCALCSIZE processing,
except when the window moves to another screen. So help Qt a bit
and trigger a WM_NCCALCSIZE message, which Qt intercepts and takes
notes of the custom margins.

Fixes #46
2020-09-30 22:12:40 +01:00
Sergio Martins
73934e2f90 Always call FloatingWindow::create() in the CTOR
0x051000 was a typo, as it's Qt 5.16, not 5.10.
Since it's been running fine for 5.15 for so long, let's remove
special cases and have the same path for all Qt versions.
2020-09-30 22:07:07 +01:00
Allen Winter
1c8642298b src/private/multisplitter/Item.cpp - fix compile with msvc2013
might be choking on the QStringLiteral being a lambda
used into a [] ??
2020-09-30 12:51:02 -04:00
Allen Winter
bfc45bb0e9 tst_multisplitter.cpp - add braces to make msvc2013 happy
Change-Id: I562a8b14c9c6713fc15116397b5c215138a0c9cb
2020-09-30 12:50:03 -04:00
Allen Winter
58af9e2516 tst_multisplitter.cpp - add braces to make msvc2013 happy
Change-Id: I562a8b14c9c6713fc15116397b5c215138a0c9cb
2020-09-30 09:25:01 -04:00
Sergio Martins
4228c044ea Fix false-positive caught by Coverity
It's benign
2020-09-30 10:58:36 +01:00
Sergio Martins
ccc0aec968 Remove some dead code which is no longer used 2020-09-30 10:39:04 +01:00
Sergio Martins
3718d3fe79 Silence false-positive pointed out by Coverity 2020-09-30 10:33:58 +01:00
Sergio Martins
26ed9b722b Don't allow to turn off native dragging on Windows
Native dragging is much better as Windows deals with crossing screen
boundaries, there's no reason not to want that.

Client-side moving is buggy within Qt, depending on the HDPI setting.

Fixes #86
Fixes #78
2020-09-30 09:01:09 +01:00
Sergio Martins
6751669249 Fix flaky test on 5.14, it's benign 2020-09-29 23:21:36 +01:00
Sergio Martins
c7955dce1e Update ChangeLog and README
1.1 is due out soon, won't have QtQuick yetx
2020-09-29 21:10:47 +01:00
Sergio Martins
2e432f402f Also update floating action when removing from a FloatingWindow
Fixes #79
2020-09-29 21:05:45 +01:00
Sergio Martins
07791cd901 Fix another case where floating actions weren't updated
Relates to issue #79
2020-09-29 20:50:02 +01:00
Sergio Martins
1458da92d9 minimal example: Use fusion too
Looks better in general
2020-09-29 18:10:12 +01:00
Sergio Martins
c56f998292 Use Qt::MitterJoin when drawing rectangle
As it's not the default. Otherwise there's artifacts with hdpi scaling
2020-09-29 13:38:44 +01:00
Sergio Martins
991075d69e Windows: Start a native drag as soon as possible
Native drag works much better with HDPI crossing screens.
Relates to issue #78
2020-09-29 12:39:10 +01:00
Sergio Martins
234ca75728 tests: minor: Use QCOMPARE instead of QVERIFY 2020-09-28 22:10:00 +01:00
Allen Winter
e34d62d3e5 src/private/multisplitter/Item.cpp - fix compile with msvc2013
might be choking on the QStringLiteral being a lambda
used into a [] ??
2020-09-28 16:49:59 -04:00
Allen Winter
423be28afd various - misspelling-- 2020-09-28 16:40:27 -04:00
Sergio Martins
eb7bed9601 Fix build with -Werror 2020-09-28 19:00:40 +01:00
Sergio Martins
fa09521012 Adjust unit-test, according to the latest change 2020-09-28 18:55:55 +01:00
Sergio Martins
bb30f322a3 Fix size when docking a floating window
The docked widget would have the size of the window's contents,
we should use the size of the floating window instead.

The difference is just the title bar. When docked, the title bar
belongs do Frame, while when Floating it belongs to FloatingWindow.
When doing the docking calculation the frame's title bar is still hidden

Fixes issue #84
2020-09-28 18:47:46 +01:00
Sergio Martins
0e35c93ae5 Update ChangeLog 2020-09-27 18:02:56 +01:00
Sergio Martins
603224e553 FrameWidget: Fix painting the border on HDPI
Work in floating point instead of int.
2020-09-27 18:00:15 +01:00
Sergio Martins
9b82063d52 Fix drawing the FloatingWindowWidget border on HDPI
left and top margins were smaller than bottom and right.
2020-09-27 17:49:29 +01:00
Sergio Martins
c210a523e3 Focus the newly dropped dock widget
When we drag a dock widget into a another widget, we should focus it

Fixes issue #77
2020-09-26 17:44:30 +01:00
Sergio Martins
e33151d482 Add a failing test for issue #77 2020-09-26 17:15:46 +01:00
Sergio Martins
835f67a106 Mark DropArea::drop() as private
It's an implementation detail
2020-09-26 17:08:23 +01:00
Sergio Martins
a50f6ec602 Added DockWidgetBase::isFocused Q_PROPERTY
For GammaRay convenience. For QML too.
The getter and signal already existed.

For issue #73
2020-09-25 19:35:28 +01:00
Sergio Martins
4a49dbc6b4 Add a DockWidget::isFloatingChanged() signal
For issue #73
2020-09-25 19:25:58 +01:00
Sergio Martins
05c843397b Add one more test
tabbed dock widget aren't floating either
2020-09-25 18:32:06 +01:00
Sergio Martins
e4871eb340 Fix floating action not being triggered in some cases
When docking a dock widget into a floating widget, then both
are not "floating" anymore, as there's two of them in the layout

Fixes #79
2020-09-25 18:28:32 +01:00
Sergio Martins
0e696ff2dd FloatingWindow: Also use margin when using aero-snap
It's always good to have contents margin. Initially the idea was
that we were adding margin just to make the client resize handler
work better. But no reason to have different visual aspect depending
on if you have aero-snap or not

Fixes applications needing to look the same on all platforms.
2020-09-25 11:23:03 +01:00
Sergio Martins
9f15773a9b Fix dragging by tabbar if there's a line edit in the tab bar
User was able to drag and line edit wouldn't get focus.
This is a hot fix, not the most elegant way to do it.
2020-09-25 11:02:35 +01:00
Sergio Martins
a00984f95a Fix potential crash at shutdown
QWidget DTOR can trigger a focus change, which triggers
DockRegistry::onFocusObjectChanged(), which would dereference the
dockwidget
2020-09-24 16:05:38 +01:00
Allen Winter
c7e9632f18 src/MainWindow.cpp - minor header order 2020-09-22 11:22:40 -04:00
Sergio Martins
7080712501 Rename the tab's title if its dock widget changes 2020-09-21 16:19:35 +01:00
Sergio Martins
03b574434c Fix non-developer build
Fixes #76
2020-09-21 10:07:04 +01:00
Sergio Martins
6a46744073 Make Flag_AutoHideSupport public
Ready to be tested by the public
2020-09-21 00:19:20 +01:00
Sergio Martins
7e52c510b3 Fix rendering vertical sidebars on scaled monitors 2020-09-21 00:14:09 +01:00
Sergio Martins
9bf060af9a SideBar: Support sending to West/East too
Algorithm can be made smarter, but this is good for now
2020-09-20 23:53:26 +01:00
Sergio Martins
b5973fcf8c Fix sidebar test
We're not hidding them, they just occupy 0 it seems
2020-09-20 23:50:46 +01:00
Sergio Martins
ac7d06d4fe When closing overlay, remove it from side bar too
Added test.
2020-09-20 23:46:37 +01:00
Sergio Martins
75e9137e3a Increase a bit the side of the overlays 2020-09-20 23:18:46 +01:00
Sergio Martins
5168940422 When enabling auto-hide, don't overlay it immediately
Instead, hide it. Will be overlayed when the user toggles it.
2020-09-20 23:16:40 +01:00
Sergio Martins
cfd2dafa53 Remove bogus debug 2020-09-20 23:15:01 +01:00
Sergio Martins
188b0a0edd Don't style side-bar buttons of overlayed widgets
As mouse-over is already using the same color. Would be nice
to have some different style for the currently overlayed window.
2020-09-20 23:09:33 +01:00
Sergio Martins
206c418ebc Make TitleBarWidget::buttonAreaWidth() generic
Nowadays we have much more buttons
2020-09-20 22:59:25 +01:00
Sergio Martins
b0acf8d1ae Disable floating button when using auto-hide
TitleBar is a bit crowded otherwise. User can still pass
& ~Flag_TitleBarNoFloatButton if he really wants both buttons.
2020-09-20 22:54:51 +01:00
Sergio Martins
f279ea41e6 Add tooltips to title bar buttons 2020-09-20 22:43:10 +01:00
Sergio Martins
d2a929f35d Minor whitespace fix 2020-09-20 22:26:51 +01:00
Sergio Martins
6f5258b5dd Add auto-hide iconsz 2020-09-20 22:25:56 +01:00
Sergio Martins
4f223a9439 Change color of active/hovered SideBarButton 2020-09-20 20:59:54 +01:00
Sergio Martins
ea98eb3d44 Restyle the StyleBarButtons a bit 2020-09-20 20:30:40 +01:00
Sergio Martins
cdb8f85620 Fix overlay positions when on left/right
Was off by a few pixels, looks good now
2020-09-20 19:37:53 +01:00
Sergio Martins
f459dcb8b3 length of overlayed dockwidgets now accounts for open sidebars
For example, if we're showing a bottom overlay, but the left
sidebar is visible, then the bottom overlay can't be so wide
2020-09-20 19:20:35 +01:00
Sergio Martins
967a539e71 Simplify SideBarButton::sizeHint() 2020-09-20 19:08:52 +01:00
Sergio Martins
db615da0ee Override from QToolButton to have our own SideBarButton
Has proper size when vertical.
Text isn't vertical yet though.
2020-09-20 19:06:47 +01:00
Sergio Martins
c4b420bd31 Add a fwd-header for SideBarWidget too 2020-09-20 18:09:54 +01:00
Sergio Martins
a6c4730c44 SideBar is now constructed by the framework widget factory
Means it can be overridden by the user
2020-09-20 18:08:23 +01:00
Sergio Martins
eb1f4c5a14 Auto-hide overlays when clicking elsewhere
That's what auto-hide is all about
2020-09-20 17:25:40 +01:00
Sergio Martins
b303af738c Improve position for north/south overlays 2020-09-20 16:56:57 +01:00
Sergio Martins
af5e11a265 Update the overlay's geometry when we resize the main window 2020-09-20 16:38:03 +01:00
Sergio Martins
8d7627069c Factor out some code into updateOverlayGeometry()
So it's reusable
2020-09-20 16:30:43 +01:00
Sergio Martins
9e94c0d67d The auto-hide button now works as expected
1st click it show the overlay and adds to sidebar
2nd click it hides the overlay, removes from sidebar and restores the dockwidget
2020-09-20 14:13:39 +01:00
Sergio Martins
55ddacf978 Partially revert previous commit
toggling overlay visibility won't remove it from the sidebar afterall.
User will need to explicitly press the auto-hide button
2020-09-20 13:56:52 +01:00
Sergio Martins
005e0552b6 Delete SideBarButton when dock widget is removed from sidebar 2020-09-20 13:53:49 +01:00
Sergio Martins
54b28c42e2 Added DockWidgetBase::isOverlayed() 2020-09-20 13:48:17 +01:00
Sergio Martins
2659ddb76b refactor: Decouple moveToSideBar from overlaying
overlaying just shows/hides the overlay, and not requires
the dock widget was added to the sidebar before
2020-09-20 13:44:04 +01:00
Sergio Martins
c85873c6ce Added MainWindowBase::sideBarForDockWidget(dw)
Just a getter.
2020-09-20 13:24:18 +01:00
Sergio Martins
6e32f3f915 Added SideBar::mainWindow()
It's just a getter.
2020-09-20 13:18:34 +01:00
Sergio Martins
b8891a5727 Start implementing overlaying on top of main window 2020-09-20 12:56:31 +01:00
Sergio Martins
fcb6f5a6af Use the top sidebar too 2020-09-19 12:16:51 +01:00
Sergio Martins
0365f3194d Added Item::adjacentLayoutBorders() 2020-09-19 11:50:00 +01:00
Sergio Martins
76e2ec6429 Add East, West and North sidebars too
Instead of just south.
Only south is used for now though.
2020-09-19 11:00:42 +01:00
Sergio Martins
a5d0a202a5 Add enum with sidebar location 2020-09-19 10:35:36 +01:00
Sergio Martins
def752632f tests: fix flaky test on macOS 2020-09-19 00:08:47 +01:00
Sergio Martins
f296048063 tests: Stabilize two tests on XCB
Spacings/margins are different. Anyway, that QVERIFY isn't
very important, mostly useless.
2020-09-18 23:44:34 +01:00
Sergio Martins
1c1b816292 Fix tst_maximumSizePolicy with qpa xcb 2020-09-18 23:28:14 +01:00
Sergio Martins
fbd463e18b tests: debug++ 2020-09-18 19:42:26 +01:00
Sergio Martins
9e01363648 tests: debug++ 2020-09-18 19:40:37 +01:00
Sergio Martins
67bf7e9775 tst_raise: raise the window before starting
needed on macOS
2020-09-18 19:34:09 +01:00
Sergio Martins
d8c2100b24 tests: Set object name for debugging 2020-09-18 19:30:28 +01:00
Sergio Martins
d1a3e39f17 tests: Improve debug message 2020-09-18 19:27:17 +01:00
Sergio Martins
3d5c081333 tests: Debugging a macOS failure 2020-09-18 19:24:49 +01:00
Sergio Martins
e1085fb770 Add experimental support for minimization to side-bar
Auto-hide not working yet. Just minimization.
Internal for now. Will be public once finished.
2020-09-18 18:35:41 +01:00
Sergio Martins
c294c19be7 Fix Frame having a null DropArea
Fixes inMainWindow() signal not being emitted sometimes
2020-09-18 18:34:49 +01:00
Sergio Martins
87726fb0a7 Minor style: Reduce nesting level in Frame::setDropArea() 2020-09-18 18:34:28 +01:00
Sergio Martins
d28e61f412 Minor tidying 2020-09-18 17:48:31 +01:00
Sergio Martins
890e750c23 Trying to fix Windows/MinGW build 2020-09-18 17:48:04 +01:00
Sergio Martins
1fe5cfd121 Added Frame::mainWindow() 2020-09-18 17:40:38 +01:00
Sergio Martins
c8eaf88cf1 Added DockWidgetBase::mainWindow() 2020-09-18 17:20:41 +01:00
Sergio Martins
f3f812205d Pass the new title to DockWidget::titleChanged() signal 2020-09-18 17:12:38 +01:00
Sergio Martins
7b2ec52831 Fix build on 5.9/mingw 2020-09-18 16:59:01 +01:00
Sergio Martins
72785cf869 Updated ChangeLog and README with new features and bugfixes 2020-09-17 21:54:36 +01:00
Sergio Martins
e92ef472b3 Floating windows now support a minimize button
Introduced Flag_TitleBarHasMinimizeButton for it.
It implies Flag_DontUseUtilityFloatingWindows too, since Qt::Tool
don't appear in the task bar.

example: kddockwidgets_example -k
2020-09-17 21:46:28 +01:00
Sergio Martins
deec6ffa31 Windows: Fix windows have 0 min-size
Also tested on HDPI configurations and added the device pixel ratio
into account, as Windows works in native pixels
2020-09-17 18:37:13 +01:00
Sergio Martins
47779c8d0a Fix non-native move screwing up the size when moving across screens
The drag to the 2nd monitor was native, as we detected HTCAPTION,
but the drag back to 1st monitor was non-native. Non native is not
recommended, not great with HDPI in Qt.

The bug we were mixing native pos from win32 with Qt's logical
positions.

Fixes #72
2020-09-17 09:43:38 +01:00
Allen Winter
3e9e802b6c buildsystem - do not build docs by default 2020-09-16 16:04:18 -04:00
Allen Winter
8bd429db4c buildsystem - do not build docs by default 2020-09-16 16:03:31 -04:00
Sergio Martins
d76b27863f Don't center floating window if user moved it
Fixes #75
2020-09-16 16:51:05 +01:00
Sergio Martins
576627eb17 Always outter indicators if the center is obscured with something else
If there's some other floating window over our drop zone, then it's
very difficult to drop if there's no outter indicators.

Now we'll show the outter indicators if we suspect there's some other
window obscuring
2020-09-16 12:54:09 +01:00
Sergio Martins
74adb5f021 Fix floating window's title bar not being correct
FloatingWindow::hasSingleFrame() was true, but FloatingWindow::frames()
returned 2 of them, since frames() is based on child count and it hadn't
been reparented yet

Not commiting to 1.0 since it touches the layouting engine.
All tests pass and testing showed no side effects though, so should be fine for
1.0 too

Fixes #74
2020-09-15 19:52:48 +01:00
Allen Winter
dcdcef1fb2 Merge branch '1.0' 2020-09-15 08:45:20 -04:00
Allen Winter
cf7311682e images - add svg version of logo. update other png's 2020-09-15 08:44:37 -04:00
Sergio Martins
beb2128804 example: Added --no-aero-snap for debugging purposes 2020-09-14 22:28:15 +01:00
Sergio Martins
85cb289bc4 Also focus when clicking on the current tab
Fixes issue #71
2020-09-14 21:08:48 +01:00
Sergio Martins
5293943a50 Add TabBar::frame()
Returns the Frame this TabBar is in.
2020-09-14 21:07:51 +01:00
Sergio Martins
ee4d720c51 Added test for issue #71 2020-09-14 20:54:35 +01:00
Allen Winter
f8b698e669 Merge branch '1.0' 2020-09-13 09:41:53 -04:00
Allen Winter
0e3fcc7749 update home page URL 2020-09-13 09:29:36 -04:00
Allen Winter
5755e5ff65 Doxygen - add product logo to page header and footer 2020-09-13 09:16:23 -04:00
Allen Winter
d9db3d0b29 images - add logo and banner images 2020-09-13 09:14:04 -04:00
Sergio Martins
87ba2e0ee7 example: Add option to test combinations of Qt::Tool and parent
for internal testing
2020-09-13 13:30:55 +01:00
Sergio Martins
eaeed567f3 Don't have a parent window when using Qt::Window
Otherwise Qt::Window behaves like Qt::Tool, on Windows
2020-09-13 13:22:48 +01:00
Sergio Martins
a2054359a2 Minor code move, so next diff is short 2020-09-13 12:48:25 +01:00
Sergio Martins
85b533d4c4 Minor code move 2020-09-13 12:47:04 +01:00
Sergio Martins
2d2c8524ee Introduce Config::Flag_DontUseUtilityWindowsForFloating
Controls whether windows get Qt::Tool or not
2020-09-13 12:24:26 +01:00
Sergio Martins
62271b11a7 Update .gitignore 2020-09-13 12:12:13 +01:00
Sergio Martins
869cacc568 Use mouse events for tst_titleBarFocusedWhenTabsChange
So we can test clicking on a current tab too.
Also since changing tabs programatically shouldn't change focus,
which I'll fix soon
2020-09-12 00:39:10 +01:00
Sergio Martins
0155790b02 tests: add Test::clickOn() 2020-09-12 00:33:34 +01:00
Sergio Martins
2cb25fefe4 Minor: Add the tab widget as a member 2020-09-11 23:40:41 +01:00
Sergio Martins
98225ac9a3 Fix DockWidget::isInMainWindow()
FloatingWindows are parented to the main window, so we need to stop
the loop once isWindow().

The tests didn't catch this because the floating window in the test
was created before the main window, so it truly didn't have a parent

Fixes #69
2020-09-11 22:33:25 +01:00
Sergio Martins
4bdfc35c8c Changing tabs should also activate our focus scope
Fixes #70
2020-09-09 21:03:00 +01:00
Sergio Martins
f090a51485 example: Make title bar focusable when debugging focus 2020-09-07 20:26:09 +01:00
Sergio Martins
b510c2fd5f Added DockWidget::isInMainWindow()
For task #69.
A signal would be nice too, though.
2020-09-07 15:27:54 +01:00
Sergio Martins
03e58c7443 update change log regarding issue #68 2020-09-04 17:17:23 +01:00
Sergio Martins
676086ba90 Update .gitignore 2020-09-04 17:17:23 +01:00
Sergio Martins
4f6b9e3dff update change log regarding issue #68 2020-09-04 17:16:00 +01:00
Allen Winter
c8a5bd3f15 .../quick/qml/ClassicIndicator.qml - license+copyright header 2020-09-04 12:15:31 -04:00
Sergio Martins
5e83ddf7bd Update .gitignore 2020-09-04 17:13:58 +01:00
Sergio Martins
6b28a804f8 example: Allow to demo the focus scope
set KDDW_DEBUG_FOCUS
2020-09-04 17:06:32 +01:00
Allen Winter
7c5e159677 Merge branch '1.0' 2020-09-03 18:55:08 -04:00
Allen Winter
63f8468f48 cmake/Python - don't require pkg-config, only use if available.
Issue#68
2020-09-03 18:14:14 -04:00
Allen Winter
933a535494 Merge branch '1.0' 2020-09-03 08:08:55 -04:00
Allen Winter
518a7cb398 Changelog - fix typo 2020-09-03 08:08:14 -04:00
Allen Winter
eac2cff09c Merge branch '1.0' 2020-09-03 08:07:47 -04:00
Allen Winter
9a601a5172 CMakeLists.txt, Changelog - bump to 1.0.1 2020-09-03 08:06:12 -04:00
Allen Winter
cf8f25988c Merge branch '1.0' 2020-09-03 07:58:52 -04:00
Allen Winter
a613e401e2 ready for 1.0.0 release 2020-09-02 12:29:58 -04:00
Sergio Martins
23e27ee953 Add 1.0 release date to the ChangeLog 2020-09-02 17:27:51 +01:00
Allen Winter
633dc06e6f Merge branch '1.0' 2020-09-02 11:54:06 -04:00
Allen Winter
5ddf0ada76 Changelog - reorder versions 2020-09-02 11:50:53 -04:00
Allen Winter
c8664c4d44 cmake/Python/* - sync with the KDAB toolbox 2020-09-02 11:11:29 -04:00
Allen Winter
d6d28b3f7b src/DockWidgetBase.h - minor spelling fixes 2020-09-02 11:11:06 -04:00
Allen Winter
eddcfef5d8 Merge branch '1.0' 2020-08-31 18:19:44 -04:00
Allen Winter
737d63eede CMakeLists.txt - document PYTHON_BINDINGS_INSTALL_PREFIX 2020-08-31 18:19:20 -04:00
Allen Winter
ba3890acfa Merge branch '1.0' 2020-08-31 13:22:24 -04:00
Allen Winter
9e8353f50f cmake/Python/PySide2ModuleBuild.cmake - another fix for Mac 2020-08-31 12:11:33 -04:00
Renato Araujo Oliveira Filho
2db4398637 Python/PySide2ModuleBuild.cmake - fix for Windows build 2020-08-31 11:19:04 -04:00
Allen Winter
1348434b50 docs/api/Doxyfile.cmake - remove CLANG options
to quiet the doxygen warnings:
"belongs to an option that was not enabled at compile time."
2020-08-31 11:15:47 -04:00
Renato Araujo Oliveira Filho
4ebf60a9c8 Python/PySide2ModuleBuild.cmake - fix for Mac frameworks 2020-08-31 10:53:03 -04:00
302 changed files with 16670 additions and 7960 deletions

11
.gitignore vendored
View File

@@ -6,7 +6,6 @@ Makefile
CMakeFiles CMakeFiles
CMakeCache.txt CMakeCache.txt
/examples/example /examples/example
libdocks.so
tst_docks tst_docks
CMakeLists.txt.user* CMakeLists.txt.user*
/build /build
@@ -34,7 +33,7 @@ cmake_install.cmake
latex latex
html html
custom_titlebar custom_titlebar
libkddockwidgets.so libkddockwidgets.so*
*.depends *.depends
kddockwidgets_basic_quick kddockwidgets_basic_quick
/src/KDDockWidgetsConfig.cmake /src/KDDockWidgetsConfig.cmake
@@ -51,3 +50,11 @@ mylayout.json
*.pri *.pri
/docks-w /docks-w
kddockwidgets_minimal_example kddockwidgets_minimal_example
/docs/api/Doxyfile
/docs/api/qch/kddockwidgets-api.qch
/doxygen.log
/kddockwidgets.tag
/CMakeDoxyfile.in
/CMakeDoxygenDefaults.cmake
/Testing
/layout_tst*

View File

@@ -4,7 +4,7 @@
"qevent": "cpp" "qevent": "cpp"
}, },
"cmake.configureSettings": { "cmake.configureSettings": {
"OPTION_DEVELOPER_MODE" : "ON", "KDDockWidgets_DEVELOPER_MODE" : "ON",
"OPTION_QTQUICK" : true "KDDockWidgets_QTQUICK" : true
} }
} }

View File

@@ -1,7 +1,7 @@
# #
# This file is part of KDDockWidgets. # 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> # Author: Sergio Martins <sergio.martins@kdab.com>
# #
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only # 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: # 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] # -DKDDockWidgets_STATIC=[true|false]
# Build static versions of the libraries # Build static versions of the libraries
# Default=false # Default=false
# #
# -DKDDockWidgets_TESTS=[true|false] # -DKDDockWidgets_TESTS=[true|false]
# Build the test harness. # Build the test harness.
# Currently does nothing unless you also set KDDockWidgets_DEVELOPER_MODE=True
# Default=false # Default=false
# #
# -DKDDockWidgets_EXAMPLES=[true|false] # -DKDDockWidgets_EXAMPLES=[true|false]
@@ -25,18 +30,30 @@
# #
# -DKDDockWidgets_DOCS=[true|false] # -DKDDockWidgets_DOCS=[true|false]
# Build the API documentation. # Build the API documentation.
# Default=true # Default=false
# #
# -DOPTION_DEVELOPER_MODE=[true|false] # -DKDDockWidgets_DEVELOPER_MODE=[true|false]
# Configure the build for a developer setup. # Configure the build for a developer setup.
# Enables some features that are not geared towards end-users. # Enables some features that are not geared towards end-users.
# Forces the test harness to be built. # Forces the test harness to be built.
# Default=false # 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 # Build/Generate python bindings. Always false for Debug builds
# Default=false # Default=false
# #
# -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) cmake_minimum_required(VERSION 3.7)
if(POLICY CMP0020) if(POLICY CMP0020)
@@ -46,10 +63,12 @@ if(POLICY CMP0042)
cmake_policy(SET CMP0042 NEW) cmake_policy(SET CMP0042 NEW)
endif() endif()
if("${CMAKE_INSTALL_PREFIX}" STREQUAL "") set(KDAB_INSTALL True)
set(USE_DEFAULT_INSTALL_LOCATION True) if((NOT DEFINED ${USE_DEFAULT_INSTALL_LOCATION}) OR (NOT ${USE_DEFAULT_INSTALL_LOCATION}))
else() if(NOT "${CMAKE_INSTALL_PREFIX}" STREQUAL "")
set(USE_DEFAULT_INSTALL_LOCATION False) set(KDAB_INSTALL False)
endif()
set(USE_DEFAULT_INSTALL_LOCATION ${KDAB_INSTALL} CACHE INTERNAL "Install to default KDAB Location" FORCE)
endif() endif()
if(${CMAKE_VERSION} VERSION_LESS "3.12.0") if(${CMAKE_VERSION} VERSION_LESS "3.12.0")
@@ -62,32 +81,51 @@ else()
endif() endif()
set(${PROJECT_NAME}_VERSION_MAJOR 1) set(${PROJECT_NAME}_VERSION_MAJOR 1)
set(${PROJECT_NAME}_VERSION_MINOR 0) set(${PROJECT_NAME}_VERSION_MINOR 2)
set(${PROJECT_NAME}_VERSION_PATCH 95) 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}_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) include(FeatureSummary)
option(OPTION_DEVELOPER_MODE "Developer Mode" OFF) option(${PROJECT_NAME}_QT6 "Build against Qt 6" OFF)
option(OPTION_BUILD_PYTHON_BINDINGS "Build python bindings" OFF) option(${PROJECT_NAME}_DEVELOPER_MODE "Developer Mode" OFF)
if(OPTION_BUILD_PYTHON_BINDINGS AND (CMAKE_BUILD_TYPE MATCHES "^[Dd]eb" OR ${PROJECT_NAME}_STATIC)) 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.") message(FATAL_ERROR "** Python Bindings are disabled in debug or static builds.")
endif() endif()
option(${PROJECT_NAME}_TESTS "Build the tests" OFF) option(${PROJECT_NAME}_TESTS "Build the tests" OFF)
option(${PROJECT_NAME}_EXAMPLES "Build the examples" ON) option(${PROJECT_NAME}_EXAMPLES "Build the examples" ON)
option(${PROJECT_NAME}_DOCS "Build the API documentation" 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 #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}_TESTS ON)
set(${PROJECT_NAME}_WERROR ON)
endif() endif()
# option(OPTION_QTQUICK "Build for QtQuick instead of QtWidgets" OFF) #option(${PROJECT_NAME}_QTQUICK "Build for QtQuick instead of QtWidgets" OFF)
if (${PROJECT_NAME}_QT6)
find_package(Qt6Widgets REQUIRED)
find_package(Qt6Test REQUIRED)
set(QT_MAJOR_VERSION 6)
else()
find_package(Qt5Widgets 5.9 REQUIRED) find_package(Qt5Widgets 5.9 REQUIRED)
find_package(Qt5Test 5.9 REQUIRED)
set(QT_MAJOR_VERSION 5)
endif()
set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(ECM_MODULE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cmake/ECM/modules/") set(ECM_MODULE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cmake/ECM/modules/")
set(PYTHON_MODULE_DIR "${CMAKE_CURRENT_LIST_DIR}/cmake/Python") set(PYTHON_MODULE_DIR "${CMAKE_CURRENT_LIST_DIR}/cmake/Python")
@@ -99,17 +137,28 @@ include(InstallLocation)
include(QtInstallPaths) #to set QT_INSTALL_FOO variables include(QtInstallPaths) #to set QT_INSTALL_FOO variables
macro(set_compiler_flags targetName) macro(set_compiler_flags targetName)
if(OPTION_DEVELOPER_MODE) if(${PROJECT_NAME}_DEVELOPER_MODE)
target_compile_definitions(${targetName} PRIVATE DOCKS_DEVELOPER_MODE QT_FORCE_ASSERTS) target_compile_definitions(${targetName} PUBLIC DOCKS_DEVELOPER_MODE PRIVATE QT_FORCE_ASSERTS)
if(NOT MSVC) 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()
endif() endif()
# Enable -Werror
if(NOT MSVC AND ${PROJECT_NAME}_WERROR)
target_compile_options(${targetName} PRIVATE -Werror -Wno-error=deprecated-declarations)
endif()
endmacro() endmacro()
if(OPTION_QTQUICK) if(${PROJECT_NAME}_QTQUICK)
find_package(Qt5Quick) find_package(Qt${QT_MAJOR_VERSION}Quick)
find_package(Qt5QuickControls2) find_package(Qt${QT_MAJOR_VERSION}QuickControls2)
add_definitions(-DKDDOCKWIDGETS_QTQUICK) add_definitions(-DKDDOCKWIDGETS_QTQUICK)
else() else()
add_definitions(-DKDDOCKWIDGETS_QTWIDGETS) add_definitions(-DKDDOCKWIDGETS_QTWIDGETS)
@@ -142,14 +191,13 @@ install(FILES LICENSE.txt README.md DESTINATION ${INSTALL_DOC_DIR})
install(DIRECTORY LICENSES DESTINATION ${INSTALL_DOC_DIR}) install(DIRECTORY LICENSES DESTINATION ${INSTALL_DOC_DIR})
add_subdirectory(src) add_subdirectory(src)
if(OPTION_BUILD_PYTHON_BINDINGS) if(${PROJECT_NAME}_PYTHON_BINDINGS)
add_subdirectory(python) add_subdirectory(python)
endif() endif()
if(${PROJECT_NAME}_EXAMPLES) if(${PROJECT_NAME}_EXAMPLES)
if (OPTION_QTQUICK) if (${PROJECT_NAME}_QTQUICK)
add_subdirectory(examples/qtquick) add_subdirectory(examples/qtquick)
set_compiler_flags(kddockwidgets_example_quick)
else() else()
add_subdirectory(examples/dockwidgets) add_subdirectory(examples/dockwidgets)
add_subdirectory(examples/minimal) add_subdirectory(examples/minimal)
@@ -158,16 +206,15 @@ if(${PROJECT_NAME}_EXAMPLES)
endif() endif()
endif() endif()
if(OPTION_DEVELOPER_MODE) if(${PROJECT_NAME}_DEVELOPER_MODE)
include(ECMEnableSanitizers) include(ECMEnableSanitizers)
if(${PROJECT_NAME}_TESTS) if(${PROJECT_NAME}_TESTS)
enable_testing() enable_testing()
add_subdirectory(tests) add_subdirectory(tests)
if (NOT OPTION_QTQUICK)
# Require Qt5.15.1 or higher to run the tests_launcher tests on Mac # 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) 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. # 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_docks0 COMMAND tests_launcher 0 5)
add_test(NAME tst_docks1 COMMAND tests_launcher 1 5) add_test(NAME tst_docks1 COMMAND tests_launcher 1 5)
add_test(NAME tst_docks2 COMMAND tests_launcher 2 5) add_test(NAME tst_docks2 COMMAND tests_launcher 2 5)
@@ -191,10 +238,10 @@ if(OPTION_DEVELOPER_MODE)
add_test(NAME tst_docks20 COMMAND tests_launcher 19 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 add_test(NAME tst_docks21 COMMAND tests_launcher 20 5) # one more for rounding leftovers
endif() endif()
endif() if (NOT ${PROJECT_NAME}_QTQUICK)
# tst_multisplitter depends on QWidget
add_test(NAME tst_multisplitter COMMAND tst_multisplitter) add_test(NAME tst_multisplitter COMMAND tst_multisplitter)
add_test(NAME tst_common COMMAND tst_common) endif()
endif() endif()
endif() endif()
@@ -202,3 +249,7 @@ endif()
if(${PROJECT_NAME}_DOCS) if(${PROJECT_NAME}_DOCS)
add_subdirectory(docs) # needs to go last, in case there are build source files add_subdirectory(docs) # needs to go last, in case there are build source files
endif() endif()
if (${PROJECT_NAME}_UNITY_BUILD)
set_target_properties(kddockwidgets PROPERTIES UNITY_BUILD ON)
endif()

133
CMakePresets.json Normal file
View 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}"
}
}
]
}

View File

@@ -1,7 +1,48 @@
* v0.1 (November 4th, 2019) * v1.3.0 (unreleased)
- Initial Release and blog - [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.0.0 (, 2020) * 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()
- Added Config::Flag_AlwaysTitleBarWhenFloating, which complements Flag_HideTitleBarWhenTabsVisible
- Added Config::Flag_DontUseUtilityWindowsForFloating
- 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)
- 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 - PySide2 bindings
- Rewrote the layouting engine, resulting in a huge stability gain and makes it easy to add new features - Rewrote the layouting engine, resulting in a huge stability gain and makes it easy to add new features
- Honour min/max sizes and some QSizePolicy heuristics - Honour min/max sizes and some QSizePolicy heuristics
@@ -27,11 +68,5 @@
- Namespaced Qt support - Namespaced Qt support
- Dozens of crash fixes, bugs and much more... - Dozens of crash fixes, bugs and much more...
* v1.1.0 (, 2020) * v0.1 (4 November 2019)
- New drop indicator style type: Segmented Indicators - Initial Release and blog
- Added FocusScope support
- Added DockWidget::isFocused() and DockWidgetBase::isFocusedChanged()
- Added Config::Flag_AlwaysTitleBarWhenFloating, which complements Flag_HideTitleBarWhenTabsVisible
* Roadmap
- QtQuick support

View File

@@ -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 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 the GNU General Public License version 2 or under the terms of GNU General

View File

@@ -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: according to the terms of the:
GNU General Public License version 2.0 (see LICENSES/GPL-2.0-only.txt) GNU General Public License version 2.0 (see LICENSES/GPL-2.0-only.txt)
or the or the

33
README-WASM.md Normal file
View 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
View 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
View 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.

View File

@@ -1,5 +1,5 @@
KDDockWidgets KDDockWidgets
============== =============
`KDDockWidgets` is a Qt dock widget library written by KDAB, suitable for replacing `KDDockWidgets` is a Qt dock widget library written by KDAB, suitable for replacing
`QDockWidget` and implementing advanced functionalities missing in Qt. `QDockWidget` and implementing advanced functionalities missing in Qt.
@@ -20,10 +20,13 @@ creative with their requests, so it was clear we needed a better docking framewo
You will find more information in these places: You will find more information in these places:
* [our official home page](https://www.kdab.com/kddockwidgets) * [our official home page](https://www.kdab.com/development-resources/qt-tools/kddockwidgets)
* [online detailed browsable API reference](https://docs.kdab.com/kddockwidgets) * [online detailed browsable API reference](https://docs.kdab.com/kddockwidgets)
* [our example programs](examples/) * [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 Features
======== ========
- Provide advanced docking that QDockWidgets doesn't support - Provide advanced docking that QDockWidgets doesn't support
@@ -43,6 +46,8 @@ Features
- Customize title bars - Customize title bars
- Customize window frames - Customize window frames
- Custom widget separators - 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 - Layouting engine honouring min/max size constraints and some size policies
- PySide2 bindings - PySide2 bindings
- Clean codebase - Clean codebase
@@ -56,15 +61,17 @@ Features
- Double click on separator to distribute equally - Double click on separator to distribute equally
- Show close button on tabs - Show close button on tabs
- Allow to make a dock widget non-closable and/or non-dockable - Allow to make a dock widget non-closable and/or non-dockable
- Optional maximize button on the title bar - Optional minimize and maximize button on the title bar
- FloatingWindows can be utility windows or full native
Screen capture
==============
![Screen capture](./screencap.gif?raw=true "The docking system in action") ![Screen capture](./screencap.gif?raw=true "The docking system in action")
Roadmap Roadmap
======== ========
- QtQuick support for v1.1 - QtQuick support
- "Minimization bar" for v1.2
Trying out the examples Trying out the examples
======================= =======================
@@ -81,15 +88,15 @@ Build and install the KDDockWidgets framework:
``` ```
$ cmake -G Ninja -DCMAKE_INSTALL_PREFIX=/path/where/to/install ../path/to/kddockwidgets $ cmake -G Ninja -DCMAKE_INSTALL_PREFIX=/path/where/to/install ../path/to/kddockwidgets
$ make $ cmake --build .
$ make install $ cmake --build . --target install
``` ```
Now build and run the example: Now build and run the example:
``` ```
$ cd path/to/kddockwidgets/examples/dockwidgets/ $ cd path/to/kddockwidgets/examples/dockwidgets/
$ cmake -DCMAKE_PREFIX_PATH=/path/where/to/install $ cmake -G Ninja -DCMAKE_PREFIX_PATH=/path/where/to/install
$ make $ cmake --build .
$ ./kddockwidgets_example $ ./kddockwidgets_example
``` ```
@@ -98,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 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. 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 Python Bindings
================ ================
Make sure you have pyside2, shiboken2 and shiboken2-generator installed. 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. As this time, you cannot get shiboken2-generator because the wheels are not on PyPi.
To use the wheels do this: To use the wheels do this:
```
% pip3 install \ % pip3 install \
--index-url=http://download.qt.io/official_releases/QtForPython/ \ --index-url=http://download.qt.io/official_releases/QtForPython/ \
--trusted-host download.qt.io \ --trusted-host download.qt.io \
shiboken2 pyside2 shiboken2_generator shiboken2 pyside2 shiboken2_generator
```
For more info visit https://doc.qt.io/qtforpython/shiboken2/gettingstarted.html For more info visit https://doc.qt.io/qtforpython/shiboken2/gettingstarted.html
Once QtForPython is installed you are ready to generate the PySide bindings Once QtForPython is installed you are ready to generate the PySide bindings
for KDDockwWidgets. 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. make command.
The bindings will be installed to the passed `-DCMAKE_INSTALL_PREFIX`, which 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 might require setting the `PYTHONPATH` env variable to point to that path when
running applications. Alternatively, configure the bindings install location 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 CMake (adjust to the python path on your system).
To run the KDDW python example To run the KDDW python example
@@ -132,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). KDDockWidgets requires Qt >= 5.9 (or >=5.12 if Python bindings are enabled).
The QtQuick support will require Qt >= 5.15. 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 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). 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. Contact KDAB at <info@kdab.com> to inquire about commercial licensing.
@@ -170,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. 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. 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)

View File

@@ -1,7 +1,5 @@
# #
# This file is part of KDDockWidgets. # SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
#
# SPDX-FileCopyrightText: 2020 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
# Author: Renato Araujo Oliveira Filho <renato.araujo@kdab.com> # Author: Renato Araujo Oliveira Filho <renato.araujo@kdab.com>
# #
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only # SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
@@ -15,9 +13,12 @@
# PYSIDE_TYPESYSTEMS - Type system files that should be used by other bindings extending PySide2 # PYSIDE_TYPESYSTEMS - Type system files that should be used by other bindings extending PySide2
# #
# You can install PySide2 from Qt repository with # You can install PySide2 from Qt repository with
# pip3 install --index-url=https://download.qt.io/snapshots/ci/pyside/<Qt-Version>/latest/ pyside2 --trusted-host download.qt.io # pip3 install --index-url=https://download.qt.io/official_releases/QtForPython --trusted-host download.qt.io pyside2
find_package(PkgConfig REQUIRED)
pkg_check_modules(PYSIDE2_PRIV pyside2 QUIET) find_package(PkgConfig)
if(PKG_CONFIG_FOUND)
pkg_check_modules(PYSIDE2_PRIV QUIET pyside2)
endif()
set(PYSIDE2_FOUND FALSE) set(PYSIDE2_FOUND FALSE)

View 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
)

View File

@@ -1,7 +1,5 @@
# #
# This file is part of KDDockWidgets. # SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
#
# SPDX-FileCopyrightText: 2020 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
# Author: Renato Araujo Oliveira Filho <renato.araujo@kdab.com> # Author: Renato Araujo Oliveira Filho <renato.araujo@kdab.com>
# #
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only # SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
@@ -15,9 +13,12 @@
# SHIBOKEN_BUILD_TYPE - Tells if Shiboken was compiled in Release or Debug mode. # SHIBOKEN_BUILD_TYPE - Tells if Shiboken was compiled in Release or Debug mode.
# You can install Shiboken from Qt repository with # You can install Shiboken from Qt repository with
# pip3 install --index-url=https://download.qt.io/snapshots/ci/pyside/<Qt-Version>/latest/ shiboken2-generator --trusted-host download.qt.io # pip3 install --index-url=https://download.qt.io/official_releases/QtForPython --trusted-host download.qt.io shiboken2-generator
find_package(PkgConfig REQUIRED)
pkg_check_modules(SHIBOKEN2_PRIV shiboken2 QUIET) find_package(PkgConfig)
if(PKG_CONFIG_FOUND)
pkg_check_modules(SHIBOKEN2_PRIV QUIET shiboken2)
endif()
set(SHIBOKEN_FOUND FALSE) set(SHIBOKEN_FOUND FALSE)
@@ -114,7 +115,6 @@ else()
set(SHIBOKEN_SEARCH_PATHS ${SHIBOKEN_CUSTOM_PATH}) set(SHIBOKEN_SEARCH_PATHS ${SHIBOKEN_CUSTOM_PATH})
list(APPEND SHIBOKEN_SEARCH_PATHS ${SHIBOKEN_BASEDIR}) list(APPEND SHIBOKEN_SEARCH_PATHS ${SHIBOKEN_BASEDIR})
list(APPEND SHIBOKEN_SEARCH_PATHS ${SHIBOKEN_GENERATOR_BASEDIR}) list(APPEND SHIBOKEN_SEARCH_PATHS ${SHIBOKEN_GENERATOR_BASEDIR})
message(STATUS "BOO: ${SHIBOKEN_SEARCH_PATHS}")
find_file(SHIBOKEN_LIBRARY find_file(SHIBOKEN_LIBRARY
${SHIBOKEN_LIBRARY_BASENAMES} ${SHIBOKEN_LIBRARY_BASENAMES}
PATHS ${SHIBOKEN_SEARCH_PATHS} PATHS ${SHIBOKEN_SEARCH_PATHS}

View 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
)

View File

@@ -1,7 +1,5 @@
# #
# This file is part of KDDockWidgets. # SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
#
# SPDX-FileCopyrightText: 2020 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
# Author: Renato Araujo Oliveira Filho <renato.araujo@kdab.com> # Author: Renato Araujo Oliveira Filho <renato.araujo@kdab.com>
# #
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only # SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
@@ -9,11 +7,11 @@
# Contact KDAB at <info@kdab.com> for commercial licensing options. # Contact KDAB at <info@kdab.com> for commercial licensing options.
# #
if (NOT PYTHON_BINDINGS_INSTALL_PREFIX) if (NOT ${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX)
SET(PYTHON_BINDINGS_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} CACHE FILEPATH "Custom path to install python bindings.") SET(${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} CACHE FILEPATH "Custom path to install python bindings.")
endif() endif()
message(STATUS "PYTHON INSTALL PREFIX ${PYTHON_BINDINGS_INSTALL_PREFIX}") message(STATUS "PYTHON INSTALL PREFIX ${${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX}")
if (WIN32) if (WIN32)
set(PATH_SEP "\;") set(PATH_SEP "\;")
@@ -23,6 +21,19 @@ endif()
if (NOT CMAKE_CXX_STANDARD) if (NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
endif() endif()
# On macOS, check if Qt is a framework build. This affects how include paths should be handled.
get_target_property(QtCore_is_framework Qt5::Core FRAMEWORK)
if (QtCore_is_framework)
# Get the path to the framework dir.
list(GET Qt5Core_INCLUDE_DIRS 0 QT_INCLUDE_DIR)
get_filename_component(QT_FRAMEWORK_INCLUDE_DIR "${QT_INCLUDE_DIR}/../" ABSOLUTE)
# 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 # Flags that we will pass to shiboken-generator
# --generator-set=shiboken: tells the generator that we want to use shiboken to generate code, # --generator-set=shiboken: tells the generator that we want to use shiboken to generate code,
# a doc generator is also available # a doc generator is also available
@@ -41,6 +52,15 @@ set(GENERATOR_EXTRA_FLAGS --generator-set=shiboken
--enable-return-value-heuristic --enable-return-value-heuristic
--use-isnull-as-nb_nonzero --use-isnull-as-nb_nonzero
-std=c++${CMAKE_CXX_STANDARD}) -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) macro(make_path varname)
# accepts any number of path variables # accepts any number of path variables
string(REPLACE ";" "${PATH_SEP}" ${varname} "${ARGN}") string(REPLACE ";" "${PATH_SEP}" ${varname} "${ARGN}")
@@ -133,5 +153,5 @@ macro(CREATE_PYTHON_BINDINGS
LINK_FLAGS "-undefined dynamic_lookup") LINK_FLAGS "-undefined dynamic_lookup")
endif() endif()
install(TARGETS ${TARGET_NAME} install(TARGETS ${TARGET_NAME}
LIBRARY DESTINATION ${PYTHON_BINDINGS_INSTALL_PREFIX}/${TARGET_NAME}) LIBRARY DESTINATION ${${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX}/${TARGET_NAME})
endmacro() endmacro()

View 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()

View File

@@ -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> # Author: Allen Winter <allen.winter@kdab.com>
# #
# SPDX-License-Identifier: BSD-3-Clause # SPDX-License-Identifier: BSD-3-Clause
@@ -30,12 +30,12 @@
# #
# Create variables for all the various install paths for the Qt version in use # 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. # sets variables like QT_INSTALL_PREFIX, QT_INSTALL_DATA, QT_INSTALL_DOCS, etc.
# run qmake -query to see a full list # run qmake -query to see a full list
if(TARGET Qt5::qmake) if(TARGET Qt${QT_MAJOR_VERSION}::qmake)
get_target_property(QT_QMAKE_EXECUTABLE Qt5::qmake LOCATION) get_target_property(QT_QMAKE_EXECUTABLE Qt${QT_MAJOR_VERSION}::qmake LOCATION)
else() else()
message(FATAL_ERROR "No supported Qt version found. Make sure you find Qt before calling this") message(FATAL_ERROR "No supported Qt version found. Make sure you find Qt before calling this")
endif() endif()

View File

@@ -1,7 +1,7 @@
# #
# This file is part of KDDockWidgets. # 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 # SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
# #
# Contact KDAB at <info@kdab.com> for commercial licensing options. # Contact KDAB at <info@kdab.com> for commercial licensing options.
@@ -11,7 +11,7 @@ from conans import ConanFile, CMake, tools
class KDDockWidgetsConan(ConanFile): class KDDockWidgetsConan(ConanFile):
name = "kddockwidgets" name = "kddockwidgets"
version = "0.99.9" version = "1.2.0"
default_user = "kdab" default_user = "kdab"
default_channel = "stable" default_channel = "stable"
license = ("https://raw.githubusercontent.com/KDAB/KDDockWidgets/master/LICENSES/GPL-2.0-only.txt", 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_STATIC"] = self.options.build_static
self.cmake.definitions["KDDockWidgets_EXAMPLES"] = self.options.build_examples self.cmake.definitions["KDDockWidgets_EXAMPLES"] = self.options.build_examples
self.cmake.definitions["KDDockWidgets_TESTS"] = self.options.build_tests 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.configure()
self.cmake.build() self.cmake.build()

View File

@@ -1,3 +1,27 @@
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
-- Allen Winter <allen.winter@kdab.com> Wed, 2 Sep 2020 12:00:00 -0500
kddockwidgets (0.99.9) release candidate; urgency=high kddockwidgets (0.99.9) release candidate; urgency=high
* 1.0.0 release candidate * 1.0.0 release candidate

157
dev-scripts/build-all.dart Normal file
View 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;
}

View File

@@ -1,7 +1,7 @@
# #
# This file is part of KDDockWidgets. # 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> # Author: Allen Winter <allen.winter@kdab.com>
# #
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only # SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
@@ -25,7 +25,7 @@ find_package(Doxygen)
set_package_properties(Doxygen PROPERTIES set_package_properties(Doxygen PROPERTIES
TYPE OPTIONAL TYPE OPTIONAL
DESCRIPTION "API Documentation system" DESCRIPTION "API Documentation system"
URL "http://www.doxygen.org" URL "https://www.doxygen.org"
PURPOSE "Needed to build the API documentation." PURPOSE "Needed to build the API documentation."
) )
if(DOXYGEN_DOT_EXECUTABLE) if(DOXYGEN_DOT_EXECUTABLE)

View File

@@ -1,7 +1,7 @@
# #
# This file is part of KDDockWidgets. # 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> # Author: Allen Winter <allen.winter@kdab.com>
# #
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only # 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 OUTPUT ${DOXYGEN_OUTPUT_DIR}/qch/kddockwidgets-api.qch
COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile 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 #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 DEPENDS ${_dox_deps} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
WORKING_DIRECTORY ${CMAKE_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
) )

View File

@@ -51,7 +51,7 @@ PROJECT_BRIEF =
# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy # pixels and the maximum width should not exceed 200 pixels. Doxygen will copy
# the logo to the output directory. # the logo to the output directory.
PROJECT_LOGO = PROJECT_LOGO = "@CMAKE_SOURCE_DIR@/images/KDDockWidgets-64x64.png"
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
# into which the generated documentation will be written. If a relative path is # into which the generated documentation will be written. If a relative path is
@@ -1083,35 +1083,6 @@ USE_HTAGS = NO
VERBATIM_HEADERS = NO VERBATIM_HEADERS = NO
# If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the
# clang parser (see: http://clang.llvm.org/) for more accurate parsing at the
# cost of reduced performance. This can be particularly helpful with template
# rich C++ code for which doxygen's built-in parser lacks the necessary type
# information.
# Note: The availability of this option depends on whether or not doxygen was
# generated with the -Duse_libclang=ON option for CMake.
# The default value is: NO.
CLANG_ASSISTED_PARSING = NO
# If clang assisted parsing is enabled you can provide the compiler with command
# line options that you would normally use when invoking the compiler. Note that
# the include paths will already be set by doxygen for the files and directories
# specified with INPUT and INCLUDE_PATH.
# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES.
CLANG_OPTIONS =
# If clang assisted parsing is enabled you can provide the clang parser with the
# path to the compilation database (see:
# http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html) used when the files
# were built. This is equivalent to specifying the "-p" option to a clang tool,
# such as clang-check. These options will then be passed to the parser.
# Note: The availability of this option depends on whether or not doxygen was
# generated with the -Duse_libclang=ON option for CMake.
#TOO NEW CLANG_DATABASE_PATH =
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# Configuration options related to the alphabetical class index # Configuration options related to the alphabetical class index
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
@@ -1225,7 +1196,8 @@ HTML_EXTRA_STYLESHEET =
# files will be copied as-is; there are no commands or markers available. # files will be copied as-is; there are no commands or markers available.
# This tag requires that the tag GENERATE_HTML is set to YES. # This tag requires that the tag GENERATE_HTML is set to YES.
HTML_EXTRA_FILES = "@CMAKE_CURRENT_SOURCE_DIR@/kdab-logo-16x16.png" HTML_EXTRA_FILES = "@CMAKE_CURRENT_SOURCE_DIR@/kdab-logo-16x16.png" \
"@CMAKE_CURRENT_SOURCE_DIR@/kdab-kddockwidgets-logo-16x16.png"
# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
# will adjust the colors in the style sheet and background images according to # will adjust the colors in the style sheet and background images according to

View File

@@ -3,16 +3,16 @@
<img src="kdab-logo-16x16.png"> <img src="kdab-logo-16x16.png">
<font style="font-weight: bold;">Klar&auml;lvdalens Datakonsult AB (KDAB)</font> <font style="font-weight: bold;">Klar&auml;lvdalens Datakonsult AB (KDAB)</font>
<br> <br>
"The Qt Experts"<br> "The Qt, C++ and OpenGL Experts"<br>
<a href="https://www.kdab.com/">https://www.kdab.com/</a> <a href="https://www.kdab.com/">https://www.kdab.com/</a>
</div> </div>
<div style="text-align: right;"> <div style="text-align: right;">
<!-- <img src="kddockwidgets-logo-16x16.png" /><br> --> <img src="kdab-kddockwidgets-logo-16x16.png" />
<font style="font-weight: bold;">KDDockWidgets</font> <font style="font-weight: bold;">KDDockWidgets</font>
<br> <br>
Advanced Dock Widget Framework for Qt<br> Advanced Dock Widget Framework for Qt<br>
<a href="https://www.kdab.com/development-resources/qt-tools/kd-dockwidgets/">https://www.kdab.com/development-resources/qt-tools/kd-dockwidgets/</a> <a href="https://www.kdab.com/development-resources/qt-tools/kddockwidgets/">https://www.kdab.com/development-resources/qt-tools/kddockwidgets/</a>
</div> </div>
</body> </body>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -1,7 +1,7 @@
# #
# This file is part of KDDockWidgets. # 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> # Author: Sergio Martins <sergio.martins@kdab.com>
# #
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only # 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) project(kddockwidgets_example)
set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_INCLUDE_CURRENT_DIRS ON) set(CMAKE_INCLUDE_CURRENT_DIRS ON)
if(NOT TARGET kddockwidgets) if(NOT TARGET kddockwidgets)
@@ -21,7 +22,7 @@ if(NOT TARGET kddockwidgets)
find_package(KDDockWidgets REQUIRED) find_package(KDDockWidgets REQUIRED)
endif() 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 add_executable(kddockwidgets_example
main.cpp main.cpp

View File

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. 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> Author: Sérgio Martins <sergio.martins@kdab.com>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
@@ -17,6 +17,8 @@
#include <QApplication> #include <QApplication>
// clazy:excludeall=missing-qobject-macro,ctor-missing-parent-argument
class MyTitleBar : public KDDockWidgets::TitleBarWidget class MyTitleBar : public KDDockWidgets::TitleBarWidget
{ {
public: public:
@@ -32,6 +34,8 @@ public:
init(); init();
} }
~MyTitleBar() override;
void init() void init()
{ {
setFixedHeight(60); setFixedHeight(60);
@@ -56,6 +60,8 @@ public:
} }
}; };
MyTitleBar::~MyTitleBar() = default;
// Inheriting from SeparatorWidget instead of Separator as it handles moving and mouse cursor changing // Inheriting from SeparatorWidget instead of Separator as it handles moving and mouse cursor changing
class MySeparator : public Layouting::SeparatorWidget class MySeparator : public Layouting::SeparatorWidget
{ {
@@ -65,6 +71,8 @@ public:
{ {
} }
~MySeparator() override;
void paintEvent(QPaintEvent *) override void paintEvent(QPaintEvent *) override
{ {
QPainter p(this); QPainter p(this);
@@ -72,6 +80,8 @@ public:
} }
}; };
MySeparator::~MySeparator() = default;
KDDockWidgets::TitleBar * CustomWidgetFactory::createTitleBar(KDDockWidgets::Frame *frame) const KDDockWidgets::TitleBar * CustomWidgetFactory::createTitleBar(KDDockWidgets::Frame *frame) const
{ {
return new MyTitleBar(frame); return new MyTitleBar(frame);

View File

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. 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> Author: Sérgio Martins <sergio.martins@kdab.com>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
@@ -15,8 +15,11 @@
#include <QPainter> #include <QPainter>
// clazy:excludeall=ctor-missing-parent-argument
class CustomWidgetFactory : public KDDockWidgets::DefaultWidgetFactory class CustomWidgetFactory : public KDDockWidgets::DefaultWidgetFactory
{ {
Q_OBJECT
public: public:
KDDockWidgets::TitleBar *createTitleBar(KDDockWidgets::Frame *frame) const override; KDDockWidgets::TitleBar *createTitleBar(KDDockWidgets::Frame *frame) const override;
KDDockWidgets::TitleBar *createTitleBar(KDDockWidgets::FloatingWindow *fw) const override; KDDockWidgets::TitleBar *createTitleBar(KDDockWidgets::FloatingWindow *fw) const override;

View File

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. 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> Author: Sérgio Martins <sergio.martins@kdab.com>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
@@ -24,10 +24,12 @@
#include <QRandomGenerator> #include <QRandomGenerator>
#endif #endif
#include <QApplication>
#include <stdlib.h> #include <stdlib.h>
#include <time.h> #include <time.h>
// clazy:excludeall=qstring-allocations // clazy:excludeall=qstring-allocations,ctor-missing-parent-argument,detaching-member
static MyWidget *newMyWidget() static MyWidget *newMyWidget()
{ {
@@ -133,26 +135,26 @@ void MyMainWindow::createDockWidgets()
// MainWindow::addDockWidget() attaches a dock widget to the main window: // 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]: // 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.at(2), KDDockWidgets::Location_OnLeft);
addDockWidget(m_dockwidgets[3], KDDockWidgets::Location_OnBottom); addDockWidget(m_dockwidgets.at(3), KDDockWidgets::Location_OnBottom);
addDockWidget(m_dockwidgets[4], KDDockWidgets::Location_OnBottom); addDockWidget(m_dockwidgets.at(4), KDDockWidgets::Location_OnBottom);
// Tab two dock widgets together // 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(). // 6 is floating, as it wasn't added to the main window via MainWindow::addDockWidget().
// and we tab 7 with it. // 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 // 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); floatingWindow->move(100, 100);
} }

View File

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. 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> Author: Sérgio Martins <sergio.martins@kdab.com>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only

View File

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. 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> Author: Sérgio Martins <sergio.martins@kdab.com>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
@@ -36,13 +36,13 @@ MyWidget::MyWidget(const QString &backgroundFile, const QString &logoFile, QWidg
} }
setFocusPolicy(Qt::StrongFocus); setFocusPolicy(Qt::StrongFocus);
#if 0 if (qEnvironmentVariableIsSet("KDDW_DEBUG_FOCUS")) {
// Uncomment to show focus propagation working // Uncomment to show focus propagation working
new QLineEdit(this); new QLineEdit(this);
auto l2 = new QLineEdit(this); auto l2 = new QLineEdit(this);
l2->move(0, 100); l2->move(0, 100);
setFocusProxy(l2); setFocusProxy(l2);
#endif }
} }
MyWidget::~MyWidget() MyWidget::~MyWidget()

View File

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. 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> Author: Sérgio Martins <sergio.martins@kdab.com>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
@@ -34,6 +34,7 @@ protected:
class MyWidget1 : public MyWidget class MyWidget1 : public MyWidget
{ {
Q_OBJECT
public: public:
explicit MyWidget1(QWidget *parent = nullptr); explicit MyWidget1(QWidget *parent = nullptr);
protected: protected:
@@ -42,6 +43,7 @@ protected:
class MyWidget2 : public MyWidget class MyWidget2 : public MyWidget
{ {
Q_OBJECT
public: public:
explicit MyWidget2(QWidget *parent = nullptr); explicit MyWidget2(QWidget *parent = nullptr);
protected: protected:
@@ -50,6 +52,7 @@ protected:
class MyWidget3 : public MyWidget class MyWidget3 : public MyWidget
{ {
Q_OBJECT
public: public:
explicit MyWidget3(QWidget *parent = nullptr); explicit MyWidget3(QWidget *parent = nullptr);
protected: protected:

View File

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. 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> Author: Sérgio Martins <sergio.martins@kdab.com>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only 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) int main(int argc, char **argv)
{ {
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
#endif
QApplication app(argc, argv); QApplication app(argc, argv);
app.setOrganizationName(QStringLiteral("KDAB")); app.setOrganizationName(QStringLiteral("KDAB"));
@@ -37,6 +39,7 @@ int main(int argc, char **argv)
parser.setApplicationDescription("KDDockWidgets example application"); parser.setApplicationDescription("KDDockWidgets example application");
parser.addHelpOption(); parser.addHelpOption();
// Fusion looks better in general, but feel free to change
qApp->setStyle(QStyleFactory::create(QStringLiteral("Fusion"))); qApp->setStyle(QStyleFactory::create(QStringLiteral("Fusion")));
QCommandLineOption customStyle("p", QCoreApplication::translate("main", "Shows how to style framework internals via FrameworkWidgetFactory")); QCommandLineOption customStyle("p", QCoreApplication::translate("main", "Shows how to style framework internals via FrameworkWidgetFactory"));
@@ -78,12 +81,21 @@ int main(int argc, char **argv)
QCommandLineOption nonDockable("d", QCoreApplication::translate("main", "DockWidget #9 will be non-dockable")); QCommandLineOption nonDockable("d", QCoreApplication::translate("main", "DockWidget #9 will be non-dockable"));
parser.addOption(nonDockable); parser.addOption(nonDockable);
QCommandLineOption maximizeButton("b", QCoreApplication::translate("main", "DockWidgets have maximize/restore buttons instead of float/dock button")); QCommandLineOption maximizeButtonOption("b", QCoreApplication::translate("main", "Floating dockWidgets have maximize/restore buttons instead of float/dock button"));
parser.addOption(maximizeButton); parser.addOption(maximizeButtonOption);
QCommandLineOption minimizeButtonOption("k", QCoreApplication::translate("main", "Floating dockWidgets have a minimize button. Implies not being an utility window (~Qt::Tool)"));
parser.addOption(minimizeButtonOption);
QCommandLineOption segmentedIndicators("y", QCoreApplication::translate("main", "Use segmented indicators instead of classical")); QCommandLineOption segmentedIndicators("y", QCoreApplication::translate("main", "Use segmented indicators instead of classical"));
parser.addOption(segmentedIndicators); parser.addOption(segmentedIndicators);
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")); parser.addPositionalArgument("savedlayout", QCoreApplication::translate("main", "loads the specified json file at startup"));
#ifdef KDDOCKWIDGETS_SUPPORTS_NESTED_MAINWINDOWS #ifdef KDDOCKWIDGETS_SUPPORTS_NESTED_MAINWINDOWS
@@ -95,8 +107,27 @@ int main(int argc, char **argv)
parser.addOption(maxSizeOption); parser.addOption(maxSizeOption);
QCommandLineOption centralFrame("f", QCoreApplication::translate("main", "Persistent central frame")); QCommandLineOption centralFrame("f", QCoreApplication::translate("main", "Persistent central frame"));
QCommandLineOption autoHideSupport("w", QCoreApplication::translate("main", "Enables auto-hide/minimization to side-bar support"));
parser.addOption(autoHideSupport);
#if defined(DOCKS_DEVELOPER_MODE) #if defined(DOCKS_DEVELOPER_MODE)
parser.addOption(centralFrame); parser.addOption(centralFrame);
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
#else #else
Q_UNUSED(centralFrame) Q_UNUSED(centralFrame)
#endif #endif
@@ -114,15 +145,44 @@ int main(int argc, char **argv)
KDDockWidgets::DefaultWidgetFactory::s_dropIndicatorType = KDDockWidgets::DropIndicatorType::Segmented; KDDockWidgets::DefaultWidgetFactory::s_dropIndicatorType = KDDockWidgets::DropIndicatorType::Segmented;
MainWindowOptions options = MainWindowOption_None; MainWindowOptions options = MainWindowOption_None;
auto flags = KDDockWidgets::Config::self().flags();
#if defined(DOCKS_DEVELOPER_MODE) #if defined(DOCKS_DEVELOPER_MODE)
auto internalFlags = KDDockWidgets::Config::self().internalFlags();
options = parser.isSet(centralFrame) ? MainWindowOption_HasCentralFrame options = parser.isSet(centralFrame) ? MainWindowOption_HasCentralFrame
: MainWindowOption_None; : MainWindowOption_None;
if (parser.isSet(noQtTool))
internalFlags |= KDDockWidgets::Config::InternalFlag_DontUseQtToolWindowsForFloatingWindows;
if (parser.isSet(keepAbove))
flags |= KDDockWidgets::Config::Flag_KeepAboveIfNotUtilityWindow;
if (parser.isSet(noParentForFloating))
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))
internalFlags |= KDDockWidgets::Config::InternalFlag_NoAeroSnap;
# endif
Config::self().setInternalFlags(internalFlags);
#endif #endif
auto flags = KDDockWidgets::Config::self().flags(); if (parser.isSet(autoHideSupport))
flags |= Config::Flag_AutoHideSupport;
if (parser.isSet(noTitleBars)) if (parser.isSet(noTitleBars))
flags |= KDDockWidgets::Config::Flag_HideTitleBarWhenTabsVisible; flags |= KDDockWidgets::Config::Flag_HideTitleBarWhenTabsVisible;
if (parser.isSet(noUtilityWindows))
flags |= KDDockWidgets::Config::Flag_DontUseUtilityFloatingWindows;
if (parser.isSet(alwaysTabs)) if (parser.isSet(alwaysTabs))
flags |= KDDockWidgets::Config::Flag_AlwaysShowTabs; flags |= KDDockWidgets::Config::Flag_AlwaysShowTabs;
@@ -134,15 +194,18 @@ int main(int argc, char **argv)
} }
} }
if (parser.isSet(customStyle)) if (parser.isSet(customStyle) || qEnvironmentVariableIsSet("KDDW_DEBUG_FOCUS"))
flags |= KDDockWidgets::Config::Flag_TitleBarIsFocusable; // also showing title bar focus with -p, just to not introduce another switch flags |= KDDockWidgets::Config::Flag_TitleBarIsFocusable; // also showing title bar focus with -p, just to not introduce another switch
if (parser.isSet(reorderTabsOption)) if (parser.isSet(reorderTabsOption))
flags |= KDDockWidgets::Config::Flag_AllowReorderTabs; flags |= KDDockWidgets::Config::Flag_AllowReorderTabs;
if (parser.isSet(maximizeButton)) if (parser.isSet(maximizeButtonOption))
flags |= KDDockWidgets::Config::Flag_TitleBarHasMaximizeButton; flags |= KDDockWidgets::Config::Flag_TitleBarHasMaximizeButton;
if (parser.isSet(minimizeButtonOption))
flags |= KDDockWidgets::Config::Flag_TitleBarHasMinimizeButton;
if (parser.isSet(lazyResizeOption)) if (parser.isSet(lazyResizeOption))
flags |= KDDockWidgets::Config::Flag_LazyResize; flags |= KDDockWidgets::Config::Flag_LazyResize;

View File

@@ -1,7 +1,7 @@
# #
# This file is part of KDDockWidgets. # 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> # Author: Sergio Martins <sergio.martins@kdab.com>
# #
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only # 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) project(kddockwidgets_minimal_example)
set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_INCLUDE_CURRENT_DIRS ON) set(CMAKE_INCLUDE_CURRENT_DIRS ON)
if(NOT TARGET kddockwidgets) if(NOT TARGET kddockwidgets)
@@ -21,7 +22,7 @@ if(NOT TARGET kddockwidgets)
find_package(KDDockWidgets REQUIRED) find_package(KDDockWidgets REQUIRED)
endif() 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 add_executable(kddockwidgets_minimal_example
main.cpp main.cpp

View File

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. 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> Author: Sérgio Martins <sergio.martins@kdab.com>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only

View File

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. 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> Author: Sérgio Martins <sergio.martins@kdab.com>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
@@ -24,6 +24,7 @@ class MyWidget : public QWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
MyWidget() = default;
explicit MyWidget(const QString &backgroundFile, const QString &logoFile, QWidget *parent = nullptr); explicit MyWidget(const QString &backgroundFile, const QString &logoFile, QWidget *parent = nullptr);
~MyWidget(); ~MyWidget();
protected: protected:
@@ -34,6 +35,7 @@ protected:
class MyWidget1 : public MyWidget class MyWidget1 : public MyWidget
{ {
Q_OBJECT
public: public:
explicit MyWidget1(QWidget *parent = nullptr); explicit MyWidget1(QWidget *parent = nullptr);
protected: protected:
@@ -42,6 +44,7 @@ protected:
class MyWidget2 : public MyWidget class MyWidget2 : public MyWidget
{ {
Q_OBJECT
public: public:
explicit MyWidget2(QWidget *parent = nullptr); explicit MyWidget2(QWidget *parent = nullptr);
protected: protected:
@@ -50,6 +53,7 @@ protected:
class MyWidget3 : public MyWidget class MyWidget3 : public MyWidget
{ {
Q_OBJECT
public: public:
explicit MyWidget3(QWidget *parent = nullptr); explicit MyWidget3(QWidget *parent = nullptr);
protected: protected:

View File

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. 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> Author: Sérgio Martins <sergio.martins@kdab.com>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
@@ -14,19 +14,27 @@
#include <kddockwidgets/DockWidget.h> #include <kddockwidgets/DockWidget.h>
#include <kddockwidgets/MainWindow.h> #include <kddockwidgets/MainWindow.h>
#include <QStyleFactory>
#include <QApplication>
// clazy:excludeall=qstring-allocations // clazy:excludeall=qstring-allocations
using namespace KDDockWidgets; using namespace KDDockWidgets;
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
#endif
QApplication app(argc, argv); QApplication app(argc, argv);
app.setOrganizationName(QStringLiteral("KDAB")); app.setOrganizationName(QStringLiteral("KDAB"));
app.setApplicationName(QStringLiteral("Test app")); 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 // # 1. Create our main window
KDDockWidgets::MainWindow mainWindow(QStringLiteral("MyMainWindow")); KDDockWidgets::MainWindow mainWindow(QStringLiteral("MyMainWindow"));
@@ -34,10 +42,9 @@ int main(int argc, char **argv)
mainWindow.resize(1200, 1200); mainWindow.resize(1200, 1200);
mainWindow.show(); mainWindow.show();
// # 2. Create four dock widgets. Each needs an unique name. // # 2. Create a dock widget, it needs a unique name
auto dock1 = new KDDockWidgets::DockWidget(QStringLiteral("MyDock1")); auto dock1 = new KDDockWidgets::DockWidget(QStringLiteral("MyDock1"));
auto widget1 = new MyWidget(QStringLiteral(":/assets/base.png"), auto widget1 = new MyWidget();
QStringLiteral(":/assets/KDAB_bubble_fulcolor.png"));
dock1->setWidget(widget1); dock1->setWidget(widget1);
auto dock2 = new KDDockWidgets::DockWidget(QStringLiteral("MyDock2")); auto dock2 = new KDDockWidgets::DockWidget(QStringLiteral("MyDock2"));
@@ -55,6 +62,10 @@ int main(int argc, char **argv)
QStringLiteral(":/assets/KDAB_bubble_fulcolor.png")); QStringLiteral(":/assets/KDAB_bubble_fulcolor.png"));
dock4->setWidget(widget4); 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 // 3. Add them to the main window
mainWindow.addDockWidget(dock1, KDDockWidgets::Location_OnLeft); mainWindow.addDockWidget(dock1, KDDockWidgets::Location_OnLeft);
@@ -63,8 +74,13 @@ int main(int argc, char **argv)
// 4. Add dock3 to the right of dock2 // 4. Add dock3 to the right of dock2
mainWindow.addDockWidget(dock3, KDDockWidgets::Location_OnRight, dock2); mainWindow.addDockWidget(dock3, KDDockWidgets::Location_OnRight, dock2);
// 5. dock4 will be its own top level (floating window) // 5. dock4 is docked at the bottom, with 200px height
dock4->show(); 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(); return app.exec();
} }

View File

@@ -1,7 +1,6 @@
#
# This file is part of KDDockWidgets. # 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> # Author: Sergio Martins <sergio.martins@kdab.com>
# #
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only # 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. # Contact KDAB at <info@kdab.com> for commercial licensing options.
# #
cmake_minimum_required(VERSION 3.7) add_subdirectory(customtitlebar)
project(kddockwidgets_example_quick) add_subdirectory(dockwidgets)
set(CMAKE_AUTOMOC ON) set_compiler_flags(kddockwidgets_example_quick)
set(CMAKE_INCLUDE_CURRENT_DIRS ON) set_compiler_flags(kddockwidgets_customtitlebar_quick)
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
)

View 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
)

View 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
}
}
}
}

View 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"
}

View File

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. 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> Author: Sergio Martins <sergio.martins@kdab.com>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
@@ -11,10 +11,7 @@
import QtQuick 2.9 import QtQuick 2.9
Rectangle { Guest {
color: "pink"
anchors.fill: parent anchors.fill: parent
Text { logo: "qrc:/assets/KDAB_bubble_blue.png"
text: "Guest Widget #2!"
}
} }

View File

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. 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> Author: Sergio Martins <sergio.martins@kdab.com>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
@@ -11,10 +11,8 @@
import QtQuick 2.9 import QtQuick 2.9
Rectangle { Guest {
color: "lightblue"
anchors.fill: parent anchors.fill: parent
Text { background: "qrc:/assets/base.png"
text: "Guest Widget #1 !" logo: "qrc:/assets/KDAB_bubble_fulcolor.png"
}
} }

View 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();
}
}
}
}

View File

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. 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> Author: Sergio Martins <sergio.martins@kdab.com>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
@@ -10,24 +10,51 @@
*/ */
#include "private/DockRegistry_p.h" #include <kddockwidgets/Config.h>
#include "private/quick/DockWidgetQuick.h" #include <kddockwidgets/DockWidgetQuick.h>
#include "Config.h" #include <kddockwidgets/private/DockRegistry_p.h>
#include <kddockwidgets/FrameworkWidgetFactory.h>
#include <QQuickView> #include <QQuickView>
#include <QGuiApplication> #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[]) int main(int argc, char *argv[])
{ {
#ifdef Q_OS_WIN
QGuiApplication::setAttribute(Qt::AA_UseOpenGLES);
#endif
QGuiApplication app(argc, argv); QGuiApplication app(argc, argv);
auto &config = KDDockWidgets::Config::self();
auto flags = config.flags();
config.setFlags(flags);
config.setFrameworkWidgetFactory(new CustomFrameworkWidgetFactory());
QQuickView view; QQuickView view;
view.setObjectName("MainWindow QQuickView");
KDDockWidgets::Config::self().setQmlEngine(view.engine()); KDDockWidgets::Config::self().setQmlEngine(view.engine());
view.resize(1000, 800); view.resize(1000, 800);
view.show(); view.show();
view.setResizeMode(QQuickView::SizeRootObjectToView); view.setResizeMode(QQuickView::SizeRootObjectToView);
auto dw1 = new KDDockWidgets::DockWidgetQuick("Dock #1"); auto dw1 = new KDDockWidgets::DockWidgetQuick("Dock #1");
view.setSource(QUrl("qrc:/main.qml"));
dw1->setWidget(QStringLiteral("qrc:/Guest1.qml")); dw1->setWidget(QStringLiteral("qrc:/Guest1.qml"));
dw1->resize(QSize(800, 800)); dw1->resize(QSize(800, 800));
dw1->show(); dw1->show();
@@ -39,15 +66,10 @@ int main(int argc, char *argv[])
auto dw3 = new KDDockWidgets::DockWidgetQuick("Dock #3"); auto dw3 = new KDDockWidgets::DockWidgetQuick("Dock #3");
dw3->setWidget(QStringLiteral("qrc:/Guest3.qml")); 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); dw1->addDockWidgetToContainingWindow(dw3, KDDockWidgets::Location_OnRight);
KDDockWidgets::MainWindowBase *mainWindow = KDDockWidgets::DockRegistry::self()->mainwindows().constFirst(); KDDockWidgets::MainWindowBase *mainWindow = KDDockWidgets::DockRegistry::self()->mainwindows().constFirst();
mainWindow->addDockWidget(dw2, KDDockWidgets::Location_OnTop); mainWindow->addDockWidget(dw2, KDDockWidgets::Location_OnTop);
return app.exec(); return app.exec();
} }

View File

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. 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> Author: Sergio Martins <sergio.martins@kdab.com>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only

View File

@@ -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>

View File

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. 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> Author: Sergio Martins <sergio.martins@kdab.com>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
@@ -12,9 +12,7 @@
import QtQuick 2.9 import QtQuick 2.9
Rectangle { Rectangle {
color: "blue" id: root
color: "green"
anchors.fill: parent anchors.fill: parent
Text {
text: "Guest Widget!"
}
} }

View 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
)

View 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
}
}
}
}

View 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();
}
}
}
}

View File

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. 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> Author: Sergio Martins <sergio.martins@kdab.com>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
@@ -11,10 +11,7 @@
import QtQuick 2.9 import QtQuick 2.9
Rectangle { Guest {
color: "gray"
anchors.fill: parent anchors.fill: parent
Text { logo: "qrc:/assets/KDAB_bubble_blue.png"
text: "Guest Widget #3!"
}
} }

View 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"
}

View 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();
}

View 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");
}
}

View File

@@ -4,5 +4,7 @@
<file>Guest1.qml</file> <file>Guest1.qml</file>
<file>Guest2.qml</file> <file>Guest2.qml</file>
<file>Guest3.qml</file> <file>Guest3.qml</file>
<file>Guest.qml</file>
<file>Another.qml</file>
</qresource> </qresource>
</RCC> </RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

View File

@@ -0,0 +1,320 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="128"
height="128"
viewBox="0 0 33.866665 33.866667"
version="1.1"
id="svg8"
inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)"
sodipodi:docname="128x128.svg"
inkscape:export-filename="/home/pinheiro/media/server/kdab/2017/templates/Marketing/Branding/products/kddockwidgets/icons/256x256.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96">
<defs
id="defs2">
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4182"
id="linearGradient2204"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.51735502,0,0,0.51741082,-2340.918,-1199.7217)"
x1="4533.3271"
y1="2365.7585"
x2="4573.1943"
y2="2342.7412" />
<linearGradient
inkscape:collect="always"
id="linearGradient4182">
<stop
style="stop-color:#04a5e7;stop-opacity:1;"
offset="0"
id="stop4184" />
<stop
style="stop-color:#2982c4;stop-opacity:1"
offset="1"
id="stop4186" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4733"
id="linearGradient2202"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0,0.61581147,-0.61574507,0,3061.0284,-1011.6512)"
x1="1710.802"
y1="4975.228"
x2="1652.1422"
y2="4926.0415" />
<linearGradient
id="linearGradient4733"
inkscape:collect="always">
<stop
id="stop4735"
offset="0"
style="stop-color:#1abafb;stop-opacity:1" />
<stop
style="stop-color:#19aff2;stop-opacity:1;"
offset="0.6658641696"
id="stop4739" />
<stop
id="stop4737"
offset="1"
style="stop-color:#187fcb;stop-opacity:1" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4733"
id="linearGradient2200"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0,-0.61581147,-0.61574507,0,3061.0284,1048.8936)"
x1="1710.802"
y1="4975.228"
x2="1652.1422"
y2="4926.0415" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2009"
id="linearGradient2198"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.22796197,0,0,0.22798656,-1029.3611,-516.35749)"
x1="4620.3696"
y1="2304.967"
x2="4567.6602"
y2="2342.3162" />
<linearGradient
inkscape:collect="always"
id="linearGradient2009">
<stop
style="stop-color:#f5f5f5;stop-opacity:1;"
offset="0"
id="stop2005" />
<stop
style="stop-color:#f5f5f5;stop-opacity:0;"
offset="1"
id="stop2007" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4733"
id="linearGradient2196"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0,0.22945621,-0.22945621,0,1158.704,-373.75425)"
x1="1710.802"
y1="4975.228"
x2="1652.1422"
y2="4926.0415" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4733"
id="linearGradient2194"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0,-0.097279,0.09727896,0,-449.73978,167.5063)"
x1="1632.0477"
y1="4981.3447"
x2="1693.9222"
y2="4946.9316" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2009"
id="linearGradient2192"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.22945621,0,0,0.22945621,-1030.9526,-524.92857)"
x1="4620.3696"
y1="2304.967"
x2="4539.2959"
y2="2351.7751" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2009"
id="linearGradient2190"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.23947392,0,0,0.23947399,-1071.1667,-551.60122)"
x1="4620.3696"
y1="2304.967"
x2="4539.2959"
y2="2351.7751" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2009"
id="linearGradient2188"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0,0.22798656,-0.22796197,0,541.76567,-1033.9073)"
x1="4620.3696"
y1="2304.967"
x2="4567.6602"
y2="2342.3162" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2009"
id="linearGradient2186"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0,-0.22798656,-0.22796197,0,541.76567,1071.2141)"
x1="4620.3696"
y1="2304.967"
x2="4567.6602"
y2="2342.3162" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2009"
id="linearGradient2184"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0,-0.22798656,0.22796197,0,-511.86527,1071.2141)"
x1="4620.3696"
y1="2304.967"
x2="4567.6602"
y2="2342.3162" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1"
inkscape:cx="107.45186"
inkscape:cy="35.577827"
inkscape:document-units="px"
inkscape:current-layer="layer1"
inkscape:document-rotation="0"
showgrid="true"
units="px"
inkscape:showpageshadow="false"
inkscape:snap-global="true"
inkscape:snap-bbox="true"
inkscape:bbox-paths="true"
inkscape:bbox-nodes="true"
inkscape:snap-bbox-edge-midpoints="false"
inkscape:snap-bbox-midpoints="false"
inkscape:snap-nodes="true"
inkscape:snap-others="false"
inkscape:snap-page="true"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0">
<inkscape:grid
type="xygrid"
id="grid319"
originx="-6.9805273e-15"
originy="-6.980528e-15" />
</sodipodi:namedview>
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<rect
style="opacity:0.04470928;fill:#050505;stroke:none;stroke-width:0.192438;stroke-linecap:square;paint-order:stroke fill markers;fill-opacity:0.03451458"
id="rect339"
width="33.866665"
height="33.866665"
x="3.4902638e-15"
y="3.4902638e-15" />
<path
id="path2172"
style="opacity:1;fill:url(#linearGradient2194);fill-opacity:1;stroke:#ffffff;stroke-width:0.189129;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers"
d="M 29.460396,6.7875213 V 2.72324 l 4.064309,4.0642813 z"
sodipodi:nodetypes="cccc"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90" />
<g
id="g1175"
transform="matrix(1.0177349,0,0,1.0177349,-0.15056408,-0.31430128)"
style="stroke-width:0.982574">
<path
id="path2170"
style="opacity:1;fill:url(#linearGradient2196);fill-opacity:1;stroke:#ffffff;stroke-width:0.185833;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers"
d="M 28.393217,5.3400577 V 14.926735 L 18.806543,5.3400577 Z"
sodipodi:nodetypes="cccc"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90" />
<path
style="fill:none;stroke:url(#linearGradient2192);stroke-width:0.12682;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 28.393217,5.3400577 23.61143,10.122934"
id="path2174"
sodipodi:nodetypes="cc"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90" />
</g>
<path
style="fill:none;stroke:url(#linearGradient2190);stroke-width:0.129069;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 31.506974,4.7404732 29.460396,6.7875213"
id="path2176"
sodipodi:nodetypes="cc"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90" />
<g
id="g1171"
transform="matrix(1.00156,0,0,1.0014514,0.06599202,-0.11494774)"
style="stroke-width:0.9985">
<path
id="path2162"
style="opacity:1;fill:url(#linearGradient2204);fill-opacity:1;stroke:#ffffff;stroke-width:0.187626;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers"
d="M 2.1413076,5.7567952 H 18.336441 l 9.506012,9.5070378 V 31.46073 H 2.1413076 Z"
sodipodi:nodetypes="cccccc"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90" />
<path
id="path2164"
style="opacity:0.404507;fill:url(#linearGradient2202);fill-opacity:1;stroke:none;stroke-width:0.213405;stroke-linecap:square;stroke-linejoin:round;paint-order:stroke fill markers"
d="M 27.842495,15.26388 V 31.485416 L 2.1166666,5.7568177 H 18.33646 Z"
sodipodi:nodetypes="ccccc"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90" />
<path
id="path2166"
style="opacity:0.404507;fill:url(#linearGradient2200);fill-opacity:1;stroke:none;stroke-width:0.213405;stroke-linecap:square;stroke-linejoin:round;paint-order:stroke fill markers"
d="M 27.842495,31.485416 V 15.26388 L 23.059402,10.539405 2.1166666,31.485416 Z"
sodipodi:nodetypes="ccccc"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90" />
<path
style="fill:none;stroke:url(#linearGradient2198);stroke-width:0.128043;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 23.086067,10.514784 -8.135893,8.138618"
id="path2168"
sodipodi:nodetypes="cc"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90" />
<path
style="fill:none;stroke:url(#linearGradient2188);stroke-width:0.128043;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 14.950174,18.653402 6.8124322,10.516629"
id="path2178"
sodipodi:nodetypes="cc"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90" />
<path
style="fill:none;stroke:url(#linearGradient2186);stroke-width:0.128043;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 14.950174,18.653402 6.8124322,26.790173"
id="path2180"
sodipodi:nodetypes="cc"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90" />
<path
style="fill:none;stroke:url(#linearGradient2184);stroke-width:0.128043;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 14.950174,18.653402 8.137738,8.136771"
id="path2182"
sodipodi:nodetypes="cc"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

View File

@@ -0,0 +1,862 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="301.11804mm"
height="104.09705mm"
viewBox="0 0 1066.9537 368.84777"
id="svg2"
version="1.1"
inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)"
sodipodi:docname="kddw.svg"
inkscape:export-filename="/home/pinheiro/media/server/kdab/2017/templates/Marketing/Branding/products/kddockwidgets/kddw.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90">
<defs
id="defs4">
<linearGradient
inkscape:collect="always"
id="linearGradient2009">
<stop
style="stop-color:#f5f5f5;stop-opacity:1;"
offset="0"
id="stop2005" />
<stop
style="stop-color:#f5f5f5;stop-opacity:0;"
offset="1"
id="stop2007" />
</linearGradient>
<inkscape:path-effect
pattern-nodetypes="cscscsscssc"
fuse_tolerance="0"
vertical_pattern="true"
prop_units="true"
tang_offset="0"
normal_offset="0"
spacing="0"
scale_y_rel="false"
prop_scale="0.88207218"
copytype="single_stretched"
pattern="m 4206.4067,1373.8314 c 1.1289,-1.7427 2.2338,-2.9184 2.9093,-4.8116 0.4125,-1.156 -0.031,-16.8273 0.6649,-16.8273 0.6422,0 0.2359,15.574 0.6242,16.7092 0.6713,1.9621 1.7981,3.1516 2.95,4.9297 11.1033,14.807 11.2215,45.5151 0,60.2344 -0.7017,0.9204 -1.6243,2.6721 -2.3634,4.5072 -0.7184,1.7837 -1.2634,-18.8714 -1.2634,-17.6169 0,-1.3447 -0.5565,19.2474 -1.2655,17.457 -0.7387,-1.8651 -1.6429,-3.5838 -2.2561,-4.3473 -11.7524,-14.6327 -11.1808,-45.7893 0,-60.2344 z"
is_visible="true"
id="path-effect12719"
effect="skeletal"
lpeversion="0"
hide_knot="false" />
<inkscape:path-effect
effect="skeletal"
id="path-effect12715"
is_visible="true"
pattern="m 4176.4353,1393.8123 c 1.1289,-1.7427 2.2338,-2.9184 2.9093,-4.8116 0.4125,-1.156 -0.031,-16.8273 0.665,-16.8273 0.6421,0 0.2358,15.574 0.6242,16.7092 0.6713,1.9621 1.7981,3.1516 2.95,4.9297 11.1033,14.807 11.2215,45.5151 0,60.2344 -0.7017,0.9204 -1.6244,2.6721 -2.3635,4.5072 -0.7184,1.7837 -1.2633,-18.8714 -1.2633,-17.6169 0,-1.3448 -0.5565,19.2474 -1.2656,17.457 -0.7386,-1.8651 -1.6429,-3.5839 -2.2561,-4.3473 -11.7523,-14.6327 -11.1808,-45.7893 0,-60.2344 z"
copytype="single_stretched"
prop_scale="0.88207218"
scale_y_rel="false"
spacing="0"
normal_offset="0"
tang_offset="0"
prop_units="true"
vertical_pattern="true"
fuse_tolerance="0"
pattern-nodetypes="cscscsscssc"
lpeversion="0"
hide_knot="false" />
<inkscape:path-effect
pattern-nodetypes="cscscsscssc"
fuse_tolerance="0"
vertical_pattern="true"
prop_units="true"
tang_offset="0"
normal_offset="0"
spacing="0"
scale_y_rel="false"
prop_scale="0.88207218"
copytype="single_stretched"
pattern="m 4176.4353,1398.5578 c 1.1289,-1.7428 2.2338,-2.9184 2.9093,-4.8116 0.4125,-1.1561 -0.031,-16.8273 0.665,-16.8273 0.6421,0 0.2358,15.574 0.6242,16.7092 0.6713,1.9621 1.7981,3.1515 2.95,4.9297 11.1033,14.807 11.2215,45.515 0,60.2343 -0.7017,0.9205 -1.6244,2.6722 -2.3635,4.5073 -0.7184,1.7836 -1.2633,-18.8714 -1.2633,-17.617 0,-1.3447 -0.5565,19.2475 -1.2656,17.4571 -0.7386,-1.8652 -1.6429,-3.5839 -2.2561,-4.3474 -11.7523,-14.6327 -11.1808,-45.7892 0,-60.2343 z"
is_visible="true"
id="path-effect12711"
effect="skeletal"
lpeversion="0"
hide_knot="false" />
<inkscape:path-effect
effect="skeletal"
id="path-effect12616"
is_visible="true"
pattern="m 4231.537,1404.0525 c 1.1289,-1.7427 2.2338,-2.9184 2.9093,-4.8116 0.4125,-1.156 -0.031,-16.8273 0.6649,-16.8273 0.6422,0 0.2359,15.574 0.6242,16.7092 0.6713,1.9621 1.7981,3.1516 2.95,4.9297 11.1033,14.807 11.2215,45.5151 0,60.2344 -0.7017,0.9204 -1.6243,2.6721 -2.3634,4.5072 -0.7184,1.7837 -1.2634,-18.8714 -1.2634,-17.6169 0,-1.3447 -0.5565,19.2474 -1.2655,17.457 -0.7387,-1.8651 -1.6429,-3.5838 -2.2561,-4.3473 -11.7524,-14.6327 -11.1808,-45.7893 0,-60.2344 z"
copytype="single_stretched"
prop_scale="0.88207218"
scale_y_rel="false"
spacing="0"
normal_offset="0"
tang_offset="0"
prop_units="true"
vertical_pattern="true"
fuse_tolerance="0"
pattern-nodetypes="cscscsscssc"
lpeversion="0"
hide_knot="false" />
<inkscape:path-effect
effect="ellipse_5pts"
id="path-effect12614"
is_visible="false"
lpeversion="0" />
<linearGradient
inkscape:collect="always"
id="linearGradient1176">
<stop
style="stop-color:#fdc324;stop-opacity:1"
offset="0"
id="stop1170" />
<stop
id="stop1172"
offset="0.8829243779"
style="stop-color:#fb8510;stop-opacity:1" />
<stop
style="stop-color:#fb410e;stop-opacity:1"
offset="1"
id="stop1174" />
</linearGradient>
<linearGradient
inkscape:collect="always"
id="linearGradient4304">
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop4306" />
<stop
style="stop-color:#ffffff;stop-opacity:0;"
offset="1"
id="stop4308" />
</linearGradient>
<linearGradient
id="linearGradient5010"
inkscape:collect="always">
<stop
id="stop5012"
offset="0"
style="stop-color:#fdc324;stop-opacity:1" />
<stop
style="stop-color:#fb5010;stop-opacity:1;"
offset="0.8829243779"
id="stop5016" />
<stop
id="stop5014"
offset="1"
style="stop-color:#fb410e;stop-opacity:1" />
</linearGradient>
<linearGradient
id="linearGradient4733"
inkscape:collect="always">
<stop
id="stop4735"
offset="0"
style="stop-color:#1abafb;stop-opacity:1" />
<stop
style="stop-color:#19aff2;stop-opacity:1;"
offset="0.6658641696"
id="stop4739" />
<stop
id="stop4737"
offset="1"
style="stop-color:#187fcb;stop-opacity:1" />
</linearGradient>
<linearGradient
inkscape:collect="always"
id="linearGradient4182">
<stop
style="stop-color:#04a5e7;stop-opacity:1;"
offset="0"
id="stop4184" />
<stop
style="stop-color:#2982c4;stop-opacity:1"
offset="1"
id="stop4186" />
</linearGradient>
<clipPath
clipPathUnits="userSpaceOnUse"
id="clipPath4715">
<circle
transform="rotate(-7.0121541)"
r="21.990837"
cy="535.98236"
cx="166.16179"
id="circle4717"
style="opacity:1;fill:url(#radialGradient4719);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.8;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
</clipPath>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient4182"
id="radialGradient4719"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.90375526,-0.01183805,0.01309761,0.99991422,8.8420044,1.9777154)"
cx="163.26299"
cy="524.61469"
fx="163.26299"
fy="524.61469"
r="21.990837" />
<clipPath
clipPathUnits="userSpaceOnUse"
id="clipPath4857">
<circle
transform="rotate(-7.0121541)"
r="20.994516"
cy="547.18286"
cx="257.22266"
id="circle4859"
style="opacity:1;fill:url(#radialGradient4861);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.8;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
</clipPath>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient4733"
id="radialGradient4861"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.85037313,-0.14640233,0.12774601,0.74200851,47.860692,172.55092)"
cx="164.63748"
cy="531.20685"
fx="164.78966"
fy="519.24323"
r="21.990837" />
<filter
inkscape:collect="always"
style="color-interpolation-filters:sRGB"
id="filter5080"
x="-0.16258018"
width="1.3251604"
y="-0.092115037"
height="1.1842301">
<feGaussianBlur
inkscape:collect="always"
stdDeviation="3.753083949"
id="feGaussianBlur5082" />
</filter>
<clipPath
clipPathUnits="userSpaceOnUse"
id="clipPath5086">
<path
style="opacity:1;fill:url(#radialGradient5090);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.8;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="circle5088"
transform="rotate(-7.0121541)"
r="21.2975940704"
cy="547.763061523"
cx="261.940002441"
d="" />
</clipPath>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient5010"
id="radialGradient5090"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.94081295,-0.13201913,0.11519568,0.82092341,44.333431,128.77695)"
cx="164.63748"
cy="531.20685"
fx="165.19966"
fy="522.50458"
r="21.990837" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4304"
id="linearGradient4818"
gradientUnits="userSpaceOnUse"
x1="538.8783"
y1="1254.7184"
x2="538.8783"
y2="1463.9575"
gradientTransform="translate(0,-2501.2316)" />
<mask
maskUnits="userSpaceOnUse"
id="mask4814">
<rect
style="opacity:0.821;fill:url(#linearGradient4818);fill-opacity:1;fill-rule:nonzero;stroke:#ffffff;stroke-width:0.1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect4816"
width="534.79858"
height="279.44431"
x="273.93802"
y="-1314.6536"
transform="scale(1,-1)" />
</mask>
<clipPath
clipPathUnits="userSpaceOnUse"
id="clipPath1276">
<circle
style="opacity:1;fill:url(#radialGradient1280);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.8;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="circle1278"
cx="440.63205"
cy="722.66998"
r="85.281738"
transform="rotate(-7.0121541)" />
</clipPath>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient1176"
id="radialGradient1280"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(4.6443382,-1.2687174,1.1434364,4.1857275,-939.86166,-1313.7824)"
cx="163.84512"
cy="535.58044"
fx="164.13194"
fy="524.82343"
r="21.990837" />
<clipPath
clipPathUnits="userSpaceOnUse"
id="clipPath1713">
<path
style="opacity:1;fill:url(#radialGradient1717);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.8;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
d="m 518.8522,558.0521 c -0.82495,-10e-4 -1.65149,0.008 -2.48033,0.0264 -3.44325,0.0774 -6.88048,0.32689 -10.29881,0.7477 -5.92658,0.72912 -17.20559,3.60819 -17.20559,3.60819 l 6.91055,14.03625 c 0,0 8.00571,-1.85496 12.17321,-2.3677 2.90897,-0.35809 5.83402,-0.57046 8.76419,-0.63629 45.14453,-1.01173 82.94959,34.62 86.4993,76.24601 4.23839,49.70191 -36.47733,87.05581 -73.79756,91.14458 -0.12198,-4.28104 75.73972,20.55263 91.79648,-92.08877 -6.37636,-51.85265 -50.39015,-90.64928 -102.36144,-90.7164 z"
id="path1715"
inkscape:connector-curvature="0"
sodipodi:nodetypes="sccccccsccs" />
</clipPath>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient1176"
id="radialGradient1717"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(6.0139763,-1.6118698,1.4523165,5.4215643,-1286.7694,-2022.8268)"
cx="163.84512"
cy="535.58044"
fx="164.13194"
fy="524.82343"
r="21.990837" />
<clipPath
clipPathUnits="userSpaceOnUse"
id="clipPath1545">
<rect
style="opacity:1;fill:#eff0f1;fill-opacity:1;fill-rule:nonzero;stroke:#fcfcfc;stroke-width:1.84406;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect1547"
width="499.94531"
height="626.17499"
x="1503.0391"
y="115.11468" />
</clipPath>
<style
id="current-color-scheme"
type="text/css">
.ColorScheme-Text {
color:#f2f2f2;
}
</style>
<clipPath
clipPathUnits="userSpaceOnUse"
id="clipPath2129">
<rect
style="opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.91875;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect2131"
width="90.85743"
height="216.4682"
x="-4259.5063"
y="1335.9559"
ry="0.79583901"
transform="scale(-1,1)" />
</clipPath>
<clipPath
clipPathUnits="userSpaceOnUse"
id="clipPath3852">
<rect
style="opacity:0.547;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:#bb0000;stroke-width:1.10063;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect3854"
width="117.72582"
height="199.94704"
x="-5563.061"
y="1545.0594"
ry="0.52556229"
transform="scale(-1,1)" />
</clipPath>
<clipPath
clipPathUnits="userSpaceOnUse"
id="clipPath2142">
<path
style="opacity:0.892;fill:none;fill-opacity:0;fill-rule:nonzero;stroke:#fffafa;stroke-width:0.344063;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.374332;paint-order:markers fill stroke"
d="m 3696.4014,591.63757 v 219.42444 h 177.3285 V 591.63757 Z m 103.6395,111.05164 c 3.718,0 7.1638,0.70279 10.2319,2.15515 a 2.6924666,2.6924666 0 0 1 1.3074,3.53028 l -0.9723,2.18078 a 2.6924666,2.6924666 0 0 1 -3.6639,1.31104 c -2.1746,-1.08732 -4.3873,-1.61133 -6.7621,-1.61133 -3.7727,0 -6.2834,1.07384 -8.2617,3.27759 -1.9791,2.20458 -3.0579,5.25668 -3.0579,9.62951 0,4.51996 1.0495,7.63935 2.8803,9.76502 1.8165,2.10909 4.2427,3.16772 8.0603,3.16772 2.6784,0 5.0788,-0.34226 7.2271,-0.99792 a 2.6924666,2.6924666 0 0 1 3.4772,2.57446 v 2.13318 a 2.6924666,2.6924666 0 0 1 -1.7981,2.53967 c -2.6875,0.94525 -5.8344,1.36231 -9.4757,1.36231 -5.4481,0 -10.197,-1.89711 -13.5095,-5.62134 -3.3288,-3.74252 -4.8761,-8.88316 -4.8761,-14.9707 0,-3.86297 0.736,-7.40293 2.2705,-10.50843 a 2.6924666,2.6924666 0 0 1 0.01,-0.0128 c 1.5539,-3.10779 3.8721,-5.61989 6.8097,-7.33155 2.9591,-1.73083 6.391,-2.57263 10.1074,-2.57263 z m -48.219,0.35706 h 1.5418 a 2.6924666,2.6924666 0 0 1 2.5067,1.70837 l 13.656,34.80286 a 2.6924666,2.6924666 0 0 1 -2.5067,3.67492 h -2.7265 a 2.6924666,2.6924666 0 0 1 -2.5049,-1.70654 l -4.1418,-10.52673 h -10.4169 l -4.1656,10.53222 a 2.6924666,2.6924666 0 0 1 -2.5031,1.70105 h -2.6788 a 2.6924666,2.6924666 0 0 1 -2.4994,-3.69323 l 13.9398,-34.80286 a 2.6924666,2.6924666 0 0 1 2.4994,-1.69006 z m 77.2083,0.14099 h 2.4188 a 2.6924666,2.6924666 0 0 1 2.6916,2.69165 v 11.48437 l 12.7881,-13.34655 a 2.6924666,2.6924666 0 0 1 1.9446,-0.82947 h 3.0835 a 2.6924666,2.6924666 0 0 1 1.9336,4.56482 l -12.6251,13.02429 13.2458,18.17871 a 2.6924666,2.6924666 0 0 1 -2.1753,4.27734 h -2.9645 a 2.6924666,2.6924666 0 0 1 -2.1771,-1.10962 l -11.5594,-15.9082 -1.4942,1.31653 v 13.00964 a 2.6924666,2.6924666 0 0 1 -2.6916,2.69165 h -2.4188 a 2.6924666,2.6924666 0 0 1 -2.6917,-2.69165 v -34.66186 a 2.6924666,2.6924666 0 0 1 2.6917,-2.69165 z m -76.4942,14.30786 -2.3181,5.93994 h 4.5612 z"
id="path2144"
inkscape:connector-curvature="0" />
</clipPath>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4182"
id="linearGradient1962"
x1="4533.3271"
y1="2365.7585"
x2="4573.1943"
y2="2342.7412"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(3.753257,0,0,3.753257,-16367.842,-8500.4241)" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4733"
id="linearGradient1977"
gradientUnits="userSpaceOnUse"
x1="1710.802"
y1="4975.228"
x2="1652.1422"
y2="4926.0415"
gradientTransform="matrix(0,1.6537964,-1.6537964,0,8966.582,-2491.3872)" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4733"
id="linearGradient1983"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0,4.4670474,-4.4670474,0,22821.673,-7136.1767)"
x1="1710.802"
y1="4975.228"
x2="1652.1422"
y2="4926.0415" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4733"
id="linearGradient1987"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0,-4.4670474,-4.4670474,0,22821.673,7810.8518)"
x1="1710.802"
y1="4975.228"
x2="1652.1422"
y2="4926.0415" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4733"
id="linearGradient1991"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0,-0.6718043,0.6718042,0,-2481.8694,1362.3567)"
x1="1632.0477"
y1="4981.3447"
x2="1693.9222"
y2="4946.9316" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2009"
id="linearGradient2011"
x1="4620.3696"
y1="2304.967"
x2="4567.6602"
y2="2342.3162"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.6537964,0,0,1.6537964,-6852.8864,-3543.355)" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2009"
id="linearGradient2016"
gradientUnits="userSpaceOnUse"
x1="4620.3696"
y1="2304.967"
x2="4539.2959"
y2="2351.7751"
gradientTransform="matrix(1.6537964,0,0,1.6537964,-6815.2795,-3580.97)" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2009"
id="linearGradient2024"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.6537964,0,0,1.6537964,-6773.4163,-3603.767)"
x1="4620.3696"
y1="2304.967"
x2="4539.2959"
y2="2351.7751" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2009"
id="linearGradient2028"
gradientUnits="userSpaceOnUse"
x1="4620.3696"
y1="2304.967"
x2="4567.6602"
y2="2342.3162"
gradientTransform="matrix(0,1.6537964,-1.6537964,0,4545.1713,-7297.62)" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2009"
id="linearGradient2032"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0,-1.6537964,-1.6537964,0,4545.1714,7972.7634)"
x1="4620.3696"
y1="2304.967"
x2="4567.6602"
y2="2342.3162" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2009"
id="linearGradient2036"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0,-1.6537964,1.6537964,0,-3098.608,7972.7634)"
x1="4620.3696"
y1="2304.967"
x2="4567.6602"
y2="2342.3162" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2009"
id="linearGradient2184"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0,-2.6306245,2.6306245,0,-4989.2651,12512.226)"
x1="4620.3696"
y1="2304.967"
x2="4567.6602"
y2="2342.3162" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2009"
id="linearGradient2186"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0,-2.6306245,-2.6306245,0,7169.374,12512.226)"
x1="4620.3696"
y1="2304.967"
x2="4567.6602"
y2="2342.3162" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2009"
id="linearGradient2188"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0,2.6306245,-2.6306245,0,7169.3738,-11777.732)"
x1="4620.3696"
y1="2304.967"
x2="4567.6602"
y2="2342.3162" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2009"
id="linearGradient2190"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(2.6306245,0,0,2.6306245,-10834.629,-5902.075)"
x1="4620.3696"
y1="2304.967"
x2="4539.2959"
y2="2351.7751" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2009"
id="linearGradient2192"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(2.6306245,0,0,2.6306245,-10901.219,-5865.8128)"
x1="4620.3696"
y1="2304.967"
x2="4539.2959"
y2="2351.7751" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4733"
id="linearGradient2194"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0,-1.0686109,1.0686107,0,-4008.2449,1997.3295)"
x1="1632.0477"
y1="4981.3447"
x2="1693.9222"
y2="4946.9316" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4733"
id="linearGradient2196"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0,2.6306245,-2.6306245,0,14202.326,-4132.6592)"
x1="1710.802"
y1="4975.228"
x2="1652.1422"
y2="4926.0415" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2009"
id="linearGradient2198"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(2.6306245,0,0,2.6306245,-10961.038,-5805.9802)"
x1="4620.3696"
y1="2304.967"
x2="4567.6602"
y2="2342.3162" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4733"
id="linearGradient2200"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0,-7.1055448,-7.1055448,0,36241.038,12254.68)"
x1="1710.802"
y1="4975.228"
x2="1652.1422"
y2="4926.0415" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4733"
id="linearGradient2202"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0,7.1055448,-7.1055448,0,36241.038,-11520.931)"
x1="1710.802"
y1="4975.228"
x2="1652.1422"
y2="4926.0415" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4182"
id="linearGradient2204"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(5.9701483,0,0,5.9701483,-26096.079,-13690.983)"
x1="4533.3271"
y1="2365.7585"
x2="4573.1943"
y2="2342.7412" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1"
inkscape:cx="1020.3148"
inkscape:cy="-114.96383"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
showguides="true"
inkscape:guide-bbox="true"
inkscape:window-width="1714"
inkscape:window-height="1203"
inkscape:window-x="552"
inkscape:window-y="164"
inkscape:window-maximized="0"
inkscape:object-nodes="true"
inkscape:snap-global="true"
inkscape:snap-page="false"
inkscape:lockguides="false"
inkscape:document-rotation="0"
fit-margin-top="30"
fit-margin-left="30"
fit-margin-bottom="30"
fit-margin-right="30">
<inkscape:grid
type="xygrid"
id="grid1761"
originx="151.86636"
originy="-166.49869" />
<sodipodi:guide
position="4396.866,-873.03128"
orientation="0,1"
id="guide12660"
inkscape:locked="false" />
<sodipodi:guide
position="4356.202,-851.11722"
orientation="1,0"
id="guide12666"
inkscape:locked="false" />
<sodipodi:guide
position="4387.784,-904.14456"
orientation="0,1"
id="guide12692"
inkscape:locked="false" />
<sodipodi:guide
position="4386.9051,-921.42972"
orientation="1,0"
id="guide12694"
inkscape:locked="false" />
<sodipodi:guide
position="4372.1395,-876.42972"
orientation="1,0"
id="guide12696"
inkscape:locked="false" />
<sodipodi:guide
position="968.67798,222.36216"
orientation="-0.70710678,-0.70710678"
id="guide2114" />
</sodipodi:namedview>
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Camada 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(151.86636,-166.4987)">
<path
clip-path="url(#clipPath5086)"
sodipodi:nodetypes="cscssscscccscc"
inkscape:connector-curvature="0"
id="path5279"
d="m 338.65051,492.26754 6.78652,6.38162 c 3.12988,2.94314 3.15859,8.98109 1.39414,16.79863 -2.23777,8.35146 -8.50357,13.53359 -15.111,15.04217 -6.31742,1.44237 -13.30427,-0.34272 -17.90992,-4.61744 -1.44603,-1.34212 -2.21872,-3.81133 -1.67407,-5.84402 0.60965,-2.27523 0.73619,-5.45316 2.06641,-6.24219 -0.76814,0.26722 -1.70405,0.57479 -2.82422,1.63086 -1.88644,1.77848 -1.96369,4.28221 -4.42969,4.97266 0.25165,-7.08965 -4.15819,-10.96822 -4.46346,-14.11351 -2.9188,16.12091 12.65231,34.52007 31.91417,29.35887 12.41302,-3.09834 19.81219,-12.21234 22.25881,-22.50042 1.41285,-5.94104 0.97674,-12.06732 -0.30664,-17.20899 z"
style="opacity:0.656;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.8;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;filter:url(#filter5080)"
transform="translate(0,171.82695)" />
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:18.75px;line-height:125%;font-family:'Helvetica Neue LT Std';-inkscape-font-specification:'Helvetica Neue LT Std, Normal';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.9375px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="5413.5938"
y="1750.3309"
id="text3551" />
<flowRoot
xml:space="preserve"
id="flowRoot3585"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:20px;line-height:125%;font-family:'Helvetica Neue LT Std';-inkscape-font-specification:'Helvetica Neue LT Std, Normal';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"><flowRegion
id="flowRegion3587"><rect
id="rect3589"
width="638"
height="558"
x="7608"
y="2084.51977539" /></flowRegion><flowPara
id="flowPara3591" /></flowRoot>
<flowRoot
xml:space="preserve"
id="flowRoot3593"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:20px;line-height:125%;font-family:'Helvetica Neue LT Std';-inkscape-font-specification:'Helvetica Neue LT Std, Normal';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"><flowRegion
id="flowRegion3595"><rect
id="rect3597"
width="1124"
height="944"
x="6470"
y="1612.51965332" /></flowRegion><flowPara
id="flowPara3599" /></flowRoot>
<path
id="rect1131"
style="opacity:1;fill:url(#linearGradient1962);fill-opacity:1;stroke:#ffffff;stroke-width:0.68156246;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers"
d="m 630.35714,244.02067 h 117.49083 l 68.9633,68.9633 v 117.491 H 630.35714 Z"
sodipodi:nodetypes="cccccc" />
<path
id="path1981"
style="opacity:0.404507;fill:url(#linearGradient1983);fill-opacity:1;stroke:none;stroke-width:0.775215;stroke-linecap:square;stroke-linejoin:round;paint-order:stroke fill markers"
d="m 816.8116,312.98431 v 117.66976 l -186.63323,-186.63323 117.66977,0 z"
sodipodi:nodetypes="ccccc" />
<path
id="path1985"
style="opacity:0.404507;fill:url(#linearGradient1987);fill-opacity:1;stroke:none;stroke-width:0.775215;stroke-linecap:square;stroke-linejoin:round;paint-order:stroke fill markers"
d="M 816.8116,430.65407 V 312.98431 L 782.11165,278.71335 630.17837,430.65407 Z"
sodipodi:nodetypes="ccccc" />
<path
style="fill:none;stroke:url(#linearGradient2011);stroke-width:0.46513;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 782.30514,278.53475 -59.0235,59.03688"
id="path2003"
sodipodi:nodetypes="cc" />
<path
id="path1975"
style="opacity:1;fill:url(#linearGradient1977);fill-opacity:1;stroke:#ffffff;stroke-width:0.68156246;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers"
d="m 819.91214,240.91981 v 69.0956 l -69.09561,-69.0956 z"
sodipodi:nodetypes="cccc" />
<path
id="path1989"
style="opacity:1;fill:url(#linearGradient1991);fill-opacity:1;stroke:#ffffff;stroke-width:0.68156246;stroke-linecap:square;stroke-linejoin:miter;stroke-opacity:1;paint-order:stroke fill markers;stroke-miterlimit:4;stroke-dasharray:none"
d="m 827.46585,252.44015 v -28.06774 l 28.06807,28.06774 z"
sodipodi:nodetypes="cccc" />
<path
style="fill:none;stroke:url(#linearGradient2016);stroke-width:0.46513;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 819.91214,240.91981 785.44752,275.3922"
id="path2014"
sodipodi:nodetypes="cc" />
<path
style="fill:none;stroke:url(#linearGradient2024);stroke-width:0.46513;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 841.59952,238.30333 -14.13367,14.13682"
id="path2022"
sodipodi:nodetypes="cc" />
<path
style="fill:none;stroke:url(#linearGradient2028);stroke-width:0.46513;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 723.28164,337.57163 -59.03688,-59.0235"
id="path2026"
sodipodi:nodetypes="cc" />
<path
style="fill:none;stroke:url(#linearGradient2032);stroke-width:0.46513;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 723.28164,337.57163 -59.03688,59.0235"
id="path2030"
sodipodi:nodetypes="cc" />
<path
style="fill:none;stroke:url(#linearGradient2036);stroke-width:0.46513;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 723.28164,337.57163 59.0369,59.0235"
id="path2034"
sodipodi:nodetypes="cc" />
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:93.0993px;line-height:125%;font-family:'Helvetica Neue LT Std';-inkscape-font-specification:'Helvetica Neue LT Std, Normal';text-align:start;letter-spacing:6.17598px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#292929;fill-opacity:1;stroke:none;stroke-width:8.58756px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="-81.289284"
y="449.83054"
id="text2108"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90"><tspan
sodipodi:role="line"
id="tspan2106"
x="-81.289284"
y="449.83054"
style="font-style:normal;font-variant:normal;font-weight:300;font-stretch:normal;font-family:'Open Sans';-inkscape-font-specification:'Open Sans Light';letter-spacing:6.17598px;word-spacing:10.7995px;fill:#292929;fill-opacity:1;stroke-width:8.58756px">KDDockWidgets</tspan></text>
<path
id="path2162"
style="opacity:1;fill:url(#linearGradient2204);fill-opacity:1;stroke:#ffffff;stroke-width:1.08414;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers"
d="M 942.24318,218.43936 H 1129.131 l 109.697,109.69702 v 186.888 H 942.24318 Z"
sodipodi:nodetypes="cccccc"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90" />
<path
id="path2164"
style="opacity:0.404507;fill:url(#linearGradient2202);fill-opacity:1;stroke:none;stroke-width:1.2331;stroke-linecap:square;stroke-linejoin:round;paint-order:stroke fill markers"
d="M 1238.8285,328.13692 V 515.30927 L 941.95882,218.43962 h 187.17238 z"
sodipodi:nodetypes="ccccc"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90" />
<path
id="path2166"
style="opacity:0.404507;fill:url(#linearGradient2200);fill-opacity:1;stroke:none;stroke-width:1.2331;stroke-linecap:square;stroke-linejoin:round;paint-order:stroke fill markers"
d="M 1238.8285,515.30927 V 328.13692 l -55.1957,-54.51338 -241.67398,241.68573 z"
sodipodi:nodetypes="ccccc"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90" />
<path
style="fill:none;stroke:url(#linearGradient2198);stroke-width:0.739863;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 1183.9405,273.33945 -93.8862,93.90749"
id="path2168"
sodipodi:nodetypes="cc"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90" />
<path
id="path2170"
style="opacity:1;fill:url(#linearGradient2196);fill-opacity:1;stroke:#ffffff;stroke-width:1.08414;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers"
d="M 1243.7603,213.50695 V 323.41441 L 1133.8529,213.50695 Z"
sodipodi:nodetypes="cccc"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90" />
<path
id="path2172"
style="opacity:1;fill:url(#linearGradient2194);fill-opacity:1;stroke:#ffffff;stroke-width:1.08414;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers"
d="m 1255.7759,231.83187 v -44.64618 l 44.6465,44.64618 z"
sodipodi:nodetypes="cccc"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90" />
<path
style="fill:none;stroke:url(#linearGradient2192);stroke-width:0.739863;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 1243.7603,213.50695 -54.8213,54.83378"
id="path2174"
sodipodi:nodetypes="cc"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90" />
<path
style="fill:none;stroke:url(#linearGradient2190);stroke-width:0.739863;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 1278.2576,209.34502 -22.4817,22.48685"
id="path2176"
sodipodi:nodetypes="cc"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90" />
<path
style="fill:none;stroke:url(#linearGradient2188);stroke-width:0.739863;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 1090.0543,367.24694 -93.90751,-93.8862"
id="path2178"
sodipodi:nodetypes="cc"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90" />
<path
style="fill:none;stroke:url(#linearGradient2186);stroke-width:0.739863;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 1090.0543,367.24694 -93.90751,93.8862"
id="path2180"
sodipodi:nodetypes="cc"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90" />
<path
style="fill:none;stroke:url(#linearGradient2184);stroke-width:0.739863;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 1090.0543,367.24694 93.9075,93.8862"
id="path2182"
sodipodi:nodetypes="cc"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

1
kddockwidgets-rpmlintrc Normal file
View File

@@ -0,0 +1 @@
addFilter("E: shlib-policy-name-error")

View File

@@ -1,10 +1,10 @@
Format: 1.0 Format: 1.0
Source: kddockwidgets Source: kddockwidgets
Version: 0.99.9 Version: 1.2.0-1
Binary: kddockwidgets Binary: kddockwidgets
Maintainer: Allen Winter <allen.winter@kdab.com> Maintainer: Allen Winter <allen.winter@kdab.com>
Architecture: any Architecture: any
Build-Depends: debhelper (>=9), cdbs, cmake, qt5-default, qtbase5-dev, libqt5x11extras5-dev Build-Depends: debhelper (>=9), cdbs, cmake, qt5-default, qtbase5-dev, libqt5x11extras5-dev
Files: Files:
00000000000000000000000000000000 00000 kddockwidgets-0.99.9.tar.gz 00000000000000000000000000000000 00000 kddockwidgets-1.2.0.tar.gz

View File

@@ -1,9 +1,10 @@
Name: kddockwidgets Name: kddockwidgets
Version: 0.99.9 Version: 1.2.0
Release: 1 Release: 1
Summary: KDAB's Dock Widget Framework for Qt Summary: KDAB's Dock Widget Framework for Qt
Source0: %{name}-%{version}.tar.gz Source0: %{name}-%{version}.tar.gz
Source1: %{name}-%{version}.tar.gz.asc Source1: %{name}-%{version}.tar.gz.asc
Source2: %{name}-rpmlintrc
URL: https://github.com/KDAB/KDDockWidgets URL: https://github.com/KDAB/KDDockWidgets
Group: System/Libraries Group: System/Libraries
License: GPL-2.0-only OR GPL-3.0-only 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) %defattr(-,root,root)
%{_prefix}/share/doc/KDDockWidgets %{_prefix}/share/doc/KDDockWidgets
%{_libdir}/libkddockwidgets.so.* %{_libdir}/libkddockwidgets.so.*
%{_libdir}/libkddockwidgets_multisplitter.so.*
%files devel %files devel
%defattr(-,root,root,-) %defattr(-,root,root,-)
@@ -85,8 +85,15 @@ cmake . -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release
%dir %{_libdir}/cmake/KDDockWidgets %dir %{_libdir}/cmake/KDDockWidgets
%{_libdir}/cmake/KDDockWidgets/* %{_libdir}/cmake/KDDockWidgets/*
%{_libdir}/libkddockwidgets.so %{_libdir}/libkddockwidgets.so
%{_libdir}/libkddockwidgets_multisplitter.so
%changelog %changelog
* Thu Aug 06 2020 Allen Winter <allen.winter@kdb.com> 0.99.9 * Thu Dec 17 2020 Allen Winter <allen.winter@kdab.com> 1.2.0
1.2.0 final
* Fri Dec 11 2020 Allen Winter <allen.winter@kdab.com> 1.1.1
1.1.1 final
* Mon Oct 26 2020 Allen Winter <allen.winter@kdab.com> 1.1.0
1.1.0 final
* Wed Sep 02 2020 Allen Winter <allen.winter@kdab.com> 1.0.0
1.0.0 final
* Thu Aug 06 2020 Allen Winter <allen.winter@kdab.com> 0.99.9
1.0.0 release candidate 1.0.0 release candidate

View File

@@ -1,7 +1,7 @@
# #
# This file is part of KDDockWidgets. # 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> # Author: Renato Araujo Oliveira Filho <renato.araujo@kdab.com>
# #
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only # 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.") 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(Python3 ${PYTHON_VERSION} REQUIRED COMPONENTS Interpreter Development)
if (${PROJECT_NAME}_QT6)
find_package(Shiboken6 REQUIRED)
find_package(PySide6 ${Qt5Widgets_VERSION} EXACT REQUIRED)
include(PySide6ModuleBuild)
set(PYSIDE_MAJOR_VERSION "6")
else()
find_package(Shiboken2 REQUIRED) find_package(Shiboken2 REQUIRED)
find_package(PySide2 ${Qt5Widgets_VERSION} EXACT REQUIRED) find_package(PySide2 ${Qt5Widgets_VERSION} EXACT REQUIRED)
include(PySide2ModuleBuild) include(PySide2ModuleBuild)
set(PYSIDE_MAJOR_VERSION "2")
endif()
add_subdirectory(PyKDDockWidgets) add_subdirectory(PyKDDockWidgets)

View File

@@ -1,7 +1,7 @@
# #
# This file is part of KDDockWidgets. # 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> # Author: Renato Araujo Oliveira Filho <renato.araujo@kdab.com>
# #
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only # 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_mainwindowbase_wrapper.h
${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets/kddockwidgets_mainwindow_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets/kddockwidgets_mainwindow_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets/kddockwidgets_mainwindow_wrapper.h ${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 # global module wrapper
${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets/kddockwidgets_module_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets/kddockwidgets_module_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets/kddockwidgets_python.h ${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' # Include flags/path that will be set in 'target_include_directories'
set(PyKDDockWidgets_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' # Libraries that will be necessary to link the target, this will used in the command 'target_link_libraries'
set(PyKDDockWidgets_target_link_libraries set(PyKDDockWidgets_target_link_libraries
KDAB::kddockwidgets KDAB::kddockwidgets
Qt5::Core Qt${QT_MAJOR_VERSION}::Core
Qt5::Gui Qt${QT_MAJOR_VERSION}::Gui
Qt5::Widgets Qt${QT_MAJOR_VERSION}::Widgets
) )
# changes on these files should trigger a new generation # changes on these files should trigger a new generation
@@ -74,8 +71,8 @@ create_python_bindings(
${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}
) )
# Make moduled import from build dir works # Make module import from build dir work
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/__init__.py ${CMAKE_CURRENT_BINARY_DIR}/__init__.py) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/__init__.py.cmake ${CMAKE_CURRENT_BINARY_DIR}/__init__.py @ONLY)
# install # 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)

View File

@@ -1,7 +1,7 @@
# #
# This file is part of KDDockWidgets. # 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> # Author: Renato Araujo Oliveira Filho <renato.araujo@kdab.com>
# #
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only # 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. # Contact KDAB at <info@kdab.com> for commercial licensing options.
# #
import sys
__all__ = ['KDDockWidgets'] __all__ = ['KDDockWidgets']
# Preload PySide2 libraries to avoid missing libraries while loading KDDockWidgets # Preload PySide2 libraries to avoid missing libraries while loading KDDockWidgets
try: 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: except Exception:
print("Failed to load PySide") print("Failed to load PySide")
raise 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

View File

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. 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> Author: Renato Araujo Oliveira Filho <renato.araujo@kdab.com>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only 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 this will be used in some part of c++ to skip problematic parts
#define PYTHON_BINDINGS #define PYTHON_BINDINGS
#include <MainWindowBase.h> #ifndef QT_WIDGETS_LIB
#include <MainWindow.h> # define QT_WIDGETS_LIB
#include <DockWidgetBase.h> #endif
#include <DockWidget.h>
#include <kddockwidgets/MainWindowBase.h>
#include <kddockwidgets/MainWindow.h>
#include <kddockwidgets/DockWidgetBase.h>
#include <kddockwidgets/DockWidget.h>

View File

@@ -6,19 +6,28 @@
typesystem because it already include gui and core typesystem --> typesystem because it already include gui and core typesystem -->
<load-typesystem name="typesystem_widgets.xml" generate="no"/> <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 --> <!-- 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 <!-- 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 --> otherwise shiboken will ignore the function and will fail to create a wrapper -->
<primitive-type name="DropAreaWithCentralFrame"/> <primitive-type name="DropAreaWithCentralFrame"/>
<primitive-type name="SideBar"/>
<primitive-type name="InitialOption"/>
<!-- Some plublic enum and flags --> <!-- Some plublic enum and flags -->
<enum-type name="Location"/> <enum-type name="Location"/>
<enum-type name="MainWindowOption" flags="MainWindowOptions"/> <enum-type name="MainWindowOption" flags="MainWindowOptions"/>
<enum-type name="AddingOption"/> <enum-type name="InitialVisibilityOption"/>
<enum-type name="RestoreOption" flags="RestoreOptions"/> <enum-type name="RestoreOption" flags="RestoreOptions"/>
<enum-type name="DefaultSizeMode"/> <enum-type name="DefaultSizeMode"/>
<enum-type name="FrameOption" flags="FrameOptions"/> <enum-type name="FrameOption" flags="FrameOptions"/>
<enum-type name="DropIndicatorType"/>
<enum-type name="SideBarLocation"/>
<enum-type name="TitleBarButtonType"/>
<!-- our classes <!-- our classes
For class we can use two types: For class we can use two types:
@@ -32,6 +41,7 @@
<!-- this class contains a internal enum, so it should be declared <!-- this class contains a internal enum, so it should be declared
inside of the object-type --> inside of the object-type -->
<enum-type name="Option" flags="Options" /> <enum-type name="Option" flags="Options" />
<enum-type name="IconPlace" flags="IconPlaces" />
</object-type> </object-type>
<object-type name="DockWidget" /> <object-type name="DockWidget" />

View File

@@ -1,7 +1,7 @@
# #
# This file is part of KDDockWidgets. # 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> # Author: Renato Araujo Oliveira Filho <renato.araujo@kdab.com>
# #
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only # 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. # Contact KDAB at <info@kdab.com> for commercial licensing options.
# #
from PySide2 import QtCore, QtWidgets, QtGui
from PyKDDockWidgets import KDDockWidgets from PyKDDockWidgets import KDDockWidgets
from PySide import QtCore, QtWidgets, QtGui
from MyWidget1 import MyWidget1 from MyWidget1 import MyWidget1
from MyWidget2 import MyWidget2 from MyWidget2 import MyWidget2
from MyWidget3 import MyWidget3 from MyWidget3 import MyWidget3

View File

@@ -1,7 +1,7 @@
# #
# This file is part of KDDockWidgets. # 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> # Author: Renato Araujo Oliveira Filho <renato.araujo@kdab.com>
# #
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only # 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. # 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): class MyWidget(QtWidgets.QWidget):
s_images = {} s_images = {}

View File

@@ -1,7 +1,7 @@
# #
# This file is part of KDDockWidgets. # 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> # Author: Renato Araujo Oliveira Filho <renato.araujo@kdab.com>
# #
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only # 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. # 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 from MyWidget import MyWidget

View File

@@ -1,7 +1,7 @@
# #
# This file is part of KDDockWidgets. # 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> # Author: Renato Araujo Oliveira Filho <renato.araujo@kdab.com>
# #
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only # 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. # 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 from MyWidget import MyWidget

View File

@@ -1,7 +1,7 @@
# #
# This file is part of KDDockWidgets. # 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> # Author: Renato Araujo Oliveira Filho <renato.araujo@kdab.com>
# #
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only # 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. # 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 from MyWidget import MyWidget

View File

@@ -1,7 +1,7 @@
# #
# This file is part of KDDockWidgets. # 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> # Author: Renato Araujo Oliveira Filho <renato.araujo@kdab.com>
# #
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only # 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. # Contact KDAB at <info@kdab.com> for commercial licensing options.
# #
from PySide2 import QtWidgets, QtCore
from PyKDDockWidgets import KDDockWidgets from PyKDDockWidgets import KDDockWidgets
from MyMainWindow import MyMainWindow from MyMainWindow import MyMainWindow
from PySide import QtWidgets, QtCore
import sys import sys
import rc_assets import rc_assets

View File

@@ -1,7 +1,7 @@
# #
# This file is part of KDDockWidgets. # 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> # Author: Sergio Martins <sergio.martins@kdab.com>
# #
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only # SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
@@ -23,29 +23,68 @@ add_definitions(-DQT_NO_SIGNALS_SLOTS_KEYWORDS
set(DOCKSLIBS_SRCS set(DOCKSLIBS_SRCS
Config.cpp Config.cpp
Config.h
Qt5Qt6Compat_p.h Qt5Qt6Compat_p.h
FocusScope.cpp FocusScope.cpp
FocusScope.h
FrameworkWidgetFactory.cpp FrameworkWidgetFactory.cpp
FrameworkWidgetFactory.h
DockWidgetBase.cpp DockWidgetBase.cpp
DockWidgetBase.h
MainWindowBase.cpp MainWindowBase.cpp
MainWindowBase.h
LayoutSaver.cpp LayoutSaver.cpp
LayoutSaver.h
LayoutSaver_p.h
private/MultiSplitter.cpp private/MultiSplitter.cpp
private/MultiSplitter_p.h
private/Position.cpp private/Position.cpp
private/ObjectViewer.cpp private/Position_p.h
private/DropIndicatorOverlayInterface.cpp private/DropIndicatorOverlayInterface.cpp
private/DropIndicatorOverlayInterface_p.h
private/DropArea.cpp private/DropArea.cpp
private/DropArea_p.h
private/FloatingWindow.cpp private/FloatingWindow.cpp
private/FloatingWindow_p.h
private/Logging.cpp private/Logging.cpp
private/Logging_p.h
private/TabWidget.cpp
private/TabWidget_p.h
private/TitleBar.cpp private/TitleBar.cpp
private/TitleBar_p.h
private/SideBar.cpp
private/SideBar_p.h
private/DockRegistry.cpp private/DockRegistry.cpp
private/DockRegistry_p.h
private/Draggable.cpp private/Draggable.cpp
private/Draggable_p.h
private/WindowBeingDragged.cpp private/WindowBeingDragged.cpp
private/WindowBeingDragged_p.h
private/DragController.cpp private/DragController.cpp
private/DragController_p.h
private/Frame.cpp private/Frame.cpp
private/Frame_p.h
private/DropAreaWithCentralFrame.cpp private/DropAreaWithCentralFrame.cpp
private/DropAreaWithCentralFrame_p.h
private/WidgetResizeHandler.cpp private/WidgetResizeHandler.cpp
private/WidgetResizeHandler_p.h
private/indicators/NullIndicators.cpp
private/indicators/NullIndicators_p.h
private/indicators/ClassicIndicators.cpp private/indicators/ClassicIndicators.cpp
private/indicators/ClassicIndicators_p.h
private/indicators/ClassicIndicatorsWindow.cpp 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 set(DOCKS_INSTALLABLE_INCLUDES
@@ -54,6 +93,7 @@ set(DOCKS_INSTALLABLE_INCLUDES
FrameworkWidgetFactory.h FrameworkWidgetFactory.h
DockWidgetBase.h DockWidgetBase.h
KDDockWidgets.h KDDockWidgets.h
Qt5Qt6Compat_p.h
FocusScope.h FocusScope.h
QWidgetAdapter.h QWidgetAdapter.h
LayoutSaver.h LayoutSaver.h
@@ -61,49 +101,91 @@ set(DOCKS_INSTALLABLE_INCLUDES
) )
set(DOCKS_INSTALLABLE_PRIVATE_INCLUDES set(DOCKS_INSTALLABLE_PRIVATE_INCLUDES
private/DragController_p.h
private/Draggable_p.h private/Draggable_p.h
private/DropIndicatorOverlayInterface_p.h private/DropIndicatorOverlayInterface_p.h
private/FloatingWindow_p.h private/FloatingWindow_p.h
private/Frame_p.h private/Frame_p.h
private/SideBar_p.h
private/TitleBar_p.h private/TitleBar_p.h
private/WindowBeingDragged_p.h
private/DockRegistry_p.h
private/TabWidget_p.h
) )
set(DOCKS_INSTALLABLE_PRIVATE_WIDGET_INCLUDES set(DOCKS_INSTALLABLE_PRIVATE_WIDGET_INCLUDES
private/widgets/QWidgetAdapter_widgets_p.h private/widgets/QWidgetAdapter_widgets_p.h
private/widgets/TitleBarWidget_p.h private/widgets/TitleBarWidget_p.h
private/widgets/SideBarWidget_p.h
private/widgets/FloatingWindowWidget_p.h private/widgets/FloatingWindowWidget_p.h
private/widgets/FrameWidget_p.h private/widgets/FrameWidget_p.h
private/widgets/TabBarWidget_p.h private/widgets/TabBarWidget_p.h
private/widgets/TabWidgetWidget_p.h private/widgets/TabWidgetWidget_p.h
private/widgets/TabWidget_p.h
) )
if(OPTION_QTQUICK) if(${PROJECT_NAME}_QTQUICK)
set(DOCKSLIBS_SRCS ${DOCKSLIBS_SRCS} 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.cpp
private/quick/QWidgetAdapter_quick_p.h
private/quick/FloatingWindowQuick.cpp 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.cpp
private/quick/TitleBarQuick_p.h
private/quick/QmlTypes.cpp private/quick/QmlTypes.cpp
private/quick/QmlTypes.h
private/quick/FrameQuick.cpp private/quick/FrameQuick.cpp
private/quick/FrameQuick_p.h
private/quick/RubberBandQuick.cpp
private/quick/RubberBandQuick.h
private/quick/MainWindowQuick.cpp private/quick/MainWindowQuick.cpp
private/quick/MainWindowQuick_p.h
private/quick/MainWindowWrapper.cpp private/quick/MainWindowWrapper.cpp
) private/quick/MainWindowWrapper_p.h
private/multisplitter/Widget_quick.cpp
qt5_add_resources(RESOURCES_QUICK ${CMAKE_CURRENT_SOURCE_DIR}/qtquick.qrc) 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() else()
set(DOCKSLIBS_SRCS ${DOCKSLIBS_SRCS} set(DOCKSLIBS_SRCS ${DOCKSLIBS_SRCS}
private/DebugWindow.cpp private/DebugWindow.cpp
private/DebugWindow_p.h
private/ObjectViewer.cpp
private/ObjectViewer_p.h
MainWindow.cpp 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.cpp
private/widgets/TabBarWidget_p.h
private/widgets/FloatingWindowWidget.cpp private/widgets/FloatingWindowWidget.cpp
private/widgets/FloatingWindowWidget_p.h
private/widgets/FrameWidget.cpp 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.cpp
private/widgets/TabWidgetWidget_p.h
private/widgets/TitleBarWidget.cpp private/widgets/TitleBarWidget.cpp
private/widgets/TitleBarWidget_p.h
private/widgets/DockWidget.cpp private/widgets/DockWidget.cpp
private/widgets/QWidgetAdapter_widgets.cpp private/widgets/QWidgetAdapter_widgets.cpp
private/widgets/QWidgetAdapter_widgets_p.h
private/indicators/SegmentedIndicators.cpp private/indicators/SegmentedIndicators.cpp
private/indicators/SegmentedIndicators_p.h
# private/indicators/AnimatedIndicators.cpp # private/indicators/AnimatedIndicators.cpp
) )
@@ -121,9 +203,7 @@ else()
set(IS_CLANG_BUILD FALSE) set(IS_CLANG_BUILD FALSE)
endif() endif()
add_subdirectory(private/multisplitter) set(RESOURCES ${CMAKE_CURRENT_SOURCE_DIR}/kddockwidgets_resources.qrc)
qt5_add_resources(RESOURCES ${CMAKE_CURRENT_SOURCE_DIR}/resources.qrc)
add_library(kddockwidgets ${KDDockWidgets_LIBRARY_MODE} ${DOCKSLIBS_SRCS} ${DOCKS_INSTALLABLE_INCLUDES} ${RESOURCES} ${RESOURCES_QUICK}) add_library(kddockwidgets ${KDDockWidgets_LIBRARY_MODE} ${DOCKSLIBS_SRCS} ${DOCKS_INSTALLABLE_INCLUDES} ${RESOURCES} ${RESOURCES_QUICK})
add_library(KDAB::kddockwidgets ALIAS kddockwidgets) add_library(KDAB::kddockwidgets ALIAS kddockwidgets)
@@ -132,12 +212,11 @@ set_compiler_flags(kddockwidgets)
target_include_directories(kddockwidgets target_include_directories(kddockwidgets
PUBLIC PUBLIC
$<INSTALL_INTERFACE:include> $<INSTALL_INTERFACE:include>
$<INSTALL_INTERFACE:include/kddockwidgets>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/fwd_headers> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/fwd_headers>
PRIVATE PRIVATE
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/private ${CMAKE_CURRENT_SOURCE_DIR}/private
${CMAKE_CURRENT_SOURCE_DIR}/private/multisplitter/
) )
target_compile_definitions(kddockwidgets target_compile_definitions(kddockwidgets
@@ -154,25 +233,36 @@ else()
endif() endif()
if(CMAKE_COMPILER_IS_GNUCXX OR IS_CLANG_BUILD) 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) if(IS_CLANG_BUILD)
target_compile_options(kddockwidgets PRIVATE -Wweak-vtables) target_compile_options(kddockwidgets PRIVATE -Wweak-vtables)
endif() endif()
endif() endif()
if(OPTION_QTQUICK) if(${PROJECT_NAME}_QTQUICK)
target_link_libraries(kddockwidgets PUBLIC Qt5::Widgets Qt5::Quick Qt5::QuickControls2 kddockwidgets_multisplitter) target_link_libraries(kddockwidgets PUBLIC Qt${QT_MAJOR_VERSION}::Widgets Qt${QT_MAJOR_VERSION}::Quick Qt${QT_MAJOR_VERSION}::QuickControls2)
else() else()
target_link_libraries(kddockwidgets PUBLIC Qt5::Widgets kddockwidgets_multisplitter) target_link_libraries(kddockwidgets PUBLIC Qt${QT_MAJOR_VERSION}::Widgets)
endif() endif()
if(NOT WIN32 AND NOT APPLE) if (WIN32)
find_package(Qt5X11Extras) target_link_libraries(kddockwidgets PRIVATE Qt${QT_MAJOR_VERSION}::GuiPrivate dwmapi)
target_link_libraries(kddockwidgets PUBLIC Qt5::X11Extras) 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() 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 #version libraries on Windows
if(WIN32) if(WIN32)
set(postfix ${${PROJECT_NAME}_VERSION_MAJOR}) set(postfix ${${PROJECT_NAME}_VERSION_MAJOR})
@@ -200,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/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_p.h DESTINATION include/kddockwidgets/private/multisplitter)
install(FILES private/multisplitter/Separator_qwidget.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 ${DOCKS_INSTALLABLE_PRIVATE_WIDGET_INCLUDES} DESTINATION include/kddockwidgets/private/widgets)
install(FILES private/indicators/ClassicIndicators_p.h DESTINATION include/kddockwidgets/private/indicators) install(FILES private/indicators/ClassicIndicators_p.h DESTINATION include/kddockwidgets/private/indicators)
@@ -224,12 +313,15 @@ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgetsConfig.cmake"
DESTINATION ${INSTALL_LIBRARY_DIR}/cmake/KDDockWidgets 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 # 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) 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) 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()
endif() endif()

View File

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. 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> Author: Sérgio Martins <sergio.martins@kdab.com>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
@@ -18,14 +18,19 @@
#include "Config.h" #include "Config.h"
#include "multisplitter/MultiSplitterConfig.h" #include "multisplitter/MultiSplitterConfig.h"
#include "multisplitter/Widget_qwidget.h" #include "multisplitter/Widget.h"
#include "DockRegistry_p.h" #include "DockRegistry_p.h"
#include "FrameworkWidgetFactory.h" #include "FrameworkWidgetFactory.h"
#include "Utils_p.h"
#include <QApplication>
#include <QDebug> #include <QDebug>
#include <QOperatingSystemVersion> #include <QOperatingSystemVersion>
#ifdef KDDOCKWIDGETS_QTQUICK
# include <QQmlEngine>
# include <QQmlContext>
#endif
namespace KDDockWidgets namespace KDDockWidgets
{ {
@@ -47,8 +52,10 @@ public:
QQmlEngine *m_qmlEngine = nullptr; QQmlEngine *m_qmlEngine = nullptr;
DockWidgetFactoryFunc m_dockWidgetFactoryFunc = nullptr; DockWidgetFactoryFunc m_dockWidgetFactoryFunc = nullptr;
MainWindowFactoryFunc m_mainWindowFactoryFunc = nullptr; MainWindowFactoryFunc m_mainWindowFactoryFunc = nullptr;
FrameworkWidgetFactory *m_frameworkWidgetFactory; TabbingAllowedFunc m_tabbingAllowedFunc = nullptr;
FrameworkWidgetFactory *m_frameworkWidgetFactory = nullptr;
Flags m_flags = Flag_Default; Flags m_flags = Flag_Default;
InternalFlags m_internalFlags = InternalFlag_None;
qreal m_draggedWindowOpacity = Q_QNAN; qreal m_draggedWindowOpacity = Q_QNAN;
}; };
@@ -83,8 +90,11 @@ Config::Flags Config::flags() const
void Config::setFlags(Flags f) void Config::setFlags(Flags f)
{ {
if (!DockRegistry::self()->isEmpty()) { auto dr = DockRegistry::self();
qWarning() << Q_FUNC_INFO << "Only use this function at startup before creating any DockWidget or MainWindow"; 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; return;
} }
@@ -135,7 +145,7 @@ int Config::separatorThickness() const
void Config::setSeparatorThickness(int value) 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"; qWarning() << Q_FUNC_INFO << "Only use this function at startup before creating any DockWidget or MainWindow";
return; return;
} }
@@ -153,6 +163,57 @@ qreal Config::draggedWindowOpacity() const
return d->m_draggedWindowOpacity; 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) void Config::setQmlEngine(QQmlEngine *qmlEngine)
{ {
if (d->m_qmlEngine) { if (d->m_qmlEngine) {
@@ -160,13 +221,22 @@ void Config::setQmlEngine(QQmlEngine *qmlEngine)
return; return;
} }
if (!qmlEngine) {
qWarning() << Q_FUNC_INFO << "Null QML engine";
return;
}
d->m_qmlEngine = qmlEngine; d->m_qmlEngine = qmlEngine;
QQmlContext *context = qmlEngine->rootContext();
context->setContextProperty(QStringLiteral("_kddw_widgetFactory"), d->m_frameworkWidgetFactory);
} }
QQmlEngine *Config::qmlEngine() const QQmlEngine *Config::qmlEngine() const
{ {
return d->m_qmlEngine; return d->m_qmlEngine;
} }
#endif
void Config::Private::fixFlags() void Config::Private::fixFlags()
{ {
@@ -174,6 +244,9 @@ void Config::Private::fixFlags()
if (QOperatingSystemVersion::current().majorVersion() < 10) { if (QOperatingSystemVersion::current().majorVersion() < 10) {
// Aero-snap requires Windows 10 // Aero-snap requires Windows 10
m_flags = m_flags & ~Flag_AeroSnapWithClientDecos; m_flags = m_flags & ~Flag_AeroSnapWithClientDecos;
} else {
// Unconditional now
m_flags |= Flag_AeroSnapWithClientDecos;
} }
// These are mutually exclusive: // These are mutually exclusive:
@@ -185,15 +258,38 @@ void Config::Private::fixFlags()
// Not supported on macOS: // Not supported on macOS:
m_flags = m_flags & ~Flag_AeroSnapWithClientDecos; m_flags = m_flags & ~Flag_AeroSnapWithClientDecos;
#else #else
// Not supported on linux. 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 // 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_NativeTitleBar;
m_flags = m_flags & ~Flag_AeroSnapWithClientDecos; m_flags = m_flags & ~Flag_AeroSnapWithClientDecos;
}
#endif #endif
#if !defined(Q_OS_WIN) && !defined(Q_OS_MACOS) #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; m_flags = m_flags & ~Flag_AeroSnapWithClientDecos;
#endif #endif
#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;
}
} }
} }

View File

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. 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> Author: Sérgio Martins <sergio.martins@kdab.com>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
@@ -23,6 +23,7 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QQmlEngine; class QQmlEngine;
class QSize;
QT_END_NAMESPACE QT_END_NAMESPACE
namespace KDDockWidgets namespace KDDockWidgets
@@ -35,6 +36,14 @@ class FrameworkWidgetFactory;
typedef KDDockWidgets::DockWidgetBase* (*DockWidgetFactoryFunc)(const QString &name); typedef KDDockWidgets::DockWidgetBase* (*DockWidgetFactoryFunc)(const QString &name);
typedef KDDockWidgets::MainWindowBase* (*MainWindowFactoryFunc)(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. * @brief Singleton to allow to choose certain behaviours of the framework.
* *
@@ -53,22 +62,40 @@ public:
///@brief Flag enum to tune certain behaviours, the defaults are Flag_Default ///@brief Flag enum to tune certain behaviours, the defaults are Flag_Default
enum Flag { enum Flag {
Flag_None = 0, ///> No option set 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_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_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_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_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_AlwaysShowTabs = 16, ///< Always show tabs, even if there's only one,
Flag_AllowReorderTabs = 32, /// Allows user to re-order tabs by dragging them 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_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_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_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_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_LazyResize = 1024, ///< The dock widgets are resized in a lazy manner. The actual resize only happens when you release the mouse button.
Flag_Default = Flag_AeroSnapWithClientDecos ///> The defaults 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) 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 ///@brief returns the chosen flags
Flags flags() const; Flags flags() const;
@@ -140,9 +167,60 @@ public:
///By default it's 1.0, fully opaque ///By default it's 1.0, fully opaque
qreal draggedWindowOpacity() const; 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. ///@brief Sets the QQmlEngine to use. Applicable only when using QtQuick.
void setQmlEngine(QQmlEngine *); void setQmlEngine(QQmlEngine *);
QQmlEngine* qmlEngine() const; QQmlEngine* qmlEngine() const;
#endif
private: private:
Q_DISABLE_COPY(Config) Q_DISABLE_COPY(Config)

View File

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. 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> Author: Sérgio Martins <sergio.martins@kdab.com>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
@@ -25,6 +25,8 @@ QT_BEGIN_NAMESPACE
class QCloseEvent; class QCloseEvent;
QT_END_NAMESPACE QT_END_NAMESPACE
// clazy:excludeall=ctor-missing-parent-argument
namespace KDDockWidgets { namespace KDDockWidgets {
/** /**

View File

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. 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> Author: Sérgio Martins <sergio.martins@kdab.com>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
@@ -16,14 +16,13 @@
#include "Utils_p.h" #include "Utils_p.h"
#include "DockRegistry_p.h" #include "DockRegistry_p.h"
#include "DropArea_p.h" #include "DropArea_p.h"
#include "multisplitter/Item_p.h"
#include "Config.h" #include "Config.h"
#include "TitleBar_p.h" #include "TitleBar_p.h"
#include "FrameworkWidgetFactory.h" #include "FrameworkWidgetFactory.h"
#include "private/Position_p.h" #include "private/Position_p.h"
#include "WindowBeingDragged_p.h" #include "WindowBeingDragged_p.h"
#include "SideBar_p.h"
#include <QAction>
#include <QEvent> #include <QEvent>
#include <QCloseEvent> #include <QCloseEvent>
#include <QTimer> #include <QTimer>
@@ -57,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 if (!m_updatingFloatAction) { // guard against recursiveness
q->setFloating(enabled); q->setFloating(checked);
} }
Q_EMIT q->isFloatingChanged(checked);
}); });
toggleAction->setCheckable(true); toggleAction->setCheckable(true);
@@ -77,6 +78,26 @@ public:
return qobject_cast<FloatingWindow*>(q->window()); return qobject_cast<FloatingWindow*>(q->window());
} }
MainWindowBase *mainWindow() const
{
if (q->isWindow())
return nullptr;
// Note: Don't simply use window(), as the MainWindow might be embedded into something else
QWidgetOrQuick *p = q->parentWidget();
while (p) {
if (auto window = qobject_cast<MainWindowBase*>(p))
return window;
if (p->isWindow())
return nullptr;
p = p->parentWidget();
}
return nullptr;
}
QPoint defaultCenterPosForFloating(); QPoint defaultCenterPosForFloating();
void updateTitle(); void updateTitle();
@@ -87,7 +108,7 @@ public:
void onDockWidgetHidden(); void onDockWidgetHidden();
void show(); void show();
void close(); void close();
void restoreToPreviousPosition(); bool restoreToPreviousPosition();
void maybeRestoreToPreviousPosition(); void maybeRestoreToPreviousPosition();
int currentTabIndex() const; int currentTabIndex() const;
@@ -111,6 +132,7 @@ public:
bool m_updatingToggleAction = false; bool m_updatingToggleAction = false;
bool m_updatingFloatAction = false; bool m_updatingFloatAction = false;
bool m_isForceClosing = false; bool m_isForceClosing = false;
QSize m_lastOverlayedSize = QSize(0, 0);
}; };
DockWidgetBase::DockWidgetBase(const QString &name, Options options) DockWidgetBase::DockWidgetBase(const QString &name, Options options)
@@ -119,22 +141,22 @@ DockWidgetBase::DockWidgetBase(const QString &name, Options options)
{ {
d->init(); d->init();
DockRegistry::self()->registerDockWidget(this); DockRegistry::self()->registerDockWidget(this);
qCDebug(creation) << "DockWidget" << this;
if (name.isEmpty()) if (name.isEmpty())
qWarning() << Q_FUNC_INFO << "Name can't be null"; qWarning() << Q_FUNC_INFO << "Name can't be null";
setAttribute(Qt::WA_PendingMoveEvent, false);
qApp->installEventFilter(this);
} }
DockWidgetBase::~DockWidgetBase() DockWidgetBase::~DockWidgetBase()
{ {
DockRegistry::self()->unregisterDockWidget(this); DockRegistry::self()->unregisterDockWidget(this);
qCDebug(creation) << "~DockWidget" << this;
delete d; 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) { if (other == this) {
qWarning() << Q_FUNC_INFO << "Refusing to add dock widget into itself" << other; qWarning() << Q_FUNC_INFO << "Refusing to add dock widget into itself" << other;
return; return;
@@ -160,7 +182,7 @@ void DockWidgetBase::addDockWidgetAsTab(DockWidgetBase *other, AddingOption addi
Frame *frame = this->frame(); Frame *frame = this->frame();
if (frame) { if (frame) {
if (frame->contains(other)) { if (frame->containsDockWidget(other)) {
qWarning() << Q_FUNC_INFO << "Already contains" << other; qWarning() << Q_FUNC_INFO << "Already contains" << other;
return; return;
} }
@@ -177,14 +199,17 @@ void DockWidgetBase::addDockWidgetAsTab(DockWidgetBase *other, AddingOption addi
} }
other->setParent(nullptr); 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 (auto mainWindow = qobject_cast<MainWindowBase*>(window())) {
if (qobject_cast<MainWindowBase*>(window())) { // It's inside a main window. Simply use the main window API.
qWarning() << Q_FUNC_INFO << "Just use MainWindow::addWidget() directly. This function is for floating nested windows only."; mainWindow->addDockWidget(other, location, relativeTo, initialOption);
return; return;
} }
@@ -204,7 +229,7 @@ void DockWidgetBase::addDockWidgetToContainingWindow(DockWidgetBase *other, Loca
morphIntoFloatingWindow(); morphIntoFloatingWindow();
if (auto fw = floatingWindow()) { if (auto fw = floatingWindow()) {
fw->dropArea()->addDockWidget(other, location, relativeTo); fw->dropArea()->addDockWidget(other, location, relativeTo, initialOption);
} else { } else {
qWarning() << Q_FUNC_INFO << "Couldn't find floating nested window"; qWarning() << Q_FUNC_INFO << "Couldn't find floating nested window";
} }
@@ -213,7 +238,6 @@ void DockWidgetBase::addDockWidgetToContainingWindow(DockWidgetBase *other, Loca
void DockWidgetBase::setWidget(QWidgetOrQuick *w) void DockWidgetBase::setWidget(QWidgetOrQuick *w)
{ {
Q_ASSERT(w); Q_ASSERT(w);
qCDebug(addwidget) << Q_FUNC_INFO << w;
if (w == d->widget) if (w == d->widget)
return; return;
@@ -244,15 +268,18 @@ bool DockWidgetBase::isFloating() const
return fw && fw->hasSingleDockWidget(); return fw && fw->hasSingleDockWidget();
} }
void DockWidgetBase::setFloating(bool floats) bool DockWidgetBase::setFloating(bool floats)
{ {
const bool alreadyFloating = isFloating(); const bool alreadyFloating = isFloating();
qCDebug(docking) << Q_FUNC_INFO << "yes=" << floats
<< "; already floating=" << alreadyFloating;
if ((floats && alreadyFloating) || (!floats && !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) { if (floats) {
d->saveTabIndex(); d->saveTabIndex();
@@ -262,6 +289,7 @@ void DockWidgetBase::setFloating(bool floats)
qWarning() << "DockWidget::setFloating: Tabbed but no frame exists" qWarning() << "DockWidget::setFloating: Tabbed but no frame exists"
<< this; << this;
Q_ASSERT(false); Q_ASSERT(false);
return false;
} }
frame->detachTab(this); frame->detachTab(this);
@@ -274,9 +302,10 @@ void DockWidgetBase::setFloating(bool floats)
if (auto fw = floatingWindow()) if (auto fw = floatingWindow())
fw->setSuggestedGeometry(lastGeo, /*preserveCenter=*/true); fw->setSuggestedGeometry(lastGeo, /*preserveCenter=*/true);
} }
return true;
} else { } else {
saveLastFloatingGeometry(); saveLastFloatingGeometry();
d->restoreToPreviousPosition(); return d->restoreToPreviousPosition();
} }
} }
@@ -305,7 +334,7 @@ void DockWidgetBase::setTitle(const QString &title)
if (title != d->title) { if (title != d->title) {
d->title = title; d->title = title;
d->updateTitle(); d->updateTitle();
Q_EMIT titleChanged(); Q_EMIT titleChanged(title);
} }
} }
@@ -363,6 +392,9 @@ void DockWidgetBase::setIcon(const QIcon &icon, IconPlaces places)
if (places & IconPlace::TabBar) if (places & IconPlace::TabBar)
d->tabBarIcon = icon; d->tabBarIcon = icon;
if (places & IconPlace::ToggleAction)
d->toggleAction->setIcon(icon);
Q_EMIT iconChanged(); Q_EMIT iconChanged();
} }
@@ -374,6 +406,9 @@ QIcon DockWidgetBase::icon(IconPlace place) const
if (place == IconPlace::TabBar) if (place == IconPlace::TabBar)
return d->tabBarIcon; return d->tabBarIcon;
if (place == IconPlace::ToggleAction)
return d->toggleAction->icon();
return {}; return {};
} }
@@ -430,6 +465,16 @@ bool DockWidgetBase::isMainWindow() const
return qobject_cast<MainWindowBase*>(widget()); return qobject_cast<MainWindowBase*>(widget());
} }
bool DockWidgetBase::isInMainWindow() const
{
return d->mainWindow() != nullptr;
}
MainWindowBase* DockWidgetBase::mainWindow() const
{
return d->mainWindow();
}
bool DockWidgetBase::isFocused() const bool DockWidgetBase::isFocused() const
{ {
auto f = this->frame(); auto f = this->frame();
@@ -459,11 +504,42 @@ void DockWidgetBase::setAffinities(const QStringList &affinityNames)
d->affinities = affinities; d->affinities = affinities;
} }
void DockWidgetBase::moveToSideBar()
{
if (MainWindowBase *m = mainWindow())
m->moveToSideBar(this);
}
bool DockWidgetBase::isOverlayed() const
{
if (MainWindowBase *m = mainWindow())
return m->overlayedDockWidget() == this;
return false;
}
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() FloatingWindow *DockWidgetBase::morphIntoFloatingWindow()
{ {
qCDebug(creation) << "DockWidget::morphIntoFloatingWindow() this=" << this
<< "; visible=" << isVisible();
if (auto fw = floatingWindow()) if (auto fw = floatingWindow())
return fw; // Nothing to do return fw; // Nothing to do
@@ -471,10 +547,13 @@ FloatingWindow *DockWidgetBase::morphIntoFloatingWindow()
QRect geo = d->m_lastPositions.lastFloatingGeometry(); QRect geo = d->m_lastPositions.lastFloatingGeometry();
if (geo.isNull()) { if (geo.isNull()) {
geo = geometry(); geo = geometry();
if (!testAttribute(Qt::WA_PendingMoveEvent)) { // If user already moved it, we don't interfere
const QPoint center = d->defaultCenterPosForFloating(); const QPoint center = d->defaultCenterPosForFloating();
if (!center.isNull()) if (!center.isNull())
geo.moveCenter(center); geo.moveCenter(center);
} }
}
auto frame = Config::self().frameworkWidgetFactory()->createFrame(); auto frame = Config::self().frameworkWidgetFactory()->createFrame();
frame->addWidget(this); frame->addWidget(this);
@@ -512,7 +591,6 @@ FloatingWindow *DockWidgetBase::floatingWindow() const
void DockWidgetBase::addPlaceholderItem(Layouting::Item *item) void DockWidgetBase::addPlaceholderItem(Layouting::Item *item)
{ {
qCDebug(placeholder) << Q_FUNC_INFO << this << item;
Q_ASSERT(item); Q_ASSERT(item);
d->m_lastPositions.addPosition(item); d->m_lastPositions.addPosition(item);
} }
@@ -535,6 +613,16 @@ void DockWidgetBase::updateFloatAction()
d->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() QPoint DockWidgetBase::Private::defaultCenterPosForFloating()
{ {
MainWindowBase::List mainWindows = DockRegistry::self()->mainwindows(); MainWindowBase::List mainWindows = DockRegistry::self()->mainwindows();
@@ -594,14 +682,12 @@ void DockWidgetBase::Private::onDockWidgetShown()
{ {
updateToggleAction(); updateToggleAction();
updateFloatAction(); updateFloatAction();
qCDebug(hiding) << Q_FUNC_INFO << "parent=" << q->parentWidget();
} }
void DockWidgetBase::Private::onDockWidgetHidden() void DockWidgetBase::Private::onDockWidgetHidden()
{ {
updateToggleAction(); updateToggleAction();
updateFloatAction(); updateFloatAction();
qCDebug(hiding) << Q_FUNC_INFO << "parent=" << q->parentWidget();
} }
void DockWidgetBase::Private::close() void DockWidgetBase::Private::close()
@@ -611,26 +697,30 @@ void DockWidgetBase::Private::close()
m_lastPositions.setLastFloatingGeometry(q->window()->geometry()); m_lastPositions.setLastFloatingGeometry(q->window()->geometry());
} }
qCDebug(hiding) << "DockWidget::close" << this;
saveTabIndex(); saveTabIndex();
// Do some cleaning. Widget is hidden, but we must hide the tab containing it. // Do some cleaning. Widget is hidden, but we must hide the tab containing it.
if (Frame *frame = q->frame()) { if (Frame *frame = q->frame()) {
frame->removeWidget(q); frame->removeWidget(q);
q->setParent(nullptr); q->setParent(nullptr);
if (SideBar *sb = DockRegistry::self()->sideBarForDockWidget(q)) {
sb->removeDockWidget(q);
}
} }
} }
void DockWidgetBase::Private::restoreToPreviousPosition() bool DockWidgetBase::Private::restoreToPreviousPosition()
{ {
if (!m_lastPositions.isValid()) if (!m_lastPositions.isValid())
return; return false;
Layouting::Item *item = m_lastPositions.lastItem(); Layouting::Item *item = m_lastPositions.lastItem();
MultiSplitter *layout = DockRegistry::self()->layoutForItem(item); MultiSplitter *layout = DockRegistry::self()->layoutForItem(item);
Q_ASSERT(layout); Q_ASSERT(layout);
layout->restorePlaceholder(q, item, m_lastPositions.lastTabIndex()); layout->restorePlaceholder(q, item, m_lastPositions.lastTabIndex());
return true;
} }
void DockWidgetBase::Private::maybeRestoreToPreviousPosition() void DockWidgetBase::Private::maybeRestoreToPreviousPosition()
@@ -641,7 +731,6 @@ void DockWidgetBase::Private::maybeRestoreToPreviousPosition()
return; return;
Layouting::Item *layoutItem = m_lastPositions.lastItem(); Layouting::Item *layoutItem = m_lastPositions.lastItem();
qCDebug(placeholder) << Q_FUNC_INFO << layoutItem << m_lastPositions;
if (!layoutItem) if (!layoutItem)
return; // nothing to do, no last position return; // nothing to do, no last position
@@ -653,7 +742,6 @@ void DockWidgetBase::Private::maybeRestoreToPreviousPosition()
if (frame && frame->QWidgetAdapter::parentWidget() == DockRegistry::self()->layoutForItem(layoutItem)) { if (frame && frame->QWidgetAdapter::parentWidget() == DockRegistry::self()->layoutForItem(layoutItem)) {
// There's a frame already. Means the DockWidget was hidden instead of closed. // There's a frame already. Means the DockWidget was hidden instead of closed.
// Nothing to do, the dock widget will simply be shown // Nothing to do, the dock widget will simply be shown
qCDebug(placeholder) << Q_FUNC_INFO << "Already had frame.";
return; return;
} }
@@ -661,7 +749,6 @@ void DockWidgetBase::Private::maybeRestoreToPreviousPosition()
if (q->parentWidget()) { if (q->parentWidget()) {
// The QEvent::Show is due to it being made floating. Nothing to restore. // The QEvent::Show is due to it being made floating. Nothing to restore.
qCDebug(placeholder) << Q_FUNC_INFO << "Already had parentWidget";
return; return;
} }
@@ -688,7 +775,12 @@ void DockWidgetBase::Private::show()
void DockWidgetBase::onParentChanged() void DockWidgetBase::onParentChanged()
{ {
#ifdef KDDOCKWIDGETS_QTWIDGETS
// TODO: In v1.4, remove this part and use the signal emitting the arg
Q_EMIT parentChanged(); Q_EMIT parentChanged();
#else
Q_EMIT parentChanged(this);
#endif
d->updateToggleAction(); d->updateToggleAction();
d->updateFloatAction(); d->updateFloatAction();
} }
@@ -722,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 e->accept(); // By default we accept, means DockWidget closes
if (d->widget) if (d->widget)

View File

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. 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> Author: Sérgio Martins <sergio.martins@kdab.com>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
@@ -26,10 +26,14 @@
#include <QVector> #include <QVector>
// clazy:excludeall=ctor-missing-parent-argument
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QAction; class QAction;
QT_END_NAMESPACE QT_END_NAMESPACE
class TestDocks;
namespace Layouting { namespace Layouting {
class Item; class Item;
} }
@@ -46,6 +50,7 @@ class TabWidget;
class TitleBar; class TitleBar;
class MainWindowBase; class MainWindowBase;
class StateDragging; class StateDragging;
class FrameQuick;
/** /**
* @brief The DockWidget base-class. DockWidget and DockWidgetBase are only * @brief The DockWidget base-class. DockWidget and DockWidgetBase are only
@@ -61,13 +66,15 @@ class DOCKS_EXPORT DockWidgetBase : public QWidget
#endif #endif
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(bool isFocused READ isFocused NOTIFY isFocusedChanged)
Q_PROPERTY(bool isFloating READ isFloating WRITE setFloating NOTIFY isFloatingChanged)
public: public:
typedef QVector<DockWidgetBase *> List; typedef QVector<DockWidgetBase *> List;
///@brief DockWidget options to pass at construction time ///@brief DockWidget options to pass at construction time
enum Option { enum Option {
Option_None = 0, ///< No option, the default 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 Option_NotDockable = 2 ///< The DockWidget can't be docked, it's always floating
}; };
Q_DECLARE_FLAGS(Options, Option) Q_DECLARE_FLAGS(Options, Option)
@@ -75,7 +82,8 @@ public:
enum class IconPlace { enum class IconPlace {
TitleBar = 1, TitleBar = 1,
TabBar = 2, TabBar = 2,
All = TitleBar | TabBar ToggleAction = 4,
All = ToggleAction | TitleBar | TabBar
}; };
Q_ENUM(IconPlace) Q_ENUM(IconPlace)
Q_DECLARE_FLAGS(IconPlaces, IconPlace) Q_DECLARE_FLAGS(IconPlaces, IconPlace)
@@ -93,26 +101,15 @@ public:
///@brief destructor ///@brief destructor
~DockWidgetBase() override; ~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. * @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 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 * as hidden, recording only a placeholder in the tab. So it's restored to tabbed when eventually
* shown. * shown.
* @sa MainWindow::addDockWidget(), DockWidget::addDockWidgetToContainingWindow() * @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. * @brief docks @p other widget into the window that contains this one.
@@ -122,22 +119,24 @@ public:
* *
* @param other The other dock widget to dock into the window. * @param other The other dock widget to dock into the window.
* @param location The location to dock. * @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() * @sa MainWindow::addDockWidget(), DockWidget::addDockWidgetAsTab()
*/ */
void addDockWidgetToContainingWindow(DockWidgetBase *other, KDDockWidgets::Location location, void addDockWidgetToContainingWindow(DockWidgetBase *other, KDDockWidgets::Location location,
DockWidgetBase *relativeTo = nullptr); DockWidgetBase *relativeTo = nullptr,
InitialOption initialOption = {});
/** /**
* @brief sets the widget which this dock widget hosts. * @brief sets the widget which this dock widget hosts.
* @param widget widget to show inside this dock widget. Must not be null. * @param widget the widget to show inside this dock widget. Must not be null.
* *
* Ownership for @p widget is transfered to DockWidgetBase. * Ownership for @p widget is transferred to DockWidgetBase.
* Ownsership for any previously existing widget is transfered back to the user. Meaning if you * Ownsership for any previously existing widget is transferred back to the user. Meaning if you
* call setWidget(A) followed by setWidget(B) then A will have to be deleted by you, while B is * call setWidget(A) followed by setWidget(B) then A will have to be deleted by you, while B is
* owned by the dock widget. * owned by the dock widget.
*/ */
void setWidget(QWidgetOrQuick *widget); virtual void setWidget(QWidgetOrQuick *widget);
/** /**
* @brief returns the widget which this dock widget hosts * @brief returns the widget which this dock widget hosts
@@ -156,8 +155,10 @@ public:
/** /**
* @brief setter to make the dock widget float or dock. * @brief setter to make the dock widget float or dock.
* @param floats If true makes the dock widget float, otherwise docks it. * @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 * @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. * @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. * By default there's no icon set.
* *
@@ -240,7 +241,7 @@ public:
void setIcon(const QIcon &icon, IconPlaces places = IconPlace::All); 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. * By default it's null.
* *
@@ -252,7 +253,7 @@ public:
* @brief Like QWidget::close() but the hosted widget won't be asked if we * @brief Like QWidget::close() but the hosted widget won't be asked if we
* should close. * should close.
*/ */
void forceClose(); Q_INVOKABLE void forceClose();
/** /**
* @brief Returns this dock widget's title bar. * @brief Returns this dock widget's title bar.
@@ -297,7 +298,7 @@ public:
QStringList affinities() const; QStringList affinities() const;
/// @brief Equivalent to QWidget::show(), but it's optimized to reduce flickering on some platforms /// @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. /// @brief Brings the dock widget to the front.
/// ///
@@ -306,7 +307,7 @@ public:
/// - If the dock widget is floating, QWindow::raise() is called. /// - If the dock widget is floating, QWindow::raise() is called.
/// ///
/// This only applies if the dock widget is already open. If closed, does nothing. /// 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 * @brief Returns whether widget() is a KDDockWidget::MainWindow
@@ -320,15 +321,65 @@ public:
*/ */
bool isMainWindow() const; bool isMainWindow() const;
/**
* @brief Returns whether this dock widget is docked into a main window.
*
* Note that isFloating() returning false might either mean the dock widget is docked into a
* main window or into a floating window (groupped/nested with other dock widgets. Use this function
* then if you need to disambiguate
*/
bool isInMainWindow() const;
/// @brief Returns the main window this dock widget is in. nullptr if it's not inside a main window
MainWindowBase *mainWindow() const;
///@brief Returns whether This or any child of this dock widget is focused ///@brief Returns whether This or any child of this dock widget is focused
///Not to be confused with QWidget::hasFocus(), which just refers to 1 widget. This includes ///Not to be confused with QWidget::hasFocus(), which just refers to 1 widget. This includes
///variant includes children. ///variant includes children.
///@sa isFocusedChanged() ///@sa isFocusedChanged()
bool isFocused() const; bool isFocused() const;
/**
* @brief Minimizes this dock widget to the MainWindow's side-bar.
*
* It will be undocked from current layout. It's previous docked position will be remembered.
*
* This action is only available if the dock widget is docked into a MainWindow.
* The dockwidget will initially be visible and overlayed on top of the current layout (this is
* the auto-hide feature).
*/
void moveToSideBar();
/// @brief Returns whether this dock widget is overlayed on top of the main window, instead of
/// docked into the layout. This is only relevant when using the auto-hide and side-bar feature.
bool isOverlayed() const;
///@brief Returns whether this dock widget is in a side bar, and which.
/// SideBarLocation::None is returned if it's not in a sidebar.
/// 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: Q_SIGNALS:
#ifdef KDDOCKWIDGETS_QTWIDGETS
///@brief signal emitted when the parent changed ///@brief signal emitted when the parent changed
void parentChanged(); void parentChanged();
#endif
///@brief signal emitted when the DockWidget is shown. As in QEvent::Show. ///@brief signal emitted when the DockWidget is shown. As in QEvent::Show.
void shown(); void shown();
@@ -340,7 +391,8 @@ Q_SIGNALS:
void iconChanged(); void iconChanged();
///@brief signal emitted when the title changed ///@brief signal emitted when the title changed
void titleChanged(); ///@param title the new title
void titleChanged(const QString &title);
///@brief emitted when the hosted widget changed ///@brief emitted when the hosted widget changed
void widgetChanged(KDDockWidgets::QWidgetOrQuick *); void widgetChanged(KDDockWidgets::QWidgetOrQuick *);
@@ -353,11 +405,34 @@ Q_SIGNALS:
///@sa isFocused ///@sa isFocused
void isFocusedChanged(bool); void isFocusedChanged(bool);
///@brief emitted when isOverlayed changes
///@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: protected:
void onParentChanged(); void onParentChanged();
void onShown(bool spontaneous); void onShown(bool spontaneous);
void onHidden(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) #if defined(DOCKS_DEVELOPER_MODE)
public Q_SLOTS: public Q_SLOTS:
@@ -383,13 +458,26 @@ private:
friend class MultiSplitter; friend class MultiSplitter;
friend class Frame; friend class Frame;
friend class DropArea; friend class DropArea;
friend class TestDocks; friend class ::TestDocks;
friend class StateDragging; friend class StateDragging;
friend class KDDockWidgets::TabWidget; friend class KDDockWidgets::TabWidget;
friend class KDDockWidgets::TitleBar; friend class KDDockWidgets::TitleBar;
friend class KDDockWidgets::DragController; friend class KDDockWidgets::DragController;
friend class KDDockWidgets::DockRegistry; friend class KDDockWidgets::DockRegistry;
friend class KDDockWidgets::LayoutSaver; 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. * @brief the Frame which contains this dock widgets.
@@ -421,6 +509,9 @@ private:
///@brief Updates the floatAction state ///@brief Updates the floatAction state
void updateFloatAction(); void updateFloatAction();
///@reimp
bool eventFilter(QObject *, QEvent *) override;
class Private; class Private;
Private *const d; Private *const d;
}; };
@@ -428,4 +519,73 @@ private:
} }
Q_DECLARE_METATYPE(KDDockWidgets::Location) 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 #endif

View File

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. 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> Author: Sérgio Martins <sergio.martins@kdab.com>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only 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) : DockWidgetBase(name, options)
, d(new Private(this)) , d(new Private(this))
{ {
// To mimic what QtWidgets does when creating a new QWidget.
setVisible(false);
} }
DockWidgetQuick::~DockWidgetQuick() DockWidgetQuick::~DockWidgetQuick()
@@ -60,9 +62,15 @@ void DockWidgetQuick::setWidget(const QString &qmlFilename)
auto adapter = new QWidgetAdapter(this); auto adapter = new QWidgetAdapter(this);
guest->setParentItem(adapter); guest->setParentItem(adapter);
guest->setParent(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) bool DockWidgetQuick::event(QEvent *e)
@@ -74,8 +82,28 @@ bool DockWidgetQuick::event(QEvent *e)
} else if (e->type() == QEvent::Hide) { } else if (e->type() == QEvent::Hide) {
onHidden(e->spontaneous()); onHidden(e->spontaneous());
} else if (e->type() == QEvent::Close) { } else if (e->type() == QEvent::Close) {
onClosed(static_cast<QCloseEvent*>(e)); onCloseEvent(static_cast<QCloseEvent*>(e));
} }
return DockWidgetBase::event(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();
}

View File

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. 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> Author: Sérgio Martins <sergio.martins@kdab.com>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
@@ -54,6 +54,15 @@ public:
/// Similar to DockWidgetBase::setWidget(QQuickItem*) /// Similar to DockWidgetBase::setWidget(QQuickItem*)
void setWidget(const QString &qmlFilename); void setWidget(const QString &qmlFilename);
/// @reimp
void setWidget(QWidgetAdapter *widget) override;
/// @reimp
QSize minimumSize() const override;
/// @reimp
QSize maximumSize() const override;
protected: protected:
bool event(QEvent *e) override; bool event(QEvent *e) override;

View File

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. 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> Author: Sérgio Martins <sergio.martins@kdab.com>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
@@ -18,15 +18,18 @@
#include "FocusScope.h" #include "FocusScope.h"
#include "TitleBar_p.h" #include "TitleBar_p.h"
#include "Frame_p.h"
#include "DockWidgetBase.h"
#include "DockRegistry_p.h"
#include <QObject> #include <QObject>
#include <QApplication> #include <QGuiApplication>
#include <QPointer> #include <QPointer>
using namespace KDDockWidgets; using namespace KDDockWidgets;
// Our Private inherits from QObject since FocusScope can't (Since Frame is already QObject) // 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: public:
Private(FocusScope *qq, QWidgetAdapter *thisWidget) Private(FocusScope *qq, QWidgetAdapter *thisWidget)
@@ -40,9 +43,12 @@ public:
m_inCtor = false; m_inCtor = false;
} }
~Private() override;
void setIsFocused(bool); void setIsFocused(bool);
void onFocusObjectChanged(QObject *); void onFocusObjectChanged(QObject *);
bool isInFocusScope(WidgetType *) const; bool isInFocusScope(WidgetType *) const;
void emitDockWidgetFocusChanged();
FocusScope *const q; FocusScope *const q;
QWidgetAdapter *const m_thisWidget; QWidgetAdapter *const m_thisWidget;
@@ -51,6 +57,9 @@ public:
QPointer<WidgetType> m_lastFocusedInScope; QPointer<WidgetType> m_lastFocusedInScope;
}; };
FocusScope::Private::~Private()
{
}
FocusScope::FocusScope(QWidgetAdapter *thisWidget) FocusScope::FocusScope(QWidgetAdapter *thisWidget)
: d(new Private(this, thisWidget)) : d(new Private(this, thisWidget))
@@ -96,24 +105,30 @@ void FocusScope::Private::setIsFocused(bool is)
if (is != m_isFocused) { if (is != m_isFocused) {
m_isFocused = is; m_isFocused = is;
if (is)
emitDockWidgetFocusChanged();
if (!m_inCtor) // Hack so we don't call pure-virtual 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) void FocusScope::Private::onFocusObjectChanged(QObject *obj)
{ {
auto widget = qobject_cast<WidgetType*>(obj); auto widget = qobject_cast<WidgetType*>(obj);
if (!widget) if (!widget) {
setIsFocused(false);
return; return;
}
const bool is = isInFocusScope(widget); const bool is = isInFocusScope(widget);
if (is && m_lastFocusedInScope != widget && !qobject_cast<TitleBar*>(obj)) { if (is && m_lastFocusedInScope != widget && !qobject_cast<TitleBar*>(obj)) {
m_lastFocusedInScope = widget; m_lastFocusedInScope = widget;
Q_EMIT q->focusedWidgetChanged();
}
setIsFocused(is); setIsFocused(is);
/* Q_EMIT */ q->focusedWidgetChangedCallback();
} else {
setIsFocused(is);
}
} }
bool FocusScope::Private::isInFocusScope(WidgetType *widget) const bool FocusScope::Private::isInFocusScope(WidgetType *widget) const
@@ -128,3 +143,33 @@ bool FocusScope::Private::isInFocusScope(WidgetType *widget) const
return false; 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);
}
}

View File

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. 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> Author: Sérgio Martins <sergio.martins@kdab.com>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
@@ -25,12 +25,13 @@
namespace KDDockWidgets namespace KDDockWidgets
{ {
///@brief Allows to implement a similar functionality to QtQuick's FocusScope item, in QtWidgets ///@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: public:
///@brief constructor ///@brief constructor
explicit FocusScope(QWidgetAdapter *thisWidget); explicit FocusScope(QWidgetAdapter *thisWidget);
~FocusScope(); virtual ~FocusScope();
///@brief Returns true if this FocusScope is focused. ///@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. ///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); void focus(Qt::FocusReason = Qt::OtherFocusReason);
/*Q_SIGNALS:*/ /*Q_SIGNALS:*/
protected:
///@brief reimplement in the 1st QObject derived class ///@brief reimplement in the 1st QObject derived class
virtual void isFocusedChanged() = 0; virtual void isFocusedChangedCallback() = 0;
virtual void focusedWidgetChanged() = 0; virtual void focusedWidgetChangedCallback() = 0;
private: private:
class Private; class Private;

View File

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. 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> Author: Sérgio Martins <sergio.martins@kdab.com>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
@@ -16,26 +16,35 @@
#include "FloatingWindow_p.h" #include "FloatingWindow_p.h"
#include "Config.h" #include "Config.h"
#include "indicators/ClassicIndicators_p.h" #include "indicators/ClassicIndicators_p.h"
#include "indicators/NullIndicators_p.h"
#include "Utils_p.h"
#include "TabWidget_p.h"
#ifdef KDDOCKWIDGETS_QTWIDGETS #ifdef KDDOCKWIDGETS_QTWIDGETS
# include "indicators/ClassicIndicators_p.h"
# include "widgets/TabWidget_p.h"
# include "widgets/FrameWidget_p.h" # include "widgets/FrameWidget_p.h"
# include "widgets/TitleBarWidget_p.h" # include "widgets/TitleBarWidget_p.h"
# include "widgets/TabBarWidget_p.h" # include "widgets/TabBarWidget_p.h"
# include "widgets/SideBarWidget_p.h"
# include "widgets/TabWidgetWidget_p.h" # include "widgets/TabWidgetWidget_p.h"
# include "multisplitter/Separator_qwidget.h" # include "multisplitter/Separator_qwidget.h"
# include "widgets/FloatingWindowWidget_p.h" # include "widgets/FloatingWindowWidget_p.h"
# include "indicators/SegmentedIndicators_p.h" # include "indicators/SegmentedIndicators_p.h"
# include <QRubberBand> # include <QRubberBand>
# include <QToolButton>
#else #else
# include "DockWidgetQuick.h"
# include "quick/FrameQuick_p.h" # include "quick/FrameQuick_p.h"
# include "quick/DockWidgetQuick.h"
# include "quick/TitleBarQuick_p.h" # include "quick/TitleBarQuick_p.h"
# include "quick/TabWidgetQuick_p.h"
# include "quick/TabBarQuick_p.h"
# include "quick/FloatingWindowQuick_p.h" # include "quick/FloatingWindowQuick_p.h"
# include "quick/RubberBandQuick.h"
# include "multisplitter/Separator_quick.h" # include "multisplitter/Separator_quick.h"
#endif #endif
// clazy:excludeall=ctor-missing-parent-argument
using namespace KDDockWidgets; using namespace KDDockWidgets;
DropIndicatorType DefaultWidgetFactory::s_dropIndicatorType = DropIndicatorType::Classic; DropIndicatorType DefaultWidgetFactory::s_dropIndicatorType = DropIndicatorType::Classic;
@@ -87,11 +96,18 @@ FloatingWindow *DefaultWidgetFactory::createFloatingWindow(Frame *frame, MainWin
DropIndicatorOverlayInterface *DefaultWidgetFactory::createDropIndicatorOverlay(DropArea *dropArea) const 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) { switch (s_dropIndicatorType) {
case DropIndicatorType::Classic: case DropIndicatorType::Classic:
return new ClassicIndicators(dropArea); return new ClassicIndicators(dropArea);
case DropIndicatorType::Segmented: case DropIndicatorType::Segmented:
return new SegmentedIndicators(dropArea); return new SegmentedIndicators(dropArea);
case DropIndicatorType::None:
return new NullIndicators(dropArea);
} }
return new ClassicIndicators(dropArea); return new ClassicIndicators(dropArea);
@@ -102,6 +118,24 @@ QWidgetOrQuick *DefaultWidgetFactory::createRubberBand(QWidgetOrQuick *parent) c
return new QRubberBand(QRubberBand::Rectangle, parent); return new QRubberBand(QRubberBand::Rectangle, parent);
} }
SideBar *DefaultWidgetFactory::createSideBar(SideBarLocation loc, MainWindowBase *parent) const
{
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 #else
Frame *DefaultWidgetFactory::createFrame(QWidgetOrQuick *parent, FrameOptions options) const Frame *DefaultWidgetFactory::createFrame(QWidgetOrQuick *parent, FrameOptions options) const
@@ -136,21 +170,27 @@ FloatingWindow *DefaultWidgetFactory::createFloatingWindow(Frame *frame, MainWin
DropIndicatorOverlayInterface *DefaultWidgetFactory::createDropIndicatorOverlay(DropArea *dropArea) const 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); return new ClassicIndicators(dropArea);
} }
TabBar *DefaultWidgetFactory::createTabBar(TabWidget *parent) const TabBar *DefaultWidgetFactory::createTabBar(TabWidget *parent) const
{ {
Q_UNUSED(parent) return new TabBarQuick(parent);
Q_ASSERT(false);
return nullptr;
} }
TabWidget *DefaultWidgetFactory::createTabWidget(Frame *parent) const TabWidget *DefaultWidgetFactory::createTabWidget(Frame *parent) const
{ {
Q_UNUSED(parent) return new TabWidgetQuick(parent);
Q_ASSERT(false);
return nullptr;
} }
Layouting::Separator *DefaultWidgetFactory::createSeparator(Layouting::Widget *parent) const Layouting::Separator *DefaultWidgetFactory::createSeparator(Layouting::Widget *parent) const
@@ -160,7 +200,78 @@ Layouting::Separator *DefaultWidgetFactory::createSeparator(Layouting::Widget *p
QWidgetOrQuick *DefaultWidgetFactory::createRubberBand(QWidgetOrQuick *parent) const 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 #endif
icon.addFile(QStringLiteral(":/img/%1-2x.png").arg(iconName));
return icon;
}

View File

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. 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> Author: Sérgio Martins <sergio.martins@kdab.com>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
@@ -16,6 +16,8 @@
#include "KDDockWidgets.h" #include "KDDockWidgets.h"
#include "QWidgetAdapter.h" #include "QWidgetAdapter.h"
// clazy:excludeall=ctor-missing-parent-argument
/** /**
* @file * @file
* @brief A factory class for allowing the user to customize some internal widgets. * @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\> * @author Sérgio Martins \<sergio.martins@kdab.com\>
*/ */
QT_BEGIN_NAMESPACE
class QAbstractButton;
QT_END_NAMESPACE
namespace Layouting { namespace Layouting {
class Separator; class Separator;
class Widget; class Widget;
@@ -37,7 +43,9 @@ class TabWidget;
class TitleBar; class TitleBar;
class Frame; class Frame;
class DropArea; class DropArea;
class SideBar;
class TabBar; class TabBar;
class TabWidgetQuick;
/** /**
* @brief A factory class for allowing the user to customize some internal widgets. * @brief A factory class for allowing the user to customize some internal widgets.
@@ -56,7 +64,12 @@ class TabBar;
* *
* @sa Config::setFrameworkWidgetFactory() * @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: public:
FrameworkWidgetFactory() = default; FrameworkWidgetFactory() = default;
@@ -84,16 +97,16 @@ public:
///@param floatingWindow Just forward to TitleBar's constructor. ///@param floatingWindow Just forward to TitleBar's constructor.
virtual TitleBar* createTitleBar(FloatingWindow *floatingWindow) const = 0; virtual TitleBar* createTitleBar(FloatingWindow *floatingWindow) const = 0;
///@brief Called internally by the framework to create a 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 ///@brief Called internally by the framework to create a TabWidget
/// Override to provide your own TabWidget sub-class. /// Override to provide your own TabWidget sub-class.
///@param parent Just forward to TabWidget's constructor. ///@param parent Just forward to TabWidget's constructor.
virtual TabWidget* createTabWidget(Frame *parent) const = 0; virtual TabWidget* createTabWidget(Frame *parent) const = 0;
///@brief Called internally by the framework to create a TabBar
/// Override to provide your own TabBar sub-class.
///@param parent Just forward to TabBar's's constructor.
virtual TabBar* createTabBar(TabWidget *parent = nullptr) const = 0;
///@brief Called internally by the framework to create a Separator ///@brief Called internally by the framework to create a Separator
/// Override to provide your own Separator sub-class. The Separator allows /// Override to provide your own Separator sub-class. The Separator allows
/// the user to resize nested dock widgets. /// the user to resize nested dock widgets.
@@ -121,6 +134,23 @@ public:
///@brief Called internally by the framework to create a RubberBand to show as drop zone ///@brief Called internally by the framework to create a RubberBand to show as drop zone
///Returns a rubber band ///Returns a rubber band
virtual QWidgetOrQuick *createRubberBand(QWidgetOrQuick *parent) const = 0; virtual QWidgetOrQuick *createRubberBand(QWidgetOrQuick *parent) const = 0;
///@brief Called internally by the framework to create a SideBar
///@param loc The side-bar location without the main window. Just forward into your SideBar sub-class ctor.
///@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: private:
Q_DISABLE_COPY(FrameworkWidgetFactory) Q_DISABLE_COPY(FrameworkWidgetFactory)
}; };
@@ -130,18 +160,28 @@ private:
*/ */
class DOCKS_EXPORT DefaultWidgetFactory : public FrameworkWidgetFactory class DOCKS_EXPORT DefaultWidgetFactory : public FrameworkWidgetFactory
{ {
Q_OBJECT
public: public:
DefaultWidgetFactory() = default; DefaultWidgetFactory() = default;
Frame *createFrame(QWidgetOrQuick *parent, FrameOptions) const override; Frame *createFrame(QWidgetOrQuick *parent, FrameOptions) const override;
TitleBar *createTitleBar(Frame *) const override; TitleBar *createTitleBar(Frame *) const override;
TitleBar *createTitleBar(FloatingWindow *) const override; TitleBar *createTitleBar(FloatingWindow *) const override;
TabBar *createTabBar(TabWidget *parent) const override;
TabWidget *createTabWidget(Frame *parent) const override; TabWidget *createTabWidget(Frame *parent) const override;
TabBar *createTabBar(TabWidget *parent) const override;
Layouting::Separator *createSeparator(Layouting::Widget *parent = nullptr) const override; Layouting::Separator *createSeparator(Layouting::Widget *parent = nullptr) const override;
FloatingWindow *createFloatingWindow(MainWindowBase *parent = nullptr) const override; FloatingWindow *createFloatingWindow(MainWindowBase *parent = nullptr) const override;
FloatingWindow *createFloatingWindow(Frame *frame, MainWindowBase *parent = nullptr) const override; FloatingWindow *createFloatingWindow(Frame *frame, MainWindowBase *parent = nullptr) const override;
DropIndicatorOverlayInterface *createDropIndicatorOverlay(DropArea*) const override; DropIndicatorOverlayInterface *createDropIndicatorOverlay(DropArea*) const override;
QWidgetOrQuick *createRubberBand(QWidgetOrQuick *parent) const override; QWidgetOrQuick *createRubberBand(QWidgetOrQuick *parent) const override;
SideBar *createSideBar(SideBarLocation loc, MainWindowBase *parent) const override;
#ifdef KDDOCKWIDGETS_QTWIDGETS
QAbstractButton* createTitleBarButton(QWidget *parent, TitleBarButtonType) const override;
#else
QUrl titleBarFilename() const override;
#endif
QIcon iconForButtonType(TitleBarButtonType type, qreal dpr) const override;
static DropIndicatorType s_dropIndicatorType; static DropIndicatorType s_dropIndicatorType;
private: private:

View File

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. 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> Author: Sérgio Martins <sergio.martins@kdab.com>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
@@ -19,17 +19,26 @@
#ifndef KD_KDDOCKWIDGETS_H #ifndef KD_KDDOCKWIDGETS_H
#define KD_KDDOCKWIDGETS_H #define KD_KDDOCKWIDGETS_H
#include "Qt5Qt6Compat_p.h"
#include <QObject> #include <QObject>
#include <QDebug>
#ifdef Q_OS_WIN #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 # define KDDOCKWIDGETS_SUPPORTS_NESTED_MAINWINDOWS
#endif #endif
namespace Layouting {
class Item;
class ItemBoxContainer;
}
namespace KDDockWidgets namespace KDDockWidgets
{ {
class MultiSplitter;
class DropArea;
enum Location { enum Location {
Location_None, Location_None,
Location_OnLeft, ///> Left docking location Location_OnLeft, ///> Left docking location
@@ -44,16 +53,113 @@ namespace KDDockWidgets
}; };
Q_DECLARE_FLAGS(MainWindowOptions, MainWindowOption) 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 { enum AddingOption {
AddingOption_None = 0, ///> No option set AddingOption_None = 0,
AddingOption_StartHidden ///< Don't show the dock widget when adding it 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 ///@internal
enum FrameOption { enum FrameOption {
FrameOption_None = 0, FrameOption_None = 0,
FrameOption_AlwaysShowsTabs = 1, FrameOption_AlwaysShowsTabs = 1,
FrameOption_IsCentralFrame = 2 FrameOption_IsCentralFrame = 2,
FrameOption_IsOverlayed = 4
}; };
Q_DECLARE_FLAGS(FrameOptions, FrameOption) Q_DECLARE_FLAGS(FrameOptions, FrameOption)
@@ -64,18 +170,10 @@ namespace KDDockWidgets
}; };
Q_DECLARE_FLAGS(RestoreOptions, RestoreOption) 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 { enum class DropIndicatorType {
Classic, ///< The default Classic, ///< The default
Segmented Segmented, ///< Segmented indicators
None ///< Don't show any drop indicators while dragging
}; };
///@internal ///@internal
@@ -96,8 +194,44 @@ namespace KDDockWidgets
return QString(); return QString();
} }
/// @brief Each main window supports 4 sidebars
enum class SideBarLocation {
None,
North,
East,
West,
South
};
///@brief describes a type of button you can have in the title bar
enum class TitleBarButtonType {
Close,
Float,
Minimize,
Maximize,
Normal, // Restore from maximized state
AutoHide,
UnautoHide
};
///@internal
inline Qt5Qt6Compat::qhashtype qHash(SideBarLocation loc, Qt5Qt6Compat::qhashtype seed)
{
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_OPERATORS_FOR_FLAGS(KDDockWidgets::FrameOptions)
Q_DECLARE_METATYPE(KDDockWidgets::InitialVisibilityOption)
#endif #endif

View File

@@ -1,7 +1,7 @@
# #
# This file is part of KDDockWidgets. # 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> # Author: Jean-Michaël Celerier <jean-michael.celerier@kdab.com>
# #
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only # SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
@@ -12,7 +12,7 @@
include(CMakeFindDependencyMacro) include(CMakeFindDependencyMacro)
find_dependency(Qt5Widgets REQUIRED) find_dependency(Qt5Widgets REQUIRED)
if (@OPTION_QTQUICK@) if (@KDDockWidgets_QTQUICK@)
find_dependency(Qt5Quick REQUIRED) find_dependency(Qt5Quick REQUIRED)
endif() endif()

View File

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. 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> Author: Sérgio Martins <sergio.martins@kdab.com>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
@@ -25,14 +25,13 @@
#include "Logging_p.h" #include "Logging_p.h"
#include "Frame_p.h" #include "Frame_p.h"
#include "Position_p.h" #include "Position_p.h"
#include "multisplitter/Item_p.h"
#include "FrameworkWidgetFactory.h" #include "FrameworkWidgetFactory.h"
#include "MainWindowBase.h" #include "MainWindowBase.h"
#include "FloatingWindow_p.h"
#include <qmath.h> #include <qmath.h>
#include <QDebug> #include <QDebug>
#include <QSettings> #include <QSettings>
#include <QApplication>
#include <QFile> #include <QFile>
#include <memory> #include <memory>
@@ -163,7 +162,7 @@ QByteArray LayoutSaver::serializeLayout() const
layout.mainWindows.push_back(mainWindow->serialize()); 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()); layout.floatingWindows.reserve(floatingWindows.size());
for (KDDockWidgets::FloatingWindow *floatingWindow : floatingWindows) { for (KDDockWidgets::FloatingWindow *floatingWindow : floatingWindows) {
if (d->matchesAffinity(floatingWindow->affinities())) if (d->matchesAffinity(floatingWindow->affinities()))
@@ -700,6 +699,12 @@ QVariantMap LayoutSaver::MainWindow::toVariantMap() const
map.insert(QStringLiteral("isVisible"), isVisible); map.insert(QStringLiteral("isVisible"), isVisible);
map.insert(QStringLiteral("affinities"), stringListToVariant(affinities)); 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; return map;
} }
@@ -720,6 +725,13 @@ void LayoutSaver::MainWindow::fromVariantMap(const QVariantMap &map)
affinities.push_back(affinityName); 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 bool LayoutSaver::MultiSplitter::isValid() const

View File

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. 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> Author: Sérgio Martins <sergio.martins@kdab.com>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
@@ -27,6 +27,8 @@ QT_BEGIN_NAMESPACE
class QByteArray; class QByteArray;
QT_END_NAMESPACE QT_END_NAMESPACE
class TestDocks;
namespace KDDockWidgets { namespace KDDockWidgets {
class DockWidgetBase; class DockWidgetBase;
@@ -105,7 +107,7 @@ public:
struct ScreenInfo; struct ScreenInfo;
private: private:
Q_DISABLE_COPY(LayoutSaver) Q_DISABLE_COPY(LayoutSaver)
friend class TestDocks; friend class ::TestDocks;
class Private; class Private;
Private *const d; Private *const d;

View File

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. 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> Author: Sérgio Martins <sergio.martins@kdab.com>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
@@ -18,7 +18,7 @@
#include <QRect> #include <QRect>
#include <QDebug> #include <QDebug>
#include <QScreen> #include <QScreen>
#include <QApplication> #include <QGuiApplication>
#include <QJsonDocument> #include <QJsonDocument>
#include <memory> #include <memory>
@@ -236,6 +236,7 @@ public:
QVariantMap toVariantMap() const; QVariantMap toVariantMap() const;
void fromVariantMap(const QVariantMap &map); void fromVariantMap(const QVariantMap &map);
QHash<SideBarLocation, QStringList> dockWidgetsPerSideBar;
KDDockWidgets::MainWindowOptions options; KDDockWidgets::MainWindowOptions options;
LayoutSaver::MultiSplitter multiSplitterLayout; LayoutSaver::MultiSplitter multiSplitterLayout;
QString uniqueName; QString uniqueName;
@@ -271,7 +272,9 @@ public:
s_currentLayoutBeingRestored = this; s_currentLayoutBeingRestored = this;
const QList<QScreen*> screens = qApp->screens(); 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; ScreenInfo info;
info.index = i; info.index = i;
info.geometry = screens[i]->geometry(); info.geometry = screens[i]->geometry();

View File

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. 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> Author: Sérgio Martins <sergio.martins@kdab.com>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
@@ -17,25 +17,39 @@
*/ */
#include "MainWindow.h" #include "MainWindow.h"
#include "Config.h"
#include "DropArea_p.h" #include "DropArea_p.h"
#include "Frame_p.h" #include "Frame_p.h"
#include "Logging_p.h" #include "Logging_p.h"
#include "SideBar_p.h"
#include "DropAreaWithCentralFrame_p.h" #include "DropAreaWithCentralFrame_p.h"
#include "FrameworkWidgetFactory.h"
#include <QApplication>
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QPainter> #include <QPainter>
// clazy:excludeall=ctor-missing-parent-argument,missing-qobject-macro
using namespace KDDockWidgets; using namespace KDDockWidgets;
class MainWindow::Private class MainWindow::Private
{ {
public: public:
explicit Private(MainWindowOptions, MainWindowBase *)
{
}
};
explicit Private(MainWindowOptions, MainWindowBase *mainWindow)
: m_supportsAutoHide(Config::self().flags() & Config::Flag_AutoHideSupport)
{
if (m_supportsAutoHide) {
for (auto location : { SideBarLocation::North, SideBarLocation::East,
SideBarLocation::West, SideBarLocation::South}) {
m_sideBars.insert(location, Config::self().frameworkWidgetFactory()->createSideBar(location, mainWindow) );
}
}
}
const bool m_supportsAutoHide;
QHash<SideBarLocation, SideBar*> m_sideBars;
};
namespace KDDockWidgets { namespace KDDockWidgets {
class MyCentralWidget : public QWidget class MyCentralWidget : public QWidget
@@ -67,12 +81,25 @@ MainWindow::MainWindow(const QString &name, MainWindowOptions options,
, d(new Private(options, this)) , d(new Private(options, this))
{ {
auto centralWidget = new MyCentralWidget(this); auto centralWidget = new MyCentralWidget(this);
auto layout = new QVBoxLayout(centralWidget); auto layout = new QHBoxLayout(centralWidget); // 1 level of indirection so we can add some margins
layout->setContentsMargins(1, 5, 1, 1); layout->setSpacing(0);
layout->addWidget(dropArea()); // 1 level of indirection so we can add some margins layout->setContentsMargins(centerWidgetMargins());
setCentralWidget(centralWidget);
// qApp->installEventFilter(this); if (d->m_supportsAutoHide) {
layout->addWidget(sideBar(SideBarLocation::West));
auto innerVLayout = new QVBoxLayout();
innerVLayout->setSpacing(0);
innerVLayout->setContentsMargins(0, 0, 0, 0);
innerVLayout->addWidget(sideBar(SideBarLocation::North));
innerVLayout->addWidget(dropArea());
innerVLayout->addWidget(sideBar(SideBarLocation::South));
layout->addLayout(innerVLayout);
layout->addWidget(sideBar(SideBarLocation::East));
} else {
layout->addWidget(dropArea());
}
setCentralWidget(centralWidget);
} }
MainWindow::~MainWindow() MainWindow::~MainWindow()
@@ -84,3 +111,24 @@ void MainWindow::setCentralWidget(QWidget *w)
{ {
QMainWindow::setCentralWidget(w); QMainWindow::setCentralWidget(w);
} }
SideBar *MainWindow::sideBar(SideBarLocation location) const
{
return d->m_sideBars.value(location);
}
void MainWindow::resizeEvent(QResizeEvent *ev)
{
MainWindowBase::resizeEvent(ev);
onResized(ev); // Also call our own handler, since QtQuick doesn't have resizeEvent()
}
QMargins MainWindow::centerWidgetMargins() const
{
return { 1, 5, 1, 1};
}
QRect MainWindow::centralAreaGeometry() const
{
return centralWidget()->geometry();
}

Some files were not shown because too many files have changed in this diff Show More