Compare commits

...

231 Commits

Author SHA1 Message Date
Philipp Swoboda
7a7c03793c Switched back to version 1.6 because of disapearing icons 2023-02-12 18:49:05 +01:00
Allen Winter
598787868b appveyor.yml - use Qt6.2 on Mac as well
since 6.2 is the min supported Qt version
2022-09-14 17:50:42 -04:00
Allen Winter
48319a6309 distro/qt6-kddockwidgets.spec - fix found on OBS 2022-09-14 17:46:51 -04:00
Allen Winter
409ac51a3f distro - use today's date 2022-09-14 11:44:30 -04:00
Allen Winter
d9b2eab833 .krazy - skip some example files 2022-09-14 11:41:26 -04:00
Allen Winter
dc510c06eb prepare for 1.6.0 release
`
2022-09-14 10:25:34 -04:00
Allen Winter
285a51b940 buildsystem - follow DPySide[2,6]ModuleBuild.cmake renaming 2022-09-14 10:24:15 -04:00
Allen Winter
f02e3e27d6 cmake/KDAB/modules/KDInstallLocation.cmake - sync 2022-09-14 09:11:15 -04:00
Allen Winter
be42120e06 remove PySide[2,6]ModuleBuild.cmake
replaced with KDPySide[2,6]ModuleBuild.cmake
2022-09-14 09:10:27 -04:00
Allen Winter
c8e542cabf buildsystem required CMake v3.12.0 or higher 2022-09-14 09:09:21 -04:00
Sergio Martins
a267f6a0a7 Mention in ChangeLog that minimum is 6.2 2022-09-14 13:47:16 +01:00
Sergio Martins
3c2cb67bcd cmake: Allow to build with Qt 6.2, since it's the last LTS 2022-09-14 13:40:31 +01:00
Allen Winter
77127886da .pylintrc - ignore settings for older pylint versions 2022-09-13 12:14:34 -04:00
Allen Winter
70def3e14c misspellings found by codespell v2.2.1 2022-09-13 12:12:16 -04:00
Allen Winter
a91aa74d52 misc whitespace cleaning 2022-09-13 12:07:14 -04:00
Allen Winter
619119fc37 README.md - a bit of trivial whitespace cleaning 2022-09-13 12:06:37 -04:00
Sergio Martins
77c8cec2b8 cmake: Fix ci-dev-qtquick-qt6 not using QtQuick
It was building the QtWidgets frontend by mistake
2022-09-12 18:36:07 +01:00
Sergio Martins
71f5cccb61 tests: Fix tests not being run on macOS Qt6
Latest Qt5 and Qt6 are fine nowadays, so just remove the check.
There was an offscreen qpa bug in macOS which was fixed in 5.15.2.
2022-09-12 17:57:28 +01:00
Sergio Martins
f5eb97bd26 cmake: Remove unity builds from cmake presets
The speedup is small since KDDW is small as well.
The burden of maintaining it isn't worth the speedup.

Fixes static build preset failing.
2022-09-12 17:54:51 +01:00
Sergio Martins
fcedc65c41 README: Explain our versioning 2022-09-08 11:51:42 +01:00
Sergio Martins
236ed813f8 qtquick: Fix build, use WidgetType instead of QWidget 2022-09-07 17:46:46 +01:00
Sergio Martins
1c4a4fb8bc README: Discourage people from using 1.6 for QtQuick
It works but won't be receiving bug fixes.
2022-09-07 17:11:35 +01:00
Allen Winter
be7bbe00b1 appveyor.yml - don't build the master branch 2022-09-06 09:10:20 -04:00
Sergio Martins
f277d5efb7 Fix affinity of central frame
Fixes issue #245

(cherry-picked from commit f9e758d02f)
2022-09-05 22:57:02 +01:00
Sergio Martins
bde5be9d9c Release mouse if Qt doesn't receive mouse release
As explained in commit message for #166, there's a case where Qt
doesn't receive the mouse release from Windows. If that happens
then allow to drop if we're over a drop indicator.

Fixes issue #306
2022-08-16 14:28:49 -07:00
Sergio Martins
7e689f0b39 python: Improve Dockerfile
Added more instructions and missing runtime packages

So I can test issue #304
2022-08-16 20:47:21 +01:00
Sergio Martins
ef78d60751 Python: Add a Dockerfile for a python environment
So I can test issue #304
2022-08-16 00:52:34 +01:00
Sergio Martins
bdbab41674 cmake: Disable unity builds for python preset
It's not supported
2022-08-16 00:03:29 +01:00
Sergio Martins
f84006347b Add SegmentedIndicators::s_centralIndicatorMaxWidth/height
So the user can change the maximum size of the central indicator
2022-07-28 19:42:56 +01:00
Allen Winter
9ce7477cbb docs/api/Doxyfile.cmake - add .pngs 2022-07-22 16:00:08 -04:00
Allen Winter
913c570b2b .reuse/dep5 - minor cleaning 2022-07-19 12:48:22 -04:00
Shantanu Tushar
daebe9e680 Export SideBarButton
This allows code to link to subclasses of SideBarButton.
2022-07-19 11:39:32 +01:00
Shantanu Tushar
cf7f037af4 Allow custom sidebars to access its dock widgets
This is useful in cases where a custom sidebar wants behavior that
affects multiple dock widgets it "contains".
2022-07-19 11:39:32 +01:00
Sergio Martins
72ac856fa7 Allow to use TitleBar with non-KDDW widgets
For example, on EGLFS, the user might want some dialogs with similar
decorations. In the future we can make it draggable as well.
2022-07-16 23:51:39 +01:00
Allen Winter
579cd3a201 python/examples[-qt6] - minor pylint fixes 2022-07-14 15:29:51 -04:00
Allen Winter
3764feaf89 Minimum Qt6 supported version 6.3.0 2022-07-13 08:40:59 -04:00
Allen Winter
f1959e5e16 Revert "CMakeLists.txt - set QT_MAJOR_VERSION for ECM"
This reverts commit 084947612b.
2022-07-13 08:37:38 -04:00
Allen Winter
084947612b CMakeLists.txt - set QT_MAJOR_VERSION for ECM 2022-07-13 06:19:28 -04:00
Allen Winter
710f71e7f0 CMakeLists.txt - fix LIB_NAME for ECMGeneratePriFile for Qt6 2022-07-12 16:03:17 -04:00
Allen Winter
4e6b49f876 CMakeLists.txt - ECMGeneratePriFiles supports Qt6 now 2022-07-12 12:53:50 -04:00
Allen Winter
d28dc745bc buildsystem - InstallLocation.cmake -> KDInstallLocation.cmake 2022-07-12 12:09:55 -04:00
Allen Winter
ad8e14ceff .reuse/dep5 - full project reuse licensing 2022-07-12 12:09:39 -04:00
Allen Winter
f9debe5f09 .pre-commit-config.yaml - add reuse lint checking 2022-07-12 12:08:45 -04:00
Allen Winter
b52b1335a6 Markdownlint the project 2022-07-12 11:12:33 -04:00
Sergio Martins
fedce40883 Workaround for EGLFS not supporting per window mouse cursor shape
When hovering over the floating window edges our mouse cursor
changes to resize shape, but when leaving and entering the main window
the mouse cursor wasn't unset.

Workaround by using a global event filter and detecting the leave.

Not using QEvent::Leave as we still allow for some margin outside
the floating window to count as a resize cursor
2022-07-12 15:29:43 +01:00
Sergio Martins
5894fd54f5 WidgetResizeHandler: Remove no-op code
We already bail out if o != mTarget a few lines above
2022-07-12 14:09:16 +01:00
Sergio Martins
d788cde263 minor: Improve readability
Mouse cursor setting is directly related to it being global or local
event filter.
2022-07-12 12:50:31 +01:00
Sergio Martins
1051e859f4 minor: Separate "toplevelness" with filter being local/global
It's too separate concepts
2022-07-12 12:22:39 +01:00
Sergio Martins
2fa9c06f9a minor: Pass a dedicated enum instead of bool to WidgetResizeHandler ctor
bool is opaque and needs a comment, the enum is expressive just by itself.
2022-07-12 11:49:58 +01:00
Sergio Martins
4691f9bfa5 Ran clang-format over the codebase 2022-07-12 11:28:05 +01:00
Sergio Martins
c7dd7d954f pre-commit: Don't clang-format json files
Not until I find out how to make vscode use clang-format for
json. It seems to be using its own formatter.
2022-07-11 21:14:15 +01:00
Sergio Martins
0f66fe853d pre-commit: Allow for multi-document yaml files
Which is valid yaml.
In case we want to make settings for json formatting in .clang-format.
2022-07-11 19:23:58 +01:00
Allen Winter
025c49c583 buildsystem - sync with cmake ECM and KDAB upstream 2022-07-11 12:27:24 -04:00
Allen Winter
518724132b fix a few missed pylint issues 2022-07-11 08:36:12 -04:00
Sergio Martins
800d97c352 Fix 2 clazy warnings 2022-07-09 14:38:01 +01:00
Allen Winter
ba7afe20b0 fix misspelling 2022-07-09 09:16:59 -04:00
Allen Winter
0b5b06dc5a .gitignore - ignore python/examples-qt6/rc_assets.py 2022-07-09 09:12:17 -04:00
Allen Winter
460b898bea cmake-lint, cmake-format CMake files 2022-07-09 09:11:45 -04:00
Allen Winter
6e5cfd70d1 pylint and autopep8 all python files 2022-07-08 17:34:42 -04:00
Allen Winter
4afc6b62b2 .pre-commit-config.yaml - add pylint,autopep8,cmake-lint,cmake-format 2022-07-08 17:33:12 -04:00
Sergio Martins
0785408a5c Add fwd header for DropAreaWithCentralFrame_p.h 2022-07-08 14:09:57 +01:00
Sergio Martins
3364d8ba76 Add .pre-commit-config.yaml
This one is simpler than the one in 2.0 branch, does not include
cmake formatting.
2022-07-08 06:55:59 +01:00
Sergio Martins
b5d1b6d02f vscode: Copy the compile_commands.json from build to source dir
No longer needed to symlink it to make clangd work
2022-07-08 06:53:59 +01:00
Allen Winter
ddf6847d4e .krazy - fix comment 2022-07-06 09:10:04 -04:00
Sergio Martins
6f177bc2df Assert that dock widget passed to MainWindow::addDockWidget is valid 2022-07-05 13:48:47 +01:00
Sergio Martins
e9eee0e69e wayland: Fix StateDragging::handleMouseMove() being called
For wayland we override StateDragging and deal in QDrag instead
but some spurious mouse event got in and were handled in the base
class.

Fixes a crash when receiving mouse move during a drag
2022-06-21 11:17:31 +01:00
Sergio Martins
d2339d1b12 wayland: Fix QEvent::DragEnter being accepted by user code
Otherwise we stop receiving drag moves.
If we're dragging a window we're absolutely sure that user code
won't be interested.

As reproduced by using graphic views.
2022-06-21 11:10:11 +01:00
Sergio Martins
e980dc9bb1 Add some trace debugging to DragController 2022-06-20 14:27:28 +01:00
Allen Winter
a2f0e2e689 codespell fix 2022-06-19 16:02:29 -04:00
Allen Winter
1b1d963d3e .krazy - exclude spelling checking -- use codespell instead 2022-06-19 15:39:24 -04:00
Sergio Martins
2dff66fb97 README: Move the supported toolchain section into the build section
So it's easier for users to find that they need a C++17 compiler.
Won't add exact compiler versions as I have no idea which gcc and which
clang version introduced such support.

Fixes #296
2022-06-19 17:59:09 +01:00
Sergio Martins
a44886279b README: Move building section to before the example
Since you need to build kddw before building the examples.

As a drive-by, added a mention to X11Extras.
Won't mention any package names as that's distro dependent and the amount
of distros is open ended. Would rather remove our current mentions of package names
to make it consistent.

Fixes #297
2022-06-19 17:15:17 +01:00
Sergio Martins
cd1ce835d7 Add cmake presets for ci 2022-06-18 21:49:12 +01:00
Sergio Martins
74dcbd994a Added MainWindow::internalLayout()
Allows the application to add more widgets next to the drop area.
2022-06-08 16:31:35 +01:00
Sergio Martins
189fc7356a Don't install DropArea_p.h twice
Adding the fwd header is enough, so it builds with same include
name for both system and submodule install
2022-06-08 08:17:02 +01:00
Sergio Martins
2ef569c114 Add a fwd area for DropArea 2022-06-08 08:09:26 +01:00
Sergio Martins
d06c6e8f11 EGLFS: Don't raise the main window when docking
EGLFS doesn't honour that the floating windows should be
on top and will make the floating windows go behind.

It's also unneeded to raise it on eglfs, since it's fullscreen.
2022-06-03 14:42:08 +01:00
Sergio Martins
596c330a77 Make numSideBySide_recursive() ignore invisible items
This amends previous commit, which missed a code path
2022-06-02 16:49:12 +01:00
Sergio Martins
9f96eff663 Make numSideBySide_recursive() ignore invisible items
We have invisible items that just remember the position of
other items.
2022-06-02 16:30:02 +01:00
Sergio Martins
3260c65a6c Add DropLocation_Horizontal and DropLocation_Vertical
So we can quickly use a bitwise and to see if an arbitrary
drop location is vertical or horizontal.
2022-06-02 16:16:24 +01:00
Sergio Martins
2c8ceb67ef Allow segmented indicators to disable individual segments
The application developer might now want to show some segments.
Now he can use Config::setDropIndicatorAllowedFunc(), which previously
only worked for classic indicators
2022-06-02 16:02:00 +01:00
Sergio Martins
982904e2ba Pass the DropArea to setDropIndicatorAllowedFunc() too
So the lambda can have more advanced usage and inspect the
target layout before allowing or disallowing the drop.

For our use case, we want to limit max 3 dock widgets side by side,
for example.
2022-06-02 15:19:01 +01:00
Sergio Martins
b2b75cd5bb Fix typo in snippet 2022-06-02 14:44:14 +01:00
Sergio Martins
90ad1a7f23 Added MultiSplitter::numSideBySide_recursive()
Since ItemBoxContainer isn't exported.
2022-06-02 14:01:47 +01:00
Sergio Martins
f5622732ce Added ItemBoxContainer::tst_numSideBySide_recursive() 2022-06-02 13:59:20 +01:00
Sergio Martins
4727c9c7fc MainWindow: Allow to avoid the immediate QWidget::create()
In case you're going to put the main window into a layout you
don't want to have it create a QWindow.
2022-05-25 00:36:40 +01:00
Allen Winter
f8ca5ca1ef KDDockWidgetsConfig.cmake.in - make sure QuickControls2 is found
if building for QTQUICK we'll have dependencies
on the Qt libraries QtQuick and QuickControls2
2022-05-24 17:20:16 -04:00
Allen Winter
ea00ecf33d qt6-kddockwidgets.dsc - fix package list 2022-05-23 12:00:29 -04:00
Allen Winter
bf255c104f distro/ - update for ubuntu22.04 and fedora36 2022-05-22 10:04:17 -04:00
Albert Astals Cid
9b8759c472 Add the possibility of setting the margin used for overlay docks 2022-05-17 15:32:28 +01:00
Sergio Martins
58b8633e3d Added KDDockWidgets::InitialVisibilityOption::PreserveCurrentTab
So you can insert into a tab group without changing the current
tab, if you want.
2022-05-05 14:28:07 +01:00
Sergio Martins
a743eafca1 Added DockWidgetBase::currentTabIndex() 2022-05-05 10:45:55 +01:00
Albert Astals Cid
2446519024 SideBar_p.h: Fix includes to make it usable from external projects 2022-05-03 10:43:37 +01:00
Sergio Martins
6166e5805c Don't show middle dock indicator if frame isn't dockable
This was implemented but the logic was wrong.
Fixes central persistent showing the central indicator.
2022-04-19 15:53:42 +01:00
Allen Winter
b1379f0bef .pylintrc - initial pylint config file 2022-04-14 12:40:17 -04:00
Allen Winter
f3da0f0547 various - fix some misspellings 2022-04-14 12:27:29 -04:00
Allen Winter
b2fc0c3eb1 various - update copyright year 2022-04-14 12:01:05 -04:00
Sergio Martins
6e7268e42a Workaround QTBUG-102430, don't move still maximized window
When dragging a maximized window we show normal, but we can
only start moving it when the window managers acknowledges the new
state. The state in QWidget isn't reliable.
2022-04-12 16:37:14 +01:00
Sergio Martins
7e6c5b2d9f Save the last known window state from the window manager POV
Required for QTBUG-102430
2022-04-12 14:56:20 +01:00
Sergio Martins
9a9676cb7a Add a TODOv2 comment about writing the same fix for QtQuick 2022-04-11 22:33:45 +01:00
Sergio Martins
aff86c3e0f Add a comment regarding QTBUG-102430 2022-04-11 22:31:26 +01:00
Sergio Martins
d4fe17a0bf Workaround FloatingWindow::windowStateChanged regarding QTBUG-102430
QWidget::windowStateChanged isn't useful as it's emitted once sync
and another async, with the same value. Only the async one is useful
as it will represent the real window manager state. Then we can do
further moves.

The QWindow one happens to be good (async), so use that one instead.
2022-04-11 22:10:30 +01:00
Sergio Martins
ab2843f3ef Update ChangeLog 2022-04-08 14:12:35 +01:00
Sergio Martins
0e5247e039 Use FloatingWindow::isMaximizedOverride() instead of isMaximized()
This is for issue #286.
Allows users to workaround buggy window managers.
2022-04-08 14:12:35 +01:00
Sergio Martins
6413266df3 Linux: Fix dragging of maximized floating windows
They should restore their normal size when the drag starts

(cherry picked from commit 1305dee081)
2022-04-08 14:12:35 +01:00
Allen Winter
c6ce421432 CMakeLists.txt - Python bindings are not supported in Unity builds
fixes #284
2022-04-08 08:42:06 -04:00
Sergio Martins
1f638d2c7a tests|qtquick|Windows: Stabilize a test
The warning is benign and unrelated to anything kddw is doing
2022-04-05 17:26:38 +01:00
Albert Astals Cid
7b73393095 Fix position of right overlay dockwidgets when there's a toolbar on the left 2022-04-05 17:13:29 +01:00
Sergio Martins
1a85363faf Preserve order of tabs when re-docking a tabbed group
Since our workaround isn't an atomic operation, each dock widget
was saving its new tab index while we were in the middle of a restore.

So be sure we set their correct index and restore "current" at the end.

Fixes #279
2022-03-30 15:26:11 +01:00
Sergio Martins
7f021248bf vscode: Remove ms-vscode.cpptools based launchers from linux/macOS
Replaced them with CodeLLDB based launchers.
This allows to not depend on binary-blob from microsoft and reduces
having to have 2 configs, now macOS uses the same one as Linux.
2022-03-30 14:49:42 +01:00
Sergio Martins
bec69e17a2 Fix QtQuick build 2022-03-21 15:40:07 +00:00
Allen Winter
057b33179a Changelog - we didn't have a formal 1.5.1 release
move the 1.5.1 changes to 1.6.0 since we never had a 1.5.1
2022-03-15 08:08:14 -04:00
Allen Winter
4945e6318c CMakeLists.txt - set version to 1.5.99 (ie. Release Candidate) 2022-03-15 08:00:46 -04:00
Allen Winter
339edf1143 appveyor.yml - re-enable testing on Windows 2022-03-15 07:59:43 -04:00
Allen Winter
f98ce37c12 appveyor.yml - fix PATH on Windows
forgot the Qt "bin"
2022-03-15 07:58:39 -04: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
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
9c17b44ad7 Merge branch '1.5' 2022-01-19 16:23:47 -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
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
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
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
d832750eb7 CMakeLists.txt - increase min Qt to version 5.15 2021-11-18 09:07:36 -05:00
Sergio Martins
77392709e2 Merge branch '1.5' 2021-11-18 14:03:00 +00:00
Allen Winter
6fd0b4ddee CMakeLists.txt, Changelog - this will be version 1.6 2021-11-15 09:55:47 -05:00
197 changed files with 5971 additions and 2967 deletions

View File

@@ -70,4 +70,3 @@ SpacesInAngles: false
SpacesInCStyleCastParentheses: true
SpacesInParentheses: false
...

240
.cmake-format.py Normal file
View File

@@ -0,0 +1,240 @@
# ----------------------------------
# Options affecting listfile parsing
# ----------------------------------
with section("parse"):
# Specify structure for custom cmake functions
additional_commands = {'foo': {'flags': ['BAR', 'BAZ'],
'kwargs': {'DEPENDS': '*', 'HEADERS': '*', 'SOURCES': '*'}}}
# Override configurations per-command where available
override_spec = {}
# Specify variable tags.
vartags = []
# Specify property tags.
proptags = []
# -----------------------------
# Options affecting formatting.
# -----------------------------
with section("format"):
# Disable formatting entirely, making cmake-format a no-op
disable = False
# How wide to allow formatted cmake files
line_width = 120
# How many spaces to tab for indent
tab_size = 4
# If true, lines are indented using tab characters (utf-8 0x09) instead of
# <tab_size> space characters (utf-8 0x20). In cases where the layout would
# require a fractional tab character, the behavior of the fractional
# indentation is governed by <fractional_tab_policy>
use_tabchars = False
# If <use_tabchars> is True, then the value of this variable indicates how
# fractional indentions are handled during whitespace replacement. If set to
# 'use-space', fractional indentation is left as spaces (utf-8 0x20). If set
# to `round-up` fractional indentation is replaced with a single tab character
# (utf-8 0x09) effectively shifting the column to the next tabstop
fractional_tab_policy = 'use-space'
# If an argument group contains more than this many sub-groups (parg or kwarg
# groups) then force it to a vertical layout.
max_subgroups_hwrap = 2
# If a positional argument group contains more than this many arguments, then
# force it to a vertical layout.
max_pargs_hwrap = 6
# If a cmdline positional group consumes more than this many lines without
# nesting, then invalidate the layout (and nest)
max_rows_cmdline = 2
# If true, separate flow control names from their parentheses with a space
separate_ctrl_name_with_space = False
# If true, separate function names from parentheses with a space
separate_fn_name_with_space = False
# If a statement is wrapped to more than one line, than dangle the closing
# parenthesis on its own line.
dangle_parens = True
# If the trailing parenthesis must be 'dangled' on its on line, then align it
# to this reference: `prefix`: the start of the statement, `prefix-indent`:
# the start of the statement, plus one indentation level, `child`: align to
# the column of the arguments
dangle_align = 'prefix'
# If the statement spelling length (including space and parenthesis) is
# smaller than this amount, then force reject nested layouts.
min_prefix_chars = 4
# If the statement spelling length (including space and parenthesis) is larger
# than the tab width by more than this amount, then force reject un-nested
# layouts.
max_prefix_chars = 10
# If a candidate layout is wrapped horizontally but it exceeds this many
# lines, then reject the layout.
max_lines_hwrap = 2
# What style line endings to use in the output.
line_ending = 'unix'
# Format command names consistently as 'lower' or 'upper' case
command_case = 'lower'
# Format keywords consistently as 'lower' or 'upper' case
keyword_case = 'upper'
# A list of command names which should always be wrapped
always_wrap = []
# If true, the argument lists which are known to be sortable will be sorted
# lexicographicall
enable_sort = True
# If true, the parsers may infer whether or not an argument list is sortable
# (without annotation).
autosort = False
# By default, if cmake-format cannot successfully fit everything into the
# desired linewidth it will apply the last, most agressive attempt that it
# made. If this flag is True, however, cmake-format will print error, exit
# with non-zero status code, and write-out nothing
require_valid_layout = False
# A dictionary mapping layout nodes to a list of wrap decisions. See the
# documentation for more information.
layout_passes = {}
# ------------------------------------------------
# Options affecting comment reflow and formatting.
# ------------------------------------------------
with section("markup"):
# What character to use for bulleted lists
bullet_char = '*'
# What character to use as punctuation after numerals in an enumerated list
enum_char = '.'
# If comment markup is enabled, don't reflow the first comment block in each
# listfile. Use this to preserve formatting of your copyright/license
# statements.
first_comment_is_literal = False
# If comment markup is enabled, don't reflow any comment block which matches
# this (regex) pattern. Default is `None` (disabled).
literal_comment_pattern = None
# Regular expression to match preformat fences in comments default=
# ``r'^\s*([`~]{3}[`~]*)(.*)$'``
fence_pattern = '^\\s*([`~]{3}[`~]*)(.*)$'
# Regular expression to match rulers in comments default=
# ``r'^\s*[^\w\s]{3}.*[^\w\s]{3}$'``
ruler_pattern = '^\\s*[^\\w\\s]{3}.*[^\\w\\s]{3}$'
# If a comment line matches starts with this pattern then it is explicitly a
# trailing comment for the preceeding argument. Default is '#<'
explicit_trailing_pattern = '#<'
# If a comment line starts with at least this many consecutive hash
# characters, then don't lstrip() them off. This allows for lazy hash rulers
# where the first hash char is not separated by space
hashruler_min_length = 10
# If true, then insert a space between the first hash char and remaining hash
# chars in a hash ruler, and normalize its length to fill the column
canonicalize_hashrulers = True
# enable comment markup parsing and reflow
enable_markup = False
# ----------------------------
# Options affecting the linter
# ----------------------------
with section("lint"):
# a list of lint codes to disable
disabled_codes = []
# regular expression pattern describing valid function names
function_pattern = '[0-9a-z_]+'
# regular expression pattern describing valid macro names
macro_pattern = '[0-9a-z_]+'
# regular expression pattern describing valid names for variables with global
# (cache) scope
global_var_pattern = '[A-Z][0-9A-Z_]+'
# regular expression pattern describing valid names for variables with global
# scope (but internal semantic)
internal_var_pattern = '[A-Z][0-9A-Z_]+'
# regular expression pattern describing valid names for variables with local
# scope
local_var_pattern = '[_A-Za-z][A-Za-z0-9_]+'
# regular expression pattern describing valid names for privatedirectory
# variables
private_var_pattern = '[0-9a-z_]+'
# regular expression pattern describing valid names for public directory
# variables
public_var_pattern = '.*'
# regular expression pattern describing valid names for function/macro
# arguments and loop variables.
argument_var_pattern = '[a-z_][a-z0-9_]+'
# regular expression pattern describing valid names for keywords used in
# functions or macros
keyword_pattern = '[A-Z][0-9A-Z_]+'
# In the heuristic for C0201, how many conditionals to match within a loop in
# before considering the loop a parser.
max_conditionals_custom_parser = 2
# Require at least this many newlines between statements
min_statement_spacing = 1
# Require no more than this many newlines between statements
max_statement_spacing = 2
max_returns = 6
max_branches = 15
max_arguments = 10
max_localvars = 15
max_statements = 50
# -------------------------------
# Options affecting file encoding
# -------------------------------
with section("encode"):
# If true, emit the unicode byte-order mark (BOM) at the start of the file
emit_byteorder_mark = False
# Specify the encoding of the input file. Defaults to utf-8
input_encoding = 'utf-8'
# Specify the encoding of the output file. Defaults to utf-8. Note that cmake
# only claims to support utf-8 so be careful when using anything else
output_encoding = 'utf-8'
# -------------------------------------
# Miscellaneous configurations options.
# -------------------------------------
with section("misc"):
# A dictionary containing any per-command configuration overrides. Currently
# only `command_case` is supported.
per_command = {}

3
.gitignore vendored
View File

@@ -47,6 +47,7 @@ mylayout.json
*.cbp
*.pyc
/python/examples/rc_assets.py
/python/examples-qt6/rc_assets.py
*.pri
/docks-w
kddockwidgets_minimal_example
@@ -64,3 +65,5 @@ kddockwidgets_minimal_example
*.sln
*.dir
.vscode
/.cache
/compile_commands.json

9
.krazy
View File

@@ -8,16 +8,21 @@ EXTRA kdabcopyright-reuse,kdabcontactus,fosslicense-reuse
#exclude checks now being done by clazy or clang-tools
EXCLUDE strings,explicit,normalize,passbyvalue,operators,nullstrcompare,nullstrassign,doublequote_chars,qobject,sigsandslots,staticobjects,dpointer,inline,postfixop
#exclude spelling as codespell is much, much better tool
EXCLUDE spelling
#exclude more checks
EXCLUDE style
SKIP /fwd_headers/
SKIP Doxyfile.cmake
#skip some example files
SKIP /examples/qtquick/CMakeFiles/
#skip CMake files
SKIP /KDDockWidgetsConfig.cmake.in
#skip more files
SKIP CMakePresets.json
SKIP \.cmake-format\.py
#skip the borrowed code in the cmake subdir
SKIP /cmake/InstallLocation.cmake|/cmake/ECM/|/cmake/KDAB/
SKIP /cmake/ECM/|/cmake/KDAB/

1
.mdlrc Normal file
View File

@@ -0,0 +1 @@
style ".mdlrc.rb"

4
.mdlrc.rb Normal file
View File

@@ -0,0 +1,4 @@
all
rule 'MD013', :line_length => 100, :tables => false
rule 'MD029', :style => :ordered
exclude_rule 'MD033'

2
.pep8 Normal file
View File

@@ -0,0 +1,2 @@
[pycodestyle]
max_line_length = 120

51
.pre-commit-config.yaml Normal file
View File

@@ -0,0 +1,51 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
exclude: ^(cmake/ECM|cmake/KDAB/)
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-added-large-files
- id: check-case-conflict
- id: check-yaml
args: [--allow-multiple-documents]
- id: check-json
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v14.0.0
hooks:
- id: clang-format
exclude: (.json)
- repo: https://github.com/PyCQA/pylint
rev: v2.12.2
hooks:
- id: pylint
exclude: ^(.cmake-format.py|conan/conanfile.py)
additional_dependencies: ["PySide2", "PySide6"]
- repo: https://github.com/pre-commit/mirrors-autopep8
rev: v1.6.0
hooks:
- id: autopep8
- repo: https://github.com/codespell-project/codespell
rev: v2.1.0
hooks:
- id: codespell
- repo: https://github.com/cheshirekow/cmake-format-precommit
rev: v0.6.13
hooks:
- id: cmake-lint
exclude: (.py.cmake|Doxyfile.cmake)
- id: cmake-format
exclude: (.py.cmake|Doxyfile.cmake)
- repo: https://github.com/markdownlint/markdownlint
rev: v0.11.0
hooks:
- id: markdownlint
entry: mdl
language: ruby
files: \.(md|mdown|markdown)$
- repo: https://github.com/fsfe/reuse-tool
rev: v1.0.0
hooks:
- id: reuse

597
.pylintrc Normal file
View File

@@ -0,0 +1,597 @@
[MASTER]
# A comma-separated list of package or module names from where C extensions may
# be loaded. Extensions are loading into the active Python interpreter and may
# run arbitrary code.
extension-pkg-whitelist=
# Specify a score threshold to be exceeded before program exits with error.
fail-under=10.0
# Add files or directories to the blacklist. They should be base names, not
# paths.
ignore=CVS
# Add files or directories matching the regex patterns to the blacklist. The
# regex matches against base names, not paths.
ignore-patterns=rc_assets.py
# Python code to execute, usually for sys.path manipulation such as
# pygtk.require().
#init-hook=
# Use multiple processes to speed up Pylint. Specifying 0 will auto-detect the
# number of processors available to use.
jobs=1
# Control the amount of potential inferred values when inferring a single
# object. This can help the performance when dealing with large functions or
# complex, nested conditions.
limit-inference-results=100
# List of plugins (as comma separated values of python module names) to load,
# usually to register additional checkers.
load-plugins=
# Pickle collected data for later comparisons.
persistent=yes
# When enabled, pylint would attempt to guess common misconfiguration and emit
# user-friendly hints instead of false-positive error messages.
suggestion-mode=yes
# Allow loading of arbitrary C extensions. Extensions are imported into the
# active Python interpreter and may run arbitrary code.
unsafe-load-any-extension=no
[MESSAGES CONTROL]
# Only show warnings with the listed confidence levels. Leave empty to show
# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED.
confidence=
# Disable the message, report, category or checker with the given id(s). You
# can either give multiple identifiers separated by comma (,) or put this
# option multiple times (only on the command line, not in the configuration
# file where it should appear only once). You can also use "--disable=all" to
# disable everything first and then reenable specific checks. For example, if
# you want to run only the similarities checker, you can use "--disable=all
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use "--disable=all --enable=classes
# --disable=W".
disable=print-statement,
parameter-unpacking,
unpacking-in-except,
old-raise-syntax,
backtick,
long-suffix,
old-ne-operator,
old-octal-literal,
import-star-module-level,
non-ascii-bytes-literal,
raw-checker-failed,
bad-inline-option,
locally-disabled,
file-ignored,
suppressed-message,
useless-suppression,
deprecated-pragma,
use-symbolic-message-instead,
apply-builtin,
basestring-builtin,
buffer-builtin,
cmp-builtin,
coerce-builtin,
execfile-builtin,
file-builtin,
long-builtin,
raw_input-builtin,
reduce-builtin,
standarderror-builtin,
unicode-builtin,
xrange-builtin,
coerce-method,
delslice-method,
getslice-method,
setslice-method,
no-absolute-import,
old-division,
dict-iter-method,
dict-view-method,
next-method-called,
metaclass-assignment,
indexing-exception,
raising-string,
reload-builtin,
oct-method,
hex-method,
nonzero-method,
cmp-method,
input-builtin,
round-builtin,
intern-builtin,
unichr-builtin,
map-builtin-not-iterating,
zip-builtin-not-iterating,
range-builtin-not-iterating,
filter-builtin-not-iterating,
using-cmp-argument,
eq-without-hash,
div-method,
idiv-method,
rdiv-method,
exception-message-attribute,
invalid-str-codec,
sys-max-int,
bad-python3-import,
deprecated-string-function,
deprecated-str-translate-call,
deprecated-itertools-function,
deprecated-types-field,
next-method-defined,
dict-items-not-iterating,
dict-keys-not-iterating,
dict-values-not-iterating,
deprecated-operator-function,
deprecated-urllib-function,
xreadlines-attribute,
deprecated-sys-function,
exception-escape,
comprehension-escape,
consider-using-f-string,
useless-option-value,
unknown-option-value,
R0801,I1101,E0401
# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
# multiple time (only on the command line, not in the configuration file where
# it should appear only once). See also the "--disable" option for examples.
enable=c-extension-no-member=
[REPORTS]
# Python expression which should return a score less than or equal to 10. You
# have access to the variables 'error', 'warning', 'refactor', and 'convention'
# which contain the number of messages in each category, as well as 'statement'
# which is the total number of statements analyzed. This score is used by the
# global evaluation report (RP0004).
evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
# Template used to display messages. This is a python new-style format string
# used to format the message information. See doc for all details.
#msg-template=
# Set the output format. Available formats are text, parseable, colorized, json
# and msvs (visual studio). You can also give a reporter class, e.g.
# mypackage.mymodule.MyReporterClass.
output-format=text
# Tells whether to display a full report or only the messages.
reports=no
# Activate the evaluation score.
score=yes
[REFACTORING]
# Maximum number of nested blocks for function / method body
max-nested-blocks=6
# Complete name of functions that never returns. When checking for
# inconsistent-return-statements if a never returning function is called then
# it will be considered as an explicit return statement and no message will be
# printed.
never-returning-functions=sys.exit
[BASIC]
# Naming style matching correct argument names.
argument-naming-style=camelCase
# Regular expression matching correct argument names. Overrides argument-
# naming-style.
#argument-rgx=
# Naming style matching correct attribute names.
attr-naming-style=camelCase
# Regular expression matching correct attribute names. Overrides attr-naming-
# style.
#attr-rgx=
# Bad variable names which should always be refused, separated by a comma.
bad-names=foo,
bar,
baz,
toto,
tutu,
tata
# Bad variable names regexes, separated by a comma. If names match any regex,
# they will always be refused
bad-names-rgxs=
# Naming style matching correct class attribute names.
class-attribute-naming-style=any
# Regular expression matching correct class attribute names. Overrides class-
# attribute-naming-style.
#class-attribute-rgx=
# Naming style matching correct class names.
class-naming-style=PascalCase
# Regular expression matching correct class names. Overrides class-naming-
# style.
#class-rgx=
# Naming style matching correct constant names.
const-naming-style=camelCase
# Regular expression matching correct constant names. Overrides const-naming-
# style.
#const-rgx=
# Minimum line length for functions/classes that require docstrings, shorter
# ones are exempt.
docstring-min-length=-1
# Naming style matching correct function names.
function-naming-style=camelCase
# Regular expression matching correct function names. Overrides function-
# naming-style.
#function-rgx=
# Good variable names which should always be accepted, separated by a comma.
good-names=i,
j,
k,
ex,
Run,
_
# Good variable names regexes, separated by a comma. If names match any regex,
# they will always be accepted
good-names-rgxs=^[a-z]?$
# Include a hint for the correct naming format with invalid-name.
include-naming-hint=no
# Naming style matching correct inline iteration names.
inlinevar-naming-style=any
# Regular expression matching correct inline iteration names. Overrides
# inlinevar-naming-style.
#inlinevar-rgx=
# Naming style matching correct method names.
method-naming-style=any
# Regular expression matching correct method names. Overrides method-naming-
# style.
#method-rgx=
# Naming style matching correct module names.
module-naming-style=any
# Regular expression matching correct module names. Overrides module-naming-
# style.
#module-rgx=
# Colon-delimited sets of names that determine each other's naming style when
# the name regexes allow several styles.
name-group=
# Regular expression which should only match function or class names that do
# not require a docstring.
no-docstring-rgx=^_
# List of decorators that produce properties, such as abc.abstractproperty. Add
# to this list to register other decorators that produce valid properties.
# These decorators are taken in consideration only for invalid-name.
property-classes=abc.abstractproperty
# Naming style matching correct variable names.
variable-naming-style=camelCase
# Regular expression matching correct variable names. Overrides variable-
# naming-style.
#variable-rgx="[a-z0-9_]{1,30}$"
[FORMAT]
# Expected format of line ending, e.g. empty (any line ending), LF or CRLF.
expected-line-ending-format=
# Regexp for a line that is allowed to be longer than the limit.
ignore-long-lines=^\s*(# )?<?https?://\S+>?$
# Number of spaces of indent required inside a hanging or continued line.
indent-after-paren=4
# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1
# tab).
indent-string=' '
# Maximum number of characters on a single line.
max-line-length=120
# Maximum number of lines in a module.
max-module-lines=1000
# Allow the body of a class to be on the same line as the declaration if body
# contains single statement.
single-line-class-stmt=no
# Allow the body of an if to be on the same line as the test if there is no
# else.
single-line-if-stmt=no
[LOGGING]
# The type of string formatting that logging methods do. `old` means using %
# formatting, `new` is for `{}` formatting.
logging-format-style=old
# Logging modules to check that the string format arguments are in logging
# function parameter format.
logging-modules=logging
[MISCELLANEOUS]
# List of note tags to take in consideration, separated by a comma.
notes=FIXME,
XXX,
TODO
# Regular expression of note tags to take in consideration.
#notes-rgx=
[SIMILARITIES]
# Ignore comments when computing similarities.
ignore-comments=yes
# Ignore docstrings when computing similarities.
ignore-docstrings=yes
# Ignore imports when computing similarities.
ignore-imports=yes
# Minimum lines number of a similarity.
min-similarity-lines=4
[SPELLING]
# Limits count of emitted suggestions for spelling mistakes.
max-spelling-suggestions=4
# Spelling dictionary name. Available dictionaries: en_AG (hunspell), en_AU
# (hunspell), en_BS (hunspell), en_BW (hunspell), en_BZ (hunspell), en_CA
# (hunspell), en_DK (hunspell), en_GB (hunspell), en_GH (hunspell), en_HK
# (hunspell), en_IE (hunspell), en_IN (hunspell), en_JM (hunspell), en_MW
# (hunspell), en_NA (hunspell), en_NG (hunspell), en_NZ (hunspell), en_PH
# (hunspell), en_SG (hunspell), en_TT (hunspell), en_US (hunspell), en_ZA
# (hunspell), en_ZM (hunspell), en_ZW (hunspell).
spelling-dict=
# List of comma separated words that should not be checked.
spelling-ignore-words=
# A path to a file that contains the private dictionary; one word per line.
spelling-private-dict-file=
# Tells whether to store unknown words to the private dictionary (see the
# --spelling-private-dict-file option) instead of raising a message.
spelling-store-unknown-words=no
[STRING]
# This flag controls whether inconsistent-quotes generates a warning when the
# character used as a quote delimiter is used inconsistently within a module.
check-quote-consistency=no
# This flag controls whether the implicit-str-concat should generate a warning
# on implicit string concatenation in sequences defined over several lines.
check-str-concat-over-line-jumps=no
[TYPECHECK]
# List of decorators that produce context managers, such as
# contextlib.contextmanager. Add to this list to register other decorators that
# produce valid context managers.
contextmanager-decorators=contextlib.contextmanager
# List of members which are set dynamically and missed by pylint inference
# system, and so shouldn't trigger E1101 when accessed. Python regular
# expressions are accepted.
generated-members=
# Tells whether missing members accessed in mixin class should be ignored. A
# mixin class is detected if its name ends with "mixin" (case insensitive).
ignore-mixin-members=yes
# Tells whether to warn about missing members when the owner of the attribute
# is inferred to be None.
ignore-none=yes
# This flag controls whether pylint should warn about no-member and similar
# checks whenever an opaque object is returned when inferring. The inference
# can return multiple potential results while evaluating a Python object, but
# some branches might not be evaluated, which results in partial inference. In
# that case, it might be useful to still emit no-member and other checks for
# the rest of the inferred objects.
ignore-on-opaque-inference=yes
# List of class names for which member attributes should not be checked (useful
# for classes with dynamically set attributes). This supports the use of
# qualified names.
ignored-classes=optparse.Values,thread._local,_thread._local
# List of module names for which member attributes should not be checked
# (useful for modules/projects where namespaces are manipulated during runtime
# and thus existing member attributes cannot be deduced by static analysis). It
# supports qualified module names, as well as Unix pattern matching.
ignored-modules=
# Show a hint with possible names when a member name was not found. The aspect
# of finding the hint is based on edit distance.
missing-member-hint=yes
# The minimum edit distance a name should have in order to be considered a
# similar match for a missing member name.
missing-member-hint-distance=1
# The total number of similar names that should be taken in consideration when
# showing a hint for a missing member.
missing-member-max-choices=1
# List of decorators that change the signature of a decorated function.
signature-mutators=
[VARIABLES]
# List of additional names supposed to be defined in builtins. Remember that
# you should avoid defining new builtins when possible.
additional-builtins=
# Tells whether unused global variables should be treated as a violation.
allow-global-unused-variables=yes
# List of strings which can identify a callback function by name. A callback
# name must start or end with one of those strings.
callbacks=cb_,
_cb
# A regular expression matching the name of dummy variables (i.e. expected to
# not be used).
dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_
# Argument names that match this expression will be ignored. Default to name
# with leading underscore.
ignored-argument-names=_.*|^ignored_|^unused_
# Tells whether we should check for unused import in __init__ files.
init-import=no
# List of qualified module names which can have objects that can redefine
# builtins.
redefining-builtins-modules=six.moves,past.builtins,future.builtins,builtins,io
[CLASSES]
# List of method names used to declare (i.e. assign) instance attributes.
defining-attr-methods=__init__,
__new__,
setUp,
__post_init__
# List of member names, which should be excluded from the protected access
# warning.
exclude-protected=_asdict,
_fields,
_replace,
_source,
_make
# List of valid names for the first argument in a class method.
valid-classmethod-first-arg=cls
# List of valid names for the first argument in a metaclass class method.
valid-metaclass-classmethod-first-arg=cls
[DESIGN]
# Maximum number of arguments for function / method.
max-args=10
# Maximum number of attributes for a class (see R0902).
max-attributes=7
# Maximum number of boolean expressions in an if statement (see R0916).
max-bool-expr=6
# Maximum number of branch for function / method body.
max-branches=15
# Maximum number of locals for function / method body.
max-locals=20
# Maximum number of parents for a class (see R0901).
max-parents=7
# Maximum number of public methods for a class (see R0904).
max-public-methods=20
# Maximum number of return / yield for function / method body.
max-returns=6
# Maximum number of statements in function / method body.
max-statements=50
# Minimum number of public methods for a class (see R0903).
min-public-methods=2
[IMPORTS]
# List of modules that can be imported at any level, not just the top level
# one.
allow-any-import-level=
# Allow wildcard imports from modules that define __all__.
allow-wildcard-with-all=no
# Analyse import fallback blocks. This can be used to support both Python 2 and
# 3 compatible code, which means that the block might have code that exists
# only in one or another interpreter, leading to false positives when analysed.
analyse-fallback-blocks=no
# Deprecated modules which should not be used, separated by a comma.
deprecated-modules=optparse,tkinter.tix
# Create a graph of external dependencies in the given file (report RP0402 must
# not be disabled).
ext-import-graph=
# Create a graph of every (i.e. internal and external) dependencies in the
# given file (report RP0402 must not be disabled).
import-graph=
# Create a graph of internal dependencies in the given file (report RP0402 must
# not be disabled).
int-import-graph=
# Force import order to recognize a module as part of the standard
# compatibility libraries.
known-standard-library=
# Force import order to recognize a module as part of a third party library.
known-third-party=enchant
# Couples of modules and preferred modules, separated by a comma.
preferred-modules=
[EXCEPTIONS]
# Exceptions that will emit a warning when being caught. Defaults to
# "BaseException, Exception".
overgeneral-exceptions=BaseException,
Exception

View File

@@ -1,12 +1,23 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: KDDockWidgets
Upstream-Contact: <info@kdab.com>
Upstream-Contact: <info@kdab.com>
Source: https://www.github.com/KDAB/KDDockWidgets
Files: *.qrc *.json *.xml *.html src/fwd_headers/*
#misc source code
Files: *.qrc *.json *.xml src/fwd_headers/*
Copyright: 2019-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
License: GPL-2.0-only OR GPL-3.0-only
#misc documentation
Files: CONTRIBUTORS.txt Changelog README.md README-QtQuick.md README-WASM.md README-Wayland.md README-bindings.md README-troubleshooting conan/README.txt python/examples/README.txt python/examples-qt6/README.txt docs/KDDockWidgets-CopyrightAssignmentForm.pdf *.html
Copyright: 2019-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
License: GPL-2.0-only OR GPL-3.0-only
#misc config files
Files: .pre-commit-config.yaml .codespellrc .krazy .cmake-format .clang-format .clazy .gitignore .mdlrc .mdlrc.rb .pep8 .pylintrc appveyor.yml code.dev-*.code-workspace docs/api/Doxyfile.cmake distro/*
Copyright: 2019-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
License: BSD-3-Clause
#artwork
Files: screencap.gif images/* src/img/* docs/api/*.png examples/dockwidgets/assets/*.png src/img/classic_indicators/*.png
Copyright: 2019-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
@@ -14,5 +25,5 @@ License: GPL-2.0-only OR GPL-3.0-only
#3rdparty
Files: cmake/ECM/modules/*
Copyright:
Copyright: The KDE Project
License: BSD-3-Clause

View File

@@ -69,31 +69,37 @@
# Ignored unless KDDockWidgets_DEVELOPER_MODE=True
# Default=true
cmake_minimum_required(VERSION 3.7)
cmake_minimum_required(VERSION 3.12)
# Allow using a non-KDAB install location.
set(KDAB_INSTALL True CACHE INTERNAL "Install to default KDAB Location")
set(KDAB_INSTALL
True
CACHE INTERNAL "Install to default KDAB Location"
)
if(DEFINED CMAKE_INSTALL_PREFIX)
if(NOT "${CMAKE_INSTALL_PREFIX}" STREQUAL "")
set(KDAB_INSTALL False CACHE INTERNAL "Install to non-KDAB Location")
endif()
if(NOT "${CMAKE_INSTALL_PREFIX}" STREQUAL "")
set(KDAB_INSTALL
False
CACHE INTERNAL "Install to non-KDAB Location"
)
endif()
endif()
if(${CMAKE_VERSION} VERSION_LESS "3.12.0")
project(KDDockWidgets LANGUAGES CXX)
else()
project(KDDockWidgets
DESCRIPTION "An advanced docking system for Qt"
HOMEPAGE_URL "https://github.com/KDAB/KDDockWidgets"
LANGUAGES CXX)
endif()
project(
KDDockWidgets
DESCRIPTION "An advanced docking system for Qt"
HOMEPAGE_URL "https://github.com/KDAB/KDDockWidgets"
LANGUAGES CXX
)
set(${PROJECT_NAME}_VERSION_MAJOR 1)
set(${PROJECT_NAME}_VERSION_MINOR 5)
set(${PROJECT_NAME}_VERSION_PATCH 1)
set(${PROJECT_NAME}_VERSION ${${PROJECT_NAME}_VERSION_MAJOR}.${${PROJECT_NAME}_VERSION_MINOR}.${${PROJECT_NAME}_VERSION_PATCH})
set(${PROJECT_NAME}_VERSION_MINOR 6)
set(${PROJECT_NAME}_VERSION_PATCH 0)
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_NAME}_SOVERSION "1.5")
set(${PROJECT_NAME}_SOVERSION "1.6")
include(FeatureSummary)
@@ -106,74 +112,85 @@ option(${PROJECT_NAME}_TESTS "Build the tests" OFF)
option(${PROJECT_NAME}_EXAMPLES "Build the examples" ON)
option(${PROJECT_NAME}_DOCS "Build the API documentation" OFF)
option(${PROJECT_NAME}_WERROR "Use -Werror (will be true for developer-mode unconditionally)" OFF)
option(${PROJECT_NAME}_X11EXTRAS "On Linux, link against QtX11Extras so we can detect if the compositor supports transparency. Not applicable to other platforms or Qt6." ON)
option(${PROJECT_NAME}_X11EXTRAS
"Link with QtX11Extras to detect if the compositor supports transparency. Not applicable to non-Linux 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")
# changed by Philipp Swoboda, philipp@swoboda.xyz
# set QT6 as default option and switch X11 Extra off
set(${PROJECT_NAME}_X11EXTRA OFF)
set(${PROJECT_NAME}_QT6 ON)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/ECM/modules")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/KDAB/modules")
# Set a default build type if none was specified
set(default_build_type "Release")
if(EXISTS "${CMAKE_SOURCE_DIR}/.git" OR ${PROJECT_NAME}_DEVELOPER_MODE)
set(default_build_type "Debug")
set(default_build_type "Debug")
endif()
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to ${default_build_type} as none was specified.")
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
message(STATUS "Setting build type to ${default_build_type} as none was specified.")
set(CMAKE_BUILD_TYPE
"${default_build_type}"
CACHE STRING "Choose the type of build." FORCE
)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()
if (${PROJECT_NAME}_XLib)
add_definitions(-DKDDockWidgets_XLIB)
if(${PROJECT_NAME}_XLib)
add_definitions(-DKDDockWidgets_XLIB)
endif()
if(${PROJECT_NAME}_QT6)
set(Qt_VERSION_MAJOR 6)
set(QT_MIN_VERSION "6.0.0")
find_package(Qt6Widgets ${QT_MIN_VERSION} REQUIRED)
find_package(Qt6Test ${QT_MIN_VERSION} REQUIRED)
set(${PROJECT_NAME}_LIBRARY_QTID "-qt6")
set(Qt_VERSION_MAJOR 6)
set(QT_MIN_VERSION "6.2.0")
set(${PROJECT_NAME}_LIBRARY_QTID "-qt6")
else()
set(Qt_VERSION_MAJOR 5)
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(Qt_VERSION_MAJOR 5)
set(QT_MIN_VERSION "5.15")
set(${PROJECT_NAME}_LIBRARY_QTID "")
endif()
find_package(Qt${Qt_VERSION_MAJOR} ${QT_MIN_VERSION} NO_MODULE REQUIRED COMPONENTS Widgets Test)
include(KDQtInstallPaths) #to set QT_INSTALL_FOO variables
set(${PROJECT_NAME}_DEPS "widgets")
if(${PROJECT_NAME}_QTQUICK)
find_package(Qt${Qt_VERSION_MAJOR}Quick)
find_package(Qt${Qt_VERSION_MAJOR}QuickControls2)
add_definitions(-DKDDOCKWIDGETS_QTQUICK)
set(${PROJECT_NAME}_DEPS "${${PROJECT_NAME}_DEPS} quick quickcontrols2")
find_package(Qt${Qt_VERSION_MAJOR} NO_MODULE REQUIRED COMPONENTS Quick QuickControls2)
add_definitions(-DKDDOCKWIDGETS_QTQUICK)
set(${PROJECT_NAME}_DEPS "${${PROJECT_NAME}_DEPS} quick quickcontrols2")
else()
add_definitions(-DKDDOCKWIDGETS_QTWIDGETS)
add_definitions(-DKDDOCKWIDGETS_QTWIDGETS)
endif()
if(NOT WIN32 AND NOT APPLE AND NOT EMSCRIPTEN AND NOT ${PROJECT_NAME}_QT6 AND ${PROJECT_NAME}_X11EXTRAS)
set(${PROJECT_NAME}_DEPS "${${PROJECT_NAME}_DEPS} x11extras")
if(NOT WIN32
AND NOT APPLE
AND NOT EMSCRIPTEN
AND NOT ${PROJECT_NAME}_QT6
AND ${PROJECT_NAME}_X11EXTRAS
)
set(${PROJECT_NAME}_DEPS "${${PROJECT_NAME}_DEPS} x11extras")
endif()
#Always build the test harness in developer-mode
if(${PROJECT_NAME}_DEVELOPER_MODE)
set(${PROJECT_NAME}_TESTS ON)
set(${PROJECT_NAME}_WERROR ON)
include(ECMEnableSanitizers)
set(${PROJECT_NAME}_TESTS ON)
set(${PROJECT_NAME}_WERROR ON)
include(ECMEnableSanitizers)
endif()
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(IS_CLANG_BUILD TRUE)
set(IS_CLANG_BUILD TRUE)
else()
set(IS_CLANG_BUILD FALSE)
set(IS_CLANG_BUILD FALSE)
endif()
if(${PROJECT_NAME}_QTQUICK)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
endif()
set(CMAKE_AUTOMOC ON)
@@ -184,170 +201,195 @@ set(CMAKE_C_VISIBILITY_PRESET hidden)
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
# Sets compiler flags for the specified target, taking platform into consideration.
macro(set_compiler_flags targetName)
if(${PROJECT_NAME}_DEVELOPER_MODE)
target_compile_definitions(${targetName} PUBLIC DOCKS_DEVELOPER_MODE PRIVATE QT_FORCE_ASSERTS)
if(${PROJECT_NAME}_DEVELOPER_MODE)
target_compile_definitions(
${targetName}
PUBLIC DOCKS_DEVELOPER_MODE
PRIVATE QT_FORCE_ASSERTS
)
if(NOT MSVC)
target_compile_options(${targetName} PRIVATE -Wall -Wextra)
if(NOT MSVC)
target_compile_options(${targetName} PRIVATE -Wall -Wextra)
endif()
if(APPLE)
target_compile_options(${targetName} PRIVATE -Wweak-vtables)
endif()
endif()
if(APPLE)
target_compile_options(${targetName} PRIVATE -Wweak-vtables)
# Enable -Werror
if(${PROJECT_NAME}_WERROR AND (NOT MSVC OR IS_CLANG_BUILD)) # clang-cl accepts these too
target_compile_options(${targetName} PRIVATE -Werror -Wundef -Wno-error=deprecated-declarations)
endif()
endif()
# Enable -Werror
if(${PROJECT_NAME}_WERROR AND (NOT MSVC OR IS_CLANG_BUILD)) # clang-cl accepts these too
target_compile_options(${targetName} PRIVATE -Werror -Wundef -Wno-error=deprecated-declarations)
endif()
endmacro()
if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT APPLE) OR
(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND NOT APPLE) OR
(CMAKE_CXX_COMPILER_ID STREQUAL "Intel" AND NOT WIN32))
# Linker warnings should be treated as errors
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--fatal-warnings ${CMAKE_SHARED_LINKER_FLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS "-Wl,--fatal-warnings ${CMAKE_MODULE_LINKER_FLAGS}")
if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT APPLE)
OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND NOT APPLE)
OR (CMAKE_CXX_COMPILER_ID STREQUAL "Intel" AND NOT WIN32)
)
# Linker warnings should be treated as errors
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--fatal-warnings ${CMAKE_SHARED_LINKER_FLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS "-Wl,--fatal-warnings ${CMAKE_MODULE_LINKER_FLAGS}")
string(TOUPPER "CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}" compileflags)
if("${CMAKE_CXX_FLAGS} ${${compileflags}}" MATCHES "-fsanitize")
set(sanitizers_enabled TRUE)
else()
set(sanitizers_enabled FALSE)
endif()
string(TOUPPER "CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}" compileflags)
if("${CMAKE_CXX_FLAGS} ${${compileflags}}" MATCHES "-fsanitize")
set(sanitizers_enabled TRUE)
else()
set(sanitizers_enabled FALSE)
endif()
# cannot enable this for clang + sanitizers
if(NOT sanitizers_enabled OR NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# Do not allow undefined symbols, even in non-symbolic shared libraries
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined ${CMAKE_SHARED_LINKER_FLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS "-Wl,--no-undefined ${CMAKE_MODULE_LINKER_FLAGS}")
endif()
if(APPLE OR LINUX)
# cannot enable this for clang + sanitizers
if(NOT sanitizers_enabled OR NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# Do not allow undefined symbols, even in non-symbolic shared libraries
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined ${CMAKE_SHARED_LINKER_FLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS "-Wl,--no-undefined ${CMAKE_MODULE_LINKER_FLAGS}")
endif()
endif()
endif()
if(${PROJECT_NAME}_STATIC)
set(${PROJECT_NAME}_LIBRARY_MODE "STATIC")
set(${PROJECT_NAME}_LIBRARY_MODE "STATIC")
else()
set(${PROJECT_NAME}_LIBRARY_MODE "SHARED")
set(${PROJECT_NAME}_LIBRARY_MODE "SHARED")
endif()
if(KDAB_INSTALL)
if(UNIX)
set(CMAKE_INSTALL_PREFIX "/usr/local/KDAB/${PROJECT_NAME}-${${PROJECT_NAME}_VERSION}" CACHE INTERNAL "Install to default KDAB Location")
elseif(WIN32)
set(CMAKE_INSTALL_PREFIX "C:\\KDAB\\${PROJECT_NAME}-${${PROJECT_NAME}_VERSION}" CACHE INTERNAL "Install to default KDAB Location")
endif()
if(UNIX)
set(CMAKE_INSTALL_PREFIX
"/usr/local/KDAB/${PROJECT_NAME}-${${PROJECT_NAME}_VERSION}"
CACHE INTERNAL "Install to default KDAB Location"
)
elseif(WIN32)
set(CMAKE_INSTALL_PREFIX
"C:\\KDAB\\${PROJECT_NAME}-${${PROJECT_NAME}_VERSION}"
CACHE INTERNAL "Install to default KDAB Location"
)
endif()
endif()
# setup default install locations
include(InstallLocation)
include(KDInstallLocation)
if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
set(${PROJECT_NAME}_IS_ROOT_PROJECT TRUE)
set(${PROJECT_NAME}_IS_ROOT_PROJECT TRUE)
message(STATUS "Building ${PROJECT_NAME} ${${PROJECT_NAME}_VERSION} in ${CMAKE_BUILD_TYPE} mode. Installing to ${CMAKE_INSTALL_PREFIX}")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib")
install(FILES LICENSE.txt README.md DESTINATION ${INSTALL_DOC_DIR})
install(DIRECTORY LICENSES DESTINATION ${INSTALL_DOC_DIR})
# Generate .pri file for qmake users
#TODO: ECM does not support Qt6 yet
if(Qt_VERSION_MAJOR EQUAL 5 AND
CMAKE_VERSION VERSION_GREATER "3.11.99" AND NOT CMAKE_CONFIGURATION_TYPES) # Not working with VS generator or older cmake versions
include(ECMGeneratePriFile)
set(PROJECT_VERSION_STRING ${${PROJECT_NAME}_VERSION})
ecm_generate_pri_file(BASE_NAME KDDockWidgets
LIB_NAME kddockwidgets
DEPS ${${PROJECT_NAME}_DEPS}
FILENAME_VAR pri_filename
INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR}
message(STATUS "Building ${PROJECT_NAME} ${${PROJECT_NAME}_VERSION} in ${CMAKE_BUILD_TYPE} mode. "
"Installing to ${CMAKE_INSTALL_PREFIX}"
)
install(FILES ${pri_filename} DESTINATION ${ECM_MKSPECS_INSTALL_DIR})
endif()
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib")
install(FILES LICENSE.txt README.md DESTINATION ${INSTALL_DOC_DIR})
install(DIRECTORY LICENSES DESTINATION ${INSTALL_DOC_DIR})
# Generate .pri file for qmake users (except when using the VS generator)
if(NOT CMAKE_CONFIGURATION_TYPES)
if(Qt_VERSION_MAJOR EQUAL 5 OR (Qt_VERSION_MAJOR EQUAL 6 AND Qt6Core_VERSION VERSION_GREATER "6.2"))
include(ECMGeneratePriFile)
set(PROJECT_VERSION_STRING ${${PROJECT_NAME}_VERSION})
ecm_generate_pri_file(
BASE_NAME
KDDockWidgets
LIB_NAME
kddockwidgets${${PROJECT_NAME}_LIBRARY_QTID}
DEPS
${${PROJECT_NAME}_DEPS}
FILENAME_VAR
pri_filename
INCLUDE_INSTALL_DIR
${CMAKE_INSTALL_INCLUDEDIR}
)
install(FILES ${pri_filename} DESTINATION ${ECM_MKSPECS_INSTALL_DIR})
endif()
endif()
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)
#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()
enable_testing()
endif()
add_subdirectory(src)
if(${PROJECT_NAME}_PYTHON_BINDINGS)
if(CMAKE_BUILD_TYPE MATCHES "^[Dd]eb" OR ${PROJECT_NAME}_STATIC)
message(FATAL_ERROR "** Python Bindings are disabled in debug or static builds.")
endif()
if(CMAKE_BUILD_TYPE MATCHES "^[Dd]eb" OR ${PROJECT_NAME}_STATIC)
message(FATAL_ERROR "** Python Bindings are disabled in debug or static builds.")
endif()
if(CMAKE_UNITY_BUILD)
message(FATAL_ERROR "** Python Bindings are disabled in Unity builds. " "Try again with CMAKE_UNITY_BUILD=OFF")
endif()
endif()
if(${PROJECT_NAME}_PYTHON_BINDINGS)
add_subdirectory(python)
add_subdirectory(python)
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)
set_compiler_flags(kddockwidgets_example)
set_compiler_flags(kddockwidgets_minimal_example)
endif()
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)
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()
# 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
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)
# 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)

View File

@@ -9,7 +9,6 @@
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"KDDockWidgets_DEVELOPER_MODE": "ON",
"ECM_ENABLE_SANITIZERS" : "'address;undefined'",
"CMAKE_EXPORT_COMPILE_COMMANDS" : "ON",
"KDDockWidgets_FUZZER" : "OFF"
},
@@ -18,16 +17,17 @@
}
},
{
"name": "dev-gammaray",
"displayName": "dev-gammaray",
"description": "A Gammaray friendly build. (No ASAN)",
"name": "dev-asan",
"displayName": "dev-asan",
"description": "An ASAN/UBSAN build",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build-dev-gammaray",
"binaryDir": "${sourceDir}/build-dev-asan",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"KDDockWidgets_DEVELOPER_MODE": "ON",
"CMAKE_EXPORT_COMPILE_COMMANDS" : "ON",
"KDDockWidgets_FUZZER" : "OFF"
"KDDockWidgets_FUZZER" : "OFF",
"ECM_ENABLE_SANITIZERS" : "'address;undefined'"
},
"warnings" : {
"uninitialized" : true
@@ -70,8 +70,7 @@
"generator": "Ninja",
"binaryDir": "${sourceDir}/build-release",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_UNITY_BUILD" : "ON"
"CMAKE_BUILD_TYPE": "Release"
}
},
{
@@ -81,7 +80,6 @@
"binaryDir": "${sourceDir}/build-release-no-x11extras",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_UNITY_BUILD" : "ON",
"KDDockWidgets_X11EXTRAS" : "OFF"
}
},
@@ -92,8 +90,7 @@
"binaryDir": "${sourceDir}/build-release-qtquick",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"KDDockWidgets_QTQUICK": "ON",
"CMAKE_UNITY_BUILD" : "ON"
"KDDockWidgets_QTQUICK": "ON"
}
},
{
@@ -117,8 +114,7 @@
"binaryDir": "${sourceDir}/build-python",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"KDDockWidgets_PYTHON_BINDINGS": "ON",
"CMAKE_UNITY_BUILD" : "ON"
"KDDockWidgets_PYTHON_BINDINGS": "ON"
}
},
{
@@ -128,8 +124,7 @@
"binaryDir": "${sourceDir}/build-static",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"KDDockWidgets_STATIC": "ON",
"CMAKE_UNITY_BUILD" : "ON"
"KDDockWidgets_STATIC": "ON"
}
},
{
@@ -140,8 +135,7 @@
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"KDDockWidgets_STATIC": "ON",
"KDDockWidgets_QTQUICK": "ON",
"CMAKE_UNITY_BUILD" : "ON"
"KDDockWidgets_QTQUICK": "ON"
}
},
{
@@ -152,7 +146,6 @@
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"KDDockWidgets_QT6": "ON",
"CMAKE_UNITY_BUILD" : "ON",
"CMAKE_PREFIX_PATH" : "$env{QT6_DIR}"
},
"environment": {
@@ -164,6 +157,23 @@
"displayName": "dev6",
"generator": "Ninja",
"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": {
"CMAKE_BUILD_TYPE": "Debug",
"KDDockWidgets_QT6": "ON",
@@ -186,7 +196,6 @@
"CMAKE_BUILD_TYPE": "Release",
"KDDockWidgets_QTQUICK": "ON",
"KDDockWidgets_QT6": "ON",
"CMAKE_UNITY_BUILD" : "ON",
"CMAKE_PREFIX_PATH" : "$env{QT6_DIR}"
},
"environment": {
@@ -295,6 +304,162 @@
"QML2_IMPORT_PATH" : "$env{QT6_DIR}/imports:$env{QT6_DIR}/qml",
"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"
}
},
{
"name": "ci-dev-qtwidgets-qt5",
"displayName": "ci-dev-qtwidgets-qt5",
"description": "Qt5 QtWidgets dev-mode build",
"binaryDir": "${sourceDir}/build-ci-dev-qtwidgets-qt5",
"generator": "Ninja",
"cacheVariables": {
"KDDockWidgets_DEVELOPER_MODE": "ON",
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "ci-dev-qtquick-qt5",
"displayName": "ci-dev-qtquick-qt5",
"description": "Qt5 QtQuick dev-mode build",
"binaryDir": "${sourceDir}/build-ci-dev-qtquick-qt5",
"generator": "Ninja",
"cacheVariables": {
"KDDockWidgets_DEVELOPER_MODE": "ON",
"CMAKE_BUILD_TYPE": "Debug",
"KDDockWidgets_QTQUICK": "ON"
}
},
{
"name": "ci-qtwidgets-qt5",
"displayName": "ci-qtwidgets-qt5",
"description": "Qt5 QtWidgets release build",
"binaryDir": "${sourceDir}/build-ci-qtwidgets-qt5",
"generator": "Ninja",
"cacheVariables": {
"KDDockWidgets_DEVELOPER_MODE": "OFF",
"CMAKE_BUILD_TYPE": "Release"
}
},
{
"name": "ci-qtquick-qt5",
"displayName": "ci-qtquick-qt5",
"description": "Qt5 QtQuick release build",
"binaryDir": "${sourceDir}/build-ci-qtquick-qt5",
"generator": "Ninja",
"cacheVariables": {
"KDDockWidgets_DEVELOPER_MODE": "OFF",
"CMAKE_BUILD_TYPE": "Release",
"KDDockWidgets_QTQUICK": "ON"
}
},
{
"name": "ci-dev-qtwidgets-qt6",
"displayName": "ci-dev-qtwidgets-qt6",
"description": "Qt6 dev-mode",
"binaryDir": "${sourceDir}/build-ci-dev-qtwidgets-qt6",
"generator": "Ninja",
"cacheVariables": {
"KDDockWidgets_DEVELOPER_MODE": "ON",
"CMAKE_BUILD_TYPE": "Debug",
"KDDockWidgets_QT6": "ON"
}
},
{
"name": "ci-dev-qtquick-qt6",
"displayName": "ci-dev-qtquick-qt6",
"description": "Qt6 dev-mode",
"binaryDir": "${sourceDir}/build-ci-dev-qtquick-qt6",
"generator": "Ninja",
"cacheVariables": {
"KDDockWidgets_DEVELOPER_MODE": "ON",
"CMAKE_BUILD_TYPE": "Debug",
"KDDockWidgets_QT6": "ON",
"KDDockWidgets_QTQUICK": "ON"
}
},
{
"name": "ci-qtwidgets-qt6",
"description": "Qt6 QtWidgets release build",
"displayName": "ci-qtwidgets-qt6",
"binaryDir": "${sourceDir}/build-ci-qtwidgets-qt6",
"generator": "Ninja",
"cacheVariables": {
"KDDockWidgets_DEVELOPER_MODE": "OFF",
"CMAKE_BUILD_TYPE": "Release",
"KDDockWidgets_QT6": "ON"
}
},
{
"name": "ci-qtquick-qt6",
"description": "Qt6 QtQuick release build",
"displayName": "ci-qtquick-qt6",
"binaryDir": "${sourceDir}/build-ci-qtquick-qt6",
"generator": "Ninja",
"cacheVariables": {
"KDDockWidgets_DEVELOPER_MODE": "OFF",
"CMAKE_BUILD_TYPE": "Release",
"KDDockWidgets_QT6": "ON",
"KDDockWidgets_QTQUICK": "ON"
}
},
{
"name": "ci-static",
"inherits":["static"],
"binaryDir": "${sourceDir}/build-ci-static"
},
{
"name": "ci-static-qtquick",
"inherits":["static-qtquick"],
"binaryDir": "${sourceDir}/build-ci-static-qtquick"
},
{
"name": "ci-python",
"inherits":["python"],
"binaryDir": "${sourceDir}/build-python"
}
],
"buildPresets": [

View File

@@ -1,5 +1,19 @@
* v1.5.1 (unreleased)
* v1.6.0 (14 September 2022)
- Minimum Qt6 version is now 6.2.0
- Minimum CMake version is now 3.12.0
- 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
- X11: Improved detecting which window is under the cursor, by using native X11 API
- X11: Fixed dragging a maximized floating window. Its size is now restored to normal size when the drag starts.
- Added DockWidgetBase::currentTabIndex()
- Added InitialVisibilityOption::PreserveCurrentTab
- Added MainWindow::internalLayout() for advanced customization
* v1.5.0 (24 November 2021)
- Install the Python bindings to "site-packages"

View File

@@ -2,7 +2,7 @@ GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA

View File

@@ -1,12 +1,13 @@
Supported Qt versions and toolchains
=====================================
# KDDockWidgets and QtQuick
KDDockWidgets for QtQuick requires a C++17 capable compiler and either
Qt >= 5.15.2 or Qt >= 6.2.1
## Supported Qt versions and toolchains
KDDockWidgets for QtQuick requires a C++17 capable compiler and Qt >= 6.2.1.
TROUBLESHOOTING
===============
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
- QtGraphicalEffects is not supported, as it's buggy when moving between different QWindows.
See for example QTBUG-94943, KDDockWidgets issue #213. Also search the Qt bug tracker

View File

@@ -1,33 +1,40 @@
WebAssembly
===========
# KDDockWidgets with WebAssembly
KDDockWidgets works with WebAssembly with the following known limitations:
- Classic drop indicators are not supported, only the segmented ones. This is because
WASM doesn't support windows with translucency.
WASM doesn't support windows with translucency.
- Might be slow on Linux, depending on your browser, while dragging or resizing windows.
Please file a bug with Qt, as it's out of scope for KDDW to fix.
Please file a bug with Qt, as it's out of scope for KDDW to fix.
Demo:
=====
## Demo
A demo is available at https://demos.kdab.com/wasm/kddockwidgets/dockwidgets.html
A demo is available at <https://demos.kdab.com/wasm/kddockwidgets/dockwidgets.html>.
Build tips for KDDW:
====================
## Build tips for KDDW
- Visit <https://doc.qt.io/qt-5/wasm.html> if you haven't yet
- Visit https://doc.qt.io/qt-5/wasm.html if you haven't yet
- Open a terminal suitable for WASM development (with the correct Qt and toolchain in PATH, etc)
- KDDockWidgets can be built with `cmake -DCMAKE_TOOLCHAIN_FILE=/usr/local/emsdk-1.39.8/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -DCMAKE_FIND_ROOT_PATH=~/Qt/5.15.1/wasm_32/ -DKDDockWidgets_EXAMPLES=OFF -DCMAKE_BUILD_TYPE=Release`
(Adapt the paths to your own situation)
Builds tips for your own app:
=============================
- KDDockWidgets can be built with:
```bash
cmake \
-DCMAKE_TOOLCHAIN_FILE=/usr/local/emsdk-1.39.8/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake
-DCMAKE_FIND_ROOT_PATH=~/Qt/5.15.1/wasm_32/ -DKDDockWidgets_EXAMPLES=OFF -DCMAKE_BUILD_TYPE=Release`
(Adapt the paths to your own situation)
```
## Builds tips for your own app ==
- Link to KDDW (libkddockwidgets.a, or similar)
- As the build is static, don't forget to initialize KDDW's resources:
```
#ifdef QT_STATIC
Q_INIT_RESOURCE(kddockwidgets_resources);
#endif
```cpp
#ifdef QT_STATIC
Q_INIT_RESOURCE(kddockwidgets_resources);
#endif
```

View File

@@ -1,13 +1,13 @@
# KDDockWidgets and Wayland
Wayland support is done and has been tested on KDE (Kwin) and weston.
Limitations
============
## Limitations
Wayland works very differently than traditional desktops and imposes us some,
limitations. Here's a list of different behaviours which KDDockWidgets will have
when running on Wayland:
- A title bar can either be used for drag&dock or for moving the window around.
- For this reason, floating windows now have two title bars.
@@ -28,7 +28,5 @@ when running on Wayland:
- Kwin specific:
- The pixmap that's shown during a drag can't be bigger than 250x250. Might be a bug.
All in all it's pretty decent and usable. Any further improvements should be done at the server or
protocol level now.

View File

@@ -1,26 +1,29 @@
# KDDockWidgets and Python bindings
These are the instructions for building the Python bindings for KDDockWidgets.
Make sure you have PySide2, shiboken2 and shiboken2-generator installed.
As this time, you cannot get shiboken2-generator because the wheels are not on PyPi.
To use the wheels do this:
```
```bash
% pip3 install \
--index-url=http://download.qt.io/official_releases/QtForPython/ \
--trusted-host download.qt.io \
shiboken2 pyside2 shiboken2_generator
```
For more info visit https://doc.qt.io/qtforpython/shiboken2/gettingstarted.html
For more info visit <https://doc.qt.io/qtforpython/shiboken2/gettingstarted.html>.
afterwards run 'pip3 list | grep PySide2'
Note the version *must* match the same Qt you intend to use when building KDDockWidgets.
Not supported:
- Debug builds
- static builds
- python2 bindings
- only some 32-bit platforms are supported. see https://wiki.qt.io/Qt_for_Python
- debug builds
- static builds
- python2 bindings
- only some 32-bit platforms are supported (see <https://wiki.qt.io/Qt_for_Python>)
Tell CMake to build the bindings by passing the `-DKDDockWidgets_PYTHON_BINDINGS=True' option,
followed by the make command.
@@ -33,42 +36,42 @@ to CMake (adjust to the python path on your system).
To run the KDDW python example
```
$ export PYTHONPATH=/kddw/install/path # Only if needed
$ cd python/examples/
$ rcc -g python -o rc_assets.py ../../examples/dockwidgets/resources_example.qrc
$ python3 main.py
```bash
export PYTHONPATH=/kddw/install/path # Only if needed
cd python/examples/
rcc -g python -o rc_assets.py ../../examples/dockwidgets/resources_example.qrc
python3 main.py
```
Build Issues
* If you see errors like "Unable to locate Clang's built-in include directory"
then first make sure you have llvm installed. If you still have problems try
- If you see errors like "Unable to locate Clang's built-in include directory"
then first mROUBLESHOOTINGake sure you have llvm installed. If you still have problems try
setting the environment variable `LLVM_INSTALL_DIR` to point to your llvm installation.
Examples:
```
export LLVM_INSTALL_DIR=/usr/local/opt/llvm-11
set "LLVM_INSTALL_DIR=C:\Program Files\LLVM" #Windows
```
```bash
export LLVM_INSTALL_DIR=/usr/local/opt/llvm-11
set "LLVM_INSTALL_DIR=C:\Program Files\LLVM" #Windows
```
* When building the examples you may encounter errors loading shared libraries from shiboken2_generator.
- When building the examples you may encounter errors loading shared libraries from shiboken2_generator.
Try:
```
export LD_LIBRARY_PATH=/usr/local/lib/python/dist-packages/PySide2/Qt/lib #linux
export DYLD_LIBRARY_PATH=/usr/local/lib/python/dist-packages/PySide2/Qt/lib #Mac
#adjust to wherever your PySide is installed
```
```bash
export LD_LIBRARY_PATH=/usr/local/lib/python/dist-packages/PySide2/Qt/lib #linux
export DYLD_LIBRARY_PATH=/usr/local/lib/python/dist-packages/PySide2/Qt/lib #Mac
(Adjust to wherever your PySide is installed)
```
* On Windows the `libclang.dll` that ship with QtForPython is not compatible with MSVC2019.
- On Windows the `libclang.dll` that ship with QtForPython is not compatible with MSVC2019.
To fix this, copy the `libclang.dll` that comes with llvm into shiboken2, like so:
```
cd C:\Python37\Lib\site-packages\shiboken2_generator
copy libclang.dll libclang.dll.save
copy "C:\Program Files\llvm\bin\libclang.dll" libclang.dll
#Python3 installation in C:\Python37 and llvm in c:\Program Files\llvm. adjust as needed
```
```bash
cd C:\Python37\Lib\site-packages\shiboken2_generator
copy libclang.dll libclang.dll.save
copy "C:\Program Files\llvm\bin\libclang.dll" libclang.dll
(Python3 installation in C:\Python37 and llvm in c:\Program Files\llvm. adjust as needed)
```

156
README.md
View File

@@ -1,7 +1,10 @@
# KDDockWidgets
[![Build Status](https://travis-ci.com/KDAB/KDDockWidgets.svg?branch=master)](https://travis-ci.com/KDAB/KDDockWidgets)
KDDockWidgets
=============
> ⚠️⚠️: If you're using QtQuick/QML it's recommended to use 2.0 branch. 1.x will continue
> to receive bug fixes for a long time but only for QtWidgets frontend.
`KDDockWidgets` is a Qt dock widget library written by KDAB, suitable for replacing
`QDockWidget` and implementing advanced functionalities missing in Qt.
@@ -9,9 +12,8 @@ Although `KDDockWidgets` is ready to be used out of the box, it can also be seen
as a framework to allow building very tailored custom docking systems. It tries
to expose every internal widget and every knob for the app developer to tune.
## Motivation
Motivation
==========
Throughout the years KDAB contributed and funded bug fixes and features to `QDockWidget`.
Sadly, this was very painful. Each bug fix or feature took many days of implementation,
and an equal number of days just to fix dozens of regressions.
@@ -22,15 +24,15 @@ creative with their requests, so it was clear we needed a better docking framewo
You will find more information in these places:
* [our official home page](https://www.kdab.com/development-resources/qt-tools/kddockwidgets)
* [online detailed browsable API reference](https://docs.kdab.com/kddockwidgets)
* [our example programs](examples/)
- [our official home page](https://www.kdab.com/development-resources/qt-tools/kddockwidgets)
- [online detailed browsable API reference](https://docs.kdab.com/kddockwidgets)
- [our example programs](examples/)
We also have an [in browser demo](https://demos.kdab.com/wasm/kddockwidgets/dockwidgets.html). Note
however that this demo isn't fully featured, as it's running on Qt for WebAssembly.
Features
========
## Features
- Provide advanced docking that QDockWidget doesn't support
- Native window resize on Windows (allowing for Aero-snap even with custom title bar decorations)
- Arrow drop indicators for great drop precision
@@ -66,65 +68,70 @@ Features
- Optional minimize and maximize button on the title bar
- FloatingWindows can be utility windows or full native
Screen capture
==============
## Screen capture
![Screen capture](./screencap.gif?raw=true "The docking system in action")
## Building and requirements
Trying out the examples
=======================
A full demo that showcases most of the features lives in [examples/dockwidgets](examples/dockwidgets).
To build KDDockWidgets you'll need:
A simpler example can be found in [examples/minimal](examples/minimal),
which might be more indicated to learn the API, as it's less overwhelming than the full demo.
- CMake
- Qt 5.15.x or Qt6 >= 6.2
- Ninja (Other generators might work but are untested)
- C++17 capable compiler
- Qt Widgets module
- Qt X11Extras module if on Linux/X11
- Qt Quick and QuickControls2 modules if using the QtQuick support
- Qt private development headers, for instance, for Qt5:
- SUSE: libqt5-qtbase-private-headers-devel
- Ubuntu, debian-based: qtbase5-private-dev
- Fedora, redhat-based: qt5-qtbase-private-devel
- others: consult your distro
Open a terminal capable of building Qt5 applications.
Open a terminal capable of building Qt applications.
Make sure you have cmake, ninja, compiler, Qt, etc in PATH.
Adapt the instructions to suit your cmake generator and operating system.
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 --build .
$ cmake --build . --target install
```
Now build and run the example:
```
$ cd path/to/kddockwidgets/examples/dockwidgets/
$ cmake -G Ninja -DCMAKE_PREFIX_PATH=/path/where/to/install
$ cmake --build .
$ ./kddockwidgets_example
```bash
cmake -G Ninja -DCMAKE_INSTALL_PREFIX=/path/where/to/install ../path/to/kddockwidgets
cmake --build .
cmake --build . --target install
```
The installation directory defaults to `c:\KDAB\KDDockWidgets-<version>` on Windows
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.
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:
## Trying out the examples
- SUSE: libqt5-qtbase-private-headers-devel
- Ubuntu, debian-based: qtbase5-private-dev
- Fedora, redhat-based: qt5-qtbase-private-devel
- others: consult your distro
A full demo that showcases most of the features lives in [examples/dockwidgets](examples/dockwidgets).
A simpler example can be found in [examples/minimal](examples/minimal),
which might be more indicated to learn the API, as it's less overwhelming than the full demo.
To build and run the example:
```bash
cd path/to/kddockwidgets/examples/dockwidgets/
cmake -G Ninja -DCMAKE_PREFIX_PATH=/path/where/kddw/is/installed
cmake --build .
./kddockwidgets_example
```
## Using
Using
=====
From your CMake Qt5 project, add
```
```cmake
find_package(KDDockWidgets CONFIG)
```
or for Qt6
```
```cmake
find_package(KDDockWidgets-qt6 CONFIG)
```
@@ -134,18 +141,25 @@ That's all you need to do (the imported target also brings in the include direct
You may also need to modify the `CMAKE_PREFIX_PATH` environment variable depending
on where you installed KDDockWidgets.
## Python Bindings
Python Bindings
================
Please refer to [README-bindings.md](README-bindings.md).
Versioning
==========
## Versioning
New features go to master while the stable branch only accepts non-intrusive bug fixes.
There's currently two lines of development: `v1` which is very mature and stable and `v2` which is an
ongoing effort to make KDDW support multiple "frontends" (QtWidgets, QtQuick and even non-Qt technologies,
like flutter).
We'll try to remain source and binary compatible across versions. API will get
a deprecation notice before being removed in the next version. Note that this
1.x will be supported for many years to come, at least for bug fixes and small features.
Use `v1.5.0` tag for the latest stable. `v1.6.0` will be released soon, so branch `1.6` is also safe.
Use `2.0` if you need non-QtWidgets support, for example `QtQuick/QML`. While `1.6` has support for `QtQuick/QML`
it won't be receiving bug fixes. `2.0` is under active development, you might encounter minor source/ABI
incompatibilities. Despite that, it is pretty stable, and all 200 unit-tests pass.
We'll try to remain source-compatible across versions (except for the v1 -> v2 jump).
API will get a deprecation notice before being removed in the next version. Note that this
compatibility effort is only for the public API. Private API (headers ending
in _p.h) might change so you shouldn't depend on them. Private API is only
exposed so more advanced users can override, for example `paintEvent()`, and
@@ -154,14 +168,7 @@ not so they can change internal business logic.
We don't promise or test binary compatibility. It's advised that you recompile
your application whenever updating KDDW.
Supported Qt versions and toolchains
=====================================
KDDockWidgets requires Qt 5.15.x or Qt6 >= 6.2.
Styling
========
## Styling
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
@@ -175,29 +182,24 @@ Warning: When using private headers, be sure to rebuild your application wheneve
update to a new KDDW version. Binary compatibility is only kept when using public
headers.
## Licensing
Licensing
=========
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).
Contact KDAB at <info@kdab.com> to inquire about commercial licensing.
## Get Involved
Get Involved
============
Please submit your issue reports to our GitHub space at
https://github.com/KDAB/KDDockWidgets
Please submit your issue reports to our GitHub space at <https://github.com/KDAB/KDDockWidgets>.
When reporting bugs please make it easy for the maintainer to reproduce it. Use `examples/minimal/` or
`examples/dockwidgets/` for reproducing the problem. If you did modifications to the example in order to
reproduce then please attach the *patch* and not a picture of your changes. You can get a patch by doing
`git diff > repro.diff` at the repo root.
When reporting bugs please make it easy for the maintainer to reproduce it. Use `examples/minimal/`
or `examples/dockwidgets/` for reproducing the problem. If you did modifications to the example
in order to reproduce then please attach the *patch* and not a picture of your changes. You can
get a patch by doing `git diff > repro.diff` at the repo root.
Also state which KDDW sha1, branch or version you're using, and which operating system.
KDAB will happily accept external contributions; however, **all** contributions require a
signed [Copyright Assignment Agreement](docs/KDDockWidgets-CopyrightAssignmentForm.pdf).
@@ -207,8 +209,8 @@ Contact info@kdab.com for more information.
Thanks to our [contributors](CONTRIBUTORS.txt).
About KDAB
==========
## About KDAB
KDDockWidgets is supported and maintained by Klarälvdalens Datakonsult AB (KDAB).
The KDAB Group is the global No.1 software consultancy for Qt, C++ and
@@ -220,10 +222,10 @@ We continue to help develop parts of Qt and are one of the major contributors
to the Qt Project. We can give advanced or standard trainings anywhere
around the globe on Qt as well as C++, OpenGL, 3D and more.
Please visit https://www.kdab.com to meet the people who write code like this.
Please visit <https://www.kdab.com> to meet the people who write code like this.
Stay up-to-date with KDAB product announcements:
* [KDAB Newsletter](https://news.kdab.com)
* [KDAB Blogs](https://www.kdab.com/category/blogs)
* [KDAB on Twitter](https://twitter.com/KDABQt)
- [KDAB Newsletter](https://news.kdab.com)
- [KDAB Blogs](https://www.kdab.com/category/blogs)
- [KDAB on Twitter](https://twitter.com/KDABQt)

View File

@@ -9,6 +9,8 @@ version: 1.0.{build}-{branch}
branches:
except:
- gh-pages
- wip/v2
- master
# Do not build on tags (GitHub and BitBucket)
skip_tags: false
@@ -19,7 +21,7 @@ skip_tags: false
# Build worker image
image:
- Ubuntu
- Ubuntu2004
- macos
- Visual Studio 2019
@@ -40,26 +42,29 @@ configuration:
- Release
- Debug
environment:
matrix:
- useqt6: False
- useqt6: True
install:
- sh: if [ "`uname -s`" = "Darwin" ]; then brew install ninja; else sudo apt-get -y install mesa-common-dev libglu1-mesa-dev; fi
- 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
before_build:
- cmd: call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
- cmd: set PATH=C:\Qt\5.15\msvc2019_64;%PATH%
- sh: if [ "`uname -s`" = "Darwin" ]; then export PATH=$HOME/Qt/5.15/clang_64/bin:$PATH; else export PATH=$HOME/Qt/5.15/gcc_64/bin:$PATH; fi
- cmd: set PATH=C:\Qt\6.2\msvc2019_64\bin;C:\Qt\5.15\msvc2019_64\bin;%PATH%
- sh: if [ "`uname -s`" = "Darwin" ]; then export PATH=$HOME/Qt/6.2/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:
- mkdir build
- cd build
- cmd: cmake -G Ninja -DCMAKE_BUILD_TYPE=%CONFIGURATION% -DKDDockWidgets_TESTS=True -DKDDockWidgets_EXAMPLES=True -DKDDockWidgets_DEVELOPER_MODE=True ..
- sh: cmake -G Ninja -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 ..
- 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 .
- ctest --test-dir .
# to disable automatic builds
#build: off

View File

@@ -22,24 +22,24 @@ Generate C/C++ CamelCase forwarding headers.
[COMMON_HEADER <HeaderName>]
[RELATIVE <relative_path>])
For each CamelCase header name passed to HEADER_NAMES, a file of that name
For each CamelCase header name passed to ``HEADER_NAMES``, a file of that name
will be generated that will include a version with ``.h`` or, if set,
``.<header_extension>`` appended.
For example, the generated header ``ClassA`` will include ``classa.h`` (or
``ClassA.h``, see ORIGINAL).
``ClassA.h``, see ``ORIGINAL``).
If a CamelCaseName consists of multiple comma-separated files, e.g.
``ClassA,ClassB,ClassC``, then multiple camelcase header files will be
generated which are redirects to the first header file.
The file locations of these generated headers will be stored in
<camelcase_forwarding_headers_var>.
ORIGINAL specifies how the name of the original header is written: lowercased
or also camelcased. The default is LOWERCASE. Since 1.8.0.
``ORIGINAL`` specifies how the name of the original header is written: lowercased
or also camelcased. The default is "LOWERCASE". Since 1.8.0.
HEADER_EXTENSION specifies what file name extension is used for the header
``HEADER_EXTENSION`` specifies what file name extension is used for the header
files. The default is "h". Since 5.48.0.
PREFIX places the generated headers in subdirectories. This should be a
``PREFIX`` places the generated headers in subdirectories. This should be a
CamelCase name like ``KParts``, which will cause the CamelCase forwarding
headers to be placed in the ``KParts`` directory (e.g. ``KParts/Part``). It
will also, for the convenience of code in the source distribution, generate
@@ -47,36 +47,36 @@ forwarding headers based on the original names (e.g. ``kparts/part.h``). This
allows includes like ``"#include <kparts/part.h>"`` to be used before
installation, as long as the include_directories are set appropriately.
OUTPUT_DIR specifies where the files will be generated; this should be within
``OUTPUT_DIR`` specifies where the files will be generated; this should be within
the build directory. By default, ``${CMAKE_CURRENT_BINARY_DIR}`` will be used.
This option can be used to avoid file conflicts.
REQUIRED_HEADERS specifies an output variable name where all the required
``REQUIRED_HEADERS`` specifies an output variable name where all the required
headers will be appended so that they can be installed together with the
generated ones. This is mostly intended as a convenience so that adding a new
header to a project only requires specifying the CamelCase variant in the
CMakeLists.txt file; the original variant will then be added to this
variable.
COMMON_HEADER generates an additional convenience header which includes all
``COMMON_HEADER`` generates an additional convenience header which includes all
other header files.
The RELATIVE argument indicates where the original headers can be found
relative to CMAKE_CURRENT_SOURCE_DIR. It does not affect the generated
CamelCase forwarding files, but ecm_generate_headers() uses it when checking
The ``RELATIVE`` argument indicates where the original headers can be found
relative to ``CMAKE_CURRENT_SOURCE_DIR``. It does not affect the generated
CamelCase forwarding files, but ``ecm_generate_headers()`` uses it when checking
that the original header exists, and to generate originally named forwarding
headers when PREFIX is set.
headers when ``PREFIX`` is set.
To allow other parts of the source distribution (eg: tests) to use the
generated headers before installation, it may be desirable to set the
INCLUDE_DIRECTORIES property for the library target to output_dir. For
example, if OUTPUT_DIR is CMAKE_CURRENT_BINARY_DIR (the default), you could do
``INCLUDE_DIRECTORIES`` property for the library target to output_dir. For
example, if ``OUTPUT_DIR`` is ``CMAKE_CURRENT_BINARY_DIR`` (the default), you could do
.. code-block:: cmake
target_include_directories(MyLib PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>")
Example usage (without PREFIX):
Example usage (without ``PREFIX``):
.. code-block:: cmake
@@ -93,7 +93,7 @@ Example usage (without PREFIX):
DESTINATION ${CMAKE_INSTALL_PREFIX}/include
COMPONENT Devel)
Example usage (with PREFIX):
Example usage (with ``PREFIX``):
.. code-block:: cmake

View File

@@ -26,7 +26,8 @@ the default qmake ``mkspecs`` directory or of a directory that will be in the
[VERSION <version>] # since 5.83
[DEPS "<dep> [<dep> [...]]"]
[FILENAME_VAR <filename_variable>]
[INCLUDE_INSTALL_DIR <dir>]
[INCLUDE_INSTALL_DIRS <dir> [<dir> [...]]] # since 5.92
[INCLUDE_INSTALL_DIR <dir>] # deprecated since 5.92
[LIB_INSTALL_DIR <dir>])
If your CMake project produces a Qt-based library, you may expect there to be
@@ -36,31 +37,34 @@ library convenient for them, in much the same way that CMake config files make
things convenient for CMake-based applications. ``ecm_generate_pri_file()``
generates just such a file.
VERSION specifies the version of the library the ``.pri`` file describes. If
``VERSION`` specifies the version of the library the ``.pri`` file describes. If
not set, the value is taken from the context variable ``PROJECT_VERSION``.
This variable is usually set by the ``project(... VERSION ...)`` command or,
if CMake policy CMP0048 is not NEW, by :module:`ECMSetupVersion`.
if CMake policy CMP0048 is not ``NEW``, by :module:`ECMSetupVersion`.
For backward-compatibility with older ECM versions the
``PROJECT_VERSION_STRING`` variable as set by :module:`ECMSetupVersion`
will be preferred over ``PROJECT_VERSION`` if set, unless the minimum
required version of ECM is 5.83 and newer. Since 5.83.
BASE_NAME specifies the name qmake project (.pro) files should use to refer to
the library (eg: KArchive). LIB_NAME is the name of the actual library to
link to (ie: the first argument to add_library()). DEPS is a space-separated
``BASE_NAME`` specifies the name qmake project (.pro) files should use to refer to
the library (eg: KArchive). ``LIB_NAME`` is the name of the actual library to
link to (ie: the first argument to add_library()). ``DEPS`` is a space-separated
list of the base names of other libraries (for Qt libraries, use the same
names you use with the ``QT`` variable in a qmake project file, such as "core"
for QtCore). FILENAME_VAR specifies the name of a variable to store the path
for QtCore). ``FILENAME_VAR`` specifies the name of a variable to store the path
to the generated file in.
INCLUDE_INSTALL_DIR is the path (relative to ``CMAKE_INSTALL_PREFIX``) that
``INCLUDE_INSTALL_DIRS`` are the paths (relative to ``CMAKE_INSTALL_PREFIX``) that
include files will be installed to. It defaults to
``${INCLUDE_INSTALL_DIR}/<baseName>`` if the ``INCLUDE_INSTALL_DIR`` variable
is set. If that variable is not set, the ``CMAKE_INSTALL_INCLUDEDIR`` variable
is used instead, and if neither are set ``include`` is used. LIB_INSTALL_DIR
is used instead, and if neither are set ``include`` is used. ``LIB_INSTALL_DIR``
operates similarly for the installation location for libraries; it defaults to
``${LIB_INSTALL_DIR}``, ``${CMAKE_INSTALL_LIBDIR}`` or ``lib``, in that order.
``INCLUDE_INSTALL_DIR`` is the old variant of ``INCLUDE_INSTALL_DIRS``, taking only one
directory.
Example usage:
.. code-block:: cmake
@@ -85,19 +89,19 @@ Since pre-1.0.0.
# Replicate the logic from KDEInstallDirs.cmake as we can't depend on it
# Ask qmake if we're using the same prefix as Qt
set(_askqmake OFF)
set(_should_query_qt OFF)
if(NOT DEFINED KDE_INSTALL_USE_QT_SYS_PATHS)
include(ECMQueryQmake)
query_qmake(qt_install_prefix_dir QT_INSTALL_PREFIX TRY)
include(ECMQueryQt)
ecm_query_qt(qt_install_prefix_dir QT_INSTALL_PREFIX TRY)
if(qt_install_prefix_dir STREQUAL "${CMAKE_INSTALL_PREFIX}")
set(_askqmake ON)
set(_should_query_qt ON)
endif()
endif()
if(KDE_INSTALL_USE_QT_SYS_PATHS OR _askqmake)
include(ECMQueryQmake)
query_qmake(qt_install_prefix_dir QT_INSTALL_PREFIX)
query_qmake(qt_host_data_dir QT_HOST_DATA)
if(KDE_INSTALL_USE_QT_SYS_PATHS OR _should_query_qt)
include(ECMQueryQt)
ecm_query_qt(qt_install_prefix_dir QT_INSTALL_PREFIX)
ecm_query_qt(qt_host_data_dir QT_HOST_DATA)
if(qt_install_prefix_dir STREQUAL "${CMAKE_INSTALL_PREFIX}")
file(RELATIVE_PATH qt_host_data_dir ${qt_install_prefix_dir} ${qt_host_data_dir})
endif()
@@ -114,7 +118,7 @@ endif()
function(ECM_GENERATE_PRI_FILE)
set(options )
set(oneValueArgs BASE_NAME LIB_NAME DEPS FILENAME_VAR INCLUDE_INSTALL_DIR LIB_INSTALL_DIR VERSION)
set(multiValueArgs )
set(multiValueArgs INCLUDE_INSTALL_DIRS)
cmake_parse_arguments(EGPF "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
@@ -145,13 +149,19 @@ function(ECM_GENERATE_PRI_FILE)
endif()
endif()
endif()
if(NOT EGPF_INCLUDE_INSTALL_DIR)
if(EGPF_INCLUDE_INSTALL_DIR)
if(EGPF_INCLUDE_INSTALL_DIRS)
message(FATAL_ERROR "Only one argument of INCLUDE_INSTALL_DIR & INCLUDE_INSTALL_DIRS can be used in ECM_GENERATE_PRI_FILE() call")
endif()
set(EGPF_INCLUDE_INSTALL_DIRS ${EGPF_INCLUDE_INSTALL_DIR})
endif()
if(NOT EGPF_INCLUDE_INSTALL_DIRS)
if(INCLUDE_INSTALL_DIR)
set(EGPF_INCLUDE_INSTALL_DIR "${INCLUDE_INSTALL_DIR}/${EGPF_BASE_NAME}")
set(EGPF_INCLUDE_INSTALL_DIRS "${INCLUDE_INSTALL_DIR}/${EGPF_BASE_NAME}")
elseif(CMAKE_INSTALL_INCLUDEDIR)
set(EGPF_INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_INCLUDEDIR}/${EGPF_BASE_NAME}")
set(EGPF_INCLUDE_INSTALL_DIRS "${CMAKE_INSTALL_INCLUDEDIR}/${EGPF_BASE_NAME}")
else()
set(EGPF_INCLUDE_INSTALL_DIR "include/${EGPF_BASE_NAME}")
set(EGPF_INCLUDE_INSTALL_DIRS "include/${EGPF_BASE_NAME}")
endif()
endif()
if(NOT EGPF_LIB_INSTALL_DIR)
@@ -193,16 +203,21 @@ function(ECM_GENERATE_PRI_FILE)
set(PRI_TARGET_BASENAME ${EGPF_BASE_NAME})
set(PRI_TARGET_LIBNAME ${EGPF_LIB_NAME})
set(PRI_TARGET_QTDEPS ${EGPF_DEPS})
if(IS_ABSOLUTE "${EGPF_INCLUDE_INSTALL_DIR}")
set(PRI_TARGET_INCLUDES "${EGPF_INCLUDE_INSTALL_DIR}")
else()
set(PRI_TARGET_INCLUDES "${BASEPATH}/${EGPF_INCLUDE_INSTALL_DIR}")
endif()
set(PRI_TARGET_INCLUDES)
foreach(_dir ${EGPF_INCLUDE_INSTALL_DIRS})
# separate list entries with space
if(IS_ABSOLUTE "${_dir}")
string(APPEND PRI_TARGET_INCLUDES " ${_dir}")
else()
string(APPEND PRI_TARGET_INCLUDES " ${BASEPATH}/${_dir}")
endif()
endforeach()
if(IS_ABSOLUTE "${EGPF_LIB_INSTALL_DIR}")
set(PRI_TARGET_LIBS "${EGPF_LIB_INSTALL_DIR}")
else()
set(PRI_TARGET_LIBS "${BASEPATH}/${EGPF_LIB_INSTALL_DIR}")
endif()
set(PRI_TARGET_DEFINES "")
set(PRI_FILENAME ${CMAKE_CURRENT_BINARY_DIR}/qt_${PRI_TARGET_BASENAME}.pri)
if (EGPF_FILENAME_VAR)
@@ -210,8 +225,6 @@ function(ECM_GENERATE_PRI_FILE)
endif()
set(PRI_TARGET_MODULE_CONFIG "")
set(PRI_TARGET_DEFINES "")
set(PRI_TARGET_POSTFIX "")
# backward compat: it was not obvious LIB_NAME needs to be a target name,
# and some projects where the target name was not the actual library output name
# passed the output name for LIB_NAME, so .name & .module prperties are correctly set.
@@ -221,10 +234,6 @@ function(ECM_GENERATE_PRI_FILE)
if (target_type STREQUAL "STATIC_LIBRARY")
set(PRI_TARGET_MODULE_CONFIG "staticlib")
endif()
get_target_property(target_defs ${EGPF_LIB_NAME} INTERFACE_COMPILE_DEFINITIONS)
list(FILTER target_defs EXCLUDE REGEX ^QT_)
string(JOIN " " PRI_TARGET_DEFINES "${target_defs}")
set(PRI_TARGET_POSTFIX "$<TARGET_PROPERTY:${EGPF_LIB_NAME},$<UPPER_CASE:$<CONFIG>$<$<CONFIG:>:Debug>>_POSTFIX>")
endif()
file(GENERATE
@@ -235,8 +244,8 @@ QT.${PRI_TARGET_BASENAME}.MAJOR_VERSION = ${PRI_VERSION_MAJOR}
QT.${PRI_TARGET_BASENAME}.MINOR_VERSION = ${PRI_VERSION_MINOR}
QT.${PRI_TARGET_BASENAME}.PATCH_VERSION = ${PRI_VERSION_PATCH}
QT.${PRI_TARGET_BASENAME}.name = ${PRI_TARGET_LIBNAME}
QT.${PRI_TARGET_BASENAME}.module = ${PRI_TARGET_LIBNAME}${PRI_TARGET_POSTFIX}
QT.${PRI_TARGET_BASENAME}.DEFINES = ${PRI_TARGET_DEFINES}
QT.${PRI_TARGET_BASENAME}.module = ${PRI_TARGET_LIBNAME}
QT.${PRI_TARGET_BASENAME}.defines = ${PRI_TARGET_DEFINES}
QT.${PRI_TARGET_BASENAME}.includes = ${PRI_TARGET_INCLUDES}
QT.${PRI_TARGET_BASENAME}.private_includes =
QT.${PRI_TARGET_BASENAME}.libs = ${PRI_TARGET_LIBS}

View File

@@ -1,46 +0,0 @@
find_package(Qt5Core QUIET)
if (Qt5Core_FOUND)
set(_qmake_executable_default "qmake-qt5")
endif ()
if (TARGET Qt5::qmake)
get_target_property(_qmake_executable_default Qt5::qmake LOCATION)
endif()
set(QMAKE_EXECUTABLE ${_qmake_executable_default}
CACHE FILEPATH "Location of the Qt5 qmake executable")
# Helper method
# This is not public API (yet)!
# Usage: query_qmake(<result_variable> <qt_variable> [TRY])
# Passing TRY will result in the method not failing fatal if no qmake executable
# has been found, but instead simply returning an empty string
function(query_qmake result_variable qt_variable)
set(options TRY)
set(oneValueArgs )
set(multiValueArgs )
cmake_parse_arguments(ARGS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if(NOT QMAKE_EXECUTABLE)
if(ARGS_TRY)
set(${result_variable} "" PARENT_SCOPE)
message(STATUS "No qmake Qt5 binary found. Can't check ${qt_variable}")
return()
else()
message(FATAL_ERROR "No qmake Qt5 binary found. Can't check ${qt_variable} as required")
endif()
endif()
execute_process(
COMMAND ${QMAKE_EXECUTABLE} -query "${qt_variable}"
RESULT_VARIABLE return_code
OUTPUT_VARIABLE output
)
if(return_code EQUAL 0)
string(STRIP "${output}" output)
file(TO_CMAKE_PATH "${output}" output_path)
set(${result_variable} "${output_path}" PARENT_SCOPE)
else()
message(WARNING "Failed call: ${QMAKE_EXECUTABLE} -query \"${qt_variable}\"")
message(FATAL_ERROR "QMake call failed: ${return_code}")
endif()
endfunction()

View File

@@ -0,0 +1,100 @@
# SPDX-FileCopyrightText: 2014 Rohan Garg <rohan16garg@gmail.com>
# SPDX-FileCopyrightText: 2014 Alex Merry <alex.merry@kde.org>
# SPDX-FileCopyrightText: 2014-2016 Aleix Pol <aleixpol@kde.org>
# SPDX-FileCopyrightText: 2017 Friedrich W. H. Kossebau <kossebau@kde.org>
# SPDX-FileCopyrightText: 2022 Ahmad Samir <a.samir78@gmail.com>
#
# SPDX-License-Identifier: BSD-3-Clause
#[=======================================================================[.rst:
ECMQueryQt
---------------
This module can be used to query the installation paths used by Qt.
For Qt5 this uses ``qmake``, and for Qt6 this used ``qtpaths`` (the latter has built-in
support to query the paths of a target platform when cross-compiling).
This module defines the following function:
::
ecm_query_qt(<result_variable> <qt_variable> [TRY])
Passing ``TRY`` will result in the method not making the build fail if the executable
used for querying has not been found, but instead simply print a warning message and
return an empty string.
Example usage:
.. code-block:: cmake
include(ECMQueryQt)
ecm_query_qt(bin_dir QT_INSTALL_BINS)
If the call succeeds ``${bin_dir}`` will be set to ``<prefix>/path/to/bin/dir`` (e.g.
``/usr/lib64/qt/bin/``).
Since: 5.93
#]=======================================================================]
include(${CMAKE_CURRENT_LIST_DIR}/QtVersionOption.cmake)
include(CheckLanguage)
check_language(CXX)
if (CMAKE_CXX_COMPILER)
# Enable the CXX language to let CMake look for config files in library dirs.
# See: https://gitlab.kitware.com/cmake/cmake/-/issues/23266
enable_language(CXX)
endif()
if (QT_MAJOR_VERSION STREQUAL "5")
# QUIET to accommodate the TRY option
find_package(Qt${QT_MAJOR_VERSION}Core QUIET)
if(TARGET Qt5::qmake)
get_target_property(_qmake_executable_default Qt5::qmake LOCATION)
set(QUERY_EXECUTABLE ${_qmake_executable_default}
CACHE FILEPATH "Location of the Qt5 qmake executable")
set(_exec_name_text "Qt5 qmake")
set(_cli_option "-query")
endif()
elseif(QT_MAJOR_VERSION STREQUAL "6")
# QUIET to accommodate the TRY option
find_package(Qt6 COMPONENTS CoreTools QUIET CONFIG)
if (TARGET Qt6::qtpaths)
get_target_property(_qtpaths_executable Qt6::qtpaths LOCATION)
set(QUERY_EXECUTABLE ${_qtpaths_executable}
CACHE FILEPATH "Location of the Qt6 qtpaths executable")
set(_exec_name_text "Qt6 qtpaths")
set(_cli_option "--query")
endif()
endif()
function(ecm_query_qt result_variable qt_variable)
set(options TRY)
set(oneValueArgs)
set(multiValueArgs)
cmake_parse_arguments(ARGS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if(NOT QUERY_EXECUTABLE)
if(ARGS_TRY)
set(${result_variable} "" PARENT_SCOPE)
message(STATUS "No ${_exec_name_text} executable found. Can't check ${qt_variable}")
return()
else()
message(FATAL_ERROR "No ${_exec_name_text} executable found. Can't check ${qt_variable} as required")
endif()
endif()
execute_process(
COMMAND ${QUERY_EXECUTABLE} ${_cli_option} "${qt_variable}"
RESULT_VARIABLE return_code
OUTPUT_VARIABLE output
)
if(return_code EQUAL 0)
string(STRIP "${output}" output)
file(TO_CMAKE_PATH "${output}" output_path)
set(${result_variable} "${output_path}" PARENT_SCOPE)
else()
message(WARNING "Failed call: ${_command} \"${qt_variable}\"")
message(FATAL_ERROR "${_exec_name_text} call failed: ${return_code}")
endif()
endfunction()

View File

@@ -36,7 +36,7 @@ version of ECM is < 5.83)::
<prefix>_VERSION_STRING - <version> (use <prefix>_VERSION instead)
If CMake policy CMP0048 is not NEW, the following CMake variables will also
If CMake policy CMP0048 is not ``NEW``, the following CMake variables will also
be set::
PROJECT_VERSION_MAJOR - <major>
@@ -44,14 +44,14 @@ be set::
PROJECT_VERSION_PATCH - <patch>
PROJECT_VERSION - <version>
For backward-compatibility, if CMake policy CMP0048 is not NEW, also this variable is set
For backward-compatibility, if CMake policy CMP0048 is not ``NEW``, also this variable is set
(only if the minimum required version of ECM is < 5.83)::
PROJECT_VERSION_STRING - <version> (use PROJECT_VERSION instead)
If the VERSION_HEADER option is used, a simple C header is generated with the
If the ``VERSION_HEADER`` option is used, a simple C header is generated with the
given filename. If filename is a relative path, it is interpreted as relative
to CMAKE_CURRENT_BINARY_DIR. The generated header contains the following
to ``CMAKE_CURRENT_BINARY_DIR``. The generated header contains the following
macros::
<prefix>_VERSION_MAJOR - <major> as an integer
@@ -64,15 +64,15 @@ macros::
next 8 bits and ``<major>`` in the remaining bits. Note that ``<patch>`` and
``<minor>`` must be less than 256.
If the PACKAGE_VERSION_FILE option is used, a simple CMake package version
file is created using the write_basic_package_version_file() macro provided by
If the ``PACKAGE_VERSION_FILE`` option is used, a simple CMake package version
file is created using the ``write_basic_package_version_file()`` macro provided by
CMake. It should be installed in the same location as the Config.cmake file of
the library so that it can be found by find_package(). If the filename is a
relative path, it is interpreted as relative to CMAKE_CURRENT_BINARY_DIR. The
optional COMPATIBILITY option is forwarded to
write_basic_package_version_file(), and defaults to AnyNewerVersion.
the library so that it can be found by ``find_package()``. If the filename is a
relative path, it is interpreted as relative to ``CMAKE_CURRENT_BINARY_DIR``. The
optional ``COMPATIBILITY`` option is forwarded to
``write_basic_package_version_file()``, and defaults to ``AnyNewerVersion``.
If CMake policy CMP0048 is NEW, an alternative form of the command is
If CMake policy CMP0048 is ``NEW``, an alternative form of the command is
available::
ecm_setup_version(PROJECT
@@ -81,14 +81,14 @@ available::
[VERSION_HEADER <filename>]
[PACKAGE_VERSION_FILE <filename>] )
This will use the version information set by the project() command.
VARIABLE_PREFIX defaults to the project name. Note that PROJECT must be the
This will use the version information set by the ``project()`` command.
``VARIABLE_PREFIX`` defaults to the project name. Note that ``PROJECT`` must be the
first argument. In all other respects, it behaves like the other form of the
command.
Since pre-1.0.0.
COMPATIBILITY option available since 1.6.0.
``COMPATIBILITY`` option available since 1.6.0.
#]=======================================================================]
include(CMakePackageConfigHelpers)
@@ -132,9 +132,10 @@ function(ecm_setup_version _version)
if(use_project_version)
set(_version "${PROJECT_VERSION}")
set(_major "${PROJECT_VERSION_MAJOR}")
set(_minor "${PROJECT_VERSION_MINOR}")
set(_patch "${PROJECT_VERSION_PATCH}")
# drop leading 0 from values to avoid bogus octal values in c/C++ e.g. with 08 or 09
string(REGEX REPLACE "0*([0-9]+)" "\\1" _major "${PROJECT_VERSION_MAJOR}")
string(REGEX REPLACE "0*([0-9]+)" "\\1" _minor "${PROJECT_VERSION_MINOR}")
string(REGEX REPLACE "0*([0-9]+)" "\\1" _patch "${PROJECT_VERSION_PATCH}")
else()
string(REGEX REPLACE "^0*([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" _major "${_version}")
string(REGEX REPLACE "^[0-9]+\\.0*([0-9]+)\\.[0-9]+.*" "\\1" _minor "${_version}")

View File

@@ -0,0 +1,36 @@
# SPDX-FileCopyrightText: 2021 Volker Krause <vkrause@kde.org>
#
# SPDX-License-Identifier: BSD-3-Clause
#[=======================================================================[.rst:
QtVersionOption
---------------
Adds a build option to select the major Qt version if necessary,
that is, if the major Qt version has not yet been determined otherwise
(e.g. by a corresponding ``find_package()`` call).
This module is typically included by other modules requiring knowledge
about the major Qt version.
``QT_MAJOR_VERSION`` is defined to either be "5" or "6".
Since 5.82.0.
#]=======================================================================]
if (DEFINED QT_MAJOR_VERSION)
return()
endif()
if (TARGET Qt5::Core)
set(QT_MAJOR_VERSION 5)
elseif (TARGET Qt6::Core)
set(QT_MAJOR_VERSION 6)
else()
option(BUILD_WITH_QT6 "Build against Qt 6" OFF)
if (BUILD_WITH_QT6)
set(QT_MAJOR_VERSION 6)
else()
set(QT_MAJOR_VERSION 5)
endif()
endif()

View File

@@ -58,7 +58,11 @@ else()
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(NOT PYSIDE2_BASEDIR)
message(FATAL_ERROR "The PySide2 module could not be imported. Make sure you have it installed by checking the output of \"pip${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR} list\"")
message(
FATAL_ERROR
"The PySide2 module could not be imported. Make sure you have it installed "
"by checking the output of \"pip${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR} list\""
)
endif()
set(PYSIDE_BASEDIR ${PYSIDE2_BASEDIR} CACHE PATH "Top level install of PySide2" FORCE)

View File

@@ -33,7 +33,11 @@ execute_process(
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(NOT PYSIDE6_BASEDIR)
message(FATAL_ERROR "The PySide6 module could not be imported. Make sure you have it installed by checking the output of \"pip${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR} list\"")
message(
FATAL_ERROR
"The PySide6 module could not be imported. Make sure you have it installed "
"by checking the output of \"pip${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR} list\""
)
endif()
if(PYSIDE6_BASEDIR)

View File

@@ -11,7 +11,8 @@
# SHIBOKEN_BUILD_TYPE - Tells if Shiboken was compiled in Release or Debug mode.
# You can install Shiboken from Qt repository with
# pip3 install --index-url=https://download.qt.io/official_releases/QtForPython --trusted-host download.qt.io shiboken2-generator
# pip3 install --index-url=https://download.qt.io/official_releases/QtForPython \
# --trusted-host download.qt.io shiboken2-generator
find_package(PkgConfig)
if(PKG_CONFIG_FOUND)
@@ -51,7 +52,11 @@ else()
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(NOT SHIBOKEN_GENERATOR_BASEDIR)
message(FATAL_ERROR "The shiboken2_generator module could not be imported. Make sure you have it installed by checking the output of \"pip${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR} list\"")
message(
FATAL_ERROR
"The shiboken2_generator module could not be imported. Make sure you have it installed "
"by checking the output of \"pip${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR} list\""
)
endif()
execute_process(
COMMAND ${Python3_EXECUTABLE} -c "if True:
@@ -66,7 +71,11 @@ else()
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(NOT SHIBOKEN_BASEDIR)
message(FATAL_ERROR "The shiboken2 module could not be imported. Make sure you have it installed by checking the output of \"pip${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR} list\"")
message(
FATAL_ERROR
"The shiboken2 module could not be imported. Make sure you have it installed "
"by checking the output of \"pip${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR} list\""
)
endif()
execute_process(
COMMAND ${Python3_EXECUTABLE} -c "if True:

View File

@@ -11,7 +11,8 @@
# SHIBOKEN_BUILD_TYPE - Tells if Shiboken was compiled in Release or Debug mode.
# You can install Shiboken from Qt repository with
# pip3 install --index-url=https://download.qt.io/official_releases/QtForPython --trusted-host download.qt.io shiboken6-generator
# pip3 install --index-url=https://download.qt.io/official_releases/QtForPython \
# --trusted-host download.qt.io shiboken6-generator
set(SHIBOKEN_FOUND FALSE)
@@ -28,7 +29,11 @@ execute_process(
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(NOT SHIBOKEN_GENERATOR_BASEDIR)
message(FATAL_ERROR "The shiboken6_generator module could not be imported. Make sure you have it installed by checking the output of \"pip${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR} list\"")
message(
FATAL_ERROR
"The shiboken6_generator module could not be imported. Make sure you have it installed "
"by checking the output of \"pip${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR} list\""
)
endif()
execute_process(
COMMAND ${Python3_EXECUTABLE} -c "if True:
@@ -43,7 +48,11 @@ execute_process(
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(NOT SHIBOKEN_BASEDIR)
message(FATAL_ERROR "The shiboken6 module could not be imported. Make sure you have it installed by checking the output of \"pip${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR} list\"")
message(
FATAL_ERROR
"The shiboken6 module could not be imported. Make sure you have it installed "
"by checking the output of \"pip${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR} list\""
)
endif()
execute_process(
COMMAND ${Python3_EXECUTABLE} -c "if True:
@@ -142,7 +151,7 @@ if(SHIBOKEN_FOUND)
message(STATUS "Shiboken binary: ${SHIBOKEN_BINARY}")
message(STATUS "Shiboken version: ${SHIBOKEN_VERSION}")
# Create shiboke2 target
# Create shiboken2 target
add_library(Shiboken6::libshiboken SHARED IMPORTED GLOBAL)
if(MSVC)
set_property(TARGET Shiboken6::libshiboken PROPERTY
@@ -161,7 +170,8 @@ if(SHIBOKEN_FOUND)
set_property(TARGET Shiboken6::shiboken PROPERTY IMPORTED_LOCATION ${SHIBOKEN_BINARY})
endif()
find_package_handle_standard_args(Shiboken6
find_package_handle_standard_args(
Shiboken6
REQUIRED_VARS SHIBOKEN_BASEDIR SHIBOKEN_INCLUDE_DIR SHIBOKEN_LIBRARY SHIBOKEN_BINARY
VERSION_VAR SHIBOKEN_VERSION
)

View File

@@ -1,3 +1,9 @@
#
# SPDX-FileCopyrightText: 2012-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
#
# SPDX-License-Identifier: BSD-3-Clause
#
# Some default installation locations. These should be global, with any project
# specific locations added to the end. These paths are all relative to the
# install prefix.
@@ -9,27 +15,27 @@
include(GNUInstallDirs)
if(NOT INSTALL_RUNTIME_DIR)
set(INSTALL_RUNTIME_DIR ${CMAKE_INSTALL_BINDIR})
set(INSTALL_RUNTIME_DIR ${CMAKE_INSTALL_BINDIR})
endif()
if(NOT INSTALL_LIBRARY_DIR)
set(INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR})
set(INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR})
endif()
if(NOT INSTALL_ARCHIVE_DIR)
set(INSTALL_ARCHIVE_DIR ${CMAKE_INSTALL_LIBDIR})
set(INSTALL_ARCHIVE_DIR ${CMAKE_INSTALL_LIBDIR})
endif()
if(NOT INSTALL_INCLUDE_DIR)
set(INSTALL_INCLUDE_DIR ${CMAKE_INSTALL_INCLUDEDIR})
set(INSTALL_INCLUDE_DIR ${CMAKE_INSTALL_INCLUDEDIR})
endif()
if(NOT INSTALL_DATADIR)
set(INSTALL_DATADIR ${CMAKE_INSTALL_DATADIR})
set(INSTALL_DATADIR ${CMAKE_INSTALL_DATADIR})
endif()
if(NOT INSTALL_DOC_DIR)
set(INSTALL_DOC_DIR ${CMAKE_INSTALL_DOCDIR}${KDDockWidgets_LIBRARY_QTID})
set(INSTALL_DOC_DIR ${CMAKE_INSTALL_DOCDIR}${${PROJECT_NAME}_LIBRARY_QTID})
endif()
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
if(APPLE)
set(CMAKE_MACOSX_RPATH ON)
set(CMAKE_MACOSX_RPATH ON)
else()
set(CMAKE_INSTALL_RPATH "$ORIGIN/../${INSTALL_LIBRARY_DIR}")
set(CMAKE_INSTALL_RPATH "$ORIGIN/../${INSTALL_LIBRARY_DIR}")
endif()

View File

@@ -6,7 +6,10 @@
#
if(NOT ${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX)
set(${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} CACHE FILEPATH "Custom path to install python bindings.")
# cmake-lint: disable=C0103
set(${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}
CACHE FILEPATH "Custom path to install python bindings."
)
endif()
message(STATUS "PYTHON INSTALL PREFIX ${${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX}")
@@ -65,6 +68,7 @@ if(WIN32 OR DEFINED AVOID_PROTECTED_HACK)
add_definitions(-DAVOID_PROTECTED_HACK)
endif()
# Replace all semicolons in a string with this platform's path separator
macro(make_path varname)
# accepts any number of path variables
string(REPLACE ";" "${PATH_SEP}" ${varname} "${ARGN}")
@@ -73,35 +77,35 @@ endmacro()
# Creates a PySide module target based on the arguments
# This will:
# 1 - Create a Cmake custom-target that call shiboken-generator passign the correct arguments
# 2 - Create a Cmake library target called "Py${LIBRARY_NAME}" the output name of this target
# 2 - Create a Cmake library target called "Py${libraryName}" the output name of this target
# will be changed to match PySide template
# Args:
# LIBRARY_NAME - The name of the output module
# TYPESYSTEM_PATHS - A list of paths where shiboken should look for typesystem files
# INCLUDE_PATHS - Include paths necessary to parse your class. *This is not the same as build*
# OUTPUT_SOURCES - The files that will be generated by shiboken
# TARGET_INCLUDE_DIRS - This will be passed to target_include_directories
# TARGET_LINK_LIBRARIES - This will be passed to target_link_libraries
# GLOBAL_INCLUDE - A header-file that contains all classes that will be generated
# TYPESYSTEM_XML - The target binding typesystem (that should be the full path)
# DEPENDS - This var will be passed to add_custom_command(DEPENDS) so a new generation will be
# libraryName - The name of the output module
# typesystemPaths - A list of paths where shiboken should look for typesystem files
# includePaths - Include paths necessary to parse your class. *This is not the same as build*
# outputSource - The files that will be generated by shiboken
# targetIncludeDirs - This will be passed to target_include_directories
# targetLinkLibraries - This will be passed to targetLinkLibraries
# globalInclude - A header-file that contains all classes that will be generated
# typesystemXML - The target binding typesystem (that should be the full path)
# dependsArg - This var will be passed to add_custom_command(DEPENDS) so a new generation will be
# trigger if one of these files changes
# MODULE_OUTPUT_DIR - Where the library file should be stored
macro(CREATE_PYTHON_BINDINGS
LIBRARY_NAME
TYPESYSTEM_PATHS
INCLUDE_PATHS
OUTPUT_SOURCES
TARGET_INCLUDE_DIRS
TARGET_LINK_LIBRARIES
GLOBAL_INCLUDE
TYPESYSTEM_XML
DEPENDS
MODULE_OUTPUT_DIR)
# moduleOutputDir - Where the library file should be stored
macro(create_python_bindings
libraryName
typesystemPaths
includePaths
outputSource
targetIncludeDirs
targetLinkLibraries
globalInclude
typesystemXML
dependsArg
moduleOutputDir)
# Transform the path separators into something shiboken understands.
make_path(shiboken_include_dirs ${INCLUDE_PATHS})
make_path(shiboken_typesystem_dirs ${TYPESYSTEM_PATHS})
make_path(shiboken_include_dirs ${includePaths})
make_path(shiboken_typesystem_dirs ${typesystemPaths})
get_property(raw_python_dir_include_dirs DIRECTORY PROPERTY INCLUDE_DIRECTORIES)
make_path(python_dir_include_dirs ${raw_python_dir_include_dirs})
set(shiboken_include_dirs "${shiboken_include_dirs}${PATH_SEP}${python_dir_include_dirs}")
@@ -112,54 +116,55 @@ macro(CREATE_PYTHON_BINDINGS
make_path(shiboken_framework_include_dirs ${shiboken_framework_include_dirs})
set(shiboken_framework_include_dirs_option "--framework-include-paths=${shiboken_framework_include_dirs}")
endif()
set_property(SOURCE ${OUTPUT_SOURCES} PROPERTY SKIP_AUTOGEN ON)
add_custom_command(OUTPUT ${OUTPUT_SOURCES}
set_property(SOURCE ${outputSource} PROPERTY SKIP_AUTOGEN ON)
add_custom_command(
OUTPUT ${outputSource}
COMMAND $<TARGET_PROPERTY:Shiboken2::shiboken,LOCATION> ${GENERATOR_EXTRA_FLAGS}
${GLOBAL_INCLUDE}
${globalInclude}
--include-paths=${shiboken_include_dirs}
--typesystem-paths=${shiboken_typesystem_dirs}
${shiboken_framework_include_dirs_option}
--output-directory=${CMAKE_CURRENT_BINARY_DIR}
${TYPESYSTEM_XML}
DEPENDS ${TYPESYSTEM_XML} ${DEPENDS}
${typesystemXML}
DEPENDS ${typesystemXML} ${dependsArg}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Running generator for ${LIBRARY_NAME} binding...")
COMMENT "Running generator for ${libraryName} binding..."
)
set(TARGET_NAME "Py${LIBRARY_NAME}")
set(MODULE_NAME "${LIBRARY_NAME}")
add_library(${TARGET_NAME} MODULE ${OUTPUT_SOURCES})
set(TARGET_NAME "Py${libraryName}")
set(MODULE_NAME "${libraryName}")
add_library(${TARGET_NAME} MODULE ${outputSource})
set_target_properties(${TARGET_NAME} PROPERTIES
PREFIX ""
OUTPUT_NAME ${MODULE_NAME}
LIBRARY_OUTPUT_DIRECTORY ${MODULE_OUTPUT_DIR}
)
if(APPLE)
set_target_properties(${TARGET_NAME} PROPERTIES INSTALL_RPATH "@loader_path")
elseif(NOT WIN32) #ie. linux
set_target_properties(${TARGET_NAME} PROPERTIES INSTALL_RPATH "$ORIGIN")
endif()
set_target_properties(
${TARGET_NAME} PROPERTIES
PREFIX ""
OUTPUT_NAME ${MODULE_NAME}
LIBRARY_OUTPUT_DIRECTORY ${moduleOutputDir}
)
if(APPLE)
set_target_properties(${TARGET_NAME} PROPERTIES INSTALL_RPATH "@loader_path")
elseif(NOT WIN32) #ie. linux
set_target_properties(${TARGET_NAME} PROPERTIES INSTALL_RPATH "$ORIGIN")
endif()
if(WIN32)
set_target_properties(${TARGET_NAME} PROPERTIES SUFFIX ".pyd")
endif()
if(WIN32)
set_target_properties(${TARGET_NAME} PROPERTIES SUFFIX ".pyd")
endif()
target_include_directories(${TARGET_NAME} PUBLIC
${TARGET_INCLUDE_DIRS}
)
target_include_directories(${TARGET_NAME} PUBLIC ${targetIncludeDirs})
target_link_libraries(${TARGET_NAME}
${TARGET_LINK_LIBRARIES}
PySide2::pyside2
Shiboken2::libshiboken
)
target_compile_definitions(${TARGET_NAME}
PRIVATE Py_LIMITED_API=0x03050000
)
if(APPLE)
set_property(TARGET ${TARGET_NAME} APPEND PROPERTY
LINK_FLAGS "-undefined dynamic_lookup")
endif()
install(TARGETS ${TARGET_NAME}
LIBRARY DESTINATION ${${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX})
target_link_libraries(
${TARGET_NAME}
${targetLinkLibraries}
PySide2::pyside2
Shiboken2::libshiboken
)
target_compile_definitions(${TARGET_NAME} PRIVATE Py_LIMITED_API=0x03050000)
if(APPLE)
set_property(TARGET ${TARGET_NAME} APPEND PROPERTY LINK_FLAGS "-undefined dynamic_lookup")
endif()
install(
TARGETS ${TARGET_NAME}
LIBRARY DESTINATION ${${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX}
)
endmacro()

View File

@@ -6,7 +6,10 @@
#
if(NOT ${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX)
set(${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} CACHE FILEPATH "Custom path to install python bindings.")
# cmake-lint: disable=C0103
set(${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}
CACHE FILEPATH "Custom path to install python bindings."
)
endif()
message(STATUS "PYTHON INSTALL PREFIX ${${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX}")
@@ -65,6 +68,7 @@ if(WIN32 OR DEFINED AVOID_PROTECTED_HACK)
add_definitions(-DAVOID_PROTECTED_HACK)
endif()
# Replace all semicolons in a string with this platform's path separator
macro(make_path varname)
# accepts any number of path variables
string(REPLACE ";" "${PATH_SEP}" ${varname} "${ARGN}")
@@ -73,35 +77,35 @@ endmacro()
# Creates a PySide module target based on the arguments
# This will:
# 1 - Create a Cmake custom-target that call shiboken-generator passign the correct arguments
# 2 - Create a Cmake library target called "Py${LIBRARY_NAME}" the output name of this target
# 2 - Create a Cmake library target called "Py${libraryName}" the output name of this target
# will be changed to match PySide template
# Args:
# LIBRARY_NAME - The name of the output module
# TYPESYSTEM_PATHS - A list of paths where shiboken should look for typesystem files
# INCLUDE_PATHS - Include paths necessary to parse your class. *This is not the same as build*
# OUTPUT_SOURCES - The files that will be generated by shiboken
# TARGET_INCLUDE_DIRS - This will be passed to target_include_directories
# TARGET_LINK_LIBRARIES - This will be passed to target_link_libraries
# GLOBAL_INCLUDE - A header-file that contains all classes that will be generated
# TYPESYSTEM_XML - The target binding typesystem (that should be the full path)
# DEPENDS - This var will be passed to add_custom_command(DEPENDS) so a new generation will be
# libraryName - The name of the output module
# typesystemPaths - A list of paths where shiboken should look for typesystem files
# includePaths - Include paths necessary to parse your class. *This is not the same as build*
# outputSource - The files that will be generated by shiboken
# targetIncludeDirs - This will be passed to target_include_directories
# targetLinkLibraries - This will be passed to targetLinkLibraries
# globalInclude - A header-file that contains all classes that will be generated
# typesystemXML - The target binding typesystem (that should be the full path)
# dependsArg - This var will be passed to add_custom_command(DEPENDS) so a new generation will be
# trigger if one of these files changes
# MODULE_OUTPUT_DIR - Where the library file should be stored
macro(CREATE_PYTHON_BINDINGS
LIBRARY_NAME
TYPESYSTEM_PATHS
INCLUDE_PATHS
OUTPUT_SOURCES
TARGET_INCLUDE_DIRS
TARGET_LINK_LIBRARIES
GLOBAL_INCLUDE
TYPESYSTEM_XML
DEPENDS
MODULE_OUTPUT_DIR)
# moduleOutputDir - Where the library file should be stored
macro(create_python_bindings
libraryName
typesystemPaths
includePaths
outputSource
targetIncludeDirs
targetLinkLibraries
globalInclude
typesystemXML
dependsArg
moduleOutputDir)
# Transform the path separators into something shiboken understands.
make_path(shiboken_include_dirs ${INCLUDE_PATHS})
make_path(shiboken_typesystem_dirs ${TYPESYSTEM_PATHS})
make_path(shiboken_include_dirs ${includePaths})
make_path(shiboken_typesystem_dirs ${typesystemPaths})
get_property(raw_python_dir_include_dirs DIRECTORY PROPERTY INCLUDE_DIRECTORIES)
make_path(python_dir_include_dirs ${raw_python_dir_include_dirs})
set(shiboken_include_dirs "${shiboken_include_dirs}${PATH_SEP}${python_dir_include_dirs}")
@@ -112,54 +116,55 @@ macro(CREATE_PYTHON_BINDINGS
make_path(shiboken_framework_include_dirs ${shiboken_framework_include_dirs})
set(shiboken_framework_include_dirs_option "--framework-include-paths=${shiboken_framework_include_dirs}")
endif()
set_property(SOURCE ${OUTPUT_SOURCES} PROPERTY SKIP_AUTOGEN ON)
add_custom_command(OUTPUT ${OUTPUT_SOURCES}
set_property(SOURCE ${outputSource} PROPERTY SKIP_AUTOGEN ON)
add_custom_command(
OUTPUT ${outputSource}
COMMAND $<TARGET_PROPERTY:Shiboken6::shiboken,LOCATION> ${GENERATOR_EXTRA_FLAGS}
${GLOBAL_INCLUDE}
${globalInclude}
--include-paths=${shiboken_include_dirs}
--typesystem-paths=${shiboken_typesystem_dirs}
${shiboken_framework_include_dirs_option}
--output-directory=${CMAKE_CURRENT_BINARY_DIR}
${TYPESYSTEM_XML}
DEPENDS ${TYPESYSTEM_XML} ${DEPENDS}
${typesystemXML}
DEPENDS ${typesystemXML} ${dependsArg}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Running generator for ${LIBRARY_NAME} binding...")
COMMENT "Running generator for ${libraryName} binding..."
)
set(TARGET_NAME "Py${LIBRARY_NAME}")
set(MODULE_NAME "${LIBRARY_NAME}")
add_library(${TARGET_NAME} MODULE ${OUTPUT_SOURCES})
set(TARGET_NAME "Py${libraryName}")
set(MODULE_NAME "${libraryName}")
add_library(${TARGET_NAME} MODULE ${outputSource})
set_target_properties(${TARGET_NAME} PROPERTIES
PREFIX ""
OUTPUT_NAME ${MODULE_NAME}
LIBRARY_OUTPUT_DIRECTORY ${MODULE_OUTPUT_DIR}
)
if(APPLE)
set_target_properties(${TARGET_NAME} PROPERTIES INSTALL_RPATH "@loader_path")
elseif(NOT WIN32) #ie. linux
set_target_properties(${TARGET_NAME} PROPERTIES INSTALL_RPATH "$ORIGIN")
endif()
set_target_properties(
${TARGET_NAME} PROPERTIES
PREFIX ""
OUTPUT_NAME ${MODULE_NAME}
LIBRARY_OUTPUT_DIRECTORY ${moduleOutputDir}
)
if(APPLE)
set_target_properties(${TARGET_NAME} PROPERTIES INSTALL_RPATH "@loader_path")
elseif(NOT WIN32) #ie. linux
set_target_properties(${TARGET_NAME} PROPERTIES INSTALL_RPATH "$ORIGIN")
endif()
if(WIN32)
set_target_properties(${TARGET_NAME} PROPERTIES SUFFIX ".pyd")
endif()
if(WIN32)
set_target_properties(${TARGET_NAME} PROPERTIES SUFFIX ".pyd")
endif()
target_include_directories(${TARGET_NAME} PUBLIC
${TARGET_INCLUDE_DIRS}
)
target_include_directories(${TARGET_NAME} PUBLIC ${targetIncludeDirs})
target_link_libraries(${TARGET_NAME}
${TARGET_LINK_LIBRARIES}
PySide6::pyside6
Shiboken6::libshiboken
)
target_compile_definitions(${TARGET_NAME}
PRIVATE Py_LIMITED_API=0x03050000
)
if(APPLE)
set_property(TARGET ${TARGET_NAME} APPEND PROPERTY
LINK_FLAGS "-undefined dynamic_lookup")
endif()
install(TARGETS ${TARGET_NAME}
LIBRARY DESTINATION ${${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX})
target_link_libraries(
${TARGET_NAME}
${targetLinkLibraries}
PySide6::pyside6
Shiboken6::libshiboken
)
target_compile_definitions(${TARGET_NAME} PRIVATE Py_LIMITED_API=0x03050000)
if(APPLE)
set_property(TARGET ${TARGET_NAME} APPEND PROPERTY LINK_FLAGS "-undefined dynamic_lookup")
endif()
install(
TARGETS ${TARGET_NAME}
LIBRARY DESTINATION ${${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX}
)
endmacro()

View File

@@ -33,9 +33,9 @@ if(NOT return_code EQUAL 0)
endif()
string(REPLACE "\n" ";" VARS_LIST ${ALL_VARS})
foreach(QVAL ${VARS_LIST})
if(QVAL MATCHES "QT_INSTALL_")
string(REPLACE ":" ";" QVAL_LIST ${QVAL})
foreach(qval ${VARS_LIST})
if(qval MATCHES "QT_INSTALL_")
string(REPLACE ":" ";" QVAL_LIST ${qval})
list(LENGTH QVAL_LIST listlen)
list(GET QVAL_LIST 0 var)
if(WIN32 AND ${listlen} GREATER 2)

View File

@@ -9,7 +9,8 @@
"C_Cpp.default.cStandard": "c17",
"files.trimTrailingWhitespace": true,
"editor.formatOnType": true,
"C_Cpp.autocompleteAddParentheses": true
"C_Cpp.autocompleteAddParentheses": true,
"cmake.copyCompileCommands": "${workspaceFolder}/compile_commands.json"
},
"launch": {
"version": "0.2.0",

View File

@@ -9,98 +9,51 @@
"C_Cpp.default.cStandard": "c17",
"files.trimTrailingWhitespace": true,
"editor.formatOnType": true,
"C_Cpp.autocompleteAddParentheses": true
"C_Cpp.autocompleteAddParentheses": true,
"cmake.copyCompileCommands": "${workspaceFolder}/compile_commands.json"
},
"launch": {
"version": "0.2.0",
"configurations": [
{
"name": "gdb-kddockwidgets_example",
"type": "cppdbg",
"name": "kddockwidgets_example",
"type": "lldb",
"request": "launch",
"program": "${workspaceFolder}/build-dev/bin/kddockwidgets_example",
"args": [],
"cwd": "${workspaceFolder}",
"MIMode": "gdb",
"stopAtEntry": false,
"externalConsole": false
"cwd": "${workspaceFolder}"
},
{
"name": "gdb-kddockwidgets_minimal_example",
"type": "cppdbg",
"name": "kddockwidgets_minimal_example",
"type": "lldb",
"request": "launch",
"program": "${workspaceFolder}/build-dev/bin/kddockwidgets_minimal_example",
"args": [],
"cwd": "${workspaceFolder}",
"MIMode": "gdb",
"stopAtEntry": false,
"externalConsole": false
"cwd": "${workspaceFolder}"
},
{
"name": "gdb-kddockwidgets_minimal_mdi_example",
"type": "cppdbg",
"name": "kddockwidgets_minimal_mdi_example",
"type": "lldb",
"request": "launch",
"program": "${workspaceFolder}/build-dev/bin/kddockwidgets_minimal_mdi_example",
"args": [],
"cwd": "${workspaceFolder}",
"MIMode": "gdb",
"stopAtEntry": false,
"externalConsole": false
"cwd": "${workspaceFolder}"
},
{
"name": "gdb-tst_docks",
"type": "cppdbg",
"name": "kddockwidgets_mdi_with_docking_example",
"type": "lldb",
"request": "launch",
"program": "${workspaceFolder}/build-dev/bin/kddockwidgets_mdi_with_docking_example",
"args": [],
"cwd": "${workspaceFolder}"
},
{
"name": "tst_docks",
"type": "lldb",
"request": "launch",
"program": "${workspaceFolder}/build-dev/bin/tst_docks",
"args": [],
"cwd": "${workspaceFolder}",
"MIMode": "gdb",
"stopAtEntry": false,
"externalConsole": false
},
{
"name": "lldb-kddockwidgets_example",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build-dev/bin/kddockwidgets_example",
"args": [],
"cwd": "${workspaceFolder}",
"MIMode": "lldb",
"stopAtEntry": false,
"externalConsole": false
},
{
"name": "lldb-kddockwidgets_minimal_example",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build-dev/bin/kddockwidgets_minimal_example",
"args": [],
"cwd": "${workspaceFolder}",
"MIMode": "lldb",
"stopAtEntry": false,
"externalConsole": false
},
{
"name": "lldb-kddockwidgets_minimal_mdi_example",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build-dev/bin/kddockwidgets_minimal_mdi_example",
"args": [],
"cwd": "${workspaceFolder}",
"MIMode": "lldb",
"stopAtEntry": false,
"externalConsole": false
},
{
"name": "lldb-tst_docks",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build-dev/bin/tst_docks",
"args": [],
"cwd": "${workspaceFolder}",
"MIMode": "lldb",
"stopAtEntry": false,
"externalConsole": false
"cwd": "${workspaceFolder}"
},
{
"name": "msvc-kddockwidgets_example",

View File

@@ -9,7 +9,8 @@
"C_Cpp.default.cStandard": "c17",
"files.trimTrailingWhitespace": true,
"editor.formatOnType": true,
"C_Cpp.autocompleteAddParentheses": true
"C_Cpp.autocompleteAddParentheses": true,
"cmake.copyCompileCommands": "${workspaceFolder}/compile_commands.json"
},
"launch": {
"version": "0.2.0",

View File

@@ -9,9 +9,10 @@
from conans import ConanFile, CMake, tools
class KDDockWidgetsConan(ConanFile):
name = "kddockwidgets"
version = "1.5.0"
version = "1.6.0"
default_user = "kdab"
default_channel = "stable"
license = ("https://raw.githubusercontent.com/KDAB/KDDockWidgets/master/LICENSES/GPL-2.0-only.txt",
@@ -20,7 +21,7 @@ class KDDockWidgetsConan(ConanFile):
url = "https://github.com/KDAB/KDDockWidgets"
description = "Advanced Dock Widget Framework for Qt"
generators = "cmake"
topics = ("qt", "dockwidget" , "kdab")
topics = ("qt", "dockwidget", "kdab")
settings = "os", "compiler", "build_type", "arch"
options = {
"qt_version": "ANY",
@@ -65,4 +66,5 @@ class KDDockWidgetsConan(ConanFile):
self.env_info.CMAKE_PREFIX_PATH.append(self.package_folder)
def package_id(self):
self.info.requires["qt"].minor_mode() # Check only the major and minor version!
# Check only the major and minor version!
self.info.requires["qt"].minor_mode()

View File

@@ -1,3 +1,9 @@
kddockwidgets (1.6.0) release candidate; urgency=high
* 1.6.0 final
-- Allen Winter <allen.winter@kdab.com> Wed, 14 Sep 2022 11:40:00 -0500
kddockwidgets (1.5.0) release candidate; urgency=high
* 1.5.0 final

View File

@@ -1,3 +1,4 @@
#!/usr/bin/make -f
DEB_CMAKE_EXTRA_FLAGS = -DCMAKE_BUILD_TYPE=Release
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/cmake.mk

View File

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

View File

@@ -1,5 +1,5 @@
Name: qt5-kddockwidgets
Version: 1.5.0
Version: 1.6.0
Release: 1
Summary: KDAB's Dock Widget Framework for Qt5
Source0: %{name}-%{version}.tar.gz
@@ -18,7 +18,7 @@ BuildRequires: libqt5-qtbase-devel libqt5-qtbase-private-headers-devel libqt5-q
%endif
%if %{defined fedora}
BuildRequires: gcc-c++ qt5-qtbase-devel qt5-qtbase-private-devel qt5-qtx11extras-devel desktop-file-utils
BuildRequires: gcc-c++ qt5-qtbase-devel qt5-qtbase-private-devel qt5-qtx11extras-devel desktop-file-utils util-linux
%endif
%if %{defined rhel}
@@ -98,6 +98,8 @@ cmake . -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release
%{_libdir}/libkddockwidgets.so
%changelog
* Wed Sep 14 2022 Allen Winter <allen.winter@kdab.com> 1.6.0
1.6.0 final
* 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

View File

@@ -1,10 +1,10 @@
Format: 1.0
Source: kddockwidgets
Version: 1.5.0-1
Version: 1.6.0-1
Binary: kddockwidgets
Maintainer: Allen Winter <allen.winter@kdab.com>
Architecture: any
Build-Depends: debhelper (>=9), cdbs, cmake, qtbase6-dev, qtbase6-private-dev, libqt6x11extras5-dev, libfontconfig-dev
Build-Depends: debhelper (>=9), cdbs, cmake, qt6-base-dev, qt6-base-private-dev, libgl1-mesa-dev, libfontconfig-dev, libfreetype-dev
Files:
00000000000000000000000000000000 00000 qt6-kddockwidgets-1.5.0.tar.gz
00000000000000000000000000000000 00000 qt6-kddockwidgets-1.6.0.tar.gz

View File

@@ -1,5 +1,5 @@
Name: qt6-kddockwidgets
Version: 1.5.0
Version: 1.6.0
Release: 1
Summary: KDAB's Dock Widget Framework for Qt6
Source0: %{name}-%{version}.tar.gz
@@ -18,7 +18,7 @@ BuildRequires: libqt6-qtbase-devel libqt6-qtbase-private-headers-devel libqt6-q
%endif
%if %{defined fedora}
BuildRequires: gcc-c++ qt6-qtbase-devel qt6-qtbase-private-devel desktop-file-utils libxkbcommon-devel
BuildRequires: gcc-c++ qt6-qtbase-devel qt6-qtbase-private-devel desktop-file-utils libxkbcommon-devel util-linux
%endif
%if %{defined rhel}
@@ -79,14 +79,21 @@ cmake . -DCMAKE_INSTALL_PREFIX=/usr -DKDDockWidgets_QT6=True -DCMAKE_BUILD_TYPE=
%files devel
%defattr(-,root,root,-)
%if 0%{?fedora} > 35
%{_libdir}/qt6/mkspecs/modules/*
%endif
#%dir %{_prefix}/share/mkspecs
#%dir %{_prefix}/share/mkspecs/features
#%{_prefix}/share/mkspecs/features/kddockwidgets.prf
%dir %{_includedir}/kddockwidgets-qt6
%{_includedir}/kddockwidgets-qt6/kddockwidgets/*
%dir %{_libdir}/cmake/KDDockWidgets-qt6
%{_libdir}/cmake/KDDockWidgets-qt6/*
%{_libdir}/libkddockwidgets-qt6.so
#%{_prefix}/mkspecs/modules/* ECMGeneratePriFile isn't ported to Qt6 yet
%changelog
* Wed Sep 14 2022 Allen Winter <allen.winter@kdab.com> 1.6.0
1.6.0 final
* 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

42
docker/pyside2/Dockerfile Normal file
View File

@@ -0,0 +1,42 @@
#
# This file is part of KDDockWidgets.
#
# SPDX-FileCopyrightText: 2019-2022 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.
# The purpose of this Dockerfile is just for quickly getting a running python build for testing.
# Instructions:
# $ docker build -t kddw-pyside2 .
# $ docker run -it -v ~/Qt/5.15.2/gcc_64/:/Qt/ -v /tmp/.X11-unix:/tmp/.X11-unix kddw-pyside2
# git checkout 1.6
# cmake --preset=python -G Ninja . && cd build-python/ && ninja
# Test with:
# cd ../python/examples && rcc -g python -o rc_assets.py ../../examples/dockwidgets/resources_example.qrc
# python3 main.py
FROM ubuntu:22.04
MAINTAINER Sergio Martins (sergio.martins@kdab.com)
ENV TZ=Europe/Berlin
ENV LC_CTYPE=C.UTF-8
ENV DISPLAY=:0
ENV PATH=$PATH:/Qt/bin/
ENV LD_LIBRARY_PATH=/Qt/lib/
ENV PYTHONPATH=/KDDockWidgets/build-python/python/
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt update
RUN apt install build-essential software-properties-common git ninja-build libssl-dev mesa-common-dev libglu1-mesa-dev libglib2.0-dev libfontconfig libxkbcommon-x11-0 libdbus-1-3 cmake pip libxslt1-dev llvm-dev clang libxcb-keysyms1 libxcb-image0 libxcb-icccm4 libxcb-xinerama0 libxcb-shape0 libxcb-render-util0 -y
RUN pip3 install --index-url=http://download.qt.io/official_releases/QtForPython/ --trusted-host download.qt.io shiboken2 pyside2 shiboken2_generator
WORKDIR /
RUN git clone https://github.com/KDAB/KDDockWidgets.git
WORKDIR /KDDockWidgets/

View File

@@ -11,13 +11,14 @@
# Doxygen
find_package(Doxygen)
set_package_properties(Doxygen PROPERTIES
TYPE OPTIONAL
DESCRIPTION "API Documentation system"
URL "https://www.doxygen.org"
PURPOSE "Needed to build the API documentation."
set_package_properties(
Doxygen PROPERTIES
TYPE OPTIONAL
DESCRIPTION "API Documentation system"
URL "https://www.doxygen.org"
PURPOSE "Needed to build the API documentation."
)
if(DOXYGEN_FOUND)
add_subdirectory(api)
add_subdirectory(api)
endif()

View File

@@ -11,61 +11,73 @@
# dot should come with Doxygen find_package(Doxygen)
if(DOXYGEN_DOT_EXECUTABLE)
set(HAVE_DOT "YES")
set(HAVE_DOT "YES")
else()
set(HAVE_DOT "NO")
message(STATUS "Unable to provide inheritance diagrams for the API documentation. To fix, install the graphviz project from https://www.graphviz.org")
set(HAVE_DOT "NO")
message(STATUS "Unable to provide inheritance diagrams for the API documentation. "
"To fix, install the graphviz project from https://www.graphviz.org"
)
endif()
# qhelpgenerator
find_program(QHELPGEN_EXECUTABLE qhelpgenerator
HINTS ${QT_INSTALL_BINS}
)
find_program(QHELPGEN_EXECUTABLE qhelpgenerator HINTS ${QT_INSTALL_BINS})
if(QHELPGEN_EXECUTABLE)
set(HAVE_QHELPGEN "YES")
set(HAVE_QHELPGEN "YES")
else()
set(HAVE_QHELPGEN "NO")
message(STATUS "Unable to generate the API documentation in qch format. To fix, install the qthelpgenerator program which comes with Qt.")
set(HAVE_QHELPGEN "NO")
message(STATUS "Unable to generate the API documentation in qch format. "
"To fix, install the qthelpgenerator program which comes with Qt."
)
endif()
find_file(QDOC_QTCORE_TAG qtcore.tags
HINTS ${QT_INSTALL_DOCS}/qtcore
HINTS ${QT_INSTALL_DATA}/doc/qtcore
)
find_file(QDOC_QTCORE_TAG qtcore.tags HINTS ${QT_INSTALL_DOCS}/qtcore ${QT_INSTALL_DATA}/doc/qtcore)
set(QDOC_TAG_DIR "<QDOC_TAG_DIR_not_found>")
if(QDOC_QTCORE_TAG)
get_filename_component(QDOC_TAG_DIR ${QDOC_QTCORE_TAG} DIRECTORY)
get_filename_component(QDOC_TAG_DIR ${QDOC_TAG_DIR} DIRECTORY)
get_filename_component(QDOC_TAG_DIR ${QDOC_QTCORE_TAG} DIRECTORY)
get_filename_component(QDOC_TAG_DIR ${QDOC_TAG_DIR} DIRECTORY)
endif()
file(GLOB _dox_deps *.dox *.html)
set(DOXYGEN_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR})
#apidox generation using doxygen
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.cmake
${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.cmake ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
add_custom_command(
OUTPUT ${DOXYGEN_OUTPUT_DIR}/qch/kddockwidgets-api.qch
COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
#handle a bug in doxygen where image files referred to in markdown are not copied the output
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/../../screencap.gif ${DOXYGEN_OUTPUT_DIR}/html
#copy some files by-hand that are referred to by the markdown README
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/README-bindings.md ${DOXYGEN_OUTPUT_DIR}/html
COMMAND ${CMAKE_COMMAND} -E make_directory ${DOXYGEN_OUTPUT_DIR}/html/LICENSES
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/LICENSES/GPL-2.0-only.txt ${DOXYGEN_OUTPUT_DIR}/html/LICENSES
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/LICENSES/GPL-3.0-only.txt ${DOXYGEN_OUTPUT_DIR}/html/LICENSES
COMMAND ${CMAKE_COMMAND} -E make_directory ${DOXYGEN_OUTPUT_DIR}/html/docs
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/docs/KDDockWidgets-CopyrightAssignmentForm.pdf ${DOXYGEN_OUTPUT_DIR}/html/docs
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/examples ${DOXYGEN_OUTPUT_DIR}/html/examples
DEPENDS ${_dox_deps} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
OUTPUT ${DOXYGEN_OUTPUT_DIR}/qch/kddockwidgets-api.qch
COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
#handle a bug in doxygen where image files referred to in markdown are not copied the output
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/../../screencap.gif
${DOXYGEN_OUTPUT_DIR}/html
#copy some files by-hand that are referred to by the markdown README
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/README-bindings.md ${DOXYGEN_OUTPUT_DIR}/html
COMMAND ${CMAKE_COMMAND} -E make_directory ${DOXYGEN_OUTPUT_DIR}/html/LICENSES
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/LICENSES/GPL-2.0-only.txt
${DOXYGEN_OUTPUT_DIR}/html/LICENSES
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/LICENSES/GPL-3.0-only.txt
${DOXYGEN_OUTPUT_DIR}/html/LICENSES
COMMAND ${CMAKE_COMMAND} -E make_directory ${DOXYGEN_OUTPUT_DIR}/html/docs
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/docs/KDDockWidgets-CopyrightAssignmentForm.pdf
${DOXYGEN_OUTPUT_DIR}/html/docs
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/examples ${DOXYGEN_OUTPUT_DIR}/html/examples
DEPENDS ${_dox_deps} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMENT "Generate the .qch file"
)
add_custom_target(
kddockwidgets-api.qch ALL
DEPENDS ${DOXYGEN_OUTPUT_DIR}/qch/kddockwidgets-api.qch
COMMENT "Target generate the .qch file"
)
add_custom_target(
docs
DEPENDS kddockwidgets-api.qch
COMMENT "Target to generate the documentation"
)
add_custom_target(kddockwidgets-api.qch ALL DEPENDS ${DOXYGEN_OUTPUT_DIR}/qch/kddockwidgets-api.qch)
add_custom_target(docs DEPENDS kddockwidgets-api.qch)
set(QCH_INSTALL_DIR ${INSTALL_DOC_DIR} CACHE STRING "Install location of Qt Assistant help files.")
set(QCH_INSTALL_DIR
${INSTALL_DOC_DIR}
CACHE STRING "Install location of Qt Assistant help files."
)
install(FILES ${DOXYGEN_OUTPUT_DIR}/qch/kddockwidgets-api.qch DESTINATION ${QCH_INSTALL_DIR})
install(FILES ${DOXYGEN_OUTPUT_DIR}/kddockwidgets.tags DESTINATION ${INSTALL_DOC_DIR})

View File

@@ -876,7 +876,8 @@ FILE_PATTERNS = *.cpp \
*.h \
*.dox \
*.md \
*.gif
*.gif \
*.png
# The RECURSIVE tag can be used to specify whether or not subdirectories should
# be searched for input files as well.
@@ -1102,38 +1103,6 @@ USE_HTAGS = NO
VERBATIM_HEADERS = YES
# If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the
# clang parser (see: http://clang.llvm.org/) for more accurate parsing at the
# cost of reduced performance. This can be particularly helpful with template
# rich C++ code for which doxygen's built-in parser lacks the necessary type
# information.
# Note: The availability of this option depends on whether or not doxygen was
# generated with the -Duse_libclang=ON option for CMake.
# The default value is: NO.
CLANG_ASSISTED_PARSING = NO
# If clang assisted parsing is enabled you can provide the compiler with command
# line options that you would normally use when invoking the compiler. Note that
# the include paths will already be set by doxygen for the files and directories
# specified with INPUT and INCLUDE_PATH.
# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES.
CLANG_OPTIONS =
# If clang assisted parsing is enabled you can provide the clang parser with the
# path to the directory containing a file called compile_commands.json. This
# file is the compilation database (see:
# http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html) containing the
# options used when the source files were built. This is equivalent to
# specifying the "-p" option to a clang tool, such as clang-check. These options
# will then be passed to the parser. Any options specified with CLANG_OPTIONS
# will be added as well.
# Note: The availability of this option depends on whether or not doxygen was
# generated with the -Duse_libclang=ON option for CMake.
CLANG_DATABASE_PATH =
#---------------------------------------------------------------------------
# Configuration options related to the alphabetical class index
#---------------------------------------------------------------------------

View File

@@ -17,23 +17,15 @@ 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)
# This will look for Qt, do find_package yourself manually before
# if you want to look for a specific Qt version for instance.
find_package(KDDockWidgets REQUIRED)
endif()
set(RESOURCES_EXAMPLE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/resources_example.qrc)
add_executable(kddockwidgets_example
main.cpp
MyFrameworkWidgetFactory.cpp
MyMainWindow.cpp
MyWidget.cpp
${RESOURCES_EXAMPLE_SRC}
)
target_link_libraries(kddockwidgets_example
PRIVATE
KDAB::kddockwidgets
add_executable(
kddockwidgets_example main.cpp MyFrameworkWidgetFactory.cpp MyMainWindow.cpp MyWidget.cpp ${RESOURCES_EXAMPLE_SRC}
)
target_link_libraries(kddockwidgets_example PRIVATE KDAB::kddockwidgets)

View File

@@ -62,7 +62,7 @@ public:
f.setPixelSize(30);
f.setBold(true);
p.setFont(f);
p.drawText(QPoint(10,40), title());
p.drawText(QPoint(10, 40), title());
}
};
@@ -88,19 +88,19 @@ public:
MySeparator::~MySeparator() = default;
KDDockWidgets::TitleBar * CustomWidgetFactory::createTitleBar(KDDockWidgets::Frame *frame) const
KDDockWidgets::TitleBar *CustomWidgetFactory::createTitleBar(KDDockWidgets::Frame *frame) const
{
// Feel free to return MyTitleBar_CSS here instead, but just for education purposes!
return new MyTitleBar(frame);
}
KDDockWidgets::TitleBar * CustomWidgetFactory::createTitleBar(KDDockWidgets::FloatingWindow *fw) const
KDDockWidgets::TitleBar *CustomWidgetFactory::createTitleBar(KDDockWidgets::FloatingWindow *fw) const
{
// Feel free to return MyTitleBar_CSS here instead, but just for education purposes!
return new MyTitleBar(fw);
}
Layouting::Separator * CustomWidgetFactory::createSeparator(Layouting::Widget *parent) const
Layouting::Separator *CustomWidgetFactory::createSeparator(Layouting::Widget *parent) const
{
return new MySeparator(parent);
}

View File

@@ -47,6 +47,7 @@ static MyWidget *newMyWidget()
MyMainWindow::MyMainWindow(const QString &uniqueName, KDDockWidgets::MainWindowOptions options,
bool dockWidget0IsNonClosable, bool nonDockableDockWidget9, bool restoreIsRelative,
bool maxSizeForDockWidget8, bool dockwidget5DoesntCloseBeforeRestore,
bool dock0BlocksCloseEvent,
const QString &affinityName, QWidget *parent)
: MainWindow(uniqueName, options, parent)
, m_dockWidget0IsNonClosable(dockWidget0IsNonClosable)
@@ -54,6 +55,7 @@ MyMainWindow::MyMainWindow(const QString &uniqueName, KDDockWidgets::MainWindowO
, m_restoreIsRelative(restoreIsRelative)
, m_maxSizeForDockWidget8(maxSizeForDockWidget8)
, m_dockwidget5DoesntCloseBeforeRestore(dockwidget5DoesntCloseBeforeRestore)
, m_dock0BlocksCloseEvent(dock0BlocksCloseEvent)
{
auto menubar = menuBar();
auto fileMenu = new QMenu(QStringLiteral("File"), this);
@@ -190,6 +192,9 @@ KDDockWidgets::DockWidgetBase *MyMainWindow::newDockWidget()
myWidget->setMaximumSize(200, 200);
}
if (count == 0 && m_dock0BlocksCloseEvent)
myWidget->blockCloseEvent();
dock->setWidget(myWidget);
if (dock->options() & KDDockWidgets::DockWidget::Option_NotDockable) {

View File

@@ -20,19 +20,20 @@ class MyMainWindow : public KDDockWidgets::MainWindow
public:
explicit MyMainWindow(const QString &uniqueName, KDDockWidgets::MainWindowOptions options,
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.
QWidget *parent = nullptr);
~MyMainWindow() override;
private:
void createDockWidgets();
KDDockWidgets::DockWidgetBase* newDockWidget();
KDDockWidgets::DockWidgetBase *newDockWidget();
QMenu *m_toggleMenu = nullptr;
const bool m_dockWidget0IsNonClosable;
const bool m_dockWidget9IsNonDockable;
const bool m_restoreIsRelative;
const bool m_maxSizeForDockWidget8;
const bool m_dockwidget5DoesntCloseBeforeRestore;
const bool m_dock0BlocksCloseEvent;
KDDockWidgets::DockWidget::List m_dockwidgets;
};

View File

@@ -15,6 +15,7 @@
#include <QDebug>
#include <QFile>
#include <QLineEdit>
#include <QCloseEvent>
static QHash<QString, QImage> s_images; /// clazy:exclude=non-pod-global-static
@@ -65,11 +66,25 @@ void MyWidget::drawLogo(QPainter &p)
: int(maxHeight / ratio);
const int height = int(width * ratio);
QRect targetLogoRect(0,0, width, height);
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());
}
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)
: MyWidget(QStringLiteral(":/assets/triangles.png"), QStringLiteral(":/assets/KDAB_bubble_white.png"), parent)
{

View File

@@ -26,10 +26,16 @@ class MyWidget : public QWidget
public:
explicit MyWidget(const QString &backgroundFile, const QString &logoFile, QWidget *parent = nullptr);
~MyWidget();
// These two are just for demonstrating how to block the close event, if desired
void blockCloseEvent();
void closeEvent(QCloseEvent *) override;
protected:
void drawLogo(QPainter &);
QImage m_background;
QImage m_logo;
bool m_blocksCloseEvent = false;
};
class MyWidget1 : public MyWidget
@@ -37,8 +43,9 @@ class MyWidget1 : public MyWidget
Q_OBJECT
public:
explicit MyWidget1(QWidget *parent = nullptr);
protected:
void paintEvent(QPaintEvent*) override;
void paintEvent(QPaintEvent *) override;
};
class MyWidget2 : public MyWidget
@@ -46,8 +53,9 @@ class MyWidget2 : public MyWidget
Q_OBJECT
public:
explicit MyWidget2(QWidget *parent = nullptr);
protected:
void paintEvent(QPaintEvent*) override;
void paintEvent(QPaintEvent *) override;
};
class MyWidget3 : public MyWidget
@@ -55,8 +63,9 @@ class MyWidget3 : public MyWidget
Q_OBJECT
public:
explicit MyWidget3(QWidget *parent = nullptr);
protected:
void paintEvent(QPaintEvent*) override;
void paintEvent(QPaintEvent *) override;
QImage m_triangle;
};

View File

@@ -13,6 +13,7 @@
#include "MyMainWindow.h"
#include "MyFrameworkWidgetFactory.h"
#include <algorithm>
#include <kddockwidgets/Config.h>
#include <QStyleFactory>
@@ -115,10 +116,14 @@ int main(int argc, char **argv)
QCoreApplication::translate("main", "The title bar's close button will only close the current tab instead of all. Illustrates using Config::Flag_CloseOnlyCurrentTab"));
parser.addOption(closeOnlyCurrentTab);
QCommandLineOption dontCloseBeforeRestore("dont-close-widget-before-restore", //krazy:exclude=spelling
QCommandLineOption dontCloseBeforeRestore("dont-close-widget-before-restore", // krazy:exclude=spelling
QCoreApplication::translate("main", "DockWidget #5 won't be closed before a restore. Illustrates LayoutSaverOption::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",
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);
@@ -131,6 +136,10 @@ int main(int argc, char **argv)
QCoreApplication::translate("main", "Allow switching tabs via context menu in tabs area"));
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)
parser.addOption(centralFrame);
@@ -144,10 +153,10 @@ int main(int argc, char **argv)
parser.addOption(nativeTitleBar);
parser.addOption(noDropIndicators);
# if defined(Q_OS_WIN)
#if defined(Q_OS_WIN)
QCommandLineOption noAeroSnap("no-aero-snap", QCoreApplication::translate("main", "(internal) Disable AeroSnap"));
parser.addOption(noAeroSnap);
# endif
#endif
#else
Q_UNUSED(centralFrame)
#endif
@@ -190,10 +199,10 @@ int main(int argc, char **argv)
if (parser.isSet(noDropIndicators))
KDDockWidgets::DefaultWidgetFactory::s_dropIndicatorType = KDDockWidgets::DropIndicatorType::None;
# if defined(Q_OS_WIN)
#if defined(Q_OS_WIN)
if (parser.isSet(noAeroSnap))
internalFlags |= KDDockWidgets::Config::InternalFlag_NoAeroSnap;
# endif
#endif
Config::self().setInternalFlags(internalFlags);
#endif
@@ -253,6 +262,26 @@ int main(int argc, char **argv)
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 outer areasa
auto func = [](KDDockWidgets::DropLocation location,
const KDDockWidgets::DockWidgetBase::List &source,
const KDDockWidgets::DockWidgetBase::List &target,
KDDockWidgets::DropArea *) {
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);
const bool nonClosableDockWidget0 = parser.isSet(nonClosableDockWidget);
@@ -261,6 +290,7 @@ int main(int argc, char **argv)
const bool maxSizeForDockWidget8 = parser.isSet(maxSizeOption);
const bool dontCloseDockWidget5BeforeRestore = parser.isSet(dontCloseBeforeRestore);
const bool usesMainWindowsWithAffinity = parser.isSet(multipleMainWindows);
const bool dock0BlocksCloseEvent = parser.isSet(blockCloseEvent);
#ifdef KDDOCKWIDGETS_SUPPORTS_NESTED_MAINWINDOWS
const bool usesDockableMainWindows = parser.isSet(dockableMainWindows);
@@ -270,7 +300,7 @@ int main(int argc, char **argv)
MyMainWindow mainWindow(QStringLiteral("MyMainWindow"), options, nonClosableDockWidget0,
nonDockableDockWidget9, restoreIsRelative, maxSizeForDockWidget8,
dontCloseDockWidget5BeforeRestore);
dontCloseDockWidget5BeforeRestore, dock0BlocksCloseEvent);
mainWindow.setWindowTitle("Main Window 1");
mainWindow.resize(1200, 1200);
mainWindow.show();
@@ -289,7 +319,7 @@ int main(int argc, char **argv)
auto mainWindow2 = new MyMainWindow(QStringLiteral("MyMainWindow-2"), options,
nonClosableDockWidget0, nonDockableDockWidget9,
restoreIsRelative, maxSizeForDockWidget8,
dontCloseDockWidget5BeforeRestore, affinity);
dontCloseDockWidget5BeforeRestore, dock0BlocksCloseEvent, affinity);
if (affinity.isEmpty())
mainWindow2->setWindowTitle("Main Window 2");
else
@@ -303,7 +333,7 @@ int main(int argc, char **argv)
const QString affinity = QStringLiteral("Inner-DockWidgets-2");
auto dockableMainWindow = new MyMainWindow(QStringLiteral("MyMainWindow-2"), options,
false, false, restoreIsRelative, false,
false, affinity);
false, false, affinity);
dockableMainWindow->setAffinities({ affinity });

View File

@@ -0,0 +1,32 @@
#
# This file is part of KDDockWidgets.
#
# SPDX-FileCopyrightText: 2019-2022 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-2022 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

@@ -17,21 +17,16 @@ 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)
# 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)
add_executable(kddockwidgets_minimal_mdi_example
main.cpp
../dockwidgets/MyWidget.cpp
${RESOURCES_EXAMPLE_SRC}
)
# Just to reuse MyWidget.h
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../dockwidgets/)
target_link_libraries(kddockwidgets_minimal_mdi_example
PRIVATE
KDAB::kddockwidgets
)
add_executable(kddockwidgets_minimal_mdi_example main.cpp ../dockwidgets/MyWidget.cpp ${RESOURCES_EXAMPLE_SRC})
target_link_libraries(kddockwidgets_minimal_mdi_example PRIVATE KDAB::kddockwidgets)

View File

@@ -1,116 +0,0 @@
/*
This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2019-2022 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-2022 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

@@ -53,6 +53,9 @@ int main(int argc, char **argv)
auto widget3 = new MyWidget3();
dock3->setWidget(widget3);
// Just for my personal testing: Overkill to add an option
// widget3->blockCloseEvent();
// # 3. Dock them
mainWindow.addDockWidget(dock1, QPoint(10, 10));
mainWindow.addDockWidget(dock2, QPoint(50, 50));

View File

@@ -17,21 +17,13 @@ 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)
# 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)
add_executable(kddockwidgets_minimal_example
main.cpp
../dockwidgets/MyWidget.cpp
${RESOURCES_EXAMPLE_SRC}
)
target_link_libraries(kddockwidgets_minimal_example
PRIVATE
KDAB::kddockwidgets
)
add_executable(kddockwidgets_minimal_example main.cpp ../dockwidgets/MyWidget.cpp ${RESOURCES_EXAMPLE_SRC})
target_link_libraries(kddockwidgets_minimal_example PRIVATE KDAB::kddockwidgets)

View File

@@ -65,7 +65,7 @@ void MyWidget::drawLogo(QPainter &p)
: int(maxHeight / ratio);
const int height = int(width * ratio);
QRect targetLogoRect(0,0, width, height);
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());
}

View File

@@ -27,6 +27,7 @@ public:
MyWidget() = default;
explicit MyWidget(const QString &backgroundFile, const QString &logoFile, QWidget *parent = nullptr);
~MyWidget();
protected:
void drawLogo(QPainter &);
QImage m_background;
@@ -38,8 +39,9 @@ class MyWidget1 : public MyWidget
Q_OBJECT
public:
explicit MyWidget1(QWidget *parent = nullptr);
protected:
void paintEvent(QPaintEvent*) override;
void paintEvent(QPaintEvent *) override;
};
class MyWidget2 : public MyWidget
@@ -47,8 +49,9 @@ class MyWidget2 : public MyWidget
Q_OBJECT
public:
explicit MyWidget2(QWidget *parent = nullptr);
protected:
void paintEvent(QPaintEvent*) override;
void paintEvent(QPaintEvent *) override;
};
class MyWidget3 : public MyWidget
@@ -56,8 +59,9 @@ class MyWidget3 : public MyWidget
Q_OBJECT
public:
explicit MyWidget3(QWidget *parent = nullptr);
protected:
void paintEvent(QPaintEvent*) override;
void paintEvent(QPaintEvent *) override;
QImage m_triangle;
};

View File

@@ -75,7 +75,7 @@ int main(int argc, char **argv)
mainWindow.addDockWidget(dock3, KDDockWidgets::Location_OnRight, dock2);
// 5. dock4 is docked at the bottom, with 200px height
const QSize preferredSize(QSize(/*ignored*/0, 200));
const QSize preferredSize(QSize(/*ignored*/ 0, 200));
mainWindow.addDockWidget(dock4, KDDockWidgets::Location_OnBottom, nullptr, preferredSize);

View File

@@ -17,21 +17,15 @@ 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)
# This will look for Qt, do find_package yourself manually before
# if you want to look for a specific Qt version for instance.
find_package(KDDockWidgets REQUIRED)
endif()
set(RESOURCES_EXAMPLE_SRC
${CMAKE_CURRENT_SOURCE_DIR}/resources_qtquick_example.qrc
${CMAKE_CURRENT_SOURCE_DIR}/../../dockwidgets/resources_example.qrc)
add_executable(kddockwidgets_customtitlebar_quick
main.cpp
${RESOURCES_EXAMPLE_SRC}
set(RESOURCES_EXAMPLE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/resources_qtquick_example.qrc
${CMAKE_CURRENT_SOURCE_DIR}/../../dockwidgets/resources_example.qrc
)
target_link_libraries(kddockwidgets_customtitlebar_quick
PRIVATE
KDAB::kddockwidgets
)
add_executable(kddockwidgets_customtitlebar_quick main.cpp ${RESOURCES_EXAMPLE_SRC})
target_link_libraries(kddockwidgets_customtitlebar_quick PRIVATE KDAB::kddockwidgets)

View File

@@ -22,7 +22,6 @@
class CustomFrameworkWidgetFactory : public KDDockWidgets::DefaultWidgetFactory
{
public:
~CustomFrameworkWidgetFactory() override;
QUrl titleBarFilename() const override

View File

@@ -17,21 +17,15 @@ 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)
# This will look for Qt, do find_package yourself manually before
# if you want to look for a specific Qt version for instance.
find_package(KDDockWidgets REQUIRED)
endif()
set(RESOURCES_EXAMPLE_SRC
${CMAKE_CURRENT_SOURCE_DIR}/resources_qtquick_example.qrc
${CMAKE_CURRENT_SOURCE_DIR}/../../dockwidgets/resources_example.qrc)
add_executable(kddockwidgets_example_quick
main.cpp
${RESOURCES_EXAMPLE_SRC}
set(RESOURCES_EXAMPLE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/resources_qtquick_example.qrc
${CMAKE_CURRENT_SOURCE_DIR}/../../dockwidgets/resources_example.qrc
)
target_link_libraries(kddockwidgets_example_quick
PRIVATE
KDAB::kddockwidgets
)
add_executable(kddockwidgets_example_quick main.cpp ${RESOURCES_EXAMPLE_SRC})
target_link_libraries(kddockwidgets_example_quick PRIVATE KDAB::kddockwidgets)

View File

@@ -45,10 +45,10 @@ int main(int argc, char *argv[])
parser.addOption(nativeTitleBar);
parser.addOption(noDropIndicators);
# if defined(Q_OS_WIN)
#if defined(Q_OS_WIN)
QCommandLineOption noAeroSnap("no-aero-snap", QCoreApplication::translate("main", "(internal) Disable AeroSnap"));
parser.addOption(noAeroSnap);
# endif
#endif
#endif
auto flags = KDDockWidgets::Config::self().flags();
@@ -68,10 +68,10 @@ int main(int argc, char *argv[])
else if (parser.isSet(noDropIndicators))
KDDockWidgets::DefaultWidgetFactory::s_dropIndicatorType = KDDockWidgets::DropIndicatorType::None;
# if defined(Q_OS_WIN)
#if defined(Q_OS_WIN)
if (parser.isSet(noAeroSnap))
internalFlags |= KDDockWidgets::Config::InternalFlag_NoAeroSnap;
# endif
#endif
// These are debug-only/development flags, which you can ignore.
KDDockWidgets::Config::self().setInternalFlags(internalFlags);

View File

@@ -17,21 +17,15 @@ 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)
# This will look for Qt, do find_package yourself manually before
# if you want to look for a specific Qt version for instance.
find_package(KDDockWidgets REQUIRED)
endif()
set(RESOURCES_EXAMPLE_SRC
${CMAKE_CURRENT_SOURCE_DIR}/resources_qtquick_mdi_example.qrc
${CMAKE_CURRENT_SOURCE_DIR}/../../dockwidgets/resources_example.qrc)
add_executable(kddockwidgets_example_mdi_quick
main.cpp
${RESOURCES_EXAMPLE_SRC}
set(RESOURCES_EXAMPLE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/resources_qtquick_mdi_example.qrc
${CMAKE_CURRENT_SOURCE_DIR}/../../dockwidgets/resources_example.qrc
)
target_link_libraries(kddockwidgets_example_mdi_quick
PRIVATE
KDAB::kddockwidgets
)
add_executable(kddockwidgets_example_mdi_quick main.cpp ${RESOURCES_EXAMPLE_SRC})
target_link_libraries(kddockwidgets_example_mdi_quick PRIVATE KDAB::kddockwidgets)

View File

@@ -48,7 +48,7 @@ int main(int argc, char *argv[])
auto dw3 = new KDDockWidgets::DockWidgetQuick("Dock #3");
dw3->setWidget(QStringLiteral("qrc:/Guest3.qml"));
auto mainWindow = static_cast<KDDockWidgets::MainWindowMDI*>(KDDockWidgets::DockRegistry::self()->mainwindows().constFirst());
auto mainWindow = static_cast<KDDockWidgets::MainWindowMDI *>(KDDockWidgets::DockRegistry::self()->mainwindows().constFirst());
mainWindow->addDockWidget(dw1, QPoint(10, 10));
mainWindow->addDockWidget(dw2, QPoint(50, 50));

View File

@@ -12,19 +12,19 @@ set(PYTHON_BINDING_NAMESPACE "PyKDDockWidgets")
# Just to fix warnings with --warn-uninitialized
if(NOT DEFINED SHIBOKEN_CUSTOM_PREFIX) #look for shiboken in a custom location
set(SHIBOKEN_CUSTOM_PREFIX "")
set(SHIBOKEN_CUSTOM_PREFIX "")
endif()
if(NOT DEFINED PYSIDE_CUSTOM_PREFIX) #look for pyside in a custom location
set(PYSIDE_CUSTOM_PREFIX "")
set(PYSIDE_CUSTOM_PREFIX "")
endif()
if(${PROJECT_NAME}_QT6)
set(PYSIDE_MAJOR_VERSION "6")
set(PYTHON_BINDING_NAMESPACE "${PYTHON_BINDING_NAMESPACE}Qt${PYSIDE_MAJOR_VERSION}")
set(QtWidgets_VERSION ${Qt6Widgets_VERSION})
set(PYSIDE_MAJOR_VERSION "6")
set(PYTHON_BINDING_NAMESPACE "${PYTHON_BINDING_NAMESPACE}Qt${PYSIDE_MAJOR_VERSION}")
set(QtWidgets_VERSION ${Qt6Widgets_VERSION})
else()
set(PYSIDE_MAJOR_VERSION "2")
set(QtWidgets_VERSION ${Qt5Widgets_VERSION})
set(PYSIDE_MAJOR_VERSION "2")
set(QtWidgets_VERSION ${Qt5Widgets_VERSION})
endif()
find_package(Python3 3.7 REQUIRED COMPONENTS Interpreter Development)
@@ -32,13 +32,14 @@ find_package(Shiboken${PYSIDE_MAJOR_VERSION} REQUIRED)
find_package(PySide${PYSIDE_MAJOR_VERSION} ${QtWidgets_VERSION} EXACT REQUIRED)
if(NOT ${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX)
set(${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
set(${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
endif()
set(BINDINGS_DIR "${INSTALL_LIBRARY_DIR}/python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}/site-packages/${PYTHON_BINDING_NAMESPACE}")
set(Python3_VERSION_MAJORMINOR "${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}")
set(BINDINGS_DIR "${INSTALL_LIBRARY_DIR}/python${Python3_VERSION_MAJORMINOR}/site-packages/${PYTHON_BINDING_NAMESPACE}")
set(${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX "${${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX}/${BINDINGS_DIR}")
include(PySide${PYSIDE_MAJOR_VERSION}ModuleBuild)
include(KDPySide${PYSIDE_MAJOR_VERSION}ModuleBuild)
add_subdirectory(PyKDDockWidgets)
if(${PROJECT_NAME}_TESTS)
add_subdirectory(tests)
add_subdirectory(tests)
endif()

View File

@@ -35,65 +35,47 @@ set(PyKDDockWidgets_include_paths
)
# A list of paths where shiboken should look for typesystem
set(PyKDDockWidgets_typesystem_paths
# PySide path, this variable was exposed by FindPySide2.cmake
set(PyKDDockWidgets_typesystem_paths # PySide path, this variable was exposed by FindPySide2.cmake
${PYSIDE_TYPESYSTEMS}
)
# Include flags/path that will be set in 'target_include_directories'
set(PyKDDockWidgets_target_include_directories
${CMAKE_SOURCE_DIR}/src
)
set(PyKDDockWidgets_target_include_directories ${CMAKE_SOURCE_DIR}/src)
# Libraries that will be necessary to link the target, this will used in the command 'target_link_libraries'
set(PyKDDockWidgets_target_link_libraries
KDAB::kddockwidgets
Qt${Qt_VERSION_MAJOR}::Core
Qt${Qt_VERSION_MAJOR}::Gui
Qt${Qt_VERSION_MAJOR}::Widgets
${Python3_LIBRARIES}
set(PyKDDockWidgets_target_link_libraries KDAB::kddockwidgets Qt${Qt_VERSION_MAJOR}::Core Qt${Qt_VERSION_MAJOR}::Gui
Qt${Qt_VERSION_MAJOR}::Widgets ${Python3_LIBRARIES}
)
# changes on these files should trigger a new generation
set(PyKDDockWidgets_DEPENDS
${CMAKE_CURRENT_SOURCE_DIR}/kddockwidgets_global.h
${CMAKE_SOURCE_DIR}/src/DockWidgetBase.h
${CMAKE_SOURCE_DIR}/src/DockWidget.h
${CMAKE_SOURCE_DIR}/src/MainWindowBase.h
${CMAKE_SOURCE_DIR}/src/MainWindow.h
${CMAKE_CURRENT_SOURCE_DIR}/kddockwidgets_global.h ${CMAKE_SOURCE_DIR}/src/DockWidgetBase.h
${CMAKE_SOURCE_DIR}/src/DockWidget.h ${CMAKE_SOURCE_DIR}/src/MainWindowBase.h ${CMAKE_SOURCE_DIR}/src/MainWindow.h
${CMAKE_SOURCE_DIR}/src/LayoutSaver.h
)
create_python_bindings(
"KDDockWidgets"
"${PyKDDockWidgets_typesystem_paths}"
"${PyKDDockWidgets_include_paths}"
"${PyKDDockWidgets_SRC}"
"${PyKDDockWidgets_target_include_directories}"
"${PyKDDockWidgets_target_link_libraries}"
${CMAKE_CURRENT_SOURCE_DIR}/kddockwidgets_global.h
${CMAKE_CURRENT_SOURCE_DIR}/typesystem_kddockwidgets.xml
"${PyKDDockWidgets_DEPENDS}"
${CMAKE_CURRENT_BINARY_DIR}
"KDDockWidgets"
"${PyKDDockWidgets_typesystem_paths}"
"${PyKDDockWidgets_include_paths}"
"${PyKDDockWidgets_SRC}"
"${PyKDDockWidgets_target_include_directories}"
"${PyKDDockWidgets_target_link_libraries}"
${CMAKE_CURRENT_SOURCE_DIR}/kddockwidgets_global.h
${CMAKE_CURRENT_SOURCE_DIR}/typesystem_kddockwidgets.xml
"${PyKDDockWidgets_DEPENDS}"
${CMAKE_CURRENT_BINARY_DIR}
)
# Make module import from build dir work
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/__init__.py.cmake ${CMAKE_CURRENT_BINARY_DIR}/__init__.py @ONLY)
# install
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/__init__.py
$<TARGET_FILE:KDAB::kddockwidgets>
DESTINATION
${${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX}
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/__init__.py $<TARGET_FILE:KDAB::kddockwidgets>
DESTINATION ${${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX}
)
if(NOT WIN32)
install(
FILES
$<TARGET_LINKER_FILE:KDAB::kddockwidgets>
$<TARGET_SONAME_FILE:KDAB::kddockwidgets>
DESTINATION
${${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX}
)
install(FILES $<TARGET_LINKER_FILE:KDAB::kddockwidgets> $<TARGET_SONAME_FILE:KDAB::kddockwidgets>
DESTINATION ${${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX}
)
endif()

View File

@@ -18,7 +18,7 @@
#define PYTHON_BINDINGS
#ifndef QT_WIDGETS_LIB
# define QT_WIDGETS_LIB
#define QT_WIDGETS_LIB
#endif
#include <kddockwidgets/MainWindowBase.h>

View File

@@ -9,41 +9,51 @@
# Contact KDAB at <info@kdab.com> for commercial licensing options.
#
from PyKDDockWidgetsQt6 import KDDockWidgets
# pylint: disable=missing-module-docstring,missing-function-docstring,missing-class-docstring
# pylint: disable=no-name-in-module
from PySide6 import QtCore, QtWidgets, QtGui
from PyKDDockWidgetsQt6 import KDDockWidgets
from MyWidget1 import MyWidget1
from MyWidget2 import MyWidget2
from MyWidget3 import MyWidget3
def newMyWidget(parent = None):
def newMyWidget(parent=None):
randomNumber = QtCore.QRandomGenerator.global_().bounded(0, 100) + 1
if (randomNumber < 50):
if (randomNumber < 33):
if randomNumber < 50:
if randomNumber < 33:
return MyWidget1(parent)
else:
return MyWidget3(parent)
else:
return MyWidget2(parent)
return MyWidget3(parent)
return MyWidget2(parent)
class MyMainWindow(KDDockWidgets.MainWindow):
s_count = 0
s_menuCount = 0
def __init__(self, uniqueName, options = KDDockWidgets.MainWindowOption_None, dockWidget0IsNonClosable = False, nonDockableDockWidget9 = False, restoreIsRelative = False, maxSizeForDockWidget8 = False, affinityName = "", parent = None):
def __init__(self,
uniqueName,
options=KDDockWidgets.MainWindowOption_None,
dockWidget0IsNonClosable=False,
nonDockableDockWidget9=False,
restoreIsRelative=False,
maxSizeForDockWidget8=False,
affinityName="",
parent=None):
super().__init__(uniqueName, options, parent)
self.m_dockWidget0IsNonClosable = dockWidget0IsNonClosable
self.m_dockWidget9IsNonDockable = nonDockableDockWidget9
self.m_restoreIsRelative = restoreIsRelative
self.m_maxSizeForDockWidget8 = maxSizeForDockWidget8
self.m_dockwidgets = []
self.dockWidget0IsNonClosable = dockWidget0IsNonClosable
self.dockWidget9IsNonDockable = nonDockableDockWidget9
self.restoreIsRelative = restoreIsRelative
self.maxSizeForDockWidget8 = maxSizeForDockWidget8
self.dockwidgets = []
menubar = self.menuBar()
fileMenu = QtWidgets.QMenu("File")
self.m_toggleMenu = QtWidgets.QMenu("Toggle")
self.toggleMenu = QtWidgets.QMenu("Toggle")
menubar.addMenu(fileMenu)
menubar.addMenu(self.m_toggleMenu)
menubar.addMenu(self.toggleMenu)
newAction = fileMenu.addAction("New DockWidget")
newAction.triggered.connect(self._newDockWidget)
@@ -63,101 +73,104 @@ class MyMainWindow(KDDockWidgets.MainWindow):
quitAction = fileMenu.addAction("Quit")
quitAction.triggered.connect(QtWidgets.QApplication.instance().quit)
self.setAffinities([ affinityName ])
self.setAffinities([affinityName])
self.createDockWidgets()
def _newDockWidget(self):
MyMainWindow.s_menuCount += 1
w = newMyWidget(self)
w.setGeometry(100, 100, 400, 400)
dock = KDDockWidgets.DockWidget("new dock %d"%(MyMainWindow.s_menuCount))
dock = KDDockWidgets.DockWidget("new dock %d" % (MyMainWindow.s_menuCount))
dock.setWidget(w)
dock.resize(600, 600)
dock.show()
self.m_dockwidgets.append(dock)
self.dockwidgets.append(dock)
# pylint: disable=no-self-use
def _saveLayout(self):
#saver = KDDockWidgets.LayoutSaver()
#result = saver.saveToFile("mylayout.json")
#print("Saving layout to disk. Result=", result)
print("Not available")
# pylint: disable=no-self-use
def _restoreLayout(self):
#options = KDDockWidgets.RestoreOption_None
#if self.m_restoreIsRelative:
# if self.restoreIsRelative:
# options |= KDDockWidgets.RestoreOption_RelativeToMainWindow
#saver = KDDockWidgets.LayoutSaver(options)
#saver.restoreFromFile("mylayout.json")
# saver.restoreFromFile("mylayout.json")
print("Not available")
def _closeAll(self):
for dw in self.m_dockwidgets:
dw.close()
for widget in self.dockwidgets:
widget.close()
def createDockWidgets(self):
if self.m_dockWidget9IsNonDockable:
if self.dockWidget9IsNonDockable:
numDockWidgets = 10
else:
numDockWidgets = 9
# numDockWidgets = 2
# Create 9 KDDockWidget::DockWidget and the respective widgets they're hosting (MyWidget instances)
for i in range(numDockWidgets):
self.m_dockwidgets.append(self.newDockWidget())
for _ in range(numDockWidgets):
self.dockwidgets.append(self.newDockWidget())
# MainWindow::addDockWidget() attaches a dock widget to the main window:
initialOpts = KDDockWidgets.InitialOption(KDDockWidgets.InitialVisibilityOption.StartHidden, QtCore.QSize(500, 500))
self.addDockWidget(self.m_dockwidgets[0], KDDockWidgets.Location_OnBottom, None, initialOpts)
initialOpts = KDDockWidgets.InitialOption(KDDockWidgets.InitialVisibilityOption.StartHidden,
QtCore.QSize(500, 500))
self.addDockWidget(self.dockwidgets[0], KDDockWidgets.Location_OnBottom, None, initialOpts)
# Here, for finer granularity we specify right of dockwidgets[0]:
self.addDockWidget(self.m_dockwidgets[1], KDDockWidgets.Location_OnRight, self.m_dockwidgets[0])
self.addDockWidget(self.m_dockwidgets[2], KDDockWidgets.Location_OnLeft)
self.addDockWidget(self.m_dockwidgets[3], KDDockWidgets.Location_OnBottom)
self.addDockWidget(self.m_dockwidgets[4], KDDockWidgets.Location_OnBottom)
self.addDockWidget(self.dockwidgets[1], KDDockWidgets.Location_OnRight, self.dockwidgets[0])
self.addDockWidget(self.dockwidgets[2], KDDockWidgets.Location_OnLeft)
self.addDockWidget(self.dockwidgets[3], KDDockWidgets.Location_OnBottom)
self.addDockWidget(self.dockwidgets[4], KDDockWidgets.Location_OnBottom)
# Tab two dock widgets together
self.m_dockwidgets[3].addDockWidgetAsTab(self.m_dockwidgets[5])
self.dockwidgets[3].addDockWidgetAsTab(self.dockwidgets[5])
# 6 is floating, as it wasn't added to the main window via MainWindow::addDockWidget().
# and we tab 7 with it.
self.m_dockwidgets[6].addDockWidgetAsTab(self.m_dockwidgets[7])
self.dockwidgets[6].addDockWidgetAsTab(self.dockwidgets[7])
# Floating windows also support nesting, here we add 8 to the bottom of the group
self.m_dockwidgets[6].addDockWidgetToContainingWindow(self.m_dockwidgets[8], KDDockWidgets.Location_OnBottom)
self.dockwidgets[6].addDockWidgetToContainingWindow(self.dockwidgets[8], KDDockWidgets.Location_OnBottom)
floatingWindow = self.m_dockwidgets[6].window()
floatingWindow = self.dockwidgets[6].window()
floatingWindow.move(100, 100)
def newDockWidget(self):
# Passing options is optional, we just want to illustrate Option_NotClosable here
options = KDDockWidgets.DockWidget.Option_None
if (MyMainWindow.s_count == 0) and self.m_dockWidget0IsNonClosable:
if (MyMainWindow.s_count == 0) and self.dockWidget0IsNonClosable:
options |= KDDockWidgets.DockWidget.Option_NotClosable
if (MyMainWindow.s_count == 9) and self.m_dockWidget9IsNonDockable:
if (MyMainWindow.s_count == 9) and self.dockWidget9IsNonDockable:
options |= KDDockWidgets.DockWidget.Option_NotDockable
dock = KDDockWidgets.DockWidget("DockWidget #%d"%(MyMainWindow.s_count), options)
dock.setAffinities(self.affinities()); # optional, just to show the feature. Pass -mi to the example to see incompatible dock widgets
dock = KDDockWidgets.DockWidget("DockWidget #%d" % (MyMainWindow.s_count), options)
# optional, just to show the feature. Pass -mi to the example to see incompatible dock widgets
dock.setAffinities(self.affinities())
if MyMainWindow.s_count == 1:
dock.setIcon(QtGui.QIcon.fromTheme("mail-message"))
myWidget = newMyWidget(self)
if (MyMainWindow.s_count == 8) and self.m_maxSizeForDockWidget8:
if (MyMainWindow.s_count == 8) and self.maxSizeForDockWidget8:
# Set a maximum size on dock #8
myWidget.setMaximumSize(200, 200)
dock.setWidget(myWidget)
if dock.options() & KDDockWidgets.DockWidget.Option_NotDockable:
dock.setTitle("DockWidget #%d (%s)" %(MyMainWindow.s_count, "non dockable"))
dock.setTitle("DockWidget #%d (%s)" % (MyMainWindow.s_count, "non dockable"))
else:
dock.setTitle("DockWidget #%d"%(MyMainWindow.s_count))
dock.setTitle("DockWidget #%d" % (MyMainWindow.s_count))
dock.resize(600, 600)
self.m_toggleMenu.addAction(dock.toggleAction())
self.toggleMenu.addAction(dock.toggleAction())
MyMainWindow.s_count += 1
return dock

View File

@@ -9,18 +9,23 @@
# Contact KDAB at <info@kdab.com> for commercial licensing options.
#
import PyKDDockWidgetsQt6
# pylint: disable=missing-module-docstring,missing-class-docstring,missing-function-docstring
from PySide6 import QtWidgets, QtGui, QtCore
# pylint: disable=too-few-public-methods
class MyWidget(QtWidgets.QWidget):
s_images = {}
def __init__(self, backgroundFile, logoFile, parent = None):
def __init__(self, backgroundFile, logoFile, parent=None):
super().__init__(parent)
self.m_background = self._lookupImage(backgroundFile)
self.m_logo = self._lookupImage(logoFile)
self.background = self._lookupImage(backgroundFile)
self.logo = self._lookupImage(logoFile)
# pylint: disable=no-self-use
def _lookupImage(self, imageName):
if imageName == "":
return None
@@ -29,23 +34,23 @@ class MyWidget(QtWidgets.QWidget):
MyWidget.s_images[imageName] = QtGui.QImage(imageName)
return MyWidget.s_images[imageName]
def drawLogo(self, p):
if not self.m_logo:
if not self.logo:
return
ratio = self.m_logo.height() / (self.m_logo.width() * 1.0)
ratio = self.logo.height() / (self.logo.width() * 1.0)
maxWidth = int(0.80 * self.size().width())
maxHeight = int(0.80 * self.size().height())
proposedHeight = int(maxWidth * ratio)
if (proposedHeight <= maxHeight):
if proposedHeight <= maxHeight:
width = maxWidth
else:
width = int(maxHeight / ratio)
height = int(width * ratio)
targetLogoRect = QtCore.QRect(0,0, width, height)
targetLogoRect.moveCenter(self.rect().center() + QtCore.QPoint(0, -int(self.size().height() * 0.00)))
p.drawImage(targetLogoRect, self.m_logo, self.m_logo.rect());
targetLogoRect = QtCore.QRect(0, 0, width, height)
targetLogoRect.moveCenter(self.rect().center(
) + QtCore.QPoint(0, -int(self.size().height() * 0.00)))
p.drawImage(targetLogoRect, self.logo, self.logo.rect())

View File

@@ -9,21 +9,21 @@
# Contact KDAB at <info@kdab.com> for commercial licensing options.
#
import PyKDDockWidgetsQt6
from PySide6 import QtWidgets, QtGui
# pylint: disable=missing-module-docstring,missing-class-docstring,missing-function-docstring
from PySide6 import QtGui
from MyWidget import MyWidget
# pylint: disable=too-few-public-methods
class MyWidget1(MyWidget):
def __init__(self, parent = None):
def __init__(self, parent=None):
super().__init__(":/assets/triangles.png", ":/assets/KDAB_bubble_white.png", parent)
def paintEvent(self, ev):
def paintEvent(self, event):
del event # unused at this time
p = QtGui.QPainter(self)
p.fillRect(self.rect(), QtGui.QColor(0xCC, 0xCC, 0xCC))
p.drawImage(self.m_background.rect(), self.m_background, self.m_background.rect())
p.drawImage(self.background.rect(),
self.background, self.background.rect())
self.drawLogo(p)

View File

@@ -9,19 +9,20 @@
# Contact KDAB at <info@kdab.com> for commercial licensing options.
#
import PyKDDockWidgetsQt6
# pylint: disable=missing-module-docstring,missing-class-docstring,missing-function-docstring
from PySide6 import QtWidgets, QtGui, QtCore
from PySide6 import QtGui, QtCore
from MyWidget import MyWidget
# pylint: disable=too-few-public-methods
class MyWidget2(MyWidget):
def __init__(self, parent = None):
def __init__(self, parent=None):
super().__init__("", ":/assets/KDAB_bubble_blue.png", parent)
def paintEvent(self, ev):
def paintEvent(self, event):
del event # unused at this time
p = QtGui.QPainter(self)
p.fillRect(self.rect(), QtCore.Qt.white);
p.fillRect(self.rect(), QtCore.Qt.white)
self.drawLogo(p)

View File

@@ -9,24 +9,28 @@
# Contact KDAB at <info@kdab.com> for commercial licensing options.
#
import PyKDDockWidgetsQt6
from PySide6 import QtWidgets, QtGui, QtCore
# pylint: disable=missing-module-docstring,missing-class-docstring,missing-function-docstring
from PySide6 import QtGui, QtCore
from MyWidget import MyWidget
# pylint: disable=too-few-public-methods
class MyWidget3(MyWidget):
def __init__(self, parent = None):
def __init__(self, parent=None):
super().__init__(":/assets/base.png", ":/assets/KDAB_bubble_fulcolor.png", parent)
self.m_triangle = QtGui.QImage(":/assets/tri.png")
self.triangle = QtGui.QImage(":/assets/tri.png")
def paintEvent(self, ev):
def paintEvent(self, event):
del event # unused at this time
p = QtGui.QPainter(self)
p.fillRect(self.rect(), QtGui.QColor(0xD5, 0xD5, 0xD5))
p.drawImage(self.m_background.rect(), self.m_background, self.m_background.rect())
targetRect = QtCore.QRect(QtCore.QPoint(self.width() - self.m_triangle.width(), self.height() - self.m_triangle.height()), self.m_triangle.size())
p.drawImage(self.background.rect(),
self.background, self.background.rect())
QtCore.QRect(QtCore.QPoint(self.width() - self.triangle.width(),
self.height() - self.triangle.height()),
self.triangle.size())
self.drawLogo(p)

View File

@@ -3,6 +3,9 @@ Running python example
Generate resource file with:
~# rcc -g python -o rc_assets.py ../../examples/dockwidgets/resources_example.qrc
(on some systems, rcc might be invoked as rcc-qt6)
Make sure you installed kddockwidgets and set PYTHONPATH accordingly.
Run the app:
~# python3 main.py

View File

@@ -9,16 +9,26 @@
# Contact KDAB at <info@kdab.com> for commercial licensing options.
#
from PyKDDockWidgetsQt6 import KDDockWidgets
from MyMainWindow import MyMainWindow
from PySide6 import QtWidgets, QtCore
''' KDDockWidgets example (Qt6) '''
import sys
from PySide6 import QtWidgets, QtCore
from MyMainWindow import MyMainWindow
try:
# pylint: disable=unused-import
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!)")
except ImportError:
sys.exit(
'''
Oops.. rc_assets needs to be generated first.
Please run:
rcc -g python -o rc_assets.py ../../examples/dockwidgets/resources_example.qrc
(Make sure to use the rcc from the Qt6 version used to generate the bindings!)
On some systems rcc might be invoked as rcc-qt6.
'''
)
if __name__ == "__main__":
QtWidgets.QApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling)
@@ -34,5 +44,4 @@ if __name__ == "__main__":
mainWindow.resize(1200, 1200)
mainWindow.show()
app.exec_()
app.exec()

View File

@@ -9,41 +9,51 @@
# Contact KDAB at <info@kdab.com> for commercial licensing options.
#
from PyKDDockWidgets import KDDockWidgets
# pylint: disable=missing-module-docstring,missing-function-docstring,missing-class-docstring
# pylint: disable=no-name-in-module
from PySide2 import QtCore, QtWidgets, QtGui
from PyKDDockWidgets import KDDockWidgets
from MyWidget1 import MyWidget1
from MyWidget2 import MyWidget2
from MyWidget3 import MyWidget3
def newMyWidget(parent = None):
def newMyWidget(parent=None):
randomNumber = QtCore.QRandomGenerator.global_().bounded(0, 100) + 1
if (randomNumber < 50):
if (randomNumber < 33):
if randomNumber < 50:
if randomNumber < 33:
return MyWidget1(parent)
else:
return MyWidget3(parent)
else:
return MyWidget2(parent)
return MyWidget3(parent)
return MyWidget2(parent)
class MyMainWindow(KDDockWidgets.MainWindow):
s_count = 0
s_menuCount = 0
def __init__(self, uniqueName, options = KDDockWidgets.MainWindowOption_None, dockWidget0IsNonClosable = False, nonDockableDockWidget9 = False, restoreIsRelative = False, maxSizeForDockWidget8 = False, affinityName = "", parent = None):
def __init__(self,
uniqueName,
options=KDDockWidgets.MainWindowOption_None,
dockWidget0IsNonClosable=False,
nonDockableDockWidget9=False,
restoreIsRelative=False,
maxSizeForDockWidget8=False,
affinityName="",
parent=None):
super().__init__(uniqueName, options, parent)
self.m_dockWidget0IsNonClosable = dockWidget0IsNonClosable
self.m_dockWidget9IsNonDockable = nonDockableDockWidget9
self.m_restoreIsRelative = restoreIsRelative
self.m_maxSizeForDockWidget8 = maxSizeForDockWidget8
self.m_dockwidgets = []
self.dockWidget0IsNonClosable = dockWidget0IsNonClosable
self.dockWidget9IsNonDockable = nonDockableDockWidget9
self.restoreIsRelative = restoreIsRelative
self.maxSizeForDockWidget8 = maxSizeForDockWidget8
self.dockwidgets = []
menubar = self.menuBar()
fileMenu = QtWidgets.QMenu("File")
self.m_toggleMenu = QtWidgets.QMenu("Toggle")
self.toggleMenu = QtWidgets.QMenu("Toggle")
menubar.addMenu(fileMenu)
menubar.addMenu(self.m_toggleMenu)
menubar.addMenu(self.toggleMenu)
newAction = fileMenu.addAction("New DockWidget")
newAction.triggered.connect(self._newDockWidget)
@@ -63,101 +73,104 @@ class MyMainWindow(KDDockWidgets.MainWindow):
quitAction = fileMenu.addAction("Quit")
quitAction.triggered.connect(QtWidgets.QApplication.instance().quit)
self.setAffinities([ affinityName ])
self.setAffinities([affinityName])
self.createDockWidgets()
def _newDockWidget(self):
MyMainWindow.s_menuCount += 1
w = newMyWidget(self)
w.setGeometry(100, 100, 400, 400)
dock = KDDockWidgets.DockWidget("new dock %d"%(MyMainWindow.s_menuCount))
dock = KDDockWidgets.DockWidget("new dock %d" % (MyMainWindow.s_menuCount))
dock.setWidget(w)
dock.resize(600, 600)
dock.show()
self.m_dockwidgets.append(dock)
self.dockwidgets.append(dock)
# pylint: disable=no-self-use
def _saveLayout(self):
#saver = KDDockWidgets.LayoutSaver()
#result = saver.saveToFile("mylayout.json")
#print("Saving layout to disk. Result=", result)
print("Not available")
# pylint: disable=no-self-use
def _restoreLayout(self):
#options = KDDockWidgets.RestoreOption_None
#if self.m_restoreIsRelative:
# if self.restoreIsRelative:
# options |= KDDockWidgets.RestoreOption_RelativeToMainWindow
#saver = KDDockWidgets.LayoutSaver(options)
#saver.restoreFromFile("mylayout.json")
# saver.restoreFromFile("mylayout.json")
print("Not available")
def _closeAll(self):
for dw in self.m_dockwidgets:
dw.close()
for widget in self.dockwidgets:
widget.close()
def createDockWidgets(self):
if self.m_dockWidget9IsNonDockable:
if self.dockWidget9IsNonDockable:
numDockWidgets = 10
else:
numDockWidgets = 9
# numDockWidgets = 2
# Create 9 KDDockWidget::DockWidget and the respective widgets they're hosting (MyWidget instances)
for i in range(numDockWidgets):
self.m_dockwidgets.append(self.newDockWidget())
for _ in range(numDockWidgets):
self.dockwidgets.append(self.newDockWidget())
# MainWindow::addDockWidget() attaches a dock widget to the main window:
initialOpts = KDDockWidgets.InitialOption(KDDockWidgets.InitialVisibilityOption.StartHidden, QtCore.QSize(500, 500))
self.addDockWidget(self.m_dockwidgets[0], KDDockWidgets.Location_OnBottom, None, initialOpts)
initialOpts = KDDockWidgets.InitialOption(KDDockWidgets.InitialVisibilityOption.StartHidden,
QtCore.QSize(500, 500))
self.addDockWidget(self.dockwidgets[0], KDDockWidgets.Location_OnBottom, None, initialOpts)
# Here, for finer granularity we specify right of dockwidgets[0]:
self.addDockWidget(self.m_dockwidgets[1], KDDockWidgets.Location_OnRight, self.m_dockwidgets[0])
self.addDockWidget(self.m_dockwidgets[2], KDDockWidgets.Location_OnLeft)
self.addDockWidget(self.m_dockwidgets[3], KDDockWidgets.Location_OnBottom)
self.addDockWidget(self.m_dockwidgets[4], KDDockWidgets.Location_OnBottom)
self.addDockWidget(self.dockwidgets[1], KDDockWidgets.Location_OnRight, self.dockwidgets[0])
self.addDockWidget(self.dockwidgets[2], KDDockWidgets.Location_OnLeft)
self.addDockWidget(self.dockwidgets[3], KDDockWidgets.Location_OnBottom)
self.addDockWidget(self.dockwidgets[4], KDDockWidgets.Location_OnBottom)
# Tab two dock widgets together
self.m_dockwidgets[3].addDockWidgetAsTab(self.m_dockwidgets[5])
self.dockwidgets[3].addDockWidgetAsTab(self.dockwidgets[5])
# 6 is floating, as it wasn't added to the main window via MainWindow::addDockWidget().
# and we tab 7 with it.
self.m_dockwidgets[6].addDockWidgetAsTab(self.m_dockwidgets[7])
self.dockwidgets[6].addDockWidgetAsTab(self.dockwidgets[7])
# Floating windows also support nesting, here we add 8 to the bottom of the group
self.m_dockwidgets[6].addDockWidgetToContainingWindow(self.m_dockwidgets[8], KDDockWidgets.Location_OnBottom)
self.dockwidgets[6].addDockWidgetToContainingWindow(self.dockwidgets[8], KDDockWidgets.Location_OnBottom)
floatingWindow = self.m_dockwidgets[6].window()
floatingWindow = self.dockwidgets[6].window()
floatingWindow.move(100, 100)
def newDockWidget(self):
# Passing options is optional, we just want to illustrate Option_NotClosable here
options = KDDockWidgets.DockWidget.Option_None
if (MyMainWindow.s_count == 0) and self.m_dockWidget0IsNonClosable:
if (MyMainWindow.s_count == 0) and self.dockWidget0IsNonClosable:
options |= KDDockWidgets.DockWidget.Option_NotClosable
if (MyMainWindow.s_count == 9) and self.m_dockWidget9IsNonDockable:
if (MyMainWindow.s_count == 9) and self.dockWidget9IsNonDockable:
options |= KDDockWidgets.DockWidget.Option_NotDockable
dock = KDDockWidgets.DockWidget("DockWidget #%d"%(MyMainWindow.s_count), options)
dock.setAffinities(self.affinities()); # optional, just to show the feature. Pass -mi to the example to see incompatible dock widgets
dock = KDDockWidgets.DockWidget("DockWidget #%d" % (MyMainWindow.s_count), options)
# optional, just to show the feature. Pass -mi to the example to see incompatible dock widgets
dock.setAffinities(self.affinities())
if MyMainWindow.s_count == 1:
dock.setIcon(QtGui.QIcon.fromTheme("mail-message"))
myWidget = newMyWidget(self)
if (MyMainWindow.s_count == 8) and self.m_maxSizeForDockWidget8:
if (MyMainWindow.s_count == 8) and self.maxSizeForDockWidget8:
# Set a maximum size on dock #8
myWidget.setMaximumSize(200, 200)
dock.setWidget(myWidget)
if dock.options() & KDDockWidgets.DockWidget.Option_NotDockable:
dock.setTitle("DockWidget #%d (%s)" %(MyMainWindow.s_count, "non dockable"))
dock.setTitle("DockWidget #%d (%s)" % (MyMainWindow.s_count, "non dockable"))
else:
dock.setTitle("DockWidget #%d"%(MyMainWindow.s_count))
dock.setTitle("DockWidget #%d" % (MyMainWindow.s_count))
dock.resize(600, 600)
self.m_toggleMenu.addAction(dock.toggleAction())
self.toggleMenu.addAction(dock.toggleAction())
MyMainWindow.s_count += 1
return dock

View File

@@ -9,18 +9,23 @@
# Contact KDAB at <info@kdab.com> for commercial licensing options.
#
import PyKDDockWidgets
# pylint: disable=missing-module-docstring,missing-class-docstring,missing-function-docstring
from PySide2 import QtWidgets, QtGui, QtCore
# pylint: disable=too-few-public-methods
class MyWidget(QtWidgets.QWidget):
s_images = {}
def __init__(self, backgroundFile, logoFile, parent = None):
def __init__(self, backgroundFile, logoFile, parent=None):
super().__init__(parent)
self.m_background = self._lookupImage(backgroundFile)
self.m_logo = self._lookupImage(logoFile)
self.background = self._lookupImage(backgroundFile)
self.logo = self._lookupImage(logoFile)
# pylint: disable=no-self-use
def _lookupImage(self, imageName):
if imageName == "":
return None
@@ -29,23 +34,23 @@ class MyWidget(QtWidgets.QWidget):
MyWidget.s_images[imageName] = QtGui.QImage(imageName)
return MyWidget.s_images[imageName]
def drawLogo(self, p):
if not self.m_logo:
if not self.logo:
return
ratio = self.m_logo.height() / (self.m_logo.width() * 1.0)
ratio = self.logo.height() / (self.logo.width() * 1.0)
maxWidth = int(0.80 * self.size().width())
maxHeight = int(0.80 * self.size().height())
proposedHeight = int(maxWidth * ratio)
if (proposedHeight <= maxHeight):
if proposedHeight <= maxHeight:
width = maxWidth
else:
width = int(maxHeight / ratio)
height = int(width * ratio)
targetLogoRect = QtCore.QRect(0,0, width, height)
targetLogoRect.moveCenter(self.rect().center() + QtCore.QPoint(0, -int(self.size().height() * 0.00)))
p.drawImage(targetLogoRect, self.m_logo, self.m_logo.rect());
targetLogoRect = QtCore.QRect(0, 0, width, height)
targetLogoRect.moveCenter(self.rect().center(
) + QtCore.QPoint(0, -int(self.size().height() * 0.00)))
p.drawImage(targetLogoRect, self.logo, self.logo.rect())

View File

@@ -9,21 +9,21 @@
# Contact KDAB at <info@kdab.com> for commercial licensing options.
#
import PyKDDockWidgets
from PySide2 import QtWidgets, QtGui
# pylint: disable=missing-module-docstring,missing-class-docstring,missing-function-docstring
from PySide2 import QtGui
from MyWidget import MyWidget
# pylint: disable=too-few-public-methods
class MyWidget1(MyWidget):
def __init__(self, parent = None):
def __init__(self, parent=None):
super().__init__(":/assets/triangles.png", ":/assets/KDAB_bubble_white.png", parent)
def paintEvent(self, ev):
def paintEvent(self, event):
del event # unused at this time
p = QtGui.QPainter(self)
p.fillRect(self.rect(), QtGui.QColor(0xCC, 0xCC, 0xCC))
p.drawImage(self.m_background.rect(), self.m_background, self.m_background.rect())
p.drawImage(self.background.rect(),
self.background, self.background.rect())
self.drawLogo(p)

View File

@@ -9,19 +9,20 @@
# Contact KDAB at <info@kdab.com> for commercial licensing options.
#
import PyKDDockWidgets
# pylint: disable=missing-module-docstring,missing-class-docstring,missing-function-docstring
from PySide2 import QtWidgets, QtGui, QtCore
from PySide2 import QtGui, QtCore
from MyWidget import MyWidget
# pylint: disable=too-few-public-methods
class MyWidget2(MyWidget):
def __init__(self, parent = None):
def __init__(self, parent=None):
super().__init__("", ":/assets/KDAB_bubble_blue.png", parent)
def paintEvent(self, ev):
def paintEvent(self, event):
del event # unused at this time
p = QtGui.QPainter(self)
p.fillRect(self.rect(), QtCore.Qt.white);
p.fillRect(self.rect(), QtCore.Qt.white)
self.drawLogo(p)

View File

@@ -9,24 +9,28 @@
# Contact KDAB at <info@kdab.com> for commercial licensing options.
#
import PyKDDockWidgets
from PySide2 import QtWidgets, QtGui, QtCore
# pylint: disable=missing-module-docstring,missing-class-docstring,missing-function-docstring
from PySide2 import QtGui, QtCore
from MyWidget import MyWidget
# pylint: disable=too-few-public-methods
class MyWidget3(MyWidget):
def __init__(self, parent = None):
def __init__(self, parent=None):
super().__init__(":/assets/base.png", ":/assets/KDAB_bubble_fulcolor.png", parent)
self.m_triangle = QtGui.QImage(":/assets/tri.png")
self.triangle = QtGui.QImage(":/assets/tri.png")
def paintEvent(self, ev):
def paintEvent(self, event):
del event # unused at this time
p = QtGui.QPainter(self)
p.fillRect(self.rect(), QtGui.QColor(0xD5, 0xD5, 0xD5))
p.drawImage(self.m_background.rect(), self.m_background, self.m_background.rect())
targetRect = QtCore.QRect(QtCore.QPoint(self.width() - self.m_triangle.width(), self.height() - self.m_triangle.height()), self.m_triangle.size())
p.drawImage(self.background.rect(),
self.background, self.background.rect())
QtCore.QRect(QtCore.QPoint(self.width() - self.triangle.width(),
self.height() - self.triangle.height()),
self.triangle.size())
self.drawLogo(p)

View File

@@ -3,6 +3,9 @@ Running python example
Generate resource file with:
~# rcc -g python -o rc_assets.py ../../examples/dockwidgets/resources_example.qrc
(on some systems, rcc might be invoked as rcc-qt5)
Make sure you installed kddockwidgets and set PYTHONPATH accordingly.
Run the app:
~# python3 main.py

View File

@@ -9,16 +9,26 @@
# Contact KDAB at <info@kdab.com> for commercial licensing options.
#
from PyKDDockWidgets import KDDockWidgets
from MyMainWindow import MyMainWindow
from PySide2 import QtWidgets, QtCore
''' KDDockWidgets example (Qt5) '''
import sys
from PySide2 import QtWidgets, QtCore
from MyMainWindow import MyMainWindow
try:
# pylint: disable=unused-import
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!)")
except ImportError:
sys.exit(
'''
Oops.. rc_assets needs to be generated first.
Please run:
rcc -g python -o rc_assets.py ../../examples/dockwidgets/resources_example.qrc
(Make sure to use the rcc from the Qt5 version used to generate the bindings!)
On some systems rcc might be invoked as rcc-qt5.
'''
)
if __name__ == "__main__":
QtWidgets.QApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling)
@@ -35,4 +45,3 @@ if __name__ == "__main__":
mainWindow.show()
app.exec_()

View File

@@ -11,30 +11,26 @@
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.py.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.py @ONLY)
set(TEST_PYTHONPATH
${CMAKE_BINARY_DIR}/python
${CMAKE_CURRENT_BINARY_DIR}
)
set(TEST_PYTHONPATH ${CMAKE_BINARY_DIR}/python ${CMAKE_CURRENT_BINARY_DIR})
set(TEST_LIBRARYPATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
if(WIN32)
set(TEST_LIBRARY_VAR "PATH")
string(REPLACE "\\" "/" TEST_PYTHONPATH "${TEST_PYTHONPATH}")
string(REPLACE "\\" "/" TEST_LIBRARYPATH "${TEST_LIBRARYPATH}")
list(JOIN TEST_PYTHONPATH "\\;" TEST_PYTHONPATH)
list(JOIN TEST_LIBRARYPATH "\\;" TEST_LIBRARYPATH)
set(TEST_LIBRARY_VAR "PATH")
string(REPLACE "\\" "/" TEST_PYTHONPATH "${TEST_PYTHONPATH}")
string(REPLACE "\\" "/" TEST_LIBRARYPATH "${TEST_LIBRARYPATH}")
list(JOIN TEST_PYTHONPATH "\\;" TEST_PYTHONPATH)
list(JOIN TEST_LIBRARYPATH "\\;" TEST_LIBRARYPATH)
else()
set(TEST_LIBRARY_VAR "LD_LIBRARY_PATH")
list(JOIN TEST_PYTHONPATH ":" TEST_PYTHONPATH)
list(JOIN TEST_LIBRARYPATH ":" TEST_LIBRARYPATH)
set(TEST_LIBRARY_VAR "LD_LIBRARY_PATH")
list(JOIN TEST_PYTHONPATH ":" TEST_PYTHONPATH)
list(JOIN TEST_LIBRARYPATH ":" TEST_LIBRARYPATH)
endif()
set(PYTHON_ENV_COMMON "PYTHONPATH=${TEST_PYTHONPATH};${TEST_LIBRARY_VAR}=${TEST_LIBRARYPATH}")
file(GLOB TEST_FILES ${CMAKE_CURRENT_SOURCE_DIR}/tst_*.py)
foreach(test_file ${TEST_FILES})
get_filename_component(test_name ${test_file} NAME_WE)
add_test(${test_name} ${Python3_EXECUTABLE} ${test_file})
set_tests_properties(${test_name} PROPERTIES ENVIRONMENT "${PYTHON_ENV_COMMON}")
get_filename_component(test_name ${test_file} NAME_WE)
add_test(${test_name} ${Python3_EXECUTABLE} ${test_file})
set_tests_properties(${test_name} PROPERTIES ENVIRONMENT "${PYTHON_ENV_COMMON}")
endforeach()

View File

@@ -8,12 +8,15 @@
# Contact KDAB at <info@kdab.com> for commercial licensing options.
#
# pylint: disable=missing-module-docstring,missing-class-docstring,missing-function-docstring
import unittest
import importlib
import inspect
from config import TstConfig
class TestImportModules(unittest.TestCase):
def test_importModules(self):
m = importlib.import_module(TstConfig.bindingsNamespace + '.KDDockWidgets')
@@ -25,6 +28,7 @@ class TestImportModules(unittest.TestCase):
for symbol in symbols:
self.assertIn(symbol, moduleSymbols)
if __name__ == '__main__':
TstConfig.initLibraryPath()
unittest.main()

View File

@@ -10,15 +10,12 @@
#
if(POLICY CMP0043)
cmake_policy(SET CMP0043 NEW)
cmake_policy(SET CMP0043 NEW)
endif()
add_definitions(-DQT_NO_SIGNALS_SLOTS_KEYWORDS
-DQT_USE_QSTRINGBUILDER
-DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT
-DQT_STRICT_ITERATORS
-DQT_NO_KEYWORDS
-DQT_NO_FOREACH
add_definitions(
-DQT_NO_SIGNALS_SLOTS_KEYWORDS -DQT_USE_QSTRINGBUILDER -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT
-DQT_STRICT_ITERATORS -DQT_NO_KEYWORDS -DQT_NO_FOREACH
)
set(DOCKSLIBS_SRCS
@@ -35,6 +32,8 @@ set(DOCKSLIBS_SRCS
MainWindowBase.h
MainWindowMDI.cpp
MainWindowMDI.h
MDIArea.cpp
MDIArea.h
LayoutSaver.cpp
LayoutSaver.h
private/LayoutSaver_p.h
@@ -81,7 +80,6 @@ set(DOCKSLIBS_SRCS
private/indicators/ClassicIndicators_p.h
private/indicators/ClassicIndicatorsWindow.cpp
private/indicators/ClassicIndicatorsWindow_p.h
private/multisplitter/Item.cpp
private/multisplitter/Item_p.h
private/multisplitter/ItemFreeContainer.cpp
@@ -114,6 +112,7 @@ set(DOCKS_INSTALLABLE_PRIVATE_INCLUDES
private/DragController_p.h
private/Draggable_p.h
private/DropArea_p.h
private/DropAreaWithCentralFrame_p.h
private/DropIndicatorOverlayInterface_p.h
private/FloatingWindow_p.h
private/Frame_p.h
@@ -126,6 +125,7 @@ set(DOCKS_INSTALLABLE_PRIVATE_INCLUDES
private/WidgetResizeHandler_p.h
private/DockRegistry_p.h
private/TabWidget_p.h
private/MDILayoutWidget_p.h
)
set(DOCKS_INSTALLABLE_PRIVATE_WIDGET_INCLUDES
@@ -138,96 +138,94 @@ set(DOCKS_INSTALLABLE_PRIVATE_WIDGET_INCLUDES
private/widgets/TabWidgetWidget_p.h
)
set(DOCKS_INSTALLABLE_PRIVATE_QUICK_INCLUDES
private/quick/QWidgetAdapter_quick_p.h
)
set(DOCKS_INSTALLABLE_PRIVATE_QUICK_INCLUDES private/quick/QWidgetAdapter_quick_p.h)
if(${PROJECT_NAME}_QTQUICK)
set(DOCKSLIBS_SRCS ${DOCKSLIBS_SRCS}
DockWidgetQuick.cpp
DockWidgetQuick.h
private/quick/DockWidgetInstantiator.cpp
private/quick/DockWidgetInstantiator_p.h
private/quick/QWidgetAdapter_quick.cpp
private/quick/QWidgetAdapter_quick_p.h
private/quick/FloatingWindowQuick.cpp
private/quick/FloatingWindowQuick_p.h
private/quick/TabWidgetQuick.cpp
private/quick/TabWidgetQuick_p.h
private/quick/TabBarQuick.cpp
private/quick/TabBarQuick_p.h
private/quick/TitleBarQuick.cpp
private/quick/TitleBarQuick_p.h
private/quick/QmlTypes.cpp
private/quick/QmlTypes.h
private/quick/Helpers.cpp
private/quick/Helpers_p.h
private/quick/FrameQuick.cpp
private/quick/FrameQuick_p.h
private/quick/LayoutSaverInstantiator.cpp
private/quick/LayoutSaverInstantiator_p.h
private/quick/RubberBandQuick.cpp
private/quick/RubberBandQuick.h
private/quick/MainWindowQuick.cpp
private/quick/MainWindowQuick_p.h
private/quick/MainWindowInstantiator.cpp
private/quick/MainWindowInstantiator_p.h
private/multisplitter/Widget_quick.cpp
private/multisplitter/Widget_quick.h
private/multisplitter/Separator_quick.cpp
private/multisplitter/Separator_quick.h
private/multisplitter/Rubberband_quick.cpp
private/multisplitter/Rubberband_quick.h
kddockwidgets_qtquick.qrc)
set(DOCKSLIBS_SRCS
${DOCKSLIBS_SRCS}
DockWidgetQuick.cpp
DockWidgetQuick.h
private/quick/DockWidgetInstantiator.cpp
private/quick/DockWidgetInstantiator_p.h
private/quick/QWidgetAdapter_quick.cpp
private/quick/QWidgetAdapter_quick_p.h
private/quick/FloatingWindowQuick.cpp
private/quick/FloatingWindowQuick_p.h
private/quick/TabWidgetQuick.cpp
private/quick/TabWidgetQuick_p.h
private/quick/TabBarQuick.cpp
private/quick/TabBarQuick_p.h
private/quick/TitleBarQuick.cpp
private/quick/TitleBarQuick_p.h
private/quick/QmlTypes.cpp
private/quick/QmlTypes.h
private/quick/Helpers.cpp
private/quick/Helpers_p.h
private/quick/FrameQuick.cpp
private/quick/FrameQuick_p.h
private/quick/LayoutSaverInstantiator.cpp
private/quick/LayoutSaverInstantiator_p.h
private/quick/RubberBandQuick.cpp
private/quick/RubberBandQuick.h
private/quick/MainWindowQuick.cpp
private/quick/MainWindowQuick_p.h
private/quick/MainWindowInstantiator.cpp
private/quick/MainWindowInstantiator_p.h
private/multisplitter/Widget_quick.cpp
private/multisplitter/Widget_quick.h
private/multisplitter/Separator_quick.cpp
private/multisplitter/Separator_quick.h
private/multisplitter/Rubberband_quick.cpp
private/multisplitter/Rubberband_quick.h
kddockwidgets_qtquick.qrc
)
set(DOCKS_INSTALLABLE_INCLUDES ${DOCKS_INSTALLABLE_INCLUDES} DockWidgetQuick.h)
set(DOCKS_INSTALLABLE_INCLUDES ${DOCKS_INSTALLABLE_INCLUDES} DockWidgetQuick.h)
else()
set(DOCKSLIBS_SRCS ${DOCKSLIBS_SRCS}
private/DebugWindow.cpp
private/DebugWindow_p.h
private/ObjectViewer.cpp
private/ObjectViewer_p.h
MainWindow.cpp
MainWindow.h
DockWidget.h
private/multisplitter/Widget_qwidget.cpp
private/multisplitter/Widget_qwidget.h
private/multisplitter/Separator_qwidget.cpp
private/multisplitter/Separator_qwidget.h
private/widgets/TabBarWidget.cpp
private/widgets/TabBarWidget_p.h
private/widgets/FloatingWindowWidget.cpp
private/widgets/FloatingWindowWidget_p.h
private/widgets/FrameWidget.cpp
private/widgets/FrameWidget_p.h
private/widgets/SideBarWidget.cpp
private/widgets/SideBarWidget_p.h
private/widgets/TabWidgetWidget.cpp
private/widgets/TabWidgetWidget_p.h
private/widgets/TitleBarWidget.cpp
private/widgets/TitleBarWidget_p.h
private/widgets/DockWidget.cpp
private/widgets/QWidgetAdapter_widgets.cpp
private/widgets/QWidgetAdapter_widgets_p.h
private/indicators/SegmentedIndicators.cpp
private/indicators/SegmentedIndicators_p.h
# private/indicators/AnimatedIndicators.cpp
)
set(DOCKSLIBS_SRCS
${DOCKSLIBS_SRCS}
private/DebugWindow.cpp
private/DebugWindow_p.h
private/ObjectViewer.cpp
private/ObjectViewer_p.h
MainWindow.cpp
MainWindow.h
DockWidget.h
private/multisplitter/Widget_qwidget.cpp
private/multisplitter/Widget_qwidget.h
private/multisplitter/Separator_qwidget.cpp
private/multisplitter/Separator_qwidget.h
private/widgets/TabBarWidget.cpp
private/widgets/TabBarWidget_p.h
private/widgets/FloatingWindowWidget.cpp
private/widgets/FloatingWindowWidget_p.h
private/widgets/FrameWidget.cpp
private/widgets/FrameWidget_p.h
private/widgets/SideBarWidget.cpp
private/widgets/SideBarWidget_p.h
private/widgets/TabWidgetWidget.cpp
private/widgets/TabWidgetWidget_p.h
private/widgets/TitleBarWidget.cpp
private/widgets/TitleBarWidget_p.h
private/widgets/DockWidget.cpp
private/widgets/QWidgetAdapter_widgets.cpp
private/widgets/QWidgetAdapter_widgets_p.h
private/indicators/SegmentedIndicators.cpp
private/indicators/SegmentedIndicators_p.h
# private/indicators/AnimatedIndicators.cpp
)
set(DOCKS_INSTALLABLE_INCLUDES
${DOCKS_INSTALLABLE_INCLUDES}
MainWindow.h
DockWidget.h
)
set(DOCKS_INSTALLABLE_INCLUDES ${DOCKS_INSTALLABLE_INCLUDES} MainWindow.h DockWidget.h MDIArea.h)
endif()
#Generate C/C++ CamelCase forwarding headers (only public includes)
include(ECMGenerateHeaders)
ecm_generate_headers(camelcase_HEADERS
ORIGINAL
ecm_generate_headers(
camelcase_HEADERS
ORIGINAL
CAMELCASE
HEADER_NAMES
HEADER_NAMES
Config
DockWidget
DockWidgetBase
@@ -247,137 +245,178 @@ set_target_properties(kddockwidgets PROPERTIES OUTPUT_NAME "kddockwidgets${KDDoc
set_compiler_flags(kddockwidgets)
if(${PROJECT_NAME}_QT6)
set(DOCKS_INCLUDES_INSTALL_PATH "include/kddockwidgets-qt6")
set(DOCKS_INCLUDES_INSTALL_PATH "include/kddockwidgets-qt6")
else()
set(DOCKS_INCLUDES_INSTALL_PATH "include/")
set(DOCKS_INCLUDES_INSTALL_PATH "include/")
endif()
target_include_directories(kddockwidgets
PUBLIC
$<INSTALL_INTERFACE:${DOCKS_INCLUDES_INSTALL_PATH}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/fwd_headers>
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
target_include_directories(
kddockwidgets
PUBLIC $<INSTALL_INTERFACE:${DOCKS_INCLUDES_INSTALL_PATH}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/fwd_headers>
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
)
target_compile_definitions(kddockwidgets
PRIVATE
QT_NO_CAST_TO_ASCII
QT_NO_CAST_FROM_ASCII
QT_NO_URL_CAST_FROM_STRING
QT_NO_CAST_FROM_BYTEARRAY
target_compile_definitions(
kddockwidgets PRIVATE QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_ASCII QT_NO_URL_CAST_FROM_STRING
QT_NO_CAST_FROM_BYTEARRAY
)
if(${PROJECT_NAME}_STATIC)
target_compile_definitions(kddockwidgets PUBLIC KDDOCKWIDGETS_STATICLIB)
target_compile_definitions(kddockwidgets PUBLIC KDDOCKWIDGETS_STATICLIB)
else()
target_compile_definitions(kddockwidgets PRIVATE BUILDING_DOCKS_LIBRARY)
target_compile_definitions(kddockwidgets PRIVATE BUILDING_DOCKS_LIBRARY)
endif()
if(KDDockWidgets_QTQUICK)
target_compile_definitions(kddockwidgets PUBLIC KDDOCKWIDGETS_QTQUICK)
target_compile_definitions(kddockwidgets PUBLIC KDDOCKWIDGETS_QTQUICK)
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR IS_CLANG_BUILD)
target_compile_options(kddockwidgets PRIVATE -Wshadow)
if(NOT MSVC)
target_compile_options(kddockwidgets PRIVATE -fvisibility=hidden)
endif()
target_compile_options(kddockwidgets PRIVATE -Wshadow)
if(NOT MSVC)
target_compile_options(kddockwidgets PRIVATE -fvisibility=hidden)
endif()
# Disable -Wconversion for Qt6. The qsizetype to int conversions are harmless
if(NOT ${PROJECT_NAME}_QT6)
target_compile_options(kddockwidgets PRIVATE -Wconversion)
endif()
# Disable -Wconversion for Qt6. The qsizetype to int conversions are harmless
if(NOT ${PROJECT_NAME}_QT6)
target_compile_options(kddockwidgets PRIVATE -Wconversion)
endif()
if(IS_CLANG_BUILD)
target_compile_options(kddockwidgets PRIVATE -Wweak-vtables)
endif()
if(IS_CLANG_BUILD)
target_compile_options(kddockwidgets PRIVATE -Wweak-vtables)
endif()
endif()
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()
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()
if(WIN32)
target_link_libraries(kddockwidgets PRIVATE Qt${Qt_VERSION_MAJOR}::GuiPrivate dwmapi)
elseif(NOT APPLE AND NOT EMSCRIPTEN AND NOT ${PROJECT_NAME}_QT6 AND ${PROJECT_NAME}_X11EXTRAS)
find_package(Qt${Qt_VERSION_MAJOR}X11Extras)
target_link_libraries(kddockwidgets PUBLIC Qt${Qt_VERSION_MAJOR}::X11Extras)
target_link_libraries(kddockwidgets PRIVATE Qt${Qt_VERSION_MAJOR}::GuiPrivate dwmapi)
elseif(
NOT APPLE
AND NOT EMSCRIPTEN
AND NOT ${PROJECT_NAME}_QT6
AND ${PROJECT_NAME}_X11EXTRAS
)
find_package(Qt${Qt_VERSION_MAJOR}X11Extras)
target_link_libraries(kddockwidgets PUBLIC Qt${Qt_VERSION_MAJOR}::X11Extras)
endif()
if(${PROJECT_NAME}_XLib)
target_link_libraries(kddockwidgets PRIVATE X11)
target_link_libraries(kddockwidgets PRIVATE X11)
endif()
set_target_properties(kddockwidgets PROPERTIES
SOVERSION ${${PROJECT_NAME}_SOVERSION}
VERSION ${${PROJECT_NAME}_VERSION}
set_target_properties(
kddockwidgets PROPERTIES SOVERSION ${${PROJECT_NAME}_SOVERSION} VERSION ${${PROJECT_NAME}_VERSION}
)
#version libraries on Windows
if(WIN32)
if(CMAKE_BUILD_TYPE)
set(postfix ${${PROJECT_NAME}_VERSION_MAJOR})
string(TOUPPER ${CMAKE_BUILD_TYPE} UPPER_BUILD_TYPE)
if(${UPPER_BUILD_TYPE} MATCHES "^DEBUG")
string(CONCAT postfix ${postfix} "d")
set_target_properties(kddockwidgets PROPERTIES DEBUG_POSTFIX ${postfix})
else()
set_target_properties(kddockwidgets PROPERTIES ${UPPER_BUILD_TYPE}_POSTFIX ${postfix})
if(CMAKE_BUILD_TYPE)
set(postfix ${${PROJECT_NAME}_VERSION_MAJOR})
string(TOUPPER ${CMAKE_BUILD_TYPE} UPPER_BUILD_TYPE)
if(${UPPER_BUILD_TYPE} MATCHES "^DEBUG")
string(CONCAT postfix ${postfix} "d")
set_target_properties(kddockwidgets PROPERTIES DEBUG_POSTFIX ${postfix})
else()
set_target_properties(kddockwidgets PROPERTIES ${UPPER_BUILD_TYPE}_POSTFIX ${postfix})
endif()
elseif(CMAKE_CONFIGURATION_TYPES)
# Visual Studio generator
set_target_properties(kddockwidgets PROPERTIES DEBUG_POSTFIX d)
endif()
elseif(CMAKE_CONFIGURATION_TYPES)
# Visual Studio generator
set_target_properties(kddockwidgets PROPERTIES DEBUG_POSTFIX d)
endif()
endif()
install(TARGETS kddockwidgets
EXPORT kddockwidgetsTargets
RUNTIME DESTINATION ${INSTALL_RUNTIME_DIR}
LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}
ARCHIVE DESTINATION ${INSTALL_ARCHIVE_DIR}
install(
TARGETS kddockwidgets
EXPORT kddockwidgetsTargets
RUNTIME DESTINATION ${INSTALL_RUNTIME_DIR}
LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}
ARCHIVE DESTINATION ${INSTALL_ARCHIVE_DIR}
)
if(MSVC AND NOT ${PROJECT_NAME}_STATIC)
install(FILES "$<TARGET_PDB_FILE_DIR:kddockwidgets>/$<TARGET_PDB_FILE_NAME:kddockwidgets>" DESTINATION ${INSTALL_LIBRARY_DIR} CONFIGURATIONS Debug RelWithDebInfo)
install(
FILES "$<TARGET_PDB_FILE_DIR:kddockwidgets>/$<TARGET_PDB_FILE_NAME:kddockwidgets>"
DESTINATION ${INSTALL_LIBRARY_DIR}
CONFIGURATIONS Debug RelWithDebInfo
)
endif()
install(FILES ${camelcase_HEADERS} DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets)
install(FILES ${DOCKS_INSTALLABLE_INCLUDES} DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets)
install(FILES ${DOCKS_INSTALLABLE_PRIVATE_INCLUDES} DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets/private)
install(FILES private/multisplitter/Item_p.h DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets/private/multisplitter)
install(FILES private/multisplitter/Widget.h DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets/private/multisplitter)
install(FILES private/multisplitter/Separator_p.h DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets/private/multisplitter)
install(FILES private/indicators/ClassicIndicators_p.h DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets/private/indicators)
install(FILES private/indicators/SegmentedIndicators_p.h DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets/private/indicators)
install(FILES private/multisplitter/Item_p.h
DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets/private/multisplitter
)
install(FILES private/multisplitter/Widget.h
DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets/private/multisplitter
)
install(FILES private/multisplitter/Separator_p.h
DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets/private/multisplitter
)
install(FILES private/indicators/ClassicIndicators_p.h
DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets/private/indicators
)
install(FILES private/indicators/SegmentedIndicators_p.h
DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets/private/indicators
)
if(KDDockWidgets_QTQUICK)
install(FILES ${DOCKS_INSTALLABLE_PRIVATE_QUICK_INCLUDES} DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets/private/quick)
install(FILES private/multisplitter/Separator_quick.h DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets/private/multisplitter)
install(FILES private/multisplitter/Widget_quick.h DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets/private/multisplitter)
install(FILES ${DOCKS_INSTALLABLE_PRIVATE_QUICK_INCLUDES}
DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets/private/quick
)
install(FILES private/multisplitter/Separator_quick.h
DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets/private/multisplitter
)
install(FILES private/multisplitter/Widget_quick.h
DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets/private/multisplitter
)
else()
install(FILES ${DOCKS_INSTALLABLE_PRIVATE_WIDGET_INCLUDES} DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets/private/widgets)
install(FILES private/multisplitter/Separator_qwidget.h DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets/private/multisplitter)
install(FILES private/multisplitter/Widget_qwidget.h DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets/private/multisplitter)
install(FILES ${DOCKS_INSTALLABLE_PRIVATE_WIDGET_INCLUDES}
DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets/private/widgets
)
install(FILES private/multisplitter/Separator_qwidget.h
DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets/private/multisplitter
)
install(FILES private/multisplitter/Widget_qwidget.h
DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets/private/multisplitter
)
endif()
# Generate library version files
include(ECMSetupVersion)
ecm_setup_version(
${${PROJECT_NAME}_VERSION}
VARIABLE_PREFIX KDDOCKWIDGETS
VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/kddockwidgets_version.h"
PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets${KDDockWidgets_LIBRARY_QTID}ConfigVersion.cmake"
SOVERSION ${${PROJECT_NAME}_SOVERSION}
COMPATIBILITY AnyNewerVersion
${${PROJECT_NAME}_VERSION}
VARIABLE_PREFIX
KDDOCKWIDGETS
VERSION_HEADER
"${CMAKE_CURRENT_BINARY_DIR}/kddockwidgets_version.h"
PACKAGE_VERSION_FILE
"${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets${KDDockWidgets_LIBRARY_QTID}ConfigVersion.cmake"
SOVERSION
${${PROJECT_NAME}_SOVERSION}
COMPATIBILITY
AnyNewerVersion
)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/kddockwidgets_version.h" DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets)
install(EXPORT kddockwidgetsTargets
FILE KDDockWidgets${KDDockWidgets_LIBRARY_QTID}Targets.cmake
NAMESPACE KDAB::
DESTINATION ${INSTALL_LIBRARY_DIR}/cmake/KDDockWidgets${KDDockWidgets_LIBRARY_QTID}
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/kddockwidgets_version.h"
DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets
)
install(
EXPORT kddockwidgetsTargets
FILE KDDockWidgets${KDDockWidgets_LIBRARY_QTID}Targets.cmake
NAMESPACE KDAB::
DESTINATION ${INSTALL_LIBRARY_DIR}/cmake/KDDockWidgets${KDDockWidgets_LIBRARY_QTID}
)
configure_file(KDDockWidgetsConfig.cmake.in KDDockWidgets${KDDockWidgets_LIBRARY_QTID}Config.cmake @ONLY)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets${KDDockWidgets_LIBRARY_QTID}Config.cmake"
@@ -386,14 +425,14 @@ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets${KDDockWidgets_LIBRARY_
)
if(${PROJECT_NAME}_DEVELOPER_MODE)
# Under developer mode since kddw might be a sub-folder of a project setting a different value for QT_DISABLE_DEPRECATED_BEFORE
target_compile_definitions(kddockwidgets PRIVATE QT_DISABLE_DEPRECATED_BEFORE=0x060000)
# Under developer mode since kddw might be a sub-folder of a project
# setting a different value for QT_DISABLE_DEPRECATED_BEFORE
target_compile_definitions(kddockwidgets PRIVATE QT_DISABLE_DEPRECATED_BEFORE=0x060000)
option(KDDockWidgets_LINTER "Build the layout linter" ON)
if(NOT ${PROJECT_NAME}_QTQUICK AND KDDockWidgets_LINTER) # TODO: We can support it
add_executable(kddockwidgets_linter layoutlinter_main.cpp)
target_link_libraries(kddockwidgets_linter kddockwidgets Qt${Qt_VERSION_MAJOR}::Widgets)
endif()
option(KDDockWidgets_LINTER "Build the layout linter" ON)
if(NOT ${PROJECT_NAME}_QTQUICK AND KDDockWidgets_LINTER) # TODO: We can support it
add_executable(kddockwidgets_linter layoutlinter_main.cpp)
target_link_libraries(kddockwidgets_linter kddockwidgets Qt${Qt_VERSION_MAJOR}::Widgets)
endif()
endif()

View File

@@ -19,6 +19,7 @@
#include "Config.h"
#include "private/multisplitter/MultiSplitterConfig.h"
#include "private/multisplitter/Widget.h"
#include "private/multisplitter/Item_p.h"
#include "private/DockRegistry_p.h"
#include "private/Utils_p.h"
#include "private/DragController_p.h"
@@ -54,6 +55,7 @@ public:
DockWidgetFactoryFunc m_dockWidgetFactoryFunc = nullptr;
MainWindowFactoryFunc m_mainWindowFactoryFunc = nullptr;
TabbingAllowedFunc m_tabbingAllowedFunc = nullptr;
DropIndicatorAllowedFunc m_dropIndicatorAllowedFunc = nullptr;
FrameworkWidgetFactory *m_frameworkWidgetFactory = nullptr;
Flags m_flags = Flag_Default;
InternalFlags m_internalFlags = InternalFlag_None;
@@ -180,6 +182,16 @@ TabbingAllowedFunc Config::tabbingAllowedFunc() const
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)
{
if (!DockRegistry::self()->isEmpty(/*excludeBeingDeleted=*/false)) {

View File

@@ -20,6 +20,7 @@
#define KD_DOCKWIDGETS_CONFIG_H
#include "docks_export.h"
#include "KDDockWidgets.h"
#include <qglobal.h>
@@ -33,10 +34,29 @@ namespace KDDockWidgets {
class DockWidgetBase;
class MainWindowBase;
class FrameworkWidgetFactory;
class DropArea;
typedef KDDockWidgets::DockWidgetBase *(*DockWidgetFactoryFunc)(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 outer 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
/// @param dropArea The target drop area. Can belong to a MainWindow or a FloatingWindow.
/// @return true if the docking is allowed.
/// @sa setDropIndicatorAllowedFunc
typedef bool (*DropIndicatorAllowedFunc)(DropLocation location,
const QVector<DockWidgetBase *> &source,
const QVector<DockWidgetBase *> &target,
DropArea *dropArea);
/// @deprecated Use DropIndicatorAllowedFunc instead.
/// @brief Function to allow the user more granularity to disallow dock widgets to tab together
/// @param source The dock widgets being dragged
/// @param target The dock widgets within an existing docked tab group
@@ -64,8 +84,7 @@ public:
///@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_NativeTitleBar = 1, ///< Enables the Native OS title bar on OSes that support it (Windows 10, macOS), ignored otherwise.
Flag_AeroSnapWithClientDecos = 2, ///< Deprecated. This is now default and cannot be turned off. Moving a window on Windows 10 uses native moving, as that works well across screens with different HDPI settings. There's no reason to use manual client/Qt window moving.
@@ -82,7 +101,7 @@ public:
Flag_TitleBarHasMinimizeButton = 0x2000 | Flag_DontUseUtilityFloatingWindows, ///< The title bar will have a minimize button when floating. This implies Flag_DontUseUtilityFloatingWindows too, otherwise they wouldn't appear in the task bar.
Flag_TitleBarNoFloatButton = 0x4000, ///< The TitleBar won't show the float button
Flag_AutoHideSupport = 0x8000 | Flag_TitleBarNoFloatButton, ///< Supports minimizing dock widgets to the side-bar.
///< By default it also turns off the float button, but you can remove Flag_TitleBarNoFloatButton to have both.
///< By default it also turns off the float button, but you can remove Flag_TitleBarNoFloatButton to have both.
Flag_KeepAboveIfNotUtilityWindow = 0x10000, ///< Only meaningful if Flag_DontUseUtilityFloatingWindows is set. If floating windows are normal windows, you might still want them to keep above and not minimize when you focus the main window.
Flag_CloseOnlyCurrentTab = 0x20000, ///< The TitleBar's close button will only close the current tab, instead of all of them
Flag_ShowButtonsOnTabBarIfTitleBarHidden = 0x40000, ///< When using Flag_HideTitleBarWhenTabsVisible the close/float buttons disappear with the title bar. With Flag_ShowButtonsOnTabBarIfHidden they'll be shown in the tab bar.
@@ -92,8 +111,7 @@ public:
Q_DECLARE_FLAGS(Flags, Flag)
///@brief List of customizable widgets
enum CustomizableWidget
{
enum CustomizableWidget {
CustomizableWidget_None = 0, ///< None
CustomizableWidget_TitleBar, ///< The title bar
CustomizableWidget_DockWidget, ///< The dock widget
@@ -106,10 +124,9 @@ public:
Q_DECLARE_FLAGS(CustomizableWidgets, CustomizableWidget)
///@internal
///Internal flags for additional tuning.
/// Internal flags for additional tuning.
///@warning Not for public consumption, support will be limited.
enum InternalFlag
{
enum InternalFlag {
InternalFlag_None = 0, ///< The default
InternalFlag_NoAeroSnap = 1, ///< Only for development. Disables Aero-snap.
InternalFlag_DontUseParentForFloatingWindows = 2, ///< FloatingWindows won't have a parent top-level.
@@ -127,8 +144,8 @@ public:
///@brief setter for the flags
///@param flags the flags to set
///Not all flags are guaranteed to be set, as the OS might not supported them
///Call @ref flags() after the setter if you need to know what was really set
/// Not all flags are guaranteed to be set, as the OS might not supported them
/// Call @ref flags() after the setter if you need to know what was really set
void setFlags(Flags flags);
/**
@@ -147,7 +164,7 @@ public:
void setDockWidgetFactoryFunc(DockWidgetFactoryFunc);
///@brief Returns the DockWidgetFactoryFunc.
///nullptr by default
/// nullptr by default
DockWidgetFactoryFunc dockWidgetFactoryFunc() const;
///@brief counter-part of DockWidgetFactoryFunc but for the main window.
@@ -156,7 +173,7 @@ public:
void setMainWindowFactoryFunc(MainWindowFactoryFunc);
///@brief Returns the MainWindowFactoryFunc.
///nullptr by default
/// nullptr by default
MainWindowFactoryFunc mainWindowFactoryFunc() const;
/**
@@ -182,15 +199,15 @@ public:
int separatorThickness() const;
///@brief setter for @ref separatorThickness
///Note: Only use this function at startup before creating any DockWidget or MainWindow.
/// Note: Only use this function at startup before creating any DockWidget or MainWindow.
void setSeparatorThickness(int value);
///@brief sets the dragged window opacity
///1.0 is fully opaque while 0.0 is fully transparent
/// 1.0 is fully opaque while 0.0 is fully transparent
void setDraggedWindowOpacity(qreal opacity);
///@brief returns the opacity to use when dragging dock widgets
///By default it's 1.0, fully opaque
/// By default it's 1.0, fully opaque
qreal draggedWindowOpacity() const;
/// @brief Allows to disable support for drop indicators while dragging
@@ -203,6 +220,8 @@ public:
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.
*
* Whenever the user tries to tab two widgets together, the framework will call @p func. If
@@ -218,17 +237,51 @@ public:
* {
* // disallows dockFoo to be tabbed with dockBar.
* return !(source.contains(dockFoo) && target.contains(dockBar));
* }
* };
*
* KDDockWidgets::Config::self().setTabbingAllowedFunc(func);
*
* @endcode
* KDDockWidgets::Config::self()->setTabbingAllowedFunc(func);
*/
void setTabbingAllowedFunc(TabbingAllowedFunc func);
///@brief Used internally by the framework. Returns the function which was passed to setTabbingAllowedFunc()
///By default it's nullptr.
/// By default it's nullptr.
///@sa setTabbingAllowedFunc().
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 outer 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,
* KDDockWidgets::DropArea *)
* {
* // disallows dockFoo to be docked to outer 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.
/// Widgets can still provide their own min-size and it will be respected, however it can never be
/// smaller than this one.

View File

@@ -180,7 +180,7 @@ bool DockWidgetBase::setFloating(bool floats)
{
const bool alreadyFloating = isFloating();
if ((floats && alreadyFloating) || (!floats && !alreadyFloating))
if (floats == alreadyFloating)
return true; // Nothing to do
if (!floats && (Config::self().internalFlags() & Config::InternalFlag_DontShowWhenUnfloatingHiddenWindow) && !isVisible()) {
@@ -205,10 +205,10 @@ bool DockWidgetBase::setFloating(bool floats)
frame->detachTab(this);
} else {
d->frame()->titleBar()->makeWindow();
titleBar()->makeWindow();
}
auto lastGeo = d->lastPositions().lastFloatingGeometry();
auto lastGeo = d->lastPosition()->lastFloatingGeometry();
if (lastGeo.isValid()) {
if (auto fw = floatingWindow())
fw->setSuggestedGeometry(lastGeo, SuggestedGeometryHint_PreserveCenter);
@@ -237,6 +237,17 @@ QString DockWidgetBase::uniqueName() 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;
}
@@ -317,6 +328,14 @@ int DockWidgetBase::tabIndex() const
return 0;
}
int DockWidgetBase::currentTabIndex() const
{
if (Frame *frame = d->frame())
return frame->currentTabIndex();
return 0;
}
void DockWidgetBase::setIcon(const QIcon &icon, IconPlaces places)
{
if (places & IconPlace::TitleBar)
@@ -370,7 +389,7 @@ QStringList DockWidgetBase::affinities() const
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.
// This reduces flickering on some platforms
d->morphIntoFloatingWindow();
@@ -465,7 +484,7 @@ bool DockWidgetBase::isInSideBar() const
bool DockWidgetBase::hasPreviousDockedLocation() const
{
return d->m_lastPositions.isValid();
return d->m_lastPosition->isValid();
}
QSize DockWidgetBase::lastOverlayedSize() const
@@ -488,7 +507,7 @@ void DockWidgetBase::setFloatingGeometry(QRect geometry)
if (isOpen() && isFloating()) {
window()->setGeometry(geometry);
} else {
d->m_lastPositions.setLastFloatingGeometry(geometry);
d->m_lastPosition->setLastFloatingGeometry(geometry);
}
}
@@ -498,7 +517,7 @@ FloatingWindow *DockWidgetBase::Private::morphIntoFloatingWindow()
return fw; // Nothing to do
if (q->isWindow()) {
QRect geo = m_lastPositions.lastFloatingGeometry();
QRect geo = m_lastPosition->lastFloatingGeometry();
if (geo.isNull()) {
geo = q->geometry();
@@ -532,8 +551,74 @@ void DockWidgetBase::Private::maybeMorphIntoFloatingWindow()
MDILayoutWidget *DockWidgetBase::Private::mdiLayout() const
{
if (auto mw = mainWindow())
return mw->mdiLayoutWidget();
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)) {
// 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;
}
@@ -603,7 +688,7 @@ void DockWidgetBase::Private::updateFloatAction()
QScopedValueRollback<bool> recursionGuard(m_updatingFloatAction, true); // Guard against recursiveness
if (q->isFloating()) {
floatAction->setEnabled(m_lastPositions.isValid());
floatAction->setEnabled(m_lastPosition->isValid());
floatAction->setChecked(true);
floatAction->setToolTip(tr("Dock"));
} else {
@@ -646,7 +731,7 @@ void DockWidgetBase::Private::close()
&& q->isVisible()) { // only user-closing is interesting to save the geometry
// We check for isVisible so we don't save geometry if you call close() on an already closed
// dock widget
m_lastPositions.setLastFloatingGeometry(q->window()->geometry());
m_lastPosition->setLastFloatingGeometry(q->window()->geometry());
}
saveTabIndex();
@@ -669,14 +754,14 @@ void DockWidgetBase::Private::close()
bool DockWidgetBase::Private::restoreToPreviousPosition()
{
if (!m_lastPositions.isValid())
if (!m_lastPosition->isValid())
return false;
Layouting::Item *item = m_lastPositions.lastItem();
Layouting::Item *item = m_lastPosition->lastItem();
LayoutWidget *layout = DockRegistry::self()->layoutForItem(item);
Q_ASSERT(layout);
layout->restorePlaceholder(q, item, m_lastPositions.lastTabIndex());
layout->restorePlaceholder(q, item, m_lastPosition->lastTabIndex());
return true;
}
@@ -684,14 +769,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.
if (!m_lastPositions.isValid())
if (!m_lastPosition->isValid())
return;
Layouting::Item *layoutItem = m_lastPositions.lastItem();
Layouting::Item *layoutItem = m_lastPosition->lastItem();
if (!layoutItem)
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
Frame *frame = this->frame();
@@ -721,7 +806,7 @@ int DockWidgetBase::Private::currentTabIndex() const
void DockWidgetBase::Private::saveTabIndex()
{
m_lastPositions.saveTabIndex(currentTabIndex(), q->isFloating());
m_lastPosition->saveTabIndex(currentTabIndex(), q->isFloating());
}
void DockWidgetBase::Private::show()
@@ -826,14 +911,26 @@ int DockWidgetBase::userType() const
void DockWidgetBase::setMDIPosition(QPoint pos)
{
if (MDILayoutWidget *layout = d->mdiLayout())
layout->moveDockWidget(this, pos);
if (MDILayoutWidget *layout = d->mdiLayout()) {
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)
{
if (MDILayoutWidget *layout = d->mdiLayout())
layout->resizeDockWidget(this, size);
if (MDILayoutWidget *layout = d->mdiLayout()) {
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)
@@ -883,8 +980,8 @@ DockWidgetBase::Private::Private(const QString &dockName, DockWidgetBase::Option
q->connect(toggleAction, &QAction::toggled, q, [this](bool enabled) {
if (!m_updatingToggleAction) { // guard against recursiveness
toggleAction->blockSignals(true); // and don't emit spurious toggle. Like when a dock
// widget is inserted into a tab widget it might get
// hide events, ignore those. The Dock Widget is open.
// widget is inserted into a tab widget it might get
// hide events, ignore those. The Dock Widget is open.
m_processingToggleAction = true;
toggle(enabled);
toggleAction->blockSignals(false);
@@ -917,12 +1014,12 @@ DockWidgetBase::Private::Private(const QString &dockName, DockWidgetBase::Option
void DockWidgetBase::Private::addPlaceholderItem(Layouting::Item *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
@@ -940,6 +1037,6 @@ void DockWidgetBase::Private::saveLastFloatingGeometry()
{
if (q->isFloating() && q->isVisible()) {
// It's getting docked, save last floating position
lastPositions().setLastFloatingGeometry(q->window()->geometry());
lastPosition()->setLastFloatingGeometry(q->window()->geometry());
}
}

View File

@@ -53,7 +53,7 @@ class LayoutWidget;
*
* Do not use instantiate directly in user code. Use DockWidget instead.
*/
#ifndef PYTHON_BINDINGS //Pyside bug: https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-1327
#ifndef PYTHON_BINDINGS // Pyside bug: https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-1327
class DOCKS_EXPORT DockWidgetBase : public QWidgetAdapter
#else
class DOCKS_EXPORT DockWidgetBase : public QWidget
@@ -71,26 +71,26 @@ public:
typedef QVector<DockWidgetBase *> List;
///@brief DockWidget options to pass at construction time
enum Option
{
enum Option {
Option_None = 0, ///< No option, the default
Option_NotClosable = 1, ///< The DockWidget can't be closed on the [x], only programmatically
Option_NotDockable = 2, ///< The DockWidget can't be docked, it's always floating
Option_DeleteOnClose = 4 ///< Deletes the DockWidget when closed
Option_DeleteOnClose = 4, ///< Deletes the DockWidget when closed
Option_MDINestable = 8 ///< EXPERIMENTAL. When this dock widget is being shown in a MDI area it will also allow other dock widgets to be dropped to its sides and tabbed
/// Usually Each MDI "window" corresponds to one DockWidget, with this option each "window" will have a layout with 1 or more dock widgets
/// Run "kddockwidgets_mdi_with_docking_example -n" to see it in action
};
Q_DECLARE_FLAGS(Options, Option)
Q_ENUM(Options);
/// @brief Options which will affect LayoutSaver save/restore
enum class LayoutSaverOption
{
enum class LayoutSaverOption {
None = 0, ///< Just use the defaults
Skip = 1, ///< The dock widget won't participate in save/restore. Currently only available for floating windows.
};
Q_DECLARE_FLAGS(LayoutSaverOptions, LayoutSaverOption)
enum class IconPlace
{
enum class IconPlace {
TitleBar = 1,
TabBar = 2,
ToggleAction = 4,
@@ -263,12 +263,18 @@ public:
*/
Q_INVOKABLE void setAsCurrentTab();
/**
* @brief Returns which tab index this dock widget occupies in the tab widget it's contained in
* @brief Returns the tab index this dock widget occupies
* Note that dock widgets are almost always tabbed, even if you don't see the tab bar.
* A single floating dock widget is still tabbed on a tab widget with a single tab.
*/
int tabIndex() const;
/**
* @brief Returns the index of the current tab of the tab group this dock widget is in.
*/
int currentTabIndex() const;
/**
* @brief Sets an icon to show on title bars and tab bars.
* @param places Specifies where the icon will be shown (TitleBar, TabBar, ToggleAction, or All)
@@ -374,8 +380,8 @@ public:
MainWindowBase *mainWindow() const;
///@brief Returns whether This or any child of this dock widget is focused
///Not to be confused with QWidget::hasFocus(), which just refers to 1 widget. This includes
///variant includes children.
/// Not to be confused with QWidget::hasFocus(), which just refers to 1 widget. This includes
/// variant includes children.
///@sa isFocusedChanged()
bool isFocused() const;
@@ -435,9 +441,9 @@ public:
void setFloatingGeometry(QRect geo);
///@brief Allows the user to set a type on this dock widget
///The type is opaque and will not be interpreted by KDDockWidgets.
///This type is passed to FrameWorkWidgetFactory::createTitleBar(), which the user can override
///and return different TitleBar subclasses, depending on the type.
/// The type is opaque and will not be interpreted by KDDockWidgets.
/// This type is passed to FrameWorkWidgetFactory::createTitleBar(), which the user can override
/// and return different TitleBar subclasses, depending on the type.
void setUserType(int userType);
int userType() const;
@@ -451,7 +457,7 @@ public:
void setMDIZ(int z);
///@brief Returns whether this dock widget is the main window persistent central widget
///This only applies when using MainWindowOption_HasCentralWidget
/// This only applies when using MainWindowOption_HasCentralWidget
bool isPersistentCentralDockWidget() const;
Q_SIGNALS:
@@ -493,12 +499,12 @@ Q_SIGNALS:
void isFloatingChanged(bool);
///@brief emitted when this dock widget is removed from a side-bar.
///Only relevant for the auto-hide/sidebar feature
/// Only relevant for the auto-hide/sidebar feature
void removedFromSideBar();
///@brief Emitted when the top-level window this dock widget is in is activated or deactivated
///This is convenience to replace tracking dockWidget->window(), since the window changes when
///docking and undocking
/// This is convenience to replace tracking dockWidget->window(), since the window changes when
/// docking and undocking
///
/// It's called 'aboutTo' because it's done in an event filter and the target window doesn't
/// have it's 'activeWindow' property updated yet at this point.
@@ -515,7 +521,7 @@ protected:
void onShown(bool spontaneous);
void onHidden(bool spontaneous);
#ifndef PYTHON_BINDINGS //Pyside bug: https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-1327
#ifndef PYTHON_BINDINGS // Pyside bug: https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-1327
void onCloseEvent(QCloseEvent *e) override;
bool onResize(QSize newSize) override;
#endif
@@ -529,6 +535,7 @@ private:
friend class MultiSplitter;
friend class LayoutWidget;
friend class MDILayoutWidget;
friend class FloatingWindow;
friend class Frame;
friend class DropArea;
friend class ::TestDocks;

View File

@@ -30,7 +30,7 @@
using namespace KDDockWidgets;
// Our Private inherits from QObject since FocusScope can't (Since Frame is already QObject)
class FocusScope::Private : public QObject //clazy:exclude=missing-qobject-macro (breaks unity build with earlier cmake due to including .moc here.)
class FocusScope::Private : public QObject // clazy:exclude=missing-qobject-macro (breaks unity build with earlier cmake due to including .moc here.)
{
public:
Private(FocusScope *qq, QWidgetAdapter *thisWidget)

View File

@@ -33,13 +33,13 @@ public:
virtual ~FocusScope();
///@brief Returns true if this FocusScope is focused.
///This is similar to the QWidget::hasFocus(), except that it counts with the children being focused too.
///i.e: If any child is focused then this FocusScope has focus too.
/// This is similar to the QWidget::hasFocus(), except that it counts with the children being focused too.
/// i.e: If any child is focused then this FocusScope has focus too.
bool isFocused() const;
///@brief Returns the widget that's focused in this scope
///The widget itself might not have focus as in QWidget::hasFocus(), but will get actual focus
///as soon as this scope is focused.
/// The widget itself might not have focus as in QWidget::hasFocus(), but will get actual focus
/// as soon as this scope is focused.
WidgetType *focusedWidget() const;
///@brief Sets focus on this scope.

View File

@@ -75,9 +75,9 @@ TabBar *DefaultWidgetFactory::createTabBar(TabWidget *parent) const
return new TabBarWidget(parent);
}
TabWidget *DefaultWidgetFactory::createTabWidget(Frame *parent) const
TabWidget *DefaultWidgetFactory::createTabWidget(Frame *parent, TabWidgetOptions options) const
{
return new TabWidgetWidget(parent);
return new TabWidgetWidget(parent, options);
}
Layouting::Separator *DefaultWidgetFactory::createSeparator(Layouting::Widget *parent) const
@@ -189,7 +189,7 @@ TabBar *DefaultWidgetFactory::createTabBar(TabWidget *parent) const
return new TabBarQuick(parent);
}
TabWidget *DefaultWidgetFactory::createTabWidget(Frame *parent) const
TabWidget *DefaultWidgetFactory::createTabWidget(Frame *parent, TabWidgetOptions) const
{
return new TabWidgetQuick(parent);
}

View File

@@ -97,7 +97,7 @@ public:
///@brief Called internally by the framework to create a TabWidget
/// Override to provide your own TabWidget sub-class.
///@param parent Just forward to TabWidget's constructor.
virtual TabWidget *createTabWidget(Frame *parent) const = 0;
virtual TabWidget *createTabWidget(Frame *parent, TabWidgetOptions options = TabWidgetOption_None) const = 0;
///@brief Called internally by the framework to create a TabBar
/// Override to provide your own TabBar sub-class.
@@ -129,7 +129,7 @@ public:
virtual DropIndicatorOverlayInterface *createDropIndicatorOverlay(DropArea *dropArea) const = 0;
///@brief Called internally by the framework to create a RubberBand to show as drop zone
///Returns a rubber band
/// Returns a rubber band
virtual QWidgetOrQuick *createRubberBand(QWidgetOrQuick *parent) const = 0;
///@brief Called internally by the framework to create a SideBar
@@ -167,7 +167,7 @@ public:
Frame *createFrame(QWidgetOrQuick *parent, FrameOptions) const override;
TitleBar *createTitleBar(Frame *) const override;
TitleBar *createTitleBar(FloatingWindow *) const override;
TabWidget *createTabWidget(Frame *parent) const override;
TabWidget *createTabWidget(Frame *parent, TabWidgetOptions = TabWidgetOption_None) const override;
TabBar *createTabBar(TabWidget *parent) const override;
Layouting::Separator *createSeparator(Layouting::Widget *parent = nullptr) const override;
FloatingWindow *createFloatingWindow(MainWindowBase *parent = nullptr) const override;

View File

@@ -41,8 +41,7 @@ Q_NAMESPACE
class MultiSplitter;
class DropArea;
enum Location
{
enum Location {
Location_None,
Location_OnLeft, ///> Left docking location
Location_OnTop, ///> Top docking location
@@ -51,23 +50,21 @@ enum Location
};
Q_ENUM_NS(Location)
enum MainWindowOption
{
enum MainWindowOption {
MainWindowOption_None = 0, ///> No option set
MainWindowOption_HasCentralFrame = 1, ///> Makes the MainWindow always have a central frame, for tabbing documents
MainWindowOption_MDI = 2, ///> The layout will be MDI. DockWidgets can have arbitrary positions, not restricted by any layout
MainWindowOption_HasCentralWidget = 4 | MainWindowOption_HasCentralFrame, ///> Similar to MainWindowOption_HasCentralFrame but
///> you'll have a central widget which can't be detached (Similar to regular QMainWindow).
///> you'll have a central widget which can't be detached (Similar to regular QMainWindow). @sa MainWindowBase::setPersistentCentralWidget()
};
Q_DECLARE_FLAGS(MainWindowOptions, MainWindowOption)
Q_ENUM_NS(MainWindowOptions)
///@internal
///@brief Describes some sizing strategies for the layouting engine.
///This is internal. The public API for dealing with sizing is InitialOption.
/// This is internal. The public API for dealing with sizing is InitialOption.
///@sa InitialOption
enum class DefaultSizeMode
{
enum class DefaultSizeMode {
ItemSize, ///< Simply uses the Item::size() of the item being added. Actual used size might be smaller if our window isn't big enough.
Fair, ///< Gives an equal relative size as the items that are already in the layout
FairButFloor, ///< Equal to fair, but if the item we're adding is smaller than the fair suggestion, then that small size is used.
@@ -76,31 +73,30 @@ enum class DefaultSizeMode
Q_ENUM_NS(DefaultSizeMode)
///@brief Only here for source-compat with v1.2. Do not use.
///Use InitialVisibilityOption instead.
enum AddingOption
{
/// Use InitialVisibilityOption instead.
enum AddingOption {
AddingOption_None = 0,
AddingOption_StartHidden
};
Q_ENUM_NS(AddingOption)
enum class InitialVisibilityOption
{
enum class InitialVisibilityOption {
StartVisible = 0, ///< The dock widget is made visible when docked
StartHidden ///< Don't show the dock widget when adding it
StartHidden, ///< Don't show the dock widget when adding it
PreserveCurrentTab ///< When adding as tabbed, don't change the current index
};
Q_ENUM_NS(InitialVisibilityOption)
/**
* @brief Struct describing the preferred dock widget size and visibility when adding it to a layout
*
* You can pass this to MainWindowBase::addDockWidget() to give an hint of your preferred size
* and visibility.
*
* See below the documentation for InitialOption::visibility and InitialOption::preferredSize.
*
* @sa MainWindowBase::addDockWidget()
*/
* @brief Struct describing the preferred dock widget size and visibility when adding it to a layout
*
* You can pass this to MainWindowBase::addDockWidget() to give an hint of your preferred size
* and visibility.
*
* See below the documentation for InitialOption::visibility and InitialOption::preferredSize.
*
* @sa MainWindowBase::addDockWidget()
*/
struct InitialOption
{
// Implicit ctors for convenience:
@@ -135,6 +131,11 @@ struct InitialOption
return visibility == InitialVisibilityOption::StartHidden;
}
bool preservesCurrentTab() const
{
return visibility == InitialVisibilityOption::PreserveCurrentTab;
}
int preferredLength(Qt::Orientation o) const
{
return o == Qt::Horizontal ? preferredSize.width()
@@ -147,22 +148,22 @@ struct InitialOption
}
/**
* @brief Allows a dock widget to be docked as hidden.
*
* Next time you call DockWidget::show() it will be shown at that place. This avoids
* flickering, as no show()/hide() workarounds are needed.
*/
* @brief Allows a dock widget to be docked as hidden.
*
* Next time you call DockWidget::show() it will be shown at that place. This avoids
* flickering, as no show()/hide() workarounds are needed.
*/
InitialVisibilityOption visibility = InitialVisibilityOption::StartVisible;
/**
* @brief Allows to control the size a dock widget should get when docked.
*
* If an invalid or empty size is passed then KDDW's default heuristics are applied.
*
* Note that usually only the width or the height will be honoured: For example, when adding a
* dock widget to the left then only the preferred width will be taken into account, as the
* height will simply fill the whole layout.
*/
* @brief Allows to control the size a dock widget should get when docked.
*
* If an invalid or empty size is passed then KDDW's default heuristics are applied.
*
* Note that usually only the width or the height will be honoured: For example, when adding a
* dock widget to the left then only the preferred width will be taken into account, as the
* height will simply fill the whole layout.
*/
QSize preferredSize;
private:
@@ -179,17 +180,15 @@ private:
DefaultSizeMode sizeMode = DefaultSizeMode::Fair;
};
enum RestoreOption
{
enum RestoreOption {
RestoreOption_None = 0,
RestoreOption_RelativeToMainWindow = 1, ///< Skips restoring the main window geometry and the restored dock widgets will use relative sizing.
///< Loading layouts won't change the main window geometry and just use whatever the user has at the moment.
///< Loading layouts won't change the main window geometry and just use whatever the user has at the moment.
};
Q_DECLARE_FLAGS(RestoreOptions, RestoreOption)
Q_ENUM_NS(RestoreOptions)
enum class DropIndicatorType
{
enum class DropIndicatorType {
Classic, ///< The default
Segmented, ///< Segmented indicators
None ///< Don't show any drop indicators while dragging
@@ -197,8 +196,7 @@ enum class DropIndicatorType
Q_ENUM_NS(DropIndicatorType)
///@internal
enum SuggestedGeometryHint
{
enum SuggestedGeometryHint {
SuggestedGeometryHint_None,
SuggestedGeometryHint_PreserveCenter = 1,
SuggestedGeometryHint_GeometryIsFromDocked = 2
@@ -207,8 +205,7 @@ Q_DECLARE_FLAGS(SuggestedGeometryHints, SuggestedGeometryHint)
Q_ENUM_NS(SuggestedGeometryHint)
/// @brief Each main window supports 4 sidebars
enum class SideBarLocation
{
enum class SideBarLocation {
None,
North,
East,
@@ -217,8 +214,7 @@ enum class SideBarLocation
};
///@brief describes a type of button you can have in the title bar
enum class TitleBarButtonType
{
enum class TitleBarButtonType {
Close,
Float,
Minimize,
@@ -229,6 +225,25 @@ enum class TitleBarButtonType
};
Q_ENUM_NS(TitleBarButtonType)
///@brief Enum describing the different drop indicator types
enum DropLocation {
DropLocation_None = 0,
DropLocation_Left = 1,
DropLocation_Top = 2,
DropLocation_Right = 4,
DropLocation_Bottom = 8,
DropLocation_Center = 16,
DropLocation_OutterLeft = 32,
DropLocation_OutterTop = 64,
DropLocation_OutterRight = 128,
DropLocation_OutterBottom = 256,
DropLocation_Inner = DropLocation_Left | DropLocation_Right | DropLocation_Top | DropLocation_Bottom,
DropLocation_Outter = DropLocation_OutterLeft | DropLocation_OutterRight | DropLocation_OutterTop | DropLocation_OutterBottom,
DropLocation_Horizontal = DropLocation_Left | DropLocation_Right | DropLocation_OutterLeft | DropLocation_OutterRight,
DropLocation_Vertical = DropLocation_Top | DropLocation_Bottom | DropLocation_OutterTop | DropLocation_OutterBottom
};
Q_ENUM_NS(DropLocation)
///@internal
inline Qt5Qt6Compat::qhashtype qHash(SideBarLocation loc, Qt5Qt6Compat::qhashtype seed)
{
@@ -236,8 +251,7 @@ inline Qt5Qt6Compat::qhashtype qHash(SideBarLocation loc, Qt5Qt6Compat::qhashtyp
}
///@internal
enum CursorPosition
{
enum CursorPosition {
CursorPosition_Undefined = 0,
CursorPosition_Left = 1,
CursorPosition_Right = 2,
@@ -254,9 +268,9 @@ enum CursorPosition
Q_DECLARE_FLAGS(CursorPositions, CursorPosition)
Q_ENUM_NS(CursorPosition)
///@internal
enum FrameOption
{
enum FrameOption {
FrameOption_None = 0,
FrameOption_AlwaysShowsTabs = 1,
FrameOption_IsCentralFrame = 2,
@@ -266,6 +280,14 @@ enum FrameOption
Q_DECLARE_FLAGS(FrameOptions, FrameOption)
Q_ENUM_NS(FrameOptions)
///@internal
enum TabWidgetOption {
TabWidgetOption_None = 0,
TabWidgetOption_DocumentMode = 1 ///> Enables QTabWidget::documentMode()
};
Q_DECLARE_FLAGS(TabWidgetOptions, TabWidgetOption)
Q_ENUM_NS(TabWidgetOptions)
///@internal
inline QString locationStr(Location loc)
{

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