KDDockWidgets 1.0 has been released! An advanced docking system for Qt
The KDDockWidgets 1.0 release is now available!
What is KDDockWidgets?
KDDockWidgets is an advanced docking system for Qt, with features that are not available in
QDockWidget. See our first blog post, for a quick introduction and the motivation for a new docking framework.
What’s new in 1.0?
We’ve come a long way since the initial announcement of KDDockWidgets. The 1.0 release represents the culmination of one year of using the library in production for five different huge projects — one year of incorporating real feedback in the form of new features, bug fixes, or simply making the framework more customizable.
We could have tagged 1.0 much sooner, but I gain more personal satisfaction in calling the current state 1.0, as it’s very stable and almost feature-complete. We’re on the verge of stepping on the gas for the Qt Quick port, as there’s very little to add to the Qt Widget API.
Read on, for a few of the highlights of the KDDockWidgets 1.0 release.
We now have 200 automated tests, accounting for 30% of the codebase. It took a lot of time to get there but now they actually save us time, catching regressions very soon.
We wrote a fuzzer, to test the example app randomly for hours until it crashes. All this with Address Sanitizer enabled so memory violations and leaks don’t escape.
Rewritten layouting engine
For the KDDockWidgets 1.0 release, the layouting engine was factored out into its own reusable library without QWidget dependencies. This will allow sharing 5000 lines of code for the Qt Quick port right off the bat, but also benefits the QWidget codebase a lot, as the new engine is much more flexible. For instance, it was trivial to add support for max-size constraints and honour a bit of QSizePolicy.
Customizable docking indicators
Additionally, KDDW allows users to provide their own docking indicators. This is not just about changing icons or colors, the whole mechanism can be modified.
In the example below, we demonstrate how we created a new docking indicator type called “Segmented Indicators” in just a few hours.
kddockwidgets_example -y to see it in action.
MainWindows within MainWindows
You can now dock a main window into another main window, as if it were a dock widget. On top of that, you can even dock floating windows into the inner dock widget if that pleases you.
Not saying you should, but it’s something many people asked. Sometimes, it’s simply because they had this in MFC and wouldn’t be able to complete a port to Qt without it.
In the example below, I show you the “affinity” concept. The yellow dock widgets can only be docked into the yellow main window, but this is optional. If you want, you can dock anything, anywhere.
Aero-snap is the functionality which maximizes a window when you drag it near the screen’s edges. Typically you loose this feature when using
Qt::FramelessWindowHint , but that can be worked around.
For the KDDockWidgets 1.0 release, we even did many improvements for using Aero-snap with Windows with custom title bars. Expect some HDPI fixes for v1.1 too.
Reworked layout save/restore
Layout restoring is now done in two steps. First, everything is loaded and validated. Only if the validation passes do we change the GUI. Before, it was very hard to recover from an error if we were in the middle of the restore.
Save/restore now works better on different HDPI setups. We’ve added the
RestoreOption_RelativeToMainWindow, which, when used, will restore the dock widgets in relation to the main window’s size, instead of using absolute values which could have been saved in a different screen size.
More Config.h options
Config::flags() has 5 new options for tuning little details. They are:
Consult the documentation for more information, but they are pretty self-explanatory :).
Here is a more comprehensive list of features and improvements in the KDDockWidgets 1.0 release:
- PySide2 bindings
- Rewrote the layouting engine, resulting in a huge stability gain and makes it easy to add new features
- Honour min/max sizes and some QSizePolicy heuristics
- Lazy resize (resize only when dropping the separator)
- Native Windows dragging (supporting Aero-snap) improvements
- Reordering tabs with mouse
- Partial layout save/restore (affecting only a subset)
- Double-click on title bar to maximize
- Optional maximize button on the title bar
- HDPI: Restoring relative to main window size, instead of absolute geometries
- Allow to make a dock widget non-closable and non-dockable
- Show close button on tabs
- Multiple Main Window support
- Allowing to dock on different parents
- Support for affinities, making some dock widgets only dockable on certain main windows
- 200 unit-tests
- Fuzzer which found plenty of crashes in the old layouting engine
- ASAN/UBSAN fixes
- Double click on separator to distribute equally
- Hovering over an indicator returns the true size that the dropped widget will get
- Qt-Namespaced and Static build support
- Dozens of crash fixes, bugs and much more…
Stay tuned, 1.1 should be out soon!
Visit the KDDockWidgets GitHub page to get the update: https://github.com/KDAB/KDDockWidgets/releases/tag/v1.0.0.
The source code for the KDDockWidgets 1.0 release can be found on GitHub at: https://github.com/KDAB/KDDockWidgets
Tarballs and zipballs for 1.0 are available from: https://github.com/KDAB/KDDockWidgets/releases
Prebuilt packages for some popular Linux distributions can be found at: https://build.opensuse.org/project/repositories/isv:KDAB
For commercial licensing regarding inclusion in proprietary software and/or for tailored support options contact us and ask for a 30-day free trial license.
This blog uses KDDockWidgets as an example for creating Python bindings for your Qt Libraries. Give it a read if you’re interested in that process.
Yes, widgets are still alive and kicking. In the many years we have worked with them, we have gathered quite a number of tips and tricks that we’d love to share with you.
Populating a Combobox from Qt Designer
Using Clang-Format to Ensure Style Guidelines
Un-sorting Headers in QTableView
Using GammaRay to Find the Class of an UI Element
Understanding Contents Margins in Qt Layouts
Starting the Application in GammaRay from Qt Creator
Spell Checking in Qt Creator
Communicating between a View/Delegate and a Model
Visualizing the Model Stack in GammaRay
Traversing Proxy Models to Get to the Source Model at the Bottom
Changing the Font to Jetbrains Mono in Qt Creator
Using Custom Types with Model/View
Top 7 Shortcuts in Qt Creator
Avoiding QVariant::fromValue around your Own Types
Document Templates in Qt Creator - Part 1
Document Templates in Qt Creator - Part 2
Document Templates in Qt Creator - Part 3
Document Templates in Qt Creator - Part 4
Adapting Column Content to Size
Converting Enums to and from Strings
Qt Designer Plugins (Part 1) - Widgets Promotion
Qt Designer Plugins (Part 2) - Initializing Classes when Using Qt Designer