Compare commits

...

180 Commits

Author SHA1 Message Date
Sergio Martins
61079be42d Add example of advanced custom titlebar
Run with: ./bin/kddockwidgets_example -p

The titlebar knows which dock widgets it contains and which one
is the current.

In some cases there's no QTabBar bellow it, like when it's a FloatingWindow
titlebar and there's only 1 nested frame.
2022-03-12 13:11:44 +00:00
Sergio Martins
743dbc0718 Added dockWidgetInserted|Removed signals to TabBarWidget
Since QTabBar doesn't have them.
Useful for custom tab bars
2022-03-12 12:47:26 +00:00
Sergio Martins
fd4588de0f TitleBarWidget: Mark members as protected
So custom titlebars have more power
2022-03-12 12:31:53 +00:00
Sergio Martins
6ba10cfe12 Added TitleBar::tabBar()
Useful for people writing custom titlebar's with style that depends
on the current tab
2022-03-11 18:21:49 +00:00
Sergio Martins
096176dc72 Don't dereference potentially nullptr 2022-03-10 18:37:28 +00:00
Sergio Martins
25b04d7ed8 MDI: Fix another case of showing resize handles wrong
the logic for 'y' only makes sense if 'x' is bounded and vice-versa
2022-03-10 10:55:17 +00:00
Sergio Martins
e345e89c35 MDI: Fix case where resize cursor would be shown for frame bellow
Was already fixed a few days ago, but this is the case for nested
mdi.
2022-03-09 19:08:29 +00:00
Sergio Martins
a97663294c example: Allow to test propagation of close event in the mdi example 2022-03-09 17:18:11 +00:00
Sergio Martins
bb4cf802f5 examples: Remove more duplicate MyWidget.cpp/h files
share with main example instead
2022-03-09 16:42:15 +00:00
Sergio Martins
701069617c example: Allow to test propagation of close event in the mdi example 2022-03-09 16:30:26 +00:00
Sergio Martins
a8c50f1876 example: Remove duplicate minimal-mdi/MyWidget.cpp
It was using the cpp from the main example but the header from
minimal-mdi. Instead, share both the impl and the header
2022-03-09 16:27:25 +00:00
Sergio Martins
61cca1e5ec Forward QCloseEvent to the MDI widgets too
Fixes case where docked MDI widgets were not able to block a close
2022-03-09 16:11:55 +00:00
Sergio Martins
7db9938b85 Fix MainWindow not propagating close events to docked widgets
Nested FloatingWindows already supported it, so make it consistent.

Personal take: In a non-docking world, users can override their
main window close event and prevent a close, to save a document
or such. However, in a docking world, the main window developer
won't know which widgets are docked, so forwarding needs to happen,
as some might have documents to save.
2022-03-09 15:47:02 +00:00
Sergio Martins
01cc915734 Further move onCloseEvent to base class
So that it can be reused by MDI layouts too
2022-03-09 14:58:35 +00:00
Sergio Martins
3454b67a45 Refactor: Move close event logic from FloatingWindow to DropArea
So main window can use it too
2022-03-09 14:39:20 +00:00
Sergio Martins
21765efbac example: Added --blocks-close-event
Makes dock widget #0 reject the close event, meaning it won't close.
2022-03-09 12:46:20 +00:00
Allen Winter
60a1e46453 CMakeLists.txt - fix setting KDDockWidgets_DEPS
broken with last commit
2022-03-08 12:06:53 -05:00
Allen Winter
8b8ef7f2b0 CMakeLists.txt - find COMPONENTS to search for Qt modules 2022-03-08 12:01:13 -05:00
Sergio Martins
c0e8fe3869 Update ChangeLog regarding #44 and #96 being fixed 2022-03-07 16:38:40 +00:00
Sergio Martins
524dff9105 Don't try to restore to previous position if there isn't any 2022-03-07 16:36:38 +00:00
Sergio Martins
0099a19a82 Make redocking floating windows with tabs possible
TitleBar::isFloating() was returning false, while it should
have returned true.

Fixed by making isFloating() simpler and dumb. isFloating() should
only say if it belongs to a floating window or not. It shouldn't
contain any logic about whether button should be visible or not.

There's already logic elsewhere that will hide the float button
in case there's nesting.

Fixes issue #96 and #44
2022-03-07 15:56:15 +00:00
Sergio Martins
e6b8636e88 MDI: Fix resize cursor appearing for frames that had others on top 2022-03-04 11:34:35 +00:00
Sergio Martins
86419fd979 MDI: Fixed closing dock widget in MDI would close main window
We only close the window when the window is a FloatingWindow and
it's the last frame
2022-03-03 17:52:13 +00:00
Eism
220471f746 Corrected the updating of normal geometry for window 2022-02-14 15:34:01 +00:00
Sergio Martins
412860abac tests: Use QT_NO_KEYWORDS too 2022-02-12 14:43:37 +00:00
Sergio Martins
2eeb4aac27 Fix Item_p.h being exposed in public API
Forward declare Item instead
2022-02-12 14:37:19 +00:00
Sergio Martins
bfb2ec701e cmake: Add a dedicated ASAN preset
It's not doing well on Windows, so make the default be a non-asan
build
2022-02-11 22:55:54 +00:00
Sergio Martins
54bf24d5d4 Added Config::setDropIndicatorAllowedFunc() 2022-02-11 19:49:23 +00:00
Sergio Martins
76cbb760ed Minor refactoring before introducing DropIndicatorAllowedFunc
Deals with all the false case first
2022-02-11 19:07:28 +00:00
Sergio Martins
4824a398ab Move DropIndicatorOverlayInterface::DropLocation enum to namespace scope
It's public now
2022-02-11 18:14:26 +00:00
Sergio Martins
a502a8250b Fix possible nullptr dereference 2022-02-11 17:42:09 +00:00
Sergio Martins
85fb4ff671 indicators: Prepare the visibility to be more granular
Currently either all or none inner indicators can be hidden/shown,
and same of the outter.

We'll soon allow some of them to be hidden, selectively, by the
client app.
2022-02-11 17:37:26 +00:00
Sergio Martins
6db3ccc87f .gitignore: Add a few clangd files 2022-02-11 17:10:22 +00:00
Sergio Martins
5811cab164 segmented indicators: Fix potential bugs due to decoupled drop types
The returned QVector was indexed by the enum values, but the enum
is flag based now, no longer sequential. Instead of depending
on ordering of the enum, let's instead return a QHash where the
type is coupled with the corresponding QPolygon already
2022-02-11 17:08:30 +00:00
Sergio Martins
1387c2f573 segmented indicators: Use the base class logic
Instead of repeating it
2022-02-11 16:58:12 +00:00
Sergio Martins
79cc347cd8 Refactor: Move indicator visibility logic into base class 2022-02-11 16:42:07 +00:00
Sergio Martins
e62bde3152 Improve documentation for MainWindowOption_HasCentralWidget
Fixes issue #272
2022-02-11 14:36:19 +00:00
Sergio Martins
81abb3cea5 Fix build on OpenBSD
Fixes #265
2022-02-11 14:31:00 +00:00
Sergio Martins
ecd3c20adf Fix build with Qt5+C++20
Error was:
qvector.h:532:18: error: use of overloaded operator '!=' is ambiguous (with operand types 'int *' and 'QTypedArrayData<int>::iterator')
        while (i != d->begin())
2022-02-10 11:01:14 +00:00
Sergio Martins
755d53432b Fix "drag to detach" MDI windows when in nested MDI mode
We were deleting the draggable, causing the drag to stop
2022-02-04 17:54:43 +00:00
Sergio Martins
e00a552bf8 Add DragController::currentStateChanged() signal 2022-02-04 17:52:54 +00:00
Sergio Martins
faf93fe597 Add DragController::isIdle() 2022-02-04 17:48:42 +00:00
Sergio Martins
4f8aac7df3 Fix floating windows not restoring to previous position
The dock widget wrapper that we deleted had that info. We need
to preserve it.
2022-02-04 16:57:44 +00:00
Sergio Martins
719803ecfa Fix a test with offscreen QPA
We were pressing on pos 6,6 to start a drag but that triggered
a window resize instead.
2022-02-04 16:10:13 +00:00
Sergio Martins
f0ef24383b Debug++ 2022-02-04 16:10:13 +00:00
Sergio Martins
4f8b174a8d Fixed Frame::isFloating() for the nested MDI case 2022-02-04 15:17:11 +00:00
Sergio Martins
675b166956 Added the last crash fix to the ChangeLog 2022-02-04 15:11:17 +00:00
Sergio Martins
b13ba1e42e Fix crash due to use of native widgets on Windows
Qt has corner cases when all of its widgets are native widgets.
This particular crash was a loop between QWidget::create()
and QWidget::createWinId().
2022-02-02 13:21:14 +00:00
Sergio Martins
481dae64c3 nested_mdi: Fix floating windows not going back to their previous location
When floating a mdi window that was nested in a drop area, clicking the
float button should put it back to the MDI area.
2022-01-30 02:55:02 +00:00
Sergio Martins
6b04e20a7e Add some doxygen 2022-01-30 02:40:53 +00:00
Sergio Martins
8a3ee35993 Fix firstParentOfType() going through different windows 2022-01-30 02:15:58 +00:00
Sergio Martins
146c656e29 Minor: Use OOP, add ItemRef::isInMainWindow() 2022-01-29 21:43:41 +00:00
Sergio Martins
a190e2dfbf Fix -Wshadow warning 2022-01-29 20:57:19 +00:00
Sergio Martins
d0daff6771 vscode: Add an entry to run the mdi with dock widgets example 2022-01-29 20:15:29 +00:00
Sergio Martins
721795b113 Remove LastPosition struct, move its members to Position
It was an unneeded indirection that didn't provide added semantics
2022-01-29 19:29:03 +00:00
Sergio Martins
40231b7fae Minor coding style 2022-01-29 19:02:17 +00:00
Sergio Martins
1d0300ecc8 Fix another unused variable 2022-01-26 00:14:01 +00:00
Sergio Martins
ce20628555 Remove unused variable - fixes Werror build 2022-01-25 23:23:54 +00:00
Sergio Martins
d0dcac6b03 Make DockWidgetBase::setMDIPosition|setMDISize support nesting
They now honour Option_MDINestable.
Before they would bail out assuming they weren't in a MDI area.
Now they look further up the hierarchy to find our MDIArea, if any.
2022-01-25 20:14:04 +00:00
Sergio Martins
2b1aa44eff Fix crash when floating nested mdi 2022-01-24 19:18:55 +00:00
Sergio Martins
ae42dffcb1 Update Changelog regarding new nested MDI feature 2022-01-24 18:48:00 +00:00
Sergio Martins
21adfe06ad Add an example for nested docking within MDI 2022-01-24 18:31:10 +00:00
Sergio Martins
7de26139a2 Restore source-compat for TabWidgetWidget() 2022-01-24 15:47:06 +00:00
Sergio Martins
894ff9fea0 Minor: Fix overridden signature 2022-01-24 15:34:37 +00:00
Sergio Martins
942c462586 Fix release build 2022-01-24 15:27:24 +00:00
Sergio Martins
128645693c nested_mdi: Fix DnD over dock widgets docked in MDI
Dragging was always detecting the main window's drop indicator
overlay. Make it transparent for mouse events, so that
QWidget::childAt() doesn't pick it, and we can see the inner
drop areas.
2022-01-23 23:31:50 +00:00
Sergio Martins
86bceb4c48 nested mdi: Fix detaching inner dock widgets
Only the outter-most MDI frame is dragged in MDI mode. The inner ones
are dragged in normal docking mode, they become real floating windows.
2022-01-23 21:46:37 +00:00
Sergio Martins
ea64aae861 tests++ 2022-01-23 21:46:37 +00:00
Sergio Martins
d1645dff73 tests: Remove unneeded sleep 2022-01-23 21:46:37 +00:00
Sergio Martins
a72e018f3b nested mdi: Also test floating a nested MDI 2022-01-23 21:46:37 +00:00
Sergio Martins
66b0ba8902 Added MDIArea::frames() 2022-01-23 21:46:37 +00:00
Sergio Martins
18457d80aa nested mdi: Get rid of unneeded drop area mdi wrapper when floating
When floating, the FloatingWindow has its own DropArea for nesting.
We delete the redundant level of wrappers when floating.
2022-01-23 21:46:37 +00:00
Sergio Martins
95c12dbd4c nested mdi: Fix floating picking the wrong title bar
Use DockWidget::titleBar() which will always travel the hierarchy
and pick the first visible title bar. We have more nesting now.
2022-01-23 21:46:37 +00:00
Sergio Martins
c7682a3524 Use QScopedValueRollback, it's more expressive 2022-01-23 21:46:37 +00:00
Sergio Martins
4922363e71 Simplify expression 2022-01-23 21:46:37 +00:00
Sergio Martins
9f6ec0244f nested mdi: More tests for closing docks 2022-01-23 21:46:37 +00:00
Sergio Martins
747e987f28 test++ 2022-01-23 21:46:37 +00:00
Sergio Martins
68e01c70ee nested mdi: Delete wrappers once we close the last nested DW 2022-01-23 21:46:37 +00:00
Sergio Martins
296b2a3370 nested mdi: Fix MDI's frame title not being updated
Before we didn't need to update it because there was only 1
dock widget. But now, if there's more than one we need to set the
application's name instead of the dock widget's name as title.
2022-01-23 21:46:37 +00:00
Sergio Martins
074bc26be9 Added DropArea::mdiDockWidgetWrapper() 2022-01-23 21:46:37 +00:00
Sergio Martins
f8e6ecf821 Remove DropArea::setIsMDIWrapper(), use ctor instead
This propery is meant to be set only once, so enforce it via
compiler.
2022-01-23 21:46:37 +00:00
Sergio Martins
3e70a2cc71 nested mdi: Added DockWidgetBase::Private::isMDIWrapper 2022-01-23 21:46:37 +00:00
Sergio Martins
65ced9604f nested mdi: Fixed title bar visibility
When there's only one docked widget we only show 1 title bar.
Just like happens with a FloatingWindow
2022-01-23 21:46:37 +00:00
Sergio Martins
45b0536c6a Added DropArea::hasSingleFrame()
For readability
2022-01-23 21:46:37 +00:00
Sergio Martins
8c8f5a8fda Introduce Option_MDINestable
Should allow MDI dock widgets to also accept drops.
Befor, each MDI "window" only had 1 dock widget, but now each
MDI "window" a layout of dock widgets.

This is implemented by nesting the actual dock widget inside
a wrapper drop area. This drop area gives the drop support.

There's still bugs and more tests to fix before merging.
2022-01-23 21:46:37 +00:00
Sergio Martins
22a9ce2596 Merge branch '1.5' 2022-01-21 12:01:38 +00:00
Sergio Martins
93b664414b X11: Add support for robust z-order detection
Qt doesn't provide any way to know which window is directly
bellow the cursor. Generally this is fine since floating windows
are always on top of the main window. However, if Qt::Tool is removed,
then they can be behind, and KDDW can't know which window to overlay
the drop indicators onto.

This patch uses XLib's XQueryTree to solve this.
This is still experimental, hence disabled by default.

For now it's disabled by default, since it's experimental.
You can turn it on by passing -DKDDockWidgets_XLib=ON

Fixes bug #256

(cherry-picked from b20ce0895b as it's safe enough)
2022-01-21 11:56:48 +00:00
Sergio Martins
866788674f Minor: Added Utils::isXCB() 2022-01-21 11:56:48 +00:00
Mauro Persano
f13f0129d4 Add API to set center widget margins on MainWindow
We can't change the margins by subclassing MainWindow and overriding
centerWidgetMargins, since the margins are initialized in MainWindow's
constructor. This adds public API to MainWindow to allow us to change
the margins later on.
2022-01-20 22:37:36 +00:00
Sergio Martins
22ffc6c7ea Fix QtQuick build 2022-01-20 22:37:36 +00:00
Mauro Persano
d1767b5534 Don't render frame for central persistent widget
When the main window has a central persistent widget, make sure the
containing tab widget doesn't render a frame around it.
2022-01-20 22:08:17 +00:00
Allen Winter
2fbe4f872e Merge branch '1.5' 2022-01-20 08:15:23 -05:00
Allen Winter
93e60a743e update copyright year 2022-01-20 08:05:26 -05:00
Allen Winter
328a14b46a src/private/FloatingWindow.cpp - fix compile with mingw
NOMINMAX should only be defined with MSVC on Windows.
2022-01-20 07:50:24 -05:00
Allen Winter
9c17b44ad7 Merge branch '1.5' 2022-01-19 16:23:47 -05:00
Allen Winter
cf40cadce8 cmake/KDAB/modules/KDQtInstallPaths.cmake - sync to upstream 2022-01-19 16:23:28 -05:00
Sergio Martins
16c43b8c24 Make cmake config file honour KDDockWidgets_X11EXTRAS 2022-01-12 09:55:02 +00:00
Allen Winter
8391d85d48 appveyor.yml - add libxkbcommon on ubuntu for qt6 2022-01-09 10:17:39 -05:00
Allen Winter
e59e5d7a71 appveyor.yml - add builders for Qt6 2022-01-09 09:50:58 -05:00
Sergio Martins
aa3c3272ee Fix examples build on macOS and Windows
For some reason a X11 dependency was commited by mistake.
2022-01-08 18:39:16 +00:00
Sergio Martins
1d8fad245a Fix build with 5.12
This is a special request from a customer who can't upgrade right
now.

Min is still 5.15 in CMakeLists.
2022-01-07 17:55:53 +00:00
Sergio Martins
789c531f3d Fix parent of the MDIArea layout
Fixes tests on QtQuick. On QtWidgets it would get reparented
so tests already passed.
2022-01-07 17:45:37 +00:00
Sergio Martins
5b87fb4435 Add an examples/mdi_with_docking/ example 2022-01-07 17:31:20 +00:00
Sergio Martins
402f0b9d90 Add a fwd header for MDIArea.h 2022-01-07 17:27:45 +00:00
Sergio Martins
37567d3980 Introduce MDIArea, a widget that can host MDI dock widgets
This is a public wrapper to MDILayoutWidget. The latter is private
and has internals we don't want to expose. Instead create a public
class with a thin API.

You no longer need to create a MainWindowMDI to have MDI support.
You can now have a normal MainWindow (with normal docking) and
add some dock widget that as a MDIArea as widget.
2022-01-07 17:13:16 +00:00
Sergio Martins
6cef4cea2c Port frameParent() to firstParentOfType() 2022-01-07 14:59:33 +00:00
Sergio Martins
aea2bf971b Add TestDocks::tst_mdi_mixed_with_docking
Tests that we can dock a MDI Layout.
Meaning the main window would support both docking and MDI.
This basic test passes. But there's still a lot of bugs to fix
2022-01-07 12:50:25 +00:00
Sergio Martins
00a0e455e7 Make MDILayoutWidget::addDockWidget's initial opt param optional
It's seldom needed
2022-01-07 12:41:24 +00:00
Sergio Martins
d5c7fbfedd Install MDILayoutWidget_p.h too 2022-01-07 12:32:39 +00:00
Sergio Martins
bea6c09494 CMake: Add a clang -ftime-trace preset
Just for profiling build times.
2022-01-06 13:54:34 +00:00
Allen Winter
0adb130d4b src/private/FloatingWindow.cpp - on Windows, define NOMINMAX
else windows.h will define the max() macro which doesn't
play nice with the std::numeric_limits::max()

Issue #266
2021-12-27 08:09:09 -05:00
Allen Winter
92d0d74641 src/private/FloatingWindow.cpp - on Windows, define NOMINMAX
else windows.h will define the max() macro which doesn't
play nice with the std::numeric_limits::max()

Issue #266
2021-12-27 07:56:00 -05:00
Sergio Martins
4d4f2a0183 Merge branch '1.5' 2021-12-22 17:07:24 +00:00
Alistair Baxter
f1e19ec59c Ensure that floating windows are not positioned off-screen when they are shown
At points when a Rect is to be used to position a floating widget,
test to see if it overlaps any of the system's screens.

If it does not, adjust the Rect to within the closest screen edges.
2021-12-22 16:48:45 +00:00
Sergio Martins
64b5564f99 README: Clarify that for QtQuick we suggest Qt6 2021-12-22 16:08:55 +00:00
Sergio Martins
66cc9ddc03 Updated ChangeLog
Closes #259
2021-12-22 15:39:00 +00:00
Eism
336f1146d3 Fixed the restoration of geometry when user closed maximized window 2021-12-22 15:31:26 +00:00
Mauro Persano
29b1a434c4 Make lazy resize rubber bands optionally top-level
To workaround MFC bug
2021-12-14 11:32:45 +00:00
Allen Winter
c0c8399bd7 README.md - add a bit of info about Qt private packages on linux
related to issue#257
2021-11-26 09:04:30 -05:00
Sergio Martins
b20ce0895b X11: Add support for robust z-order detection
Qt doesn't provide any way to know which window is directly
bellow the cursor. Generally this is fine since floating windows
are always on top of the main window. However, if Qt::Tool is removed,
then they can be behind, and KDDW can't know which window to overlay
the drop indicators onto.

This patch uses XLib's XQueryTree to solve this.
This is still experimental, hence disabled by default.

For now it's disabled by default, since it's experimental.
You can turn it on by passing -DKDDockWidgets_XLib=ON

Fixes bug #256
2021-11-25 20:59:16 +00:00
Sergio Martins
e67f55af51 Minor: Added Utils::isXCB() 2021-11-25 17:22:58 +00:00
Allen Winter
f1410948f8 Merge branch '1.5' 2021-11-24 16:51:38 -05:00
Allen Winter
30185d5b2a This is would become version 1.5.1 2021-11-24 16:49:11 -05:00
Allen Winter
9990300006 distro/qt5-kddockwidgets.spec - add BuildRequires for SUSE
libqt5-qtbase-private-headers-devel is needed
2021-11-24 12:32:06 -05:00
Allen Winter
573e82e9eb update 1.5.0 release date 2021-11-24 12:20:15 -05:00
Allen Winter
07a135a10a ECMGeneratePriFile.cmake - restore "Fix issues with pri file"
commit b81c32b1c9
Author: Jacob Young <jacobly0@users.noreply.github.com>
Date:   Mon Dec 28 20:46:28 2020 -0500
2021-11-24 12:14:16 -05:00
Sergio Martins
fc172b66f8 Explain that changing window manager flags isn't portable
This restriction comes from Qt itself, not from KDDW.
Relates to bug #256

I will however try to reproduce it
2021-11-24 11:16:36 +00:00
Sergio Martins
2be0d5d1d9 Add a warning about using private headers and ABI compat 2021-11-24 10:04:52 +00:00
Allen Winter
3007b46892 ready for 1.5 release 2021-11-22 08:16:54 -05:00
Allen Winter
1419db80a2 OBS distro fixes 2021-11-19 18:03:22 -05:00
Allen Winter
5376ceec7e prep for the 1.5.0 release 2021-11-19 15:39:19 -05:00
Allen Winter
d3a3e7502e appveyor.yml - temporarily disable testing on Windows
until I have the time to figure out a proper solution
2021-11-19 12:22:20 -05:00
Allen Winter
50c3f9b899 appveyor.yml - add bin to PATH on Windows
to fix 'ctest' on Windows
2021-11-19 11:00:44 -05:00
Allen Winter
8845fae147 appveyor.yml - fix typo 2021-11-19 10:23:55 -05:00
Allen Winter
0c291116b9 appveyor.yml - install mesa on ubuntu 2021-11-19 10:05:07 -05:00
Allen Winter
f0fa0281bf CMakeLists.txt - fix default install location on Windows 2021-11-19 09:59:56 -05:00
Allen Winter
313a17a96c appveyor.yml - add Qt to PATH 2021-11-19 08:58:07 -05:00
Allen Winter
9e2b1d3e44 move github CI to appveyor for all platforms 2021-11-19 08:33:43 -05:00
Allen Winter
d832750eb7 CMakeLists.txt - increase min Qt to version 5.15 2021-11-18 09:07:36 -05:00
Allen Winter
a82a283b4b CMakeLists.txt - increase min Qt to version 5.15 2021-11-18 09:06:50 -05:00
Sergio Martins
77392709e2 Merge branch '1.5' 2021-11-18 14:03:00 +00:00
Sergio Martins
b6770217bb README: Mention 5.15 is required
5.12 no longer compiles
2021-11-18 14:01:59 +00:00
Sergio Martins
c8b22e7ea5 Fix "Unpin" button not showing up in overlayed widgets 2021-11-18 12:15:23 +00:00
Sergio Martins
8dcaaaf853 tests|Qt6: Ignore benign warning coming from QQC material style
Needs to be fixed in Qt
2021-11-17 17:00:16 +00:00
Sergio Martins
32ecdb5b37 README-QtQuick: Bump the patch revisions of min supported Qt
Probably works with earlier, but not tested
2021-11-17 15:59:46 +00:00
Sergio Martins
099c7eafc8 tests: Fix QtQuick tests
normal geometry isn't supported for QWindow, only QWidget.
2021-11-17 15:41:50 +00:00
Sergio Martins
f872d6fbc1 tests: Fix issue found by ASAN
We need to ungrab the window before deleting it.
2021-11-17 15:12:06 +00:00
Sergio Martins
3e21787efb qtquick: Fully qualify setPersistentCentralWidget() arguments
So it works from QtQuick too
2021-11-17 14:13:01 +00:00
Allen Winter
58fcd8d04d conan/conanfile.py - change to version 1.5.0 2021-11-15 09:57:14 -05:00
Allen Winter
6fd0b4ddee CMakeLists.txt, Changelog - this will be version 1.6 2021-11-15 09:55:47 -05:00
Allen Winter
95d5146fce CMakeLists.txt - increase version for release candidate 2021-11-15 09:51:21 -05:00
Sergio Martins
ea6adafc13 Fix QtQuick build
Fixes #254
2021-11-09 09:45:15 +00:00
Allen Winter
f65cb2c0ce README.md - minor 2021-11-04 17:20:51 -04:00
Sergio Martins
fbde2bd202 cmake: Allow to not create "docs" target
Fixes integrating KDDW as sub-repo of other projects that
already define "docs" target. It would conflict.

namespacing the target name would be another optionm but in doubt
keep things simple
2021-11-03 09:14:25 +00:00
Sergio Martins
0cee15c0d3 Don't do relative positioning restore if main window changed screen
We only shift floating windows position for simple cases.
Fixes floating windows being restored out of bounds in some cases.
2021-11-02 19:11:29 +00:00
Sergio Martins
4b56a336a0 Fix build on macOS 2021-10-19 14:34:27 +01:00
Sergio Martins
56bec0db04 Replace KDDOCKWIDGETS_RUBBERBAND_IS_TOPLEVEL with config option
This way one doesn't need to rebuild KDDW to make the rubber band
top-level.

Added it as internal option, as this will seldom be used.
2021-10-17 11:17:41 +01:00
Allen Winter
dd979d191f CMakeLists.txt, python/CMakeLists.txt - some restructuring 2021-10-13 17:33:32 -04:00
Sergio Martins
a5f37f851b Fix relative inner resizing not working properly
When we resize the main window then we also resize the inner
dock widgets in the same proportion (based on saved percentages),
during a resize we should not recompute those percentages due to
rounding errors.

They were being recomputed by mistake, since only the root Item
was blocking them, but the function recurses into inner items

Fixes #186
2021-10-13 18:33:45 +01:00
Sergio Martins
052d8680dc Add a test for #186
Was hard to reproduce, doesn't happen with many other layouts
2021-10-13 15:37:02 +01:00
Sergio Martins
21e8aae823 Add a test for #238
Which I can't reproduce yet, but at least tests another case.
2021-10-12 18:36:50 +01:00
Sergio Martins
0e866079da qtquick: Fix parentChanged() passing the wrong argument
QQuickItem::parentChanged(QQuickItem *parent) passes the *new*
parent, not *this*

Fixes #243 which is actually invalid, but uncovered this bug.
For #243 you can just use sender(), or connect to a lambda that
captures the dock widget.
2021-10-12 11:46:16 +01:00
Sergio Martins
a8bd6ba840 Fix corrupt layout when restoring old JSON
If the old *.json file doesn't know about some new docked widget
then we need to float it before restoring the main window

Fixes #237
2021-10-12 11:16:15 +01:00
Sergio Martins
96aefdd3c7 Make tst_restoreNonExistingDockWidget more minimal
dock1 isn't required

And it's ok that dock2 remains open, the bug is actually that it
doesn't get resized when we resize the main window
2021-10-11 00:50:53 +01:00
Sergio Martins
753fe57b30 Add a failing test for bug #237 2021-10-11 00:25:10 +01:00
Sergio Martins
9587c1b1e3 Add a test for issue #245
I can't repro still. Will wait for more feedback from reporter.
2021-10-10 19:32:27 +01:00
Sergio Martins
bc1b296440 README: Explain that StyleSheets are not supported
It's intentional.

Closes #246
2021-10-10 19:20:00 +01:00
Allen Winter
5626b0120d PySide[2,6]ModuleBuild.cmake - restore noisy compiler warnings removal
somehow got lost
2021-10-05 17:08:32 -04:00
Allen Winter
e5d2f5f857 PySide[2,6]ModuleBuild.cmake - restore noisy compiler warnings removal
somehow got lost
2021-10-03 16:54:26 -04:00
Allen Winter
3eb52c46b1 python/examples/main.py - add instructions to generate rc_assets.py 2021-09-30 15:57:22 -04:00
Allen Winter
aaa64bf769 Merge pull request #248 from KDAB/pyside6-unittest
Fixed unit test for PySide6
2021-09-30 15:49:17 -04:00
Renato Araujo
b7b1d6d4e9 Fixed unit test for PySide6 2021-09-30 06:04:52 -07:00
Allen Winter
a90417de55 python/examples-qt6/main.py - uncomment rc_assets
commented by mistake
2021-09-29 17:17:54 -04:00
Allen Winter
73f08df224 Merge pull request #247 from KDAB/python38
Fixed module import for python 3.8
2021-09-29 16:41:26 -04:00
Renato Araujo Oliveira Filho
db9babbdca Fixed module import for python 3.8 2021-09-29 13:36:16 -07:00
Allen Winter
463dd2261e various - spelling fixes 2021-09-28 16:45:44 -04:00
Allen Winter
4dd66969af examples/dockwidgets/MyTitleBar_CSS.h - add multiple include guard 2021-09-28 16:36:55 -04:00
Allen Winter
2c98003219 CMakeLists.txt,python/tests/CMakeLists.txt - minor coding style 2021-09-28 16:28:51 -04:00
Allen Winter
dd853a8f72 python/tests/ - add copyright+license header 2021-09-28 16:24:35 -04:00
Allen Winter
88d5e6b29d Merge pull request #242 from KDAB/python-unittest
Fixed import module for windows and python 3.7
2021-09-28 16:03:40 -04:00
300 changed files with 3089 additions and 1264 deletions

View File

@@ -1,4 +1,4 @@
[codespell] [codespell]
skip = ./build-*,.git skip = ./build-*,.git,*.svg,rc_assets.py
interactive = 3 interactive = 3
ignore-words-list = overlay,overlayed ignore-words-list = overlay,overlayed

2
.gitignore vendored
View File

@@ -64,3 +64,5 @@ kddockwidgets_minimal_example
*.sln *.sln
*.dir *.dir
.vscode .vscode
/.cache
/compile_commands.json

View File

@@ -4,12 +4,12 @@ Upstream-Contact: <info@kdab.com>
Source: https://www.github.com/KDAB/KDDockWidgets Source: https://www.github.com/KDAB/KDDockWidgets
Files: *.qrc *.json *.xml *.html src/fwd_headers/* Files: *.qrc *.json *.xml *.html src/fwd_headers/*
Copyright: 2019-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> Copyright: 2019-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
License: GPL-2.0-only OR GPL-3.0-only License: GPL-2.0-only OR GPL-3.0-only
#artwork #artwork
Files: screencap.gif images/* src/img/* docs/api/*.png examples/dockwidgets/assets/*.png src/img/classic_indicators/*.png Files: screencap.gif images/* src/img/* docs/api/*.png examples/dockwidgets/assets/*.png src/img/classic_indicators/*.png
Copyright: 2019-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> Copyright: 2019-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
License: GPL-2.0-only OR GPL-3.0-only License: GPL-2.0-only OR GPL-3.0-only
#3rdparty #3rdparty

View File

@@ -1,66 +0,0 @@
env:
global:
- secure: "NlWO/NTPlOU6cowOMuPOvjAprXVwIjmpHHf9CoMR71E2c/eBFFKIHj10kXuyFwz2KihHAIExmo9OlGtGniNWobvIrVrabO3dsOSb6UGbPAQkzQiyQLKsDNQAZx3nMuWEKBtMsVRee6rd7/2uGTY4WB5Ot3VhrUYcN1FoRgQQ9gk="
branches:
only:
- master
matrix:
include:
- os: linux
dist: bionic
- os: osx
osx_image: xcode11.5
env:
- QT_SELECT=qt5
- CMAKE_PREFIX_PATH=/usr/local/opt/qt
language: cpp
compiler:
- gcc
- clang
script:
- mkdir build
- cd build
- cmake -DCMAKE_BUILD_TYPE=Release -DKDDockWidgets_TESTS=True -KDDockWidgets_EXAMPLES=True -DKDDockWidgets_DEVELOPER_MODE=True ..
- make
- make test
notifications:
email:
recipients:
- allen.winter@kdab.com
- sergio.martins@kdab.com
on_success: never
on_failure: always
dist: bionic
addons:
apt:
update: true
packages:
- qt5-default
- qtbase5-dev
- qtbase5-dev-tools
- qtbase5-private-dev
- qttools5-dev
- qttools5-dev-tools
- qtdeclarative5-dev
- qtdeclarative5-dev-tools
- libqt5xmlpatterns5-dev
- libqt5xmlpatterns5
- qtxmlpatterns5-dev-tools
- libqt5x11extras5-dev
homebrew:
update: true
packages:
- qt5
coverity_scan:
project:
name: KDAB/KDDockWidgets
notification_email: allen.winter@kdab.com
build_command_prepend: cd build && cmake ..
build_command: make
branch_pattern: coverity_scan

View File

@@ -1,7 +1,7 @@
# #
# This file is part of KDDockWidgets. # This file is part of KDDockWidgets.
# #
# SPDX-FileCopyrightText: 2019-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> # SPDX-FileCopyrightText: 2019-2022 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
@@ -21,7 +21,7 @@
# #
# -DKDDockWidgets_TESTS=[true|false] # -DKDDockWidgets_TESTS=[true|false]
# Build the test harness. # Build the test harness.
# Currently ignored unless you also set KDDockWidgets_DEVELOPER_MODE=True # Currently ignored (except for Python bindings) unless KDDockWidgets_DEVELOPER_MODE=True.
# Default=false # Default=false
# #
# -DKDDockWidgets_EXAMPLES=[true|false] # -DKDDockWidgets_EXAMPLES=[true|false]
@@ -89,11 +89,11 @@ else()
endif() endif()
set(${PROJECT_NAME}_VERSION_MAJOR 1) set(${PROJECT_NAME}_VERSION_MAJOR 1)
set(${PROJECT_NAME}_VERSION_MINOR 4) set(${PROJECT_NAME}_VERSION_MINOR 5)
set(${PROJECT_NAME}_VERSION_PATCH 95) set(${PROJECT_NAME}_VERSION_PATCH 95)
set(${PROJECT_NAME}_VERSION ${${PROJECT_NAME}_VERSION_MAJOR}.${${PROJECT_NAME}_VERSION_MINOR}.${${PROJECT_NAME}_VERSION_PATCH}) set(${PROJECT_NAME}_VERSION ${${PROJECT_NAME}_VERSION_MAJOR}.${${PROJECT_NAME}_VERSION_MINOR}.${${PROJECT_NAME}_VERSION_PATCH})
set(PROJECT_VERSION ${${PROJECT_NAME}_VERSION}) #PROJECT_VERSION is needed by some ECM modules set(PROJECT_VERSION ${${PROJECT_NAME}_VERSION}) #PROJECT_VERSION is needed by some ECM modules
set(${PROJECT_NAME}_SOVERSION "1.5") set(${PROJECT_NAME}_SOVERSION "1.6")
include(FeatureSummary) include(FeatureSummary)
@@ -107,6 +107,7 @@ option(${PROJECT_NAME}_EXAMPLES "Build the examples" ON)
option(${PROJECT_NAME}_DOCS "Build the API documentation" OFF) option(${PROJECT_NAME}_DOCS "Build the API documentation" OFF)
option(${PROJECT_NAME}_WERROR "Use -Werror (will be true for developer-mode unconditionally)" OFF) option(${PROJECT_NAME}_WERROR "Use -Werror (will be true for developer-mode unconditionally)" OFF)
option(${PROJECT_NAME}_X11EXTRAS "On Linux, link against QtX11Extras so we can detect if the compositor supports transparency. Not applicable to other platforms or Qt6." ON) option(${PROJECT_NAME}_X11EXTRAS "On Linux, link against QtX11Extras so we can detect if the compositor supports transparency. Not applicable to other platforms or Qt6." ON)
option(${PROJECT_NAME}_XLib "On Linux, link against XLib, for a more robust window z-order detection." OFF)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake") list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/ECM/modules") list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/ECM/modules")
@@ -124,25 +125,25 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif() endif()
if (${PROJECT_NAME}_XLib)
add_definitions(-DKDDockWidgets_XLIB)
endif()
if(${PROJECT_NAME}_QT6) if(${PROJECT_NAME}_QT6)
set(Qt_VERSION_MAJOR 6) set(Qt_VERSION_MAJOR 6)
set(QT_MIN_VERSION "6.0.0") set(QT_MIN_VERSION "6.0.0")
find_package(Qt6Widgets ${QT_MIN_VERSION} REQUIRED)
find_package(Qt6Test ${QT_MIN_VERSION} REQUIRED)
set(${PROJECT_NAME}_LIBRARY_QTID "-qt6") set(${PROJECT_NAME}_LIBRARY_QTID "-qt6")
else() else()
set(Qt_VERSION_MAJOR 5) set(Qt_VERSION_MAJOR 5)
set(QT_MIN_VERSION "5.12") set(QT_MIN_VERSION "5.15")
find_package(Qt5Widgets ${QT_MIN_VERSION} REQUIRED)
find_package(Qt5Test ${QT_MIN_VERSION} REQUIRED)
set(${PROJECT_NAME}_LIBRARY_QTID "") set(${PROJECT_NAME}_LIBRARY_QTID "")
endif() endif()
find_package(Qt${Qt_VERSION_MAJOR} ${QT_MIN_VERSION} NO_MODULE REQUIRED COMPONENTS Widgets Test)
include(KDQtInstallPaths) #to set QT_INSTALL_FOO variables include(KDQtInstallPaths) #to set QT_INSTALL_FOO variables
set(${PROJECT_NAME}_DEPS "widgets") set(${PROJECT_NAME}_DEPS "widgets")
if(${PROJECT_NAME}_QTQUICK) if(${PROJECT_NAME}_QTQUICK)
find_package(Qt${Qt_VERSION_MAJOR}Quick) find_package(Qt${Qt_VERSION_MAJOR} NO_MODULE REQUIRED COMPONENTS Quick QuickControls2)
find_package(Qt${Qt_VERSION_MAJOR}QuickControls2)
add_definitions(-DKDDOCKWIDGETS_QTQUICK) add_definitions(-DKDDOCKWIDGETS_QTQUICK)
set(${PROJECT_NAME}_DEPS "${${PROJECT_NAME}_DEPS} quick quickcontrols2") set(${PROJECT_NAME}_DEPS "${${PROJECT_NAME}_DEPS} quick quickcontrols2")
else() else()
@@ -207,16 +208,18 @@ if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT APPLE) OR
string(TOUPPER "CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}" compileflags) string(TOUPPER "CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}" compileflags)
if("${CMAKE_CXX_FLAGS} ${${compileflags}}" MATCHES "-fsanitize") if("${CMAKE_CXX_FLAGS} ${${compileflags}}" MATCHES "-fsanitize")
set(sanitizers_enabled TRUE) set(sanitizers_enabled TRUE)
else() else()
set(sanitizers_enabled FALSE) set(sanitizers_enabled FALSE)
endif() endif()
# cannot enable this for clang + sanitizers if(APPLE OR LINUX)
if (NOT sanitizers_enabled OR NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang") # cannot enable this for clang + sanitizers
if(NOT sanitizers_enabled OR NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# Do not allow undefined symbols, even in non-symbolic shared libraries # Do not allow undefined symbols, even in non-symbolic shared libraries
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined ${CMAKE_SHARED_LINKER_FLAGS}") set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined ${CMAKE_SHARED_LINKER_FLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS "-Wl,--no-undefined ${CMAKE_MODULE_LINKER_FLAGS}") set(CMAKE_MODULE_LINKER_FLAGS "-Wl,--no-undefined ${CMAKE_MODULE_LINKER_FLAGS}")
endif()
endif() endif()
endif() endif()
@@ -230,7 +233,7 @@ if(KDAB_INSTALL)
if(UNIX) if(UNIX)
set(CMAKE_INSTALL_PREFIX "/usr/local/KDAB/${PROJECT_NAME}-${${PROJECT_NAME}_VERSION}" CACHE INTERNAL "Install to default KDAB Location") set(CMAKE_INSTALL_PREFIX "/usr/local/KDAB/${PROJECT_NAME}-${${PROJECT_NAME}_VERSION}" CACHE INTERNAL "Install to default KDAB Location")
elseif(WIN32) elseif(WIN32)
set(CMAKE_INSTALL_PREFIX "C:\\KDAB\\${PROJECT_NAME}-$$VERSION" CACHE INTERNAL "Install to default KDAB Location") set(CMAKE_INSTALL_PREFIX "C:\\KDAB\\${PROJECT_NAME}-${${PROJECT_NAME}_VERSION}" CACHE INTERNAL "Install to default KDAB Location")
endif() endif()
endif() endif()
@@ -263,80 +266,88 @@ if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
) )
install(FILES ${pri_filename} DESTINATION ${ECM_MKSPECS_INSTALL_DIR}) install(FILES ${pri_filename} DESTINATION ${ECM_MKSPECS_INSTALL_DIR})
endif() endif()
else()
#Always disable tests, examples, docs when used as a submodule
set(${PROJECT_NAME}_IS_ROOT_PROJECT FALSE)
set(${PROJECT_NAME}_TESTS FALSE)
set(${PROJECT_NAME}_EXAMPLES FALSE)
set(${PROJECT_NAME}_DOCS FALSE)
endif()
if(${PROJECT_NAME}_TESTS)
enable_testing()
endif() endif()
add_subdirectory(src) add_subdirectory(src)
if(${PROJECT_NAME}_IS_ROOT_PROJECT)
if(${PROJECT_NAME}_EXAMPLES)
if(${PROJECT_NAME}_QTQUICK)
add_subdirectory(examples/qtquick)
else()
add_subdirectory(examples/dockwidgets)
add_subdirectory(examples/minimal)
add_subdirectory(examples/minimal-mdi)
set_compiler_flags(kddockwidgets_example)
set_compiler_flags(kddockwidgets_minimal_example)
endif()
endif()
if(${PROJECT_NAME}_DEVELOPER_MODE)
if(${PROJECT_NAME}_TESTS)
enable_testing()
add_subdirectory(tests)
# Require Qt5.15.1 or higher to run the tests_launcher tests on Mac
if(NOT APPLE OR Qt5Widgets_VERSION VERSION_GREATER 5.15.0)
# tst_docks.exe is pretty big (160 tests), so split it in more runs so we can use threads.
add_test(NAME tst_docks0 COMMAND tests_launcher 0 5)
add_test(NAME tst_docks1 COMMAND tests_launcher 1 5)
add_test(NAME tst_docks2 COMMAND tests_launcher 2 5)
add_test(NAME tst_docks3 COMMAND tests_launcher 3 5)
add_test(NAME tst_docks4 COMMAND tests_launcher 4 5)
add_test(NAME tst_docks5 COMMAND tests_launcher 5 5)
add_test(NAME tst_docks6 COMMAND tests_launcher 6 5)
add_test(NAME tst_docks7 COMMAND tests_launcher 7 5)
add_test(NAME tst_docks8 COMMAND tests_launcher 8 5)
add_test(NAME tst_docks9 COMMAND tests_launcher 9 5)
add_test(NAME tst_docks10 COMMAND tests_launcher 10 5)
add_test(NAME tst_docks11 COMMAND tests_launcher 10 5)
add_test(NAME tst_docks12 COMMAND tests_launcher 11 5)
add_test(NAME tst_docks13 COMMAND tests_launcher 12 5)
add_test(NAME tst_docks14 COMMAND tests_launcher 13 5)
add_test(NAME tst_docks15 COMMAND tests_launcher 14 5)
add_test(NAME tst_docks16 COMMAND tests_launcher 15 5)
add_test(NAME tst_docks17 COMMAND tests_launcher 16 5)
add_test(NAME tst_docks18 COMMAND tests_launcher 17 5)
add_test(NAME tst_docks19 COMMAND tests_launcher 18 5)
add_test(NAME tst_docks20 COMMAND tests_launcher 19 5)
add_test(NAME tst_docks21 COMMAND tests_launcher 20 5) # one more for rounding leftovers
endif()
if(NOT ${PROJECT_NAME}_QTQUICK)
# tst_multisplitter depends on QWidget
add_test(NAME tst_multisplitter COMMAND tst_multisplitter)
endif()
endif()
endif()
if(${PROJECT_NAME}_DOCS)
add_subdirectory(docs) # needs to go last, in case there are build source files
else()
add_custom_target(docs
COMMAND ${CMAKE_COMMAND} -E echo "Sorry, there is no docs target since KDDockWidgets_DOCS=OFF."
"Re-run cmake with the -DKDDockWidgets_DOCS=True option if you want to generate the documentation.")
endif()
# Add uninstall target
include(ECMUninstallTarget)
endif()
if(${PROJECT_NAME}_PYTHON_BINDINGS) if(${PROJECT_NAME}_PYTHON_BINDINGS)
if(CMAKE_BUILD_TYPE MATCHES "^[Dd]eb" OR ${PROJECT_NAME}_STATIC) if(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()
endif()
if(${PROJECT_NAME}_PYTHON_BINDINGS)
add_subdirectory(python) add_subdirectory(python)
endif() endif()
if(${PROJECT_NAME}_EXAMPLES)
if(${PROJECT_NAME}_QTQUICK)
add_subdirectory(examples/qtquick)
else()
add_subdirectory(examples/dockwidgets)
add_subdirectory(examples/minimal)
add_subdirectory(examples/minimal-mdi)
add_subdirectory(examples/mdi_with_docking)
set_compiler_flags(kddockwidgets_example)
set_compiler_flags(kddockwidgets_minimal_example)
set_compiler_flags(kddockwidgets_mdi_with_docking_example)
endif()
endif()
if(${PROJECT_NAME}_TESTS)
if(${PROJECT_NAME}_DEVELOPER_MODE)
add_subdirectory(tests)
# Require Qt5.15.1 or higher to run the tests_launcher tests on Mac
if(NOT APPLE OR Qt5Widgets_VERSION VERSION_GREATER 5.15.0)
# tst_docks.exe is pretty big (160 tests), so split it in more runs so we can use threads.
add_test(NAME tst_docks0 COMMAND tests_launcher 0 5)
add_test(NAME tst_docks1 COMMAND tests_launcher 1 5)
add_test(NAME tst_docks2 COMMAND tests_launcher 2 5)
add_test(NAME tst_docks3 COMMAND tests_launcher 3 5)
add_test(NAME tst_docks4 COMMAND tests_launcher 4 5)
add_test(NAME tst_docks5 COMMAND tests_launcher 5 5)
add_test(NAME tst_docks6 COMMAND tests_launcher 6 5)
add_test(NAME tst_docks7 COMMAND tests_launcher 7 5)
add_test(NAME tst_docks8 COMMAND tests_launcher 8 5)
add_test(NAME tst_docks9 COMMAND tests_launcher 9 5)
add_test(NAME tst_docks10 COMMAND tests_launcher 10 5)
add_test(NAME tst_docks11 COMMAND tests_launcher 10 5)
add_test(NAME tst_docks12 COMMAND tests_launcher 11 5)
add_test(NAME tst_docks13 COMMAND tests_launcher 12 5)
add_test(NAME tst_docks14 COMMAND tests_launcher 13 5)
add_test(NAME tst_docks15 COMMAND tests_launcher 14 5)
add_test(NAME tst_docks16 COMMAND tests_launcher 15 5)
add_test(NAME tst_docks17 COMMAND tests_launcher 16 5)
add_test(NAME tst_docks18 COMMAND tests_launcher 17 5)
add_test(NAME tst_docks19 COMMAND tests_launcher 18 5)
add_test(NAME tst_docks20 COMMAND tests_launcher 19 5)
add_test(NAME tst_docks21 COMMAND tests_launcher 20 5) # one more for rounding leftovers
endif()
if(NOT ${PROJECT_NAME}_QTQUICK)
# tst_multisplitter depends on QWidget
add_test(NAME tst_multisplitter COMMAND tst_multisplitter)
endif()
endif()
endif()
if(${PROJECT_NAME}_DOCS)
add_subdirectory(docs) # needs to go last, in case there are build source files
endif()
if(${PROJECT_NAME}_IS_ROOT_PROJECT)
# Add uninstall target (not for submodules since parent projects typically have uninstall too)
include(ECMUninstallTarget)
endif()
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES) feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)

View File

@@ -9,7 +9,6 @@
"cacheVariables": { "cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug", "CMAKE_BUILD_TYPE": "Debug",
"KDDockWidgets_DEVELOPER_MODE": "ON", "KDDockWidgets_DEVELOPER_MODE": "ON",
"ECM_ENABLE_SANITIZERS" : "'address;undefined'",
"CMAKE_EXPORT_COMPILE_COMMANDS" : "ON", "CMAKE_EXPORT_COMPILE_COMMANDS" : "ON",
"KDDockWidgets_FUZZER" : "OFF" "KDDockWidgets_FUZZER" : "OFF"
}, },
@@ -18,16 +17,17 @@
} }
}, },
{ {
"name": "dev-gammaray", "name": "dev-asan",
"displayName": "dev-gammaray", "displayName": "dev-asan",
"description": "A Gammaray friendly build. (No ASAN)", "description": "An ASAN/UBSAN build",
"generator": "Ninja", "generator": "Ninja",
"binaryDir": "${sourceDir}/build-dev-gammaray", "binaryDir": "${sourceDir}/build-dev-asan",
"cacheVariables": { "cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug", "CMAKE_BUILD_TYPE": "Debug",
"KDDockWidgets_DEVELOPER_MODE": "ON", "KDDockWidgets_DEVELOPER_MODE": "ON",
"CMAKE_EXPORT_COMPILE_COMMANDS" : "ON", "CMAKE_EXPORT_COMPILE_COMMANDS" : "ON",
"KDDockWidgets_FUZZER" : "OFF" "KDDockWidgets_FUZZER" : "OFF",
"ECM_ENABLE_SANITIZERS" : "'address;undefined'"
}, },
"warnings" : { "warnings" : {
"uninitialized" : true "uninitialized" : true
@@ -164,6 +164,23 @@
"displayName": "dev6", "displayName": "dev6",
"generator": "Ninja", "generator": "Ninja",
"binaryDir": "${sourceDir}/build-dev6", "binaryDir": "${sourceDir}/build-dev6",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"KDDockWidgets_QT6": "ON",
"KDDockWidgets_DEVELOPER_MODE": "ON",
"CMAKE_EXPORT_COMPILE_COMMANDS" : "ON",
"KDDockWidgets_FUZZER" : "OFF",
"CMAKE_PREFIX_PATH" : "$env{QT6_DIR}"
},
"environment": {
"PATH": "$env{QT6_DIR}/bin:$penv{PATH}"
}
},
{
"name": "dev-asan6",
"displayName": "dev-asan6",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build-dev-asan6",
"cacheVariables": { "cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug", "CMAKE_BUILD_TYPE": "Debug",
"KDDockWidgets_QT6": "ON", "KDDockWidgets_QT6": "ON",
@@ -295,6 +312,51 @@
"QML2_IMPORT_PATH" : "$env{QT6_DIR}/imports:$env{QT6_DIR}/qml", "QML2_IMPORT_PATH" : "$env{QT6_DIR}/imports:$env{QT6_DIR}/qml",
"LD_LIBRARY_PATH" : "$env{QT6_DIR}/lib" "LD_LIBRARY_PATH" : "$env{QT6_DIR}/lib"
} }
},
{
"name": "dev-time-trace",
"displayName": "dev-time-trace",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build-dev-time-trace",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"KDDockWidgets_DEVELOPER_MODE": "ON",
"CMAKE_EXPORT_COMPILE_COMMANDS" : "ON",
"KDDockWidgets_FUZZER" : "OFF",
"CMAKE_C_FLAGS_INIT" : "-ftime-trace",
"CMAKE_CXX_FLAGS_INIT": "-ftime-trace"
},
"warnings" : {
"uninitialized" : true
},
"environment": {
"CC": "clang",
"CXX": "clang++",
"CCACHE_DISABLE" : "ON"
}
},
{
"name": "dev6-time-trace",
"displayName": "dev6-time-trace",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build-dev6-time-trace",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"KDDockWidgets_DEVELOPER_MODE": "ON",
"CMAKE_EXPORT_COMPILE_COMMANDS" : "ON",
"KDDockWidgets_FUZZER" : "OFF",
"KDDockWidgets_QT6" : "ON",
"CMAKE_C_FLAGS_INIT" : "-ftime-trace",
"CMAKE_CXX_FLAGS_INIT": "-ftime-trace"
},
"warnings" : {
"uninitialized" : true
},
"environment": {
"CC": "clang",
"CXX": "clang++",
"CCACHE_DISABLE" : "ON"
}
} }
], ],
"buildPresets": [ "buildPresets": [

View File

@@ -1,11 +1,24 @@
* v1.5.0 (unreleased) * v1.6.0 (unreleased)
- Fixed restoring of normal geometry when closing a maximized window (#259)
- Experimental support for docking into dock widgets which are in a MDI area.
- Fixed potential crash involving infinite loop between QWidget::create() and QWidget::createWinId()
- Moved DropIndicatorOverlayInterface::DropLocation enum to KDDockWidgets namespace scope
- Added Config::setDropIndicatorAllowedFunc() and corresponding example
(kddockwidgets_example --hide-certain-docking-indicators)
- Fixed case where unfloating wouldn't restore to the main window (#44 and #96)
- Fixed MainWindow not propagating close events to docked widgets
* v1.5.1 (unreleased)
- X11: Improved detecting which window is under the cursor, by using native X11 API
* v1.5.0 (24 November 2021)
- Install the Python bindings to "site-packages" - Install the Python bindings to "site-packages"
- The Python bindings for Qt6 use the "PyKDDockWidgetsQt6" namespace - The Python bindings for Qt6 use the "PyKDDockWidgetsQt6" namespace
- Co-installable with Qt6 - Co-installable with Qt6
- Adds support for non-detachable central widget, MainWindowOption_HasCentralWidget. (#225) - Adds support for non-detachable central widget, MainWindowOption_HasCentralWidget. (#225)
- Fix corrupt layout when restoring old JSON
* v1.4.1 (unreleased) - Fix "Unpin" button not showing up in overlayed widgets
- - Minimum Qt version is now 5.15
* v1.4.0 (16 July 2021) * v1.4.0 (16 July 2021)
- No longer supports Qt versions less than 5.12 - No longer supports Qt versions less than 5.12

View File

@@ -1,4 +1,4 @@
The KDDockWidgets software is Copyright (C) 2018-2021 Klaralvdalens Datakonsult AB. The KDDockWidgets software is Copyright (C) 2018-2022 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-2021, Klarälvdalens Datakonsult AB, and is licensed KDDockWidgets is (C) 2018-2022, 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

View File

@@ -1,8 +1,11 @@
Supported Qt versions and toolchains Supported Qt versions and toolchains
===================================== =====================================
KDDockWidgets for QtQuick requires a C++17 capable compiler and either KDDockWidgets for QtQuick requires a C++17 capable compiler and Qt >= 6.2.1.
Qt >= 5.15.0 or Qt >= 6.2.
Qt 5.15.2 will probably also work, but it's not built and tested by KDAB CI, we
advise users to move to Qt6 as soon as possible.
TROUBLESHOOTING TROUBLESHOOTING

View File

@@ -82,7 +82,8 @@ Open a terminal capable of building Qt5 applications.
Make sure you have cmake, ninja, compiler, Qt, etc in PATH. Make sure you have cmake, ninja, compiler, Qt, etc in PATH.
Adapt the instructions to suit your cmake generator and operating system. Adapt the instructions to suit your cmake generator and operating system.
Build and install the KDDockWidgets framework: Build and install the KDDockWidgets framework (see the "Building" section
below for more info):
``` ```
$ 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
@@ -104,6 +105,15 @@ and `/usr/local/KDAB/KDDockWidgets-<version>` on non-Windows.
You can change the installation location by passing the option `-DCMAKE_INSTALL_PREFIX=/install/path` to cmake. You can change the installation location by passing the option `-DCMAKE_INSTALL_PREFIX=/install/path` to cmake.
Building
========
On Linux distributions make sure to install the qt5 private development packages:
- SUSE: libqt5-qtbase-private-headers-devel
- Ubuntu, debian-based: qtbase5-private-dev
- Fedora, redhat-based: qt5-qtbase-private-devel
- others: consult your distro
Using Using
===== =====
From your CMake Qt5 project, add From your CMake Qt5 project, add
@@ -134,29 +144,42 @@ Versioning
New features go to master while the stable branch only accepts non-intrusive bug fixes. New features go to master while the stable branch only accepts non-intrusive bug fixes.
We'll try to remain source-compatible across versions. API will get a deprecation We'll try to remain source and binary compatible across versions. API will get
notice before being removed in the next version. Note that this source-compatibility a deprecation notice before being removed in the next version. Note that this
effort is only for the public API. Private API (headers ending in _p.h) might change so you compatibility effort is only for the public API. Private API (headers ending
shouldn't depend on them. Private API is only exposed so more advanced users can in _p.h) might change so you shouldn't depend on them. Private API is only
override, for example `paintEvent()`, and not so they can change internal business logic. exposed so more advanced users can override, for example `paintEvent()`, and
not so they can change internal business logic.
We don't promise or test binary compatibility. It's advised that you recompile We don't promise or test binary compatibility. It's advised that you recompile
your application whenever updating KDDW. your application whenever updating KDDW.
Supported Qt versions and toolchains Supported Qt versions and toolchains
===================================== ====================================
KDDockWidgets requires Qt5 >= 5.12 or Qt6 >= 6.1. KDDockWidgets requires a C++17 capable compiler and Qt 5.15.x or Qt6 >= 6.2
The QtQuick support requires Qt5 >= 5.15 or Qt6 >= 6.1. For QtQuick support see [README-QtQuick.md](README-QtQuick.md).
Regarding compilers, whatever toolchain is able to build Qt 5.9 should also be Styling
fine. Note however that MSVC 2013 isn't supported anymore due to compiler crashes. ========
Almost all private widgets used by KDDW can be derived by the user to give them
a custom look. That's done by providing your own FrameworkWidgetFactory. Run
"kddockwidgets_example -p" to see that in action.
Qt StyleSheets are not, and will not, be supported. See the comments in
`examples/dockwidgets/MyTitleBar_CSS.h` for why. You can however use some minimal
CSS, as shown in that example, just don't report bugs about it.
Warning: When using private headers, be sure to rebuild your application whenever you
update to a new KDDW version. Binary compatibility is only kept when using public
headers.
Licensing Licensing
========= =========
KDDockWidgets is (C) 2019-2021, Klarälvdalens Datakonsult AB, and is licensed according to KDDockWidgets is (C) 2019-2022, 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.

View File

@@ -19,6 +19,8 @@ skip_tags: false
# Build worker image # Build worker image
image: image:
- Ubuntu2004
- macos
- Visual Studio 2019 - Visual Studio 2019
# scripts that are called at very beginning, before repo cloning # scripts that are called at very beginning, before repo cloning
@@ -36,16 +38,33 @@ platform:
# build Configuration, i.e. Debug, Release, etc. # build Configuration, i.e. Debug, Release, etc.
configuration: configuration:
- Release - Release
- Debug
environment:
matrix:
- useqt6: False
- useqt6: True
install: install:
- call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat" - sh: if [ "`uname -s`" = "Darwin" ]; then brew install ninja; else sudo apt-get -y update; sudo apt-get -y install mesa-common-dev libglu1-mesa-dev libxkbcommon-dev libxkbcommon-x11-dev; fi
- set QTDIR=C:\Qt\5.15\msvc2019_64
- set PATH=%QTDIR%\bin;%PATH% before_build:
- cmd: call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
- cmd: set PATH=C:\Qt\6.2\msvc2019_64;C:\Qt\5.15\msvc2019_64;%PATH%
- sh: if [ "`uname -s`" = "Darwin" ]; then export PATH=$HOME/Qt/6.1/macos/bin:$HOME/Qt/5.15/clang_64/bin:$PATH; else export PATH=$HOME/Qt/6.2/gcc_64/bin:$HOME/Qt/5.15/gcc_64/bin:$PATH; fi
build_script: build_script:
- mkdir build - mkdir build
- cd build - cd build
- cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=%CONFIGURATION% -DKDDockWidgets_TESTS=True -DKDDockWidgets_EXAMPLES=True -DKDDockWidgets_DEVELOPER_MODE=True .. - cmd: cmake -G Ninja -DCMAKE_BUILD_TYPE=%CONFIGURATION% -DKDDockWidgets_QT6=%useqt6% -DKDDockWidgets_TESTS=True -DKDDockWidgets_EXAMPLES=True -DKDDockWidgets_DEVELOPER_MODE=True ..
- nmake - sh: cmake -G Ninja -DCMAKE_BUILD_TYPE=$CONFIGURATION -DKDDockWidgets_QT6=$useqt6 -DKDDockWidgets_TESTS=True -DKDDockWidgets_EXAMPLES=True -DKDDockWidgets_DEVELOPER_MODE=True ..
- cmake --build .
- cmd: cmake --build . --target install
- sh: sudo cmake --build . --target install
- cmd: set PATH=.\bin;%PATH%
#temporarily disable testing on Windows
#- ctest --test-dir .
- sh: ctest --test-dir .
# to disable automatic builds # to disable automatic builds
#build: off #build: off
@@ -54,11 +73,8 @@ build_script:
# tests configuration # # tests configuration #
#---------------------------------# #---------------------------------#
test_script:
- nmake test
# to disable automatic tests # to disable automatic tests
#test: off test: off
#---------------------------------# #---------------------------------#

View File

@@ -203,7 +203,6 @@ function(ECM_GENERATE_PRI_FILE)
else() else()
set(PRI_TARGET_LIBS "${BASEPATH}/${EGPF_LIB_INSTALL_DIR}") set(PRI_TARGET_LIBS "${BASEPATH}/${EGPF_LIB_INSTALL_DIR}")
endif() endif()
set(PRI_TARGET_DEFINES "")
set(PRI_FILENAME ${CMAKE_CURRENT_BINARY_DIR}/qt_${PRI_TARGET_BASENAME}.pri) set(PRI_FILENAME ${CMAKE_CURRENT_BINARY_DIR}/qt_${PRI_TARGET_BASENAME}.pri)
if (EGPF_FILENAME_VAR) if (EGPF_FILENAME_VAR)
@@ -211,6 +210,8 @@ function(ECM_GENERATE_PRI_FILE)
endif() endif()
set(PRI_TARGET_MODULE_CONFIG "") set(PRI_TARGET_MODULE_CONFIG "")
set(PRI_TARGET_DEFINES "")
set(PRI_TARGET_POSTFIX "")
# backward compat: it was not obvious LIB_NAME needs to be a target name, # backward compat: it was not obvious LIB_NAME needs to be a target name,
# and some projects where the target name was not the actual library output name # and some projects where the target name was not the actual library output name
# passed the output name for LIB_NAME, so .name & .module prperties are correctly set. # passed the output name for LIB_NAME, so .name & .module prperties are correctly set.
@@ -220,6 +221,10 @@ function(ECM_GENERATE_PRI_FILE)
if (target_type STREQUAL "STATIC_LIBRARY") if (target_type STREQUAL "STATIC_LIBRARY")
set(PRI_TARGET_MODULE_CONFIG "staticlib") set(PRI_TARGET_MODULE_CONFIG "staticlib")
endif() endif()
get_target_property(target_defs ${EGPF_LIB_NAME} INTERFACE_COMPILE_DEFINITIONS)
list(FILTER target_defs EXCLUDE REGEX ^QT_)
string(JOIN " " PRI_TARGET_DEFINES "${target_defs}")
set(PRI_TARGET_POSTFIX "$<TARGET_PROPERTY:${EGPF_LIB_NAME},$<UPPER_CASE:$<CONFIG>$<$<CONFIG:>:Debug>>_POSTFIX>")
endif() endif()
file(GENERATE file(GENERATE
@@ -230,8 +235,8 @@ QT.${PRI_TARGET_BASENAME}.MAJOR_VERSION = ${PRI_VERSION_MAJOR}
QT.${PRI_TARGET_BASENAME}.MINOR_VERSION = ${PRI_VERSION_MINOR} QT.${PRI_TARGET_BASENAME}.MINOR_VERSION = ${PRI_VERSION_MINOR}
QT.${PRI_TARGET_BASENAME}.PATCH_VERSION = ${PRI_VERSION_PATCH} QT.${PRI_TARGET_BASENAME}.PATCH_VERSION = ${PRI_VERSION_PATCH}
QT.${PRI_TARGET_BASENAME}.name = ${PRI_TARGET_LIBNAME} QT.${PRI_TARGET_BASENAME}.name = ${PRI_TARGET_LIBNAME}
QT.${PRI_TARGET_BASENAME}.module = ${PRI_TARGET_LIBNAME} QT.${PRI_TARGET_BASENAME}.module = ${PRI_TARGET_LIBNAME}${PRI_TARGET_POSTFIX}
QT.${PRI_TARGET_BASENAME}.defines = ${PRI_TARGET_DEFINES} QT.${PRI_TARGET_BASENAME}.DEFINES = ${PRI_TARGET_DEFINES}
QT.${PRI_TARGET_BASENAME}.includes = ${PRI_TARGET_INCLUDES} QT.${PRI_TARGET_BASENAME}.includes = ${PRI_TARGET_INCLUDES}
QT.${PRI_TARGET_BASENAME}.private_includes = QT.${PRI_TARGET_BASENAME}.private_includes =
QT.${PRI_TARGET_BASENAME}.libs = ${PRI_TARGET_LIBS} QT.${PRI_TARGET_BASENAME}.libs = ${PRI_TARGET_LIBS}

View File

@@ -1,5 +1,5 @@
# #
# SPDX-FileCopyrightText: 2019-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> # SPDX-FileCopyrightText: 2019-2022 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: BSD-3-Clause # SPDX-License-Identifier: BSD-3-Clause

View File

@@ -1,5 +1,5 @@
# #
# SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> # SPDX-FileCopyrightText: 2020-2022 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: BSD-3-Clause # SPDX-License-Identifier: BSD-3-Clause

View File

@@ -1,5 +1,5 @@
# #
# SPDX-FileCopyrightText: 2019-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> # SPDX-FileCopyrightText: 2019-2022 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: BSD-3-Clause # SPDX-License-Identifier: BSD-3-Clause

View File

@@ -1,5 +1,5 @@
# #
# SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> # SPDX-FileCopyrightText: 2020-2022 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: BSD-3-Clause # SPDX-License-Identifier: BSD-3-Clause

View File

@@ -1,5 +1,5 @@
# #
# SPDX-FileCopyrightText: 2016-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> # SPDX-FileCopyrightText: 2016-2022 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
@@ -28,7 +28,7 @@ execute_process(
OUTPUT_VARIABLE ALL_VARS OUTPUT_VARIABLE ALL_VARS
) )
if(NOT return_code EQUAL 0) if(NOT return_code EQUAL 0)
message(WARNING "Failed call: ${QMAKE_EXECUTABLE} -query") message(WARNING "Failed call: ${QT_QMAKE_EXECUTABLE} -query")
message(FATAL_ERROR "QMake call failed: ${return_code}") message(FATAL_ERROR "QMake call failed: ${return_code}")
endif() endif()

View File

@@ -1,5 +1,5 @@
# #
# SPDX-FileCopyrightText: 2019-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> # SPDX-FileCopyrightText: 2019-2022 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: BSD-3-Clause # SPDX-License-Identifier: BSD-3-Clause
@@ -19,6 +19,10 @@ endif()
#Qt5 requires C++14 #Qt5 requires C++14
set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
#remove noisy compiler warnings (as the generated code is not necessarily super-warning-free)
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-all -Wno-extra")
endif()
# On macOS, check if Qt is a framework build. This affects how include paths should be handled. # 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) get_target_property(QtCore_is_framework Qt5::Core FRAMEWORK)

View File

@@ -1,5 +1,5 @@
# #
# SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> # SPDX-FileCopyrightText: 2020-2022 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: BSD-3-Clause # SPDX-License-Identifier: BSD-3-Clause
@@ -19,6 +19,10 @@ endif()
#Qt6 requires C++17 #Qt6 requires C++17
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
#remove noisy compiler warnings (as the generated code is not necessarily super-warning-free)
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-all -Wno-extra")
endif()
# On macOS, check if Qt is a framework build. This affects how include paths should be handled. # 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) get_target_property(QtCore_is_framework Qt6::Core FRAMEWORK)

View File

@@ -47,6 +47,17 @@
"stopAtEntry": false, "stopAtEntry": false,
"externalConsole": false "externalConsole": false
}, },
{
"name": "gdb-kddockwidgets_mdi_with_docking_example",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build-dev/bin/kddockwidgets_mdi_with_docking_example",
"args": [],
"cwd": "${workspaceFolder}",
"MIMode": "gdb",
"stopAtEntry": false,
"externalConsole": false
},
{ {
"name": "gdb-tst_docks", "name": "gdb-tst_docks",
"type": "cppdbg", "type": "cppdbg",

View File

@@ -1,7 +1,7 @@
# #
# This file is part of KDDockWidgets. # This file is part of KDDockWidgets.
# #
# SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> # SPDX-FileCopyrightText: 2020-2022 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 = "1.4.0" version = "1.5.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",

View File

@@ -1,3 +1,9 @@
kddockwidgets (1.5.0) release candidate; urgency=high
* 1.5.0 final
-- Allen Winter <allen.winter@kdab.com> Mon, 24 Nov 2021 12:00:00 -0500
kddockwidgets (1.4.0) release candidate; urgency=high kddockwidgets (1.4.0) release candidate; urgency=high
* 1.4.0 final * 1.4.0 final

View File

@@ -6,7 +6,7 @@ Build-Depends: debhelper (>=9), cdbs, cmake
Standards-Version: 3.9.6 Standards-Version: 3.9.6
Homepage: https://github.com/KDAB/KDDockWidgets Homepage: https://github.com/KDAB/KDDockWidgets
Package: kddockwidgets Package: qt5-kddockwidgets
Architecture: any Architecture: any
Depends: ${misc:Depends}, ${shlibs:Depends} Depends: ${misc:Depends}, ${shlibs:Depends}
Description: KDAB's Dock Widget Framework for Qt Description: KDAB's Dock Widget Framework for Qt

View File

@@ -1,10 +1,10 @@
Format: 1.0 Format: 1.0
Source: kddockwidgets Source: kddockwidgets
Version: 1.4.0-1 Version: 1.5.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, qtbase5-dev, libqt5x11extras5-dev Build-Depends: debhelper (>=9), cdbs, cmake, qtbase5-dev, qtbase5-private-dev, libqt5x11extras5-dev, libfontconfig-dev
Files: Files:
00000000000000000000000000000000 00000 qt5-kddockwidgets-1.4.0.tar.gz 00000000000000000000000000000000 00000 qt5-kddockwidgets-1.5.0.tar.gz

View File

@@ -1,5 +1,5 @@
Name: qt5-kddockwidgets Name: qt5-kddockwidgets
Version: 1.4.0 Version: 1.5.0
Release: 1 Release: 1
Summary: KDAB's Dock Widget Framework for Qt5 Summary: KDAB's Dock Widget Framework for Qt5
Source0: %{name}-%{version}.tar.gz Source0: %{name}-%{version}.tar.gz
@@ -14,15 +14,15 @@ Packager: Klaralvdalens Datakonsult AB (KDAB) <info@kdab.com>
BuildRequires: cmake BuildRequires: cmake
%if %{defined suse_version} %if %{defined suse_version}
BuildRequires: libqt5-qtbase-devel libqt5-qtx11extras-devel BuildRequires: libqt5-qtbase-devel libqt5-qtbase-private-headers-devel libqt5-qtx11extras-devel
%endif %endif
%if %{defined fedora} %if %{defined fedora}
BuildRequires: gcc-c++ qt5-qtbase-devel qt5-qtx11extras-devel desktop-file-utils BuildRequires: gcc-c++ qt5-qtbase-devel qt5-qtbase-private-devel qt5-qtx11extras-devel desktop-file-utils
%endif %endif
%if %{defined rhel} %if %{defined rhel}
BuildRequires: gcc-c++ qt5-qtbase-devel qt5-qtx11extras-devel desktop-file-utils BuildRequires: gcc-c++ qt5-qtbase-devel qt5-qtbase-private-devel qt5-qtx11extras-devel desktop-file-utils
%endif %endif
%description %description
@@ -98,6 +98,8 @@ cmake . -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release
%{_libdir}/libkddockwidgets.so %{_libdir}/libkddockwidgets.so
%changelog %changelog
* Mon Nov 24 2021 Allen Winter <allen.winter@kdab.com> 1.5.0
1.5.0 final
* Fri Jul 16 2021 Allen Winter <allen.winter@kdab.com> 1.4.0 * Fri Jul 16 2021 Allen Winter <allen.winter@kdab.com> 1.4.0
1.4.0 final 1.4.0 final
* Mon Jun 07 2021 Allen Winter <allen.winter@kdab.com> 1.3.1 * Mon Jun 07 2021 Allen Winter <allen.winter@kdab.com> 1.3.1

12
distro/qt6-debian.control Normal file
View File

@@ -0,0 +1,12 @@
Source: kddockwidgets
Section: Miscellaneous
Priority: optional
Maintainer: Allen Winter <allen.winter@kdab.com>
Build-Depends: debhelper (>=9), cdbs, cmake
Standards-Version: 3.9.6
Homepage: https://github.com/KDAB/KDDockWidgets
Package: qt6-kddockwidgets
Architecture: any
Depends: ${misc:Depends}, ${shlibs:Depends}
Description: KDAB's Dock Widget Framework for Qt

View File

@@ -1,10 +1,10 @@
Format: 1.0 Format: 1.0
Source: kddockwidgets Source: kddockwidgets
Version: 1.4.0-1 Version: 1.5.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, qtbase6-dev, libqt6x11extras5-dev Build-Depends: debhelper (>=9), cdbs, cmake, qtbase6-dev, qtbase6-private-dev, libqt6x11extras5-dev, libfontconfig-dev
Files: Files:
00000000000000000000000000000000 00000 qt6-kddockwidgets-1.4.0.tar.gz 00000000000000000000000000000000 00000 qt6-kddockwidgets-1.5.0.tar.gz

View File

@@ -1,5 +1,5 @@
Name: qt6-kddockwidgets Name: qt6-kddockwidgets
Version: 1.4.0 Version: 1.5.0
Release: 1 Release: 1
Summary: KDAB's Dock Widget Framework for Qt6 Summary: KDAB's Dock Widget Framework for Qt6
Source0: %{name}-%{version}.tar.gz Source0: %{name}-%{version}.tar.gz
@@ -14,15 +14,15 @@ Packager: Klaralvdalens Datakonsult AB (KDAB) <info@kdab.com>
BuildRequires: cmake BuildRequires: cmake
%if %{defined suse_version} %if %{defined suse_version}
BuildRequires: libqt6-qtbase-devel libqt6-qtx11extras-devel BuildRequires: libqt6-qtbase-devel libqt6-qtbase-private-headers-devel libqt6-qtx11extras-devel
%endif %endif
%if %{defined fedora} %if %{defined fedora}
BuildRequires: gcc-c++ qt6-qtbase-devel desktop-file-utils BuildRequires: gcc-c++ qt6-qtbase-devel qt6-qtbase-private-devel desktop-file-utils libxkbcommon-devel
%endif %endif
%if %{defined rhel} %if %{defined rhel}
BuildRequires: gcc-c++ qt6-qtbase-devel qt6-qtx11extras-devel desktop-file-utils BuildRequires: gcc-c++ qt6-qtbase-devel qt6-qtbase-private-devel qt6-qtx11extras-devel desktop-file-utils libxkbcommon-devel
%endif %endif
%description %description
@@ -87,6 +87,8 @@ cmake . -DCMAKE_INSTALL_PREFIX=/usr -DKDDockWidgets_QT6=True -DCMAKE_BUILD_TYPE=
#%{_prefix}/mkspecs/modules/* ECMGeneratePriFile isn't ported to Qt6 yet #%{_prefix}/mkspecs/modules/* ECMGeneratePriFile isn't ported to Qt6 yet
%changelog %changelog
* Mon Nov 24 2021 Allen Winter <allen.winter@kdab.com> 1.5.0
1.5.0 final
* Fri Jul 16 2021 Allen Winter <allen.winter@kdab.com> 1.4.0 * Fri Jul 16 2021 Allen Winter <allen.winter@kdab.com> 1.4.0
1.4.0 final 1.4.0 final
* Mon Jun 07 2021 Allen Winter <allen.winter@kdab.com> 1.3.1 * Mon Jun 07 2021 Allen Winter <allen.winter@kdab.com> 1.3.1

View File

@@ -1,7 +1,7 @@
# #
# This file is part of KDDockWidgets. # This file is part of KDDockWidgets.
# #
# SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> # SPDX-FileCopyrightText: 2020-2022 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

View File

@@ -1,7 +1,7 @@
# #
# This file is part of KDDockWidgets. # This file is part of KDDockWidgets.
# #
# SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> # SPDX-FileCopyrightText: 2020-2022 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

View File

@@ -1,7 +1,7 @@
<hr> <hr>
<div style="float: left;"> <div style="float: left;">
<img src="kdab-logo-16x16.png"> <img src="kdab-logo-16x16.png">
<font style="font-weight: bold;">&copy; 2019-2021 Klar&auml;lvdalens Datakonsult AB (KDAB)</font> <font style="font-weight: bold;">&copy; 2019-2022 Klar&auml;lvdalens Datakonsult AB (KDAB)</font>
<br> <br>
"The Qt, C++ and OpenGL 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>

View File

@@ -1,7 +1,7 @@
# #
# This file is part of KDDockWidgets. # This file is part of KDDockWidgets.
# #
# SPDX-FileCopyrightText: 2019-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> # SPDX-FileCopyrightText: 2019-2022 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

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2019-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> SPDX-FileCopyrightText: 2019-2022 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,6 +15,7 @@
#include <kddockwidgets/FrameworkWidgetFactory.h> #include <kddockwidgets/FrameworkWidgetFactory.h>
#include <kddockwidgets/private/TabWidget_p.h> #include <kddockwidgets/private/TabWidget_p.h>
#include <kddockwidgets/private/FloatingWindow_p.h>
#include <kddockwidgets/private/widgets/FrameWidget_p.h> #include <kddockwidgets/private/widgets/FrameWidget_p.h>
#include <kddockwidgets/private/widgets/TabBarWidget_p.h> #include <kddockwidgets/private/widgets/TabBarWidget_p.h>
#include <kddockwidgets/private/widgets/TabWidgetWidget_p.h> #include <kddockwidgets/private/widgets/TabWidgetWidget_p.h>
@@ -28,6 +29,7 @@
class MyTitleBar : public KDDockWidgets::TitleBarWidget class MyTitleBar : public KDDockWidgets::TitleBarWidget
{ {
public: public:
bool m_isSpecialType = false;
explicit MyTitleBar(KDDockWidgets::Frame *frame) explicit MyTitleBar(KDDockWidgets::Frame *frame)
: KDDockWidgets::TitleBarWidget(frame) : KDDockWidgets::TitleBarWidget(frame)
{ {
@@ -45,24 +47,73 @@ public:
void init() void init()
{ {
setFixedHeight(60); setFixedHeight(60);
if (auto tb = tabBar()) {
if (auto tbWidget = qobject_cast<KDDockWidgets::TabBarWidget *>(tb->asWidget())) {
// 1. Be notified when dock widgets are added/removed from the tabbar and when current changes
connect(tbWidget, &KDDockWidgets::TabBarWidget::dockWidgetInserted, this, &MyTitleBar::updateType);
connect(tbWidget, &KDDockWidgets::TabBarWidget::dockWidgetRemoved, this, &MyTitleBar::updateType);
connect(tbWidget, &KDDockWidgets::TabBarWidget::currentChanged, this, &MyTitleBar::updateType);
}
}
if (KDDockWidgets::FloatingWindow *fw = floatingWindow()) {
// 2. Floating Windows with more than 1 Frame (more than 1 tabbar) won't have a special titlebar.
// during runtime a FloatingWindow can have frames removed/added, so update its title bar type.
connect(fw, &KDDockWidgets::FloatingWindow::numFramesChanged, this, &MyTitleBar::updateType);
}
} }
void paintEvent(QPaintEvent *) override void updateType()
{ {
QPainter p(this); m_isSpecialType = false;
QPen pen(Qt::black);
const QColor focusedBackgroundColor = Qt::yellow; if (tabBar() != nullptr) { // Will be null for floating windows with several frames.
const QColor backgroundColor = focusedBackgroundColor.darker(115); const auto dws = dockWidgets();
QBrush brush(isFocused() ? focusedBackgroundColor : backgroundColor); for (auto dw : dws) {
pen.setWidth(4); // 3. If this TitleBar contains dock widget #1 or #2 it's special and will have custom painting
p.setPen(pen); if (dw->uniqueName() == QLatin1String("DockWidget #1") ||
p.setBrush(brush); dw->uniqueName() == QLatin1String("DockWidget #2")) {
p.drawRect(rect().adjusted(4, 4, -4, -4)); m_isSpecialType = true;
QFont f = qApp->font(); break;
f.setPixelSize(30); }
f.setBold(true); }
p.setFont(f);
p.drawText(QPoint(10,40), title()); QWidget::update();
}
}
void paintEvent(QPaintEvent *ev) override
{
KDDockWidgets::DockWidgetBase *currentDW = nullptr;
if (auto tb = tabBar()) {
if (auto tbWidget = qobject_cast<KDDockWidgets::TabBarWidget *>(tb->asWidget())) {
// 4. Know the current tab, so it can influence the title bar
currentDW = tbWidget->currentDockWidget();
}
}
if (m_isSpecialType) {
QPainter p(this);
QPen pen(Qt::black);
const bool isDw2 = currentDW && currentDW->uniqueName() == QLatin1String("DockWidget #2");
const QColor focusedBackgroundColor = isDw2 ? Qt::cyan : Qt::yellow;
const QColor backgroundColor = focusedBackgroundColor.darker(115);
QBrush brush(isFocused() ? focusedBackgroundColor : backgroundColor);
pen.setWidth(4);
p.setPen(pen);
p.setBrush(brush);
p.drawRect(rect().adjusted(4, 4, -4, -4));
QFont f = qApp->font();
f.setPixelSize(30);
f.setBold(true);
p.setFont(f);
p.drawText(QPoint(10, 40), title());
} else {
KDDockWidgets::TitleBarWidget::paintEvent(ev);
}
} }
}; };

View File

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2019-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> SPDX-FileCopyrightText: 2019-2022 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-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> SPDX-FileCopyrightText: 2019-2022 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
@@ -47,6 +47,7 @@ static MyWidget *newMyWidget()
MyMainWindow::MyMainWindow(const QString &uniqueName, KDDockWidgets::MainWindowOptions options, MyMainWindow::MyMainWindow(const QString &uniqueName, KDDockWidgets::MainWindowOptions options,
bool dockWidget0IsNonClosable, bool nonDockableDockWidget9, bool restoreIsRelative, bool dockWidget0IsNonClosable, bool nonDockableDockWidget9, bool restoreIsRelative,
bool maxSizeForDockWidget8, bool dockwidget5DoesntCloseBeforeRestore, bool maxSizeForDockWidget8, bool dockwidget5DoesntCloseBeforeRestore,
bool dock0BlocksCloseEvent,
const QString &affinityName, QWidget *parent) const QString &affinityName, QWidget *parent)
: MainWindow(uniqueName, options, parent) : MainWindow(uniqueName, options, parent)
, m_dockWidget0IsNonClosable(dockWidget0IsNonClosable) , m_dockWidget0IsNonClosable(dockWidget0IsNonClosable)
@@ -54,6 +55,7 @@ MyMainWindow::MyMainWindow(const QString &uniqueName, KDDockWidgets::MainWindowO
, m_restoreIsRelative(restoreIsRelative) , m_restoreIsRelative(restoreIsRelative)
, m_maxSizeForDockWidget8(maxSizeForDockWidget8) , m_maxSizeForDockWidget8(maxSizeForDockWidget8)
, m_dockwidget5DoesntCloseBeforeRestore(dockwidget5DoesntCloseBeforeRestore) , m_dockwidget5DoesntCloseBeforeRestore(dockwidget5DoesntCloseBeforeRestore)
, m_dock0BlocksCloseEvent(dock0BlocksCloseEvent)
{ {
auto menubar = menuBar(); auto menubar = menuBar();
auto fileMenu = new QMenu(QStringLiteral("File"), this); auto fileMenu = new QMenu(QStringLiteral("File"), this);
@@ -190,6 +192,9 @@ KDDockWidgets::DockWidgetBase *MyMainWindow::newDockWidget()
myWidget->setMaximumSize(200, 200); myWidget->setMaximumSize(200, 200);
} }
if (count == 0 && m_dock0BlocksCloseEvent)
myWidget->blockCloseEvent();
dock->setWidget(myWidget); dock->setWidget(myWidget);
if (dock->options() & KDDockWidgets::DockWidget::Option_NotDockable) { if (dock->options() & KDDockWidgets::DockWidget::Option_NotDockable) {

View File

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2019-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> SPDX-FileCopyrightText: 2019-2022 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
@@ -20,7 +20,7 @@ class MyMainWindow : public KDDockWidgets::MainWindow
public: public:
explicit MyMainWindow(const QString &uniqueName, KDDockWidgets::MainWindowOptions options, explicit MyMainWindow(const QString &uniqueName, KDDockWidgets::MainWindowOptions options,
bool dockWidget0IsNonClosable, bool nonDockableDockWidget9, bool restoreIsRelative, bool dockWidget0IsNonClosable, bool nonDockableDockWidget9, bool restoreIsRelative,
bool maxSizeForDockWidget8, bool dockwidget5DoesntCloseBeforeRestore, bool maxSizeForDockWidget8, bool dockwidget5DoesntCloseBeforeRestore, bool dock0BlocksCloseEvent,
const QString &affinityName = {}, // Usually not needed. Just here to show the feature. const QString &affinityName = {}, // Usually not needed. Just here to show the feature.
QWidget *parent = nullptr); QWidget *parent = nullptr);
~MyMainWindow() override; ~MyMainWindow() override;
@@ -34,5 +34,6 @@ private:
const bool m_restoreIsRelative; const bool m_restoreIsRelative;
const bool m_maxSizeForDockWidget8; const bool m_maxSizeForDockWidget8;
const bool m_dockwidget5DoesntCloseBeforeRestore; const bool m_dockwidget5DoesntCloseBeforeRestore;
const bool m_dock0BlocksCloseEvent;
KDDockWidgets::DockWidget::List m_dockwidgets; KDDockWidgets::DockWidget::List m_dockwidgets;
}; };

View File

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2019-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> SPDX-FileCopyrightText: 2019-2022 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
@@ -9,6 +9,11 @@
Contact KDAB at <info@kdab.com> for commercial licensing options. Contact KDAB at <info@kdab.com> for commercial licensing options.
*/ */
#ifndef EXAMPLETITLEBAR_CSS_H
#define EXAMPLETITLEBAR_CSS_H
#pragma once
#include <kddockwidgets/private/widgets/TitleBarWidget_p.h> #include <kddockwidgets/private/widgets/TitleBarWidget_p.h>
/** /**
@@ -77,3 +82,5 @@ public:
MyTitleBar_CSS::~MyTitleBar_CSS() MyTitleBar_CSS::~MyTitleBar_CSS()
{ {
} }
#endif

View File

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2019-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> SPDX-FileCopyrightText: 2019-2022 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,6 +15,7 @@
#include <QDebug> #include <QDebug>
#include <QFile> #include <QFile>
#include <QLineEdit> #include <QLineEdit>
#include <QCloseEvent>
static QHash<QString, QImage> s_images; /// clazy:exclude=non-pod-global-static static QHash<QString, QImage> s_images; /// clazy:exclude=non-pod-global-static
@@ -70,6 +71,20 @@ void MyWidget::drawLogo(QPainter &p)
p.drawImage(targetLogoRect, m_logo, m_logo.rect()); p.drawImage(targetLogoRect, m_logo, m_logo.rect());
} }
void MyWidget::blockCloseEvent()
{
m_blocksCloseEvent = true;
}
void MyWidget::closeEvent(QCloseEvent *ev)
{
if (m_blocksCloseEvent) {
ev->ignore();
} else {
QWidget::closeEvent(ev);
}
}
MyWidget1::MyWidget1(MyWidget::QWidget *parent) MyWidget1::MyWidget1(MyWidget::QWidget *parent)
: MyWidget(QStringLiteral(":/assets/triangles.png"), QStringLiteral(":/assets/KDAB_bubble_white.png"), parent) : MyWidget(QStringLiteral(":/assets/triangles.png"), QStringLiteral(":/assets/KDAB_bubble_white.png"), parent)
{ {

View File

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2019-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> SPDX-FileCopyrightText: 2019-2022 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,16 @@ class MyWidget : public QWidget
public: public:
explicit MyWidget(const QString &backgroundFile, const QString &logoFile, QWidget *parent = nullptr); explicit MyWidget(const QString &backgroundFile, const QString &logoFile, QWidget *parent = nullptr);
~MyWidget(); ~MyWidget();
// These two are just for demonstrating how to block the close event, if desired
void blockCloseEvent();
void closeEvent(QCloseEvent *) override;
protected: protected:
void drawLogo(QPainter &); void drawLogo(QPainter &);
QImage m_background; QImage m_background;
QImage m_logo; QImage m_logo;
bool m_blocksCloseEvent = false;
}; };
class MyWidget1 : public MyWidget class MyWidget1 : public MyWidget

View File

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2019-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> SPDX-FileCopyrightText: 2019-2022 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
@@ -13,6 +13,7 @@
#include "MyMainWindow.h" #include "MyMainWindow.h"
#include "MyFrameworkWidgetFactory.h" #include "MyFrameworkWidgetFactory.h"
#include <algorithm>
#include <kddockwidgets/Config.h> #include <kddockwidgets/Config.h>
#include <QStyleFactory> #include <QStyleFactory>
@@ -119,6 +120,10 @@ int main(int argc, char **argv)
QCoreApplication::translate("main", "DockWidget #5 won't be closed before a restore. Illustrates LayoutSaverOption::DontCloseBeforeRestore")); QCoreApplication::translate("main", "DockWidget #5 won't be closed before a restore. Illustrates LayoutSaverOption::DontCloseBeforeRestore"));
parser.addOption(dontCloseBeforeRestore); parser.addOption(dontCloseBeforeRestore);
QCommandLineOption blockCloseEvent("block-close-event",
QCoreApplication::translate("main", "DockWidget #0 will block close events"));
parser.addOption(blockCloseEvent);
QCommandLineOption showButtonsInTabBarIfTitleBarHidden("show-buttons-in-tabbar-if-titlebar-hidden", QCommandLineOption showButtonsInTabBarIfTitleBarHidden("show-buttons-in-tabbar-if-titlebar-hidden",
QCoreApplication::translate("main", "If we're not using title bars we'll still show the close and float button in the tab bar")); QCoreApplication::translate("main", "If we're not using title bars we'll still show the close and float button in the tab bar"));
parser.addOption(showButtonsInTabBarIfTitleBarHidden); parser.addOption(showButtonsInTabBarIfTitleBarHidden);
@@ -131,6 +136,10 @@ int main(int argc, char **argv)
QCoreApplication::translate("main", "Allow switching tabs via context menu in tabs area")); QCoreApplication::translate("main", "Allow switching tabs via context menu in tabs area"));
parser.addOption(ctxtMenuOnTabs); parser.addOption(ctxtMenuOnTabs);
QCommandLineOption hideCertainDockingIndicators("hide-certain-docking-indicators",
QCoreApplication::translate("main", "Illustrates usage of Config::setDropIndicatorAllowedFunc()"));
parser.addOption(hideCertainDockingIndicators);
#if defined(DOCKS_DEVELOPER_MODE) #if defined(DOCKS_DEVELOPER_MODE)
parser.addOption(centralFrame); parser.addOption(centralFrame);
@@ -253,6 +262,24 @@ int main(int argc, char **argv)
return 1; return 1;
} }
if (parser.isSet(hideCertainDockingIndicators)) {
// Here we exemplify adding a restriction to "Dock Widget 8"
// Dock widget 8 will only be allowed to dock to the outter areasa
auto func = [](KDDockWidgets::DropLocation location,
const KDDockWidgets::DockWidgetBase::List &source,
const KDDockWidgets::DockWidgetBase::List &target) {
Q_UNUSED(target); // When dragging into a tab, 'target' would have the list of already tabbed dock widgets
const bool isDraggingDW8 = std::find_if(source.cbegin(), source.cend(), [] (KDDockWidgets::DockWidgetBase *dw) {
return dw->uniqueName() == QLatin1String("DockWidget #8");
}) != source.cend();
return (location & KDDockWidgets::DropLocation_Outter) || !isDraggingDW8;
};
KDDockWidgets::Config::self().setDropIndicatorAllowedFunc(func);
}
KDDockWidgets::Config::self().setFlags(flags); KDDockWidgets::Config::self().setFlags(flags);
const bool nonClosableDockWidget0 = parser.isSet(nonClosableDockWidget); const bool nonClosableDockWidget0 = parser.isSet(nonClosableDockWidget);
@@ -261,6 +288,7 @@ int main(int argc, char **argv)
const bool maxSizeForDockWidget8 = parser.isSet(maxSizeOption); const bool maxSizeForDockWidget8 = parser.isSet(maxSizeOption);
const bool dontCloseDockWidget5BeforeRestore = parser.isSet(dontCloseBeforeRestore); const bool dontCloseDockWidget5BeforeRestore = parser.isSet(dontCloseBeforeRestore);
const bool usesMainWindowsWithAffinity = parser.isSet(multipleMainWindows); const bool usesMainWindowsWithAffinity = parser.isSet(multipleMainWindows);
const bool dock0BlocksCloseEvent = parser.isSet(blockCloseEvent);
#ifdef KDDOCKWIDGETS_SUPPORTS_NESTED_MAINWINDOWS #ifdef KDDOCKWIDGETS_SUPPORTS_NESTED_MAINWINDOWS
const bool usesDockableMainWindows = parser.isSet(dockableMainWindows); const bool usesDockableMainWindows = parser.isSet(dockableMainWindows);
@@ -270,7 +298,7 @@ int main(int argc, char **argv)
MyMainWindow mainWindow(QStringLiteral("MyMainWindow"), options, nonClosableDockWidget0, MyMainWindow mainWindow(QStringLiteral("MyMainWindow"), options, nonClosableDockWidget0,
nonDockableDockWidget9, restoreIsRelative, maxSizeForDockWidget8, nonDockableDockWidget9, restoreIsRelative, maxSizeForDockWidget8,
dontCloseDockWidget5BeforeRestore); dontCloseDockWidget5BeforeRestore, dock0BlocksCloseEvent);
mainWindow.setWindowTitle("Main Window 1"); mainWindow.setWindowTitle("Main Window 1");
mainWindow.resize(1200, 1200); mainWindow.resize(1200, 1200);
mainWindow.show(); mainWindow.show();
@@ -289,7 +317,7 @@ int main(int argc, char **argv)
auto mainWindow2 = new MyMainWindow(QStringLiteral("MyMainWindow-2"), options, auto mainWindow2 = new MyMainWindow(QStringLiteral("MyMainWindow-2"), options,
nonClosableDockWidget0, nonDockableDockWidget9, nonClosableDockWidget0, nonDockableDockWidget9,
restoreIsRelative, maxSizeForDockWidget8, restoreIsRelative, maxSizeForDockWidget8,
dontCloseDockWidget5BeforeRestore, affinity); dontCloseDockWidget5BeforeRestore, dock0BlocksCloseEvent, affinity);
if (affinity.isEmpty()) if (affinity.isEmpty())
mainWindow2->setWindowTitle("Main Window 2"); mainWindow2->setWindowTitle("Main Window 2");
else else
@@ -303,7 +331,7 @@ int main(int argc, char **argv)
const QString affinity = QStringLiteral("Inner-DockWidgets-2"); const QString affinity = QStringLiteral("Inner-DockWidgets-2");
auto dockableMainWindow = new MyMainWindow(QStringLiteral("MyMainWindow-2"), options, auto dockableMainWindow = new MyMainWindow(QStringLiteral("MyMainWindow-2"), options,
false, false, restoreIsRelative, false, false, false, restoreIsRelative, false,
false, affinity); false, false, affinity);
dockableMainWindow->setAffinities({ affinity }); dockableMainWindow->setAffinities({ affinity });

View File

@@ -0,0 +1,40 @@
#
# 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_mdi_with_docking_example)
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}/../dockwidgets/resources_example.qrc)
# Just to reuse MyWidget.h
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../dockwidgets/)
add_executable(kddockwidgets_mdi_with_docking_example
main.cpp
../dockwidgets/MyWidget.cpp
${RESOURCES_EXAMPLE_SRC}
)
target_link_libraries(kddockwidgets_mdi_with_docking_example
PRIVATE
KDAB::kddockwidgets
)

View File

@@ -0,0 +1,95 @@
/*
This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2019-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
Author: Sérgio Martins <sergio.martins@kdab.com>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
Contact KDAB at <info@kdab.com> for commercial licensing options.
*/
#include "MyWidget.h"
#include <kddockwidgets/DockWidget.h>
#include <kddockwidgets/MainWindow.h>
#include <kddockwidgets/MDIArea.h>
#include <QStyleFactory>
#include <QApplication>
#include <QCommandLineParser>
// clazy:excludeall=qstring-allocations
int main(int argc, char **argv)
{
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
#endif
QApplication app(argc, argv);
app.setOrganizationName(QStringLiteral("KDAB"));
app.setApplicationName(QStringLiteral("App supporting both docking and a MDI area"));
QCommandLineParser parser;
parser.setApplicationDescription("KDDockWidgets MDI mixed with normal docking");
parser.addHelpOption();
QCommandLineOption nestedDocking("n", QCoreApplication::translate("main", "The MDI dock widgets will serve as drop areas, allowing for further nesting"));
parser.addOption(nestedDocking);
parser.process(app);
// Fusion looks better in general, but feel free to change
qApp->setStyle(QStyleFactory::create(QStringLiteral("Fusion")));
// # 1. Create our main window
KDDockWidgets::MainWindow mainWindow(QStringLiteral("MyMainWindow"), KDDockWidgets::MainWindowOption_HasCentralWidget);
mainWindow.setWindowTitle("Main Window");
mainWindow.resize(1600, 1200);
mainWindow.show();
// # 2. Create a dock widget, it needs a unique name
auto dock1 = new KDDockWidgets::DockWidget(QStringLiteral("MyDock1"));
auto widget1 = new MyWidget1();
dock1->setWidget(widget1);
auto dock2 = new KDDockWidgets::DockWidget(QStringLiteral("MyDock2"));
auto widget2 = new MyWidget2();
dock2->setWidget(widget2);
// # 3. Dock them
mainWindow.addDockWidget(dock1, KDDockWidgets::Location_OnLeft, nullptr, KDDockWidgets::InitialOption(QSize(300, 0)));
mainWindow.addDockWidget(dock2, KDDockWidgets::Location_OnBottom, nullptr, KDDockWidgets::InitialOption(QSize(0, 300)));
KDDockWidgets::DockWidgetBase::Options options = {};
if (parser.isSet(nestedDocking)) {
options |= KDDockWidgets::DockWidgetBase::Option_MDINestable;
}
// 4. Create our MDI widgets, which will go into the MDI area
auto mdiWidget1 = new KDDockWidgets::DockWidget(QStringLiteral("MDI widget1"), options);
mdiWidget1->setWidget(new MyWidget1());
auto mdiWidget2 = new KDDockWidgets::DockWidget(QStringLiteral("MDI widget2"), options);
mdiWidget2->setWidget(new MyWidget2());
auto mdiWidget3 = new KDDockWidgets::DockWidget(QStringLiteral("MDI widget3"), options);
auto widget3 = new MyWidget3();
mdiWidget3->setWidget(widget3);
// Just for my personal testing: Overkill to add an option
// widget3->blockCloseEvent();
auto mdiArea = new KDDockWidgets::MDIArea();
mainWindow.setPersistentCentralWidget(mdiArea);
mdiArea->addDockWidget(mdiWidget1, QPoint(10, 10));
mdiArea->addDockWidget(mdiWidget2, QPoint(50, 50));
mdiArea->addDockWidget(mdiWidget3, QPoint(110, 110));
return app.exec();
}

View File

@@ -1,7 +1,7 @@
# #
# This file is part of KDDockWidgets. # This file is part of KDDockWidgets.
# #
# SPDX-FileCopyrightText: 2019-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> # SPDX-FileCopyrightText: 2019-2022 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
@@ -24,6 +24,9 @@ endif()
set(RESOURCES_EXAMPLE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/../dockwidgets/resources_example.qrc) set(RESOURCES_EXAMPLE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/../dockwidgets/resources_example.qrc)
# Just to reuse MyWidget.h
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../dockwidgets/)
add_executable(kddockwidgets_minimal_mdi_example add_executable(kddockwidgets_minimal_mdi_example
main.cpp main.cpp
../dockwidgets/MyWidget.cpp ../dockwidgets/MyWidget.cpp

View File

@@ -1,116 +0,0 @@
/*
This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2019-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
Author: Sérgio Martins <sergio.martins@kdab.com>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
Contact KDAB at <info@kdab.com> for commercial licensing options.
*/
#include "MyWidget.h"
#include <QPainter>
#include <QDebug>
#include <QFile>
#include <QLineEdit>
static QHash<QString, QImage> s_images; /// clazy:exclude=non-pod-global-static
MyWidget::MyWidget(const QString &backgroundFile, const QString &logoFile, QWidget *parent)
: QWidget(parent)
{
if (!backgroundFile.isEmpty()) {
auto it = s_images.find(backgroundFile);
if (it == s_images.end())
it = s_images.insert(backgroundFile, QImage(backgroundFile));
m_background = it.value();
}
if (!logoFile.isEmpty()) {
auto it = s_images.find(logoFile);
if (it == s_images.end())
it = s_images.insert(logoFile, QImage(logoFile));
m_logo = it.value();
}
setFocusPolicy(Qt::StrongFocus);
#if 0
// Uncomment to show focus propagation working
new QLineEdit(this);
auto l2 = new QLineEdit(this);
l2->move(0, 100);
setFocusProxy(l2);
#endif
}
MyWidget::~MyWidget()
{
}
void MyWidget::drawLogo(QPainter &p)
{
if (m_logo.isNull())
return;
const qreal ratio = m_logo.height() / (m_logo.width() * 1.0);
const int maxWidth = int(0.80 * size().width());
const int maxHeight = int(0.80 * size().height());
const int proposedHeight = int(maxWidth * ratio);
const int width = proposedHeight <= maxHeight ? maxWidth
: int(maxHeight / ratio);
const int height = int(width * ratio);
QRect targetLogoRect(0,0, width, height);
targetLogoRect.moveCenter(rect().center() + QPoint(0, -int(size().height() * 0.00)));
p.drawImage(targetLogoRect, m_logo, m_logo.rect());
}
MyWidget1::MyWidget1(MyWidget::QWidget *parent)
: MyWidget(QStringLiteral(":/assets/triangles.png"), QStringLiteral(":/assets/KDAB_bubble_white.png"), parent)
{
}
void MyWidget1::paintEvent(QPaintEvent *)
{
QPainter p(this);
p.fillRect(rect(), QColor(0xCC, 0xCC, 0xCC));
p.drawImage(m_background.rect(), m_background, m_background.rect());
drawLogo(p);
}
MyWidget2::MyWidget2(MyWidget::QWidget *parent)
: MyWidget(QString(), QStringLiteral(":/assets/KDAB_bubble_blue.png"), parent)
{
}
void MyWidget2::paintEvent(QPaintEvent *)
{
QPainter p(this);
p.fillRect(rect(), Qt::white);
drawLogo(p);
}
MyWidget3::MyWidget3(MyWidget::QWidget *parent)
: MyWidget(QStringLiteral(":/assets/base.png"), QStringLiteral(":/assets/KDAB_bubble_fulcolor.png"), parent)
, m_triangle(QImage(QStringLiteral(":/assets/tri.png")))
{
}
void MyWidget3::paintEvent(QPaintEvent *)
{
QPainter p(this);
p.fillRect(rect(), QColor(0xD5, 0xD5, 0xD5));
p.drawImage(m_background.rect(), m_background, m_background.rect());
const QRect targetRect = QRect({ width() - m_triangle.width(), height() - m_triangle.height() }, m_triangle.size());
p.drawImage(targetRect, m_triangle, m_triangle.rect());
drawLogo(p);
}

View File

@@ -1,65 +0,0 @@
/*
This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2019-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
Author: Sérgio Martins <sergio.martins@kdab.com>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
Contact KDAB at <info@kdab.com> for commercial licensing options.
*/
#ifndef EXAMPLEDOCKABLEWIDGET_H
#define EXAMPLEDOCKABLEWIDGET_H
#pragma once
#include <QWidget>
QT_BEGIN_NAMESPACE
class QPainter;
QT_END_NAMESPACE
class MyWidget : public QWidget
{
Q_OBJECT
public:
MyWidget() = default;
explicit MyWidget(const QString &backgroundFile, const QString &logoFile, QWidget *parent = nullptr);
~MyWidget();
protected:
void drawLogo(QPainter &);
QImage m_background;
QImage m_logo;
};
class MyWidget1 : public MyWidget
{
Q_OBJECT
public:
explicit MyWidget1(QWidget *parent = nullptr);
protected:
void paintEvent(QPaintEvent*) override;
};
class MyWidget2 : public MyWidget
{
Q_OBJECT
public:
explicit MyWidget2(QWidget *parent = nullptr);
protected:
void paintEvent(QPaintEvent*) override;
};
class MyWidget3 : public MyWidget
{
Q_OBJECT
public:
explicit MyWidget3(QWidget *parent = nullptr);
protected:
void paintEvent(QPaintEvent*) override;
QImage m_triangle;
};
#endif

View File

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2019-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> SPDX-FileCopyrightText: 2019-2022 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
@@ -53,6 +53,9 @@ int main(int argc, char **argv)
auto widget3 = new MyWidget3(); auto widget3 = new MyWidget3();
dock3->setWidget(widget3); dock3->setWidget(widget3);
// Just for my personal testing: Overkill to add an option
// widget3->blockCloseEvent();
// # 3. Dock them // # 3. Dock them
mainWindow.addDockWidget(dock1, QPoint(10, 10)); mainWindow.addDockWidget(dock1, QPoint(10, 10));
mainWindow.addDockWidget(dock2, QPoint(50, 50)); mainWindow.addDockWidget(dock2, QPoint(50, 50));

View File

@@ -1,7 +1,7 @@
# #
# This file is part of KDDockWidgets. # This file is part of KDDockWidgets.
# #
# SPDX-FileCopyrightText: 2019-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> # SPDX-FileCopyrightText: 2019-2022 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

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2019-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> SPDX-FileCopyrightText: 2019-2022 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-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> SPDX-FileCopyrightText: 2019-2022 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-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> SPDX-FileCopyrightText: 2019-2022 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,6 +1,6 @@
# This file is part of KDDockWidgets. # This file is part of KDDockWidgets.
# #
# SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> # SPDX-FileCopyrightText: 2020-2022 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

@@ -1,7 +1,7 @@
# #
# This file is part of KDDockWidgets. # This file is part of KDDockWidgets.
# #
# SPDX-FileCopyrightText: 2019-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> # SPDX-FileCopyrightText: 2019-2022 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

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> SPDX-FileCopyrightText: 2020-2022 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

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> SPDX-FileCopyrightText: 2020-2022 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

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> SPDX-FileCopyrightText: 2020-2022 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

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> SPDX-FileCopyrightText: 2020-2022 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

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> SPDX-FileCopyrightText: 2020-2022 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

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> SPDX-FileCopyrightText: 2020-2022 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

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> SPDX-FileCopyrightText: 2020-2022 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

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> SPDX-FileCopyrightText: 2020-2022 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

@@ -1,7 +1,7 @@
# #
# This file is part of KDDockWidgets. # This file is part of KDDockWidgets.
# #
# SPDX-FileCopyrightText: 2019-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> # SPDX-FileCopyrightText: 2019-2022 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

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> SPDX-FileCopyrightText: 2020-2022 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

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> SPDX-FileCopyrightText: 2020-2022 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

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> SPDX-FileCopyrightText: 2020-2022 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

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> SPDX-FileCopyrightText: 2020-2022 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

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> SPDX-FileCopyrightText: 2020-2022 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

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> SPDX-FileCopyrightText: 2020-2022 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

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> SPDX-FileCopyrightText: 2020-2022 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

@@ -1,7 +1,7 @@
# #
# This file is part of KDDockWidgets. # This file is part of KDDockWidgets.
# #
# SPDX-FileCopyrightText: 2019-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> # SPDX-FileCopyrightText: 2019-2022 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

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> SPDX-FileCopyrightText: 2020-2022 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

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> SPDX-FileCopyrightText: 2020-2022 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

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> SPDX-FileCopyrightText: 2020-2022 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

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> SPDX-FileCopyrightText: 2020-2022 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

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> SPDX-FileCopyrightText: 2020-2022 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

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> SPDX-FileCopyrightText: 2020-2022 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

@@ -1,7 +1,7 @@
# #
# This file is part of KDDockWidgets. # This file is part of KDDockWidgets.
# #
# SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> # SPDX-FileCopyrightText: 2020-2022 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
@@ -39,4 +39,6 @@ set(${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX "${${PROJECT_NAME}_PYTHON_BIN
include(PySide${PYSIDE_MAJOR_VERSION}ModuleBuild) include(PySide${PYSIDE_MAJOR_VERSION}ModuleBuild)
add_subdirectory(PyKDDockWidgets) add_subdirectory(PyKDDockWidgets)
add_subdirectory(tests) if(${PROJECT_NAME}_TESTS)
add_subdirectory(tests)
endif()

View File

@@ -1,7 +1,7 @@
# #
# This file is part of KDDockWidgets. # This file is part of KDDockWidgets.
# #
# SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> # SPDX-FileCopyrightText: 2020-2022 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

View File

@@ -1,7 +1,7 @@
# #
# This file is part of KDDockWidgets. # This file is part of KDDockWidgets.
# #
# SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> # SPDX-FileCopyrightText: 2020-2022 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,15 +15,25 @@ import os
__all__ = ['KDDockWidgets'] __all__ = ['KDDockWidgets']
def setupLibraryPath(): def setupLibraryPath():
package_dir = os.path.abspath(os.path.dirname(__file__))
if sys.platform != 'win32': if sys.platform != 'win32':
return return
if sys.version_info[0] == 3 and sys.version_info[1] >= 8: if "@PYSIDE_MAJOR_VERSION@" == "6":
os.add_dll_directory(package_dir) from shiboken@PYSIDE_MAJOR_VERSION@ import Shiboken
return else:
from shiboken@PYSIDE_MAJOR_VERSION@ import shiboken@PYSIDE_MAJOR_VERSION@ as Shiboken
os.environ['PATH'] = os.fspath(package_dir) + os.pathsep + os.environ['PATH'] from PySide@PYSIDE_MAJOR_VERSION@ import QtCore
extra_dll_dirs = [ os.path.abspath(os.path.dirname(Shiboken.__file__)),
os.path.abspath(os.path.dirname(QtCore.__file__)),
os.path.abspath(os.path.dirname(__file__)) ]
if sys.version_info[0] == 3 and sys.version_info[1] >= 8:
for dll_dir in extra_dll_dirs:
os.add_dll_directory(dll_dir)
for dll_dir in extra_dll_dirs:
os.environ['PATH'] = os.fspath(dll_dir) + os.pathsep + os.environ['PATH']
# Preload PySide libraries to avoid missing libraries while loading KDDockWidgets # Preload PySide libraries to avoid missing libraries while loading KDDockWidgets
try: try:
@@ -36,15 +46,3 @@ except Exception:
raise raise
setupLibraryPath() setupLibraryPath()
#
# This file is part of KDDockWidgets.
#
# SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
# Author: Renato Araujo Oliveira Filho <renato.araujo@kdab.com>
#
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
#
# Contact KDAB at <info@kdab.com> for commercial licensing options.
#

View File

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> SPDX-FileCopyrightText: 2020-2022 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

View File

@@ -1,7 +1,7 @@
# #
# This file is part of KDDockWidgets. # This file is part of KDDockWidgets.
# #
# SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> # SPDX-FileCopyrightText: 2020-2022 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

View File

@@ -1,7 +1,7 @@
# #
# This file is part of KDDockWidgets. # This file is part of KDDockWidgets.
# #
# SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> # SPDX-FileCopyrightText: 2020-2022 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

View File

@@ -1,7 +1,7 @@
# #
# This file is part of KDDockWidgets. # This file is part of KDDockWidgets.
# #
# SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> # SPDX-FileCopyrightText: 2020-2022 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

View File

@@ -1,7 +1,7 @@
# #
# This file is part of KDDockWidgets. # This file is part of KDDockWidgets.
# #
# SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> # SPDX-FileCopyrightText: 2020-2022 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

View File

@@ -1,7 +1,7 @@
# #
# This file is part of KDDockWidgets. # This file is part of KDDockWidgets.
# #
# SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> # SPDX-FileCopyrightText: 2020-2022 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

View File

@@ -1,7 +1,7 @@
# #
# This file is part of KDDockWidgets. # This file is part of KDDockWidgets.
# #
# SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> # SPDX-FileCopyrightText: 2020-2022 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,7 +15,10 @@ from MyMainWindow import MyMainWindow
from PySide6 import QtWidgets, QtCore from PySide6 import QtWidgets, QtCore
import sys import sys
#import rc_assets try:
import rc_assets
except:
exit("Oops.. rc_assets needs to be generated first.\nPlease run:\n rcc -g python -o rc_assets.py ../../examples/dockwidgets/resources_example.qrc\n(Make sure to use the rcc from the Qt6 version used to generate the bindings!)")
if __name__ == "__main__": if __name__ == "__main__":
QtWidgets.QApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling) QtWidgets.QApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling)

View File

@@ -1,7 +1,7 @@
# #
# This file is part of KDDockWidgets. # This file is part of KDDockWidgets.
# #
# SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> # SPDX-FileCopyrightText: 2020-2022 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

View File

@@ -1,7 +1,7 @@
# #
# This file is part of KDDockWidgets. # This file is part of KDDockWidgets.
# #
# SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> # SPDX-FileCopyrightText: 2020-2022 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

View File

@@ -1,7 +1,7 @@
# #
# This file is part of KDDockWidgets. # This file is part of KDDockWidgets.
# #
# SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> # SPDX-FileCopyrightText: 2020-2022 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

View File

@@ -1,7 +1,7 @@
# #
# This file is part of KDDockWidgets. # This file is part of KDDockWidgets.
# #
# SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> # SPDX-FileCopyrightText: 2020-2022 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

View File

@@ -1,7 +1,7 @@
# #
# This file is part of KDDockWidgets. # This file is part of KDDockWidgets.
# #
# SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> # SPDX-FileCopyrightText: 2020-2022 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

View File

@@ -1,7 +1,7 @@
# #
# This file is part of KDDockWidgets. # This file is part of KDDockWidgets.
# #
# SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> # SPDX-FileCopyrightText: 2020-2022 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,7 +15,10 @@ from MyMainWindow import MyMainWindow
from PySide2 import QtWidgets, QtCore from PySide2 import QtWidgets, QtCore
import sys import sys
import rc_assets try:
import rc_assets
except:
exit("Oops.. rc_assets needs to be generated first.\nPlease run:\n rcc -g python -o rc_assets.py ../../examples/dockwidgets/resources_example.qrc\n(Make sure to use the rcc from the Qt5 version used to generate the bindings!)")
if __name__ == "__main__": if __name__ == "__main__":
QtWidgets.QApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling) QtWidgets.QApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling)

View File

@@ -1,7 +1,7 @@
# #
# This file is part of KDDockWidgets. # This file is part of KDDockWidgets.
# #
# SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> # SPDX-FileCopyrightText: 2020-2022 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
@@ -18,23 +18,23 @@ set(TEST_PYTHONPATH
set(TEST_LIBRARYPATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) set(TEST_LIBRARYPATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
if(WIN32) if(WIN32)
set(TEST_LIBRARY_VAR "PATH") set(TEST_LIBRARY_VAR "PATH")
string(REPLACE "\\" "/" TEST_PYTHONPATH "${TEST_PYTHONPATH}") string(REPLACE "\\" "/" TEST_PYTHONPATH "${TEST_PYTHONPATH}")
string(REPLACE "\\" "/" TEST_LIBRARYPATH "${TEST_LIBRARYPATH}") string(REPLACE "\\" "/" TEST_LIBRARYPATH "${TEST_LIBRARYPATH}")
list(JOIN TEST_PYTHONPATH "\\;" TEST_PYTHONPATH) list(JOIN TEST_PYTHONPATH "\\;" TEST_PYTHONPATH)
list(JOIN TEST_LIBRARYPATH "\\;" TEST_LIBRARYPATH) list(JOIN TEST_LIBRARYPATH "\\;" TEST_LIBRARYPATH)
else() else()
set(TEST_LIBRARY_VAR "LD_LIBRARY_PATH") set(TEST_LIBRARY_VAR "LD_LIBRARY_PATH")
list(JOIN TEST_PYTHONPATH ":" TEST_PYTHONPATH) list(JOIN TEST_PYTHONPATH ":" TEST_PYTHONPATH)
list(JOIN TEST_LIBRARYPATH ":" TEST_LIBRARYPATH) list(JOIN TEST_LIBRARYPATH ":" TEST_LIBRARYPATH)
endif() endif()
set(PYTHON_ENV_COMMON "PYTHONPATH=${TEST_PYTHONPATH};${TEST_LIBRARY_VAR}=${TEST_LIBRARYPATH}") set(PYTHON_ENV_COMMON "PYTHONPATH=${TEST_PYTHONPATH};${TEST_LIBRARY_VAR}=${TEST_LIBRARYPATH}")
file(GLOB TEST_FILES ${CMAKE_CURRENT_SOURCE_DIR}/tst_*.py) file(GLOB TEST_FILES ${CMAKE_CURRENT_SOURCE_DIR}/tst_*.py)
foreach(test_file ${TEST_FILES}) foreach(test_file ${TEST_FILES})
get_filename_component(test_name ${test_file} NAME_WE) get_filename_component(test_name ${test_file} NAME_WE)
add_test(${test_name} ${Python3_EXECUTABLE} ${test_file}) add_test(${test_name} ${Python3_EXECUTABLE} ${test_file})
set_tests_properties(${test_name} PROPERTIES ENVIRONMENT "${PYTHON_ENV_COMMON}") set_tests_properties(${test_name} PROPERTIES ENVIRONMENT "${PYTHON_ENV_COMMON}")
endforeach() endforeach()

View File

@@ -1,2 +1,19 @@
# This file is part of KDDockWidgets.
#
# SPDX-FileCopyrightText: 2021-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
# Author: Renato Araujo <renato.araujo@kdab.com>
#
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
#
# Contact KDAB at <info@kdab.com> for commercial licensing options.
#
import os
import sys
class TstConfig(object): class TstConfig(object):
bindingsNamespace = "@PYTHON_BINDING_NAMESPACE@" bindingsNamespace = "PyKDDockWidgets"
def initLibraryPath():
if sys.platform == 'win32' and sys.version_info[0] == 3 and sys.version_info[1] >= 8:
os.add_dll_directory("@CMAKE_RUNTIME_OUTPUT_DIRECTORY@")

View File

@@ -1,3 +1,13 @@
# This file is part of KDDockWidgets.
#
# SPDX-FileCopyrightText: 2021-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
# Author: Renato Araujo <renato.araujo@kdab.com>
#
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
#
# Contact KDAB at <info@kdab.com> for commercial licensing options.
#
import unittest import unittest
import importlib import importlib
import inspect import inspect
@@ -16,4 +26,5 @@ class TestImportModules(unittest.TestCase):
self.assertIn(symbol, moduleSymbols) self.assertIn(symbol, moduleSymbols)
if __name__ == '__main__': if __name__ == '__main__':
TstConfig.initLibraryPath()
unittest.main() unittest.main()

View File

@@ -1,7 +1,7 @@
# #
# This file is part of KDDockWidgets. # This file is part of KDDockWidgets.
# #
# SPDX-FileCopyrightText: 2019-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> # SPDX-FileCopyrightText: 2019-2022 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
@@ -35,6 +35,8 @@ set(DOCKSLIBS_SRCS
MainWindowBase.h MainWindowBase.h
MainWindowMDI.cpp MainWindowMDI.cpp
MainWindowMDI.h MainWindowMDI.h
MDIArea.cpp
MDIArea.h
LayoutSaver.cpp LayoutSaver.cpp
LayoutSaver.h LayoutSaver.h
private/LayoutSaver_p.h private/LayoutSaver_p.h
@@ -74,6 +76,7 @@ set(DOCKSLIBS_SRCS
private/DropAreaWithCentralFrame_p.h private/DropAreaWithCentralFrame_p.h
private/WidgetResizeHandler.cpp private/WidgetResizeHandler.cpp
private/WidgetResizeHandler_p.h private/WidgetResizeHandler_p.h
private/WindowZOrder_x11_p.h
private/indicators/NullIndicators.cpp private/indicators/NullIndicators.cpp
private/indicators/NullIndicators_p.h private/indicators/NullIndicators_p.h
private/indicators/ClassicIndicators.cpp private/indicators/ClassicIndicators.cpp
@@ -125,6 +128,7 @@ set(DOCKS_INSTALLABLE_PRIVATE_INCLUDES
private/WidgetResizeHandler_p.h private/WidgetResizeHandler_p.h
private/DockRegistry_p.h private/DockRegistry_p.h
private/TabWidget_p.h private/TabWidget_p.h
private/MDILayoutWidget_p.h
) )
set(DOCKS_INSTALLABLE_PRIVATE_WIDGET_INCLUDES set(DOCKS_INSTALLABLE_PRIVATE_WIDGET_INCLUDES
@@ -218,6 +222,7 @@ else()
${DOCKS_INSTALLABLE_INCLUDES} ${DOCKS_INSTALLABLE_INCLUDES}
MainWindow.h MainWindow.h
DockWidget.h DockWidget.h
MDIArea.h
) )
endif() endif()
@@ -294,7 +299,7 @@ if(CMAKE_COMPILER_IS_GNUCXX OR IS_CLANG_BUILD)
endif() endif()
if(${PROJECT_NAME}_QTQUICK) if(${PROJECT_NAME}_QTQUICK)
target_link_libraries(kddockwidgets PUBLIC Qt${Qt_VERSION_MAJOR}::Widgets Qt${Qt_VERSION_MAJOR}::Quick Qt${Qt_VERSION_MAJOR}::QuickControls2) target_link_libraries(kddockwidgets PUBLIC Qt${Qt_VERSION_MAJOR}::Widgets Qt${Qt_VERSION_MAJOR}::Quick Qt${Qt_VERSION_MAJOR}::QuickControls2 PRIVATE Qt${Qt_VERSION_MAJOR}::GuiPrivate)
else() else()
target_link_libraries(kddockwidgets PUBLIC Qt${Qt_VERSION_MAJOR}::Widgets PRIVATE Qt${Qt_VERSION_MAJOR}::WidgetsPrivate) target_link_libraries(kddockwidgets PUBLIC Qt${Qt_VERSION_MAJOR}::Widgets PRIVATE Qt${Qt_VERSION_MAJOR}::WidgetsPrivate)
endif() endif()
@@ -306,6 +311,10 @@ elseif(NOT APPLE AND NOT EMSCRIPTEN AND NOT ${PROJECT_NAME}_QT6 AND ${PROJECT_NA
target_link_libraries(kddockwidgets PUBLIC Qt${Qt_VERSION_MAJOR}::X11Extras) target_link_libraries(kddockwidgets PUBLIC Qt${Qt_VERSION_MAJOR}::X11Extras)
endif() endif()
if(${PROJECT_NAME}_XLib)
target_link_libraries(kddockwidgets PRIVATE X11)
endif()
set_target_properties(kddockwidgets PROPERTIES set_target_properties(kddockwidgets PROPERTIES
SOVERSION ${${PROJECT_NAME}_SOVERSION} SOVERSION ${${PROJECT_NAME}_SOVERSION}
VERSION ${${PROJECT_NAME}_VERSION} VERSION ${${PROJECT_NAME}_VERSION}

View File

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2019-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> SPDX-FileCopyrightText: 2019-2022 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,6 +19,7 @@
#include "Config.h" #include "Config.h"
#include "private/multisplitter/MultiSplitterConfig.h" #include "private/multisplitter/MultiSplitterConfig.h"
#include "private/multisplitter/Widget.h" #include "private/multisplitter/Widget.h"
#include "private/multisplitter/Item_p.h"
#include "private/DockRegistry_p.h" #include "private/DockRegistry_p.h"
#include "private/Utils_p.h" #include "private/Utils_p.h"
#include "private/DragController_p.h" #include "private/DragController_p.h"
@@ -54,6 +55,7 @@ public:
DockWidgetFactoryFunc m_dockWidgetFactoryFunc = nullptr; DockWidgetFactoryFunc m_dockWidgetFactoryFunc = nullptr;
MainWindowFactoryFunc m_mainWindowFactoryFunc = nullptr; MainWindowFactoryFunc m_mainWindowFactoryFunc = nullptr;
TabbingAllowedFunc m_tabbingAllowedFunc = nullptr; TabbingAllowedFunc m_tabbingAllowedFunc = nullptr;
DropIndicatorAllowedFunc m_dropIndicatorAllowedFunc = nullptr;
FrameworkWidgetFactory *m_frameworkWidgetFactory = nullptr; FrameworkWidgetFactory *m_frameworkWidgetFactory = nullptr;
Flags m_flags = Flag_Default; Flags m_flags = Flag_Default;
InternalFlags m_internalFlags = InternalFlag_None; InternalFlags m_internalFlags = InternalFlag_None;
@@ -180,6 +182,16 @@ TabbingAllowedFunc Config::tabbingAllowedFunc() const
return d->m_tabbingAllowedFunc; return d->m_tabbingAllowedFunc;
} }
void Config::setDropIndicatorAllowedFunc(DropIndicatorAllowedFunc func)
{
d->m_dropIndicatorAllowedFunc = func;
}
DropIndicatorAllowedFunc Config::dropIndicatorAllowedFunc() const
{
return d->m_dropIndicatorAllowedFunc;
}
void Config::setAbsoluteWidgetMinSize(QSize size) void Config::setAbsoluteWidgetMinSize(QSize size)
{ {
if (!DockRegistry::self()->isEmpty(/*excludeBeingDeleted=*/false)) { if (!DockRegistry::self()->isEmpty(/*excludeBeingDeleted=*/false)) {

View File

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2019-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> SPDX-FileCopyrightText: 2019-2022 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
@@ -20,6 +20,7 @@
#define KD_DOCKWIDGETS_CONFIG_H #define KD_DOCKWIDGETS_CONFIG_H
#include "docks_export.h" #include "docks_export.h"
#include "KDDockWidgets.h"
#include <qglobal.h> #include <qglobal.h>
@@ -37,6 +38,22 @@ 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 more granularity to disallow where widgets are dropped
///
/// By default, widgets can be dropped to the outter and inner left/right/top/bottom
/// and center. The client app can however provide a lambda via setDropIndicatorAllowedFunc
/// to block (by returning false) any specific locations they desire.
///
/// @param location The drop indicator location to allow or disallow
/// @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 setDropIndicatorAllowedFunc
typedef bool (*DropIndicatorAllowedFunc)(DropLocation location,
const QVector<DockWidgetBase *> &source,
const QVector<DockWidgetBase *> &target);
/// @deprecated Use DropIndicatorAllowedFunc instead.
/// @brief Function to allow the user more granularity to disallow dock widgets to tab together /// @brief Function to allow the user more granularity to disallow dock widgets to tab together
/// @param source The dock widgets being dragged /// @param source The dock widgets being dragged
/// @param target The dock widgets within an existing docked tab group /// @param target The dock widgets within an existing docked tab group
@@ -61,6 +78,9 @@ public:
~Config(); ~Config();
///@brief Flag enum to tune certain behaviours, the defaults are Flag_Default ///@brief Flag enum to tune certain behaviours, the defaults are Flag_Default
///@warning Only the default is supported on all platforms. Not all options work with all window managers,
/// Qt does its best to abstract the differences however that's only a best effort. This is true specially
/// for any option that changes window flags.
enum Flag enum Flag
{ {
Flag_None = 0, ///< No option set Flag_None = 0, ///< No option set
@@ -113,8 +133,9 @@ public:
InternalFlag_DontUseQtToolWindowsForFloatingWindows = 4, ///< FloatingWindows will use Qt::Window instead of Qt::Tool. InternalFlag_DontUseQtToolWindowsForFloatingWindows = 4, ///< FloatingWindows will use Qt::Window instead of Qt::Tool.
InternalFlag_DontShowWhenUnfloatingHiddenWindow = 8, ///< DockWidget::setFloating(false) won't do anything if the window is hidden. InternalFlag_DontShowWhenUnfloatingHiddenWindow = 8, ///< DockWidget::setFloating(false) won't do anything if the window is hidden.
InternalFlag_UseTransparentFloatingWindow = 16, ///< For QtQuick only. Allows to have round-corners. It's flaky when used with native Windows drop-shadow. InternalFlag_UseTransparentFloatingWindow = 16, ///< For QtQuick only. Allows to have round-corners. It's flaky when used with native Windows drop-shadow.
InternalFlag_DisableTranslucency = 32 ///< KDDW tries to detect if your Window Manager doesn't support transparent windows, but the detection might fail InternalFlag_DisableTranslucency = 32, ///< KDDW tries to detect if your Window Manager doesn't support transparent windows, but the detection might fail
/// with more exotic setups. This flag can be used to override. /// with more exotic setups. This flag can be used to override.
InternalFlag_TopLevelIndicatorRubberBand = 64 ///< Makes the rubber band of classic drop indicators to be top-level windows. Helps with working around MFC bugs
}; };
Q_DECLARE_FLAGS(InternalFlags, InternalFlag) Q_DECLARE_FLAGS(InternalFlags, InternalFlag)
@@ -199,6 +220,8 @@ public:
bool dropIndicatorsInhibited() const; bool dropIndicatorsInhibited() const;
/** /**
* @deprecated Use setDropIndicatorAllowedFunc() instead, and catch the DropLocation_Center case.
*
* @brief Allows the user to intercept a docking attempt to center (tabbed) and disallow it. * @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 * Whenever the user tries to tab two widgets together, the framework will call @p func. If
@@ -215,8 +238,10 @@ public:
* // disallows dockFoo to be tabbed with dockBar. * // disallows dockFoo to be tabbed with dockBar.
* return !(source.contains(dockFoo) && target.contains(dockBar)); * return !(source.contains(dockFoo) && target.contains(dockBar));
* } * }
* @endcode *
* KDDockWidgets::Config::self()->setTabbingAllowedFunc(func); * KDDockWidgets::Config::self()->setTabbingAllowedFunc(func);
*
* @endcode
*/ */
void setTabbingAllowedFunc(TabbingAllowedFunc func); void setTabbingAllowedFunc(TabbingAllowedFunc func);
@@ -225,6 +250,37 @@ public:
///@sa setTabbingAllowedFunc(). ///@sa setTabbingAllowedFunc().
TabbingAllowedFunc tabbingAllowedFunc() const; TabbingAllowedFunc tabbingAllowedFunc() const;
/**
* @brief Allows the client app to disallow certain docking indicators.
*
* For example, let's assume the app doesn't want to show outter indicators for a certain
* dock widget.
*
* @code
* #include <kddockwidgets/Config.h>
* (...)
*
* auto func = [] (KDDockWidgets::DropLocation loc,
* const KDDockWidgets::DockWidgetBase::List &source,
* const KDDockWidgets::DockWidgetBase::List &target)
* {
* // disallows dockFoo to be docked to outter areas
* return !((loc & KDDockWidgets::DropLocation_Outter) && source.contains(dockFoo));
* }
*
* KDDockWidgets::Config::self()->setDropIndicatorAllowedFunc(func);
*
* @endcode
*
* Run "kddockwidgets_example --hide-certain-docking-indicators" to see this in action.
*/
void setDropIndicatorAllowedFunc(DropIndicatorAllowedFunc func);
///@brief Used internally by the framework. Returns the function which was passed to setDropIndicatorAllowedFunc()
///By default it's nullptr.
///@sa setDropIndicatorAllowedFunc().
DropIndicatorAllowedFunc dropIndicatorAllowedFunc() const;
///@brief Sets the minimum size a dock widget can have. ///@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 /// Widgets can still provide their own min-size and it will be respected, however it can never be
/// smaller than this one. /// smaller than this one.

View File

@@ -1,7 +1,7 @@
/* /*
This file is part of KDDockWidgets. This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2019-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> SPDX-FileCopyrightText: 2019-2022 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-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> SPDX-FileCopyrightText: 2019-2022 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
@@ -180,7 +180,7 @@ bool DockWidgetBase::setFloating(bool floats)
{ {
const bool alreadyFloating = isFloating(); const bool alreadyFloating = isFloating();
if ((floats && alreadyFloating) || (!floats && !alreadyFloating)) if (floats == alreadyFloating)
return true; // Nothing to do return true; // Nothing to do
if (!floats && (Config::self().internalFlags() & Config::InternalFlag_DontShowWhenUnfloatingHiddenWindow) && !isVisible()) { if (!floats && (Config::self().internalFlags() & Config::InternalFlag_DontShowWhenUnfloatingHiddenWindow) && !isVisible()) {
@@ -205,10 +205,10 @@ bool DockWidgetBase::setFloating(bool floats)
frame->detachTab(this); frame->detachTab(this);
} else { } else {
d->frame()->titleBar()->makeWindow(); titleBar()->makeWindow();
} }
auto lastGeo = d->lastPositions().lastFloatingGeometry(); auto lastGeo = d->lastPosition()->lastFloatingGeometry();
if (lastGeo.isValid()) { if (lastGeo.isValid()) {
if (auto fw = floatingWindow()) if (auto fw = floatingWindow())
fw->setSuggestedGeometry(lastGeo, SuggestedGeometryHint_PreserveCenter); fw->setSuggestedGeometry(lastGeo, SuggestedGeometryHint_PreserveCenter);
@@ -237,6 +237,17 @@ QString DockWidgetBase::uniqueName() const
QString DockWidgetBase::title() const QString DockWidgetBase::title() const
{ {
if (d->isMDIWrapper()) {
// It's just a wrapper to help implementing Option_MDINestable. Return the title of the real dock widget we're hosting.
auto dropAreaGuest = qobject_cast<DropArea*>(widget());
Q_ASSERT(dropAreaGuest);
if (dropAreaGuest->hasSingleFrame()) {
return dropAreaGuest->frames().constFirst()->title();
} else {
return qApp->applicationName();
}
}
return d->title; return d->title;
} }
@@ -370,7 +381,7 @@ QStringList DockWidgetBase::affinities() const
void DockWidgetBase::show() void DockWidgetBase::show()
{ {
if (isWindow() && (d->m_lastPositions.wasFloating() || !d->m_lastPositions.isValid())) { if (isWindow() && (d->m_lastPosition->wasFloating() || !d->m_lastPosition->isValid())) {
// Create the FloatingWindow already, instead of waiting for the show event. // Create the FloatingWindow already, instead of waiting for the show event.
// This reduces flickering on some platforms // This reduces flickering on some platforms
d->morphIntoFloatingWindow(); d->morphIntoFloatingWindow();
@@ -465,7 +476,7 @@ bool DockWidgetBase::isInSideBar() const
bool DockWidgetBase::hasPreviousDockedLocation() const bool DockWidgetBase::hasPreviousDockedLocation() const
{ {
return d->m_lastPositions.isValid(); return d->m_lastPosition->isValid();
} }
QSize DockWidgetBase::lastOverlayedSize() const QSize DockWidgetBase::lastOverlayedSize() const
@@ -488,7 +499,7 @@ void DockWidgetBase::setFloatingGeometry(QRect geometry)
if (isOpen() && isFloating()) { if (isOpen() && isFloating()) {
window()->setGeometry(geometry); window()->setGeometry(geometry);
} else { } else {
d->m_lastPositions.setLastFloatingGeometry(geometry); d->m_lastPosition->setLastFloatingGeometry(geometry);
} }
} }
@@ -498,7 +509,7 @@ FloatingWindow *DockWidgetBase::Private::morphIntoFloatingWindow()
return fw; // Nothing to do return fw; // Nothing to do
if (q->isWindow()) { if (q->isWindow()) {
QRect geo = m_lastPositions.lastFloatingGeometry(); QRect geo = m_lastPosition->lastFloatingGeometry();
if (geo.isNull()) { if (geo.isNull()) {
geo = q->geometry(); geo = q->geometry();
@@ -513,6 +524,7 @@ FloatingWindow *DockWidgetBase::Private::morphIntoFloatingWindow()
auto frame = Config::self().frameworkWidgetFactory()->createFrame(); auto frame = Config::self().frameworkWidgetFactory()->createFrame();
frame->addWidget(q); frame->addWidget(q);
geo.setSize(geo.size().boundedTo(frame->maxSizeHint())); geo.setSize(geo.size().boundedTo(frame->maxSizeHint()));
FloatingWindow::ensureRectIsOnScreen(geo);
auto floatingWindow = auto floatingWindow =
Config::self().frameworkWidgetFactory()->createFloatingWindow(frame, nullptr, geo); Config::self().frameworkWidgetFactory()->createFloatingWindow(frame, nullptr, geo);
floatingWindow->show(); floatingWindow->show();
@@ -531,8 +543,75 @@ void DockWidgetBase::Private::maybeMorphIntoFloatingWindow()
MDILayoutWidget *DockWidgetBase::Private::mdiLayout() const MDILayoutWidget *DockWidgetBase::Private::mdiLayout() const
{ {
if (auto mw = mainWindow()) auto p = const_cast<QObject *>(q->parent());
return mw->mdiLayoutWidget(); while (p) {
if (qobject_cast<const QWindow*>(p)) {
// Ignore QObject hierarchies spanning though multiple windows
return nullptr;
}
if (qobject_cast<LayoutWidget*>(p)) {
// We found a layout
if (auto mdiLayout = qobject_cast<MDILayoutWidget*>(p)) {
// And it's MDI
return mdiLayout;
} else if (auto dropArea = qobject_cast<DropArea*>(p)) {
// It's a DropArea. But maybe it's a drop area that's just helping
// making the MDI windows accept drops (Option_MDINestable)
if (!dropArea->isMDIWrapper())
return nullptr;
// It's a MDI wrapper, keep looking up.
}
}
p = p->parent();
}
return nullptr;
}
bool DockWidgetBase::Private::isMDIWrapper() const
{
return mdiDropAreaWrapper() != nullptr;
}
DropArea *DockWidgetBase::Private::mdiDropAreaWrapper() const
{
if (auto dropAreaGuest = qobject_cast<DropArea *>(q->widget())) {
if (dropAreaGuest->isMDIWrapper())
return dropAreaGuest;
}
return nullptr;
}
DockWidgetBase *DockWidgetBase::Private::mdiDockWidgetWrapper() const
{
if (isMDIWrapper()) {
// We are the wrapper
return q;
}
auto p = const_cast<QObject *>(q->parent());
while (p) {
if (qobject_cast<const QWindow*>(p)) {
// Ignore QObject hierarchies spanning though multiple windows
return nullptr;
}
if (qobject_cast<LayoutWidget*>(p)) {
if (auto dropArea = qobject_cast<DropArea*>(p)) {
if (dropArea->isMDIWrapper())
return dropArea->mdiDockWidgetWrapper();
}
return nullptr;
}
p = p->parent();
}
return nullptr; return nullptr;
} }
@@ -602,7 +681,7 @@ void DockWidgetBase::Private::updateFloatAction()
QScopedValueRollback<bool> recursionGuard(m_updatingFloatAction, true); // Guard against recursiveness QScopedValueRollback<bool> recursionGuard(m_updatingFloatAction, true); // Guard against recursiveness
if (q->isFloating()) { if (q->isFloating()) {
floatAction->setEnabled(m_lastPositions.isValid()); floatAction->setEnabled(m_lastPosition->isValid());
floatAction->setChecked(true); floatAction->setChecked(true);
floatAction->setToolTip(tr("Dock")); floatAction->setToolTip(tr("Dock"));
} else { } else {
@@ -645,7 +724,7 @@ void DockWidgetBase::Private::close()
&& q->isVisible()) { // only user-closing is interesting to save the geometry && q->isVisible()) { // only user-closing is interesting to save the geometry
// We check for isVisible so we don't save geometry if you call close() on an already closed // We check for isVisible so we don't save geometry if you call close() on an already closed
// dock widget // dock widget
m_lastPositions.setLastFloatingGeometry(q->window()->geometry()); m_lastPosition->setLastFloatingGeometry(q->window()->geometry());
} }
saveTabIndex(); saveTabIndex();
@@ -668,14 +747,14 @@ void DockWidgetBase::Private::close()
bool DockWidgetBase::Private::restoreToPreviousPosition() bool DockWidgetBase::Private::restoreToPreviousPosition()
{ {
if (!m_lastPositions.isValid()) if (!m_lastPosition->isValid())
return false; return false;
Layouting::Item *item = m_lastPositions.lastItem(); Layouting::Item *item = m_lastPosition->lastItem();
LayoutWidget *layout = DockRegistry::self()->layoutForItem(item); LayoutWidget *layout = DockRegistry::self()->layoutForItem(item);
Q_ASSERT(layout); Q_ASSERT(layout);
layout->restorePlaceholder(q, item, m_lastPositions.lastTabIndex()); layout->restorePlaceholder(q, item, m_lastPosition->lastTabIndex());
return true; return true;
} }
@@ -683,14 +762,14 @@ void DockWidgetBase::Private::maybeRestoreToPreviousPosition()
{ {
// This is called when we get a QEvent::Show. Let's see if we have to restore it to a previous position. // This is called when we get a QEvent::Show. Let's see if we have to restore it to a previous position.
if (!m_lastPositions.isValid()) if (!m_lastPosition->isValid())
return; return;
Layouting::Item *layoutItem = m_lastPositions.lastItem(); Layouting::Item *layoutItem = m_lastPosition->lastItem();
if (!layoutItem) if (!layoutItem)
return; // nothing to do, no last position return; // nothing to do, no last position
if (m_lastPositions.wasFloating()) if (m_lastPosition->wasFloating())
return; // Nothing to do, it was floating before, now it'll just get visible return; // Nothing to do, it was floating before, now it'll just get visible
Frame *frame = this->frame(); Frame *frame = this->frame();
@@ -720,7 +799,7 @@ int DockWidgetBase::Private::currentTabIndex() const
void DockWidgetBase::Private::saveTabIndex() void DockWidgetBase::Private::saveTabIndex()
{ {
m_lastPositions.saveTabIndex(currentTabIndex(), q->isFloating()); m_lastPosition->saveTabIndex(currentTabIndex(), q->isFloating());
} }
void DockWidgetBase::Private::show() void DockWidgetBase::Private::show()
@@ -732,10 +811,9 @@ void DockWidgetBase::Private::show()
void DockWidgetBase::onParentChanged() void DockWidgetBase::onParentChanged()
{ {
#ifdef KDDOCKWIDGETS_QTWIDGETS #ifdef KDDOCKWIDGETS_QTWIDGETS
// TODO: In v1.4, remove this part and use the signal emitting the arg
Q_EMIT parentChanged(); Q_EMIT parentChanged();
#else #else
Q_EMIT parentChanged(this); Q_EMIT QQuickItem::parentChanged(parentItem());
#endif #endif
d->updateToggleAction(); d->updateToggleAction();
d->updateFloatAction(); d->updateFloatAction();
@@ -826,14 +904,26 @@ int DockWidgetBase::userType() const
void DockWidgetBase::setMDIPosition(QPoint pos) void DockWidgetBase::setMDIPosition(QPoint pos)
{ {
if (MDILayoutWidget *layout = d->mdiLayout()) if (MDILayoutWidget *layout = d->mdiLayout()) {
layout->moveDockWidget(this, pos); if (auto wrapperDW = d->mdiDockWidgetWrapper()) {
// Case of using Option_MDINestable. We need to layout the actual top level DW
layout->moveDockWidget(wrapperDW, pos);
} else {
layout->moveDockWidget(this, pos);
}
}
} }
void DockWidgetBase::setMDISize(QSize size) void DockWidgetBase::setMDISize(QSize size)
{ {
if (MDILayoutWidget *layout = d->mdiLayout()) if (MDILayoutWidget *layout = d->mdiLayout()) {
layout->resizeDockWidget(this, size); if (auto wrapperDW = d->mdiDockWidgetWrapper()) {
// Case of using Option_MDINestable. We need to layout the actual top level DW
layout->resizeDockWidget(wrapperDW, size);
} else {
layout->resizeDockWidget(this, size);
}
}
} }
void DockWidgetBase::setMDIZ(int z) void DockWidgetBase::setMDIZ(int z)
@@ -917,12 +1007,12 @@ DockWidgetBase::Private::Private(const QString &dockName, DockWidgetBase::Option
void DockWidgetBase::Private::addPlaceholderItem(Layouting::Item *item) void DockWidgetBase::Private::addPlaceholderItem(Layouting::Item *item)
{ {
Q_ASSERT(item); Q_ASSERT(item);
m_lastPositions.addPosition(item); m_lastPosition->addPlaceholderItem(item);
} }
LastPositions &DockWidgetBase::Private::lastPositions() Position::Ptr &DockWidgetBase::Private::lastPosition()
{ {
return m_lastPositions; return m_lastPosition;
} }
Frame *DockWidgetBase::Private::frame() const Frame *DockWidgetBase::Private::frame() const
@@ -940,6 +1030,6 @@ void DockWidgetBase::Private::saveLastFloatingGeometry()
{ {
if (q->isFloating() && q->isVisible()) { if (q->isFloating() && q->isVisible()) {
// It's getting docked, save last floating position // It's getting docked, save last floating position
lastPositions().setLastFloatingGeometry(q->window()->geometry()); lastPosition()->setLastFloatingGeometry(q->window()->geometry());
} }
} }

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