Skip to content

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.

Quality

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.

Run kddockwidgets_example -y to see it in action.

Segmented Indicators

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.

 

Windows Aero-Snap

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:

  • Flag_AllowReorderTabs
  • Flag_TabsHaveCloseButton
  • Flag_DoubleClickMaximizes
  • Flag_TitleBarHasMaximizeButton
  • Flag_LazyResize

Consult the documentation for more information, but they are pretty self-explanatory :).

ChangeLog

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

KDDockWidgets is Open Source (GPLv2 & GPLv3). If you need it in proprietary software, contact KDAB for other licensing options.

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.

View our ‘Widgets and more’ video series

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.

Welcome to our brand new video series about...Qt Widgets! 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.

Whether it's some handy snippet in C++ or a hidden button in a graphical tool, these suggestions will make your development life considerably easier.
In this first video, we will show you a few ways to improve your workflow when using a QGridLayout inside Qt Designer. Sounds simple, doesn't it? Well, there are a few subtleties involved.

The example code showcased in this video is available here: https://github.com/KDAB/kdabtv

The video is presented by Jesper Pedersen, who started with Qt back when Qt was widgets only and the version was 1.44, which gives him 21 years of experience with Qt. Since 2000 he has taught almost 100 Qt classes, ranging from Qt Widgets to QML. Heck, Jesper even taught a few classes on QTopia Core — Trolltech's initial attempt at creating a phone stack. Today Jesper holds a fancy business title, but that doesn't prevent him from coding both in his job and in his spare time.

About KDAB:
KDAB offers experienced software experts to help you deliver functional, high-performing and innovative software across embedded, mobile and desktop platforms for projects using C++, Qt, QML/Qt Quick, OpenGL, Qt 3D and more.  https://www.kdab.com/software-services

KDAB experts regularly take time out to deliver KDAB’s world class training, in-house or at open enrollment courses around the world. We are the market leaders for training in Qt, OpenGL and C++.

Contact us to find out more at training@kdab.com or visit our website: https://www.kdab.com/software-services/scheduled-training/

We are about 90 people, located all around the world. Our Head Office is in Sweden and we have other offices in Germany, France, the UK and the USA. https://www.kdab.com/about/contact/
GridLayout in Qt Designer

Welcome to our brand new video series about...Qt Widgets! 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.

Whether it's some handy snippet in C++ or a hidden button in a graphical tool, these suggestions will make your development life considerably easier.
In this first video, we will show you a few ways to improve your workflow when using a QGridLayout inside Qt Designer. Sounds simple, doesn't it? Well, there are a few subtleties involved.

The example code showcased in this video is available here: https://github.com/KDAB/kdabtv

The video is presented by Jesper Pedersen, who started with Qt back when Qt was widgets only and the version was 1.44, which gives him 21 years of experience with Qt. Since 2000 he has taught almost 100 Qt classes, ranging from Qt Widgets to QML. Heck, Jesper even taught a few classes on QTopia Core — Trolltech's initial attempt at creating a phone stack. Today Jesper holds a fancy business title, but that doesn't prevent him from coding both in his job and in his spare time.

About KDAB:
KDAB offers experienced software experts to help you deliver functional, high-performing and innovative software across embedded, mobile and desktop platforms for projects using C++, Qt, QML/Qt Quick, OpenGL, Qt 3D and more. https://www.kdab.com/software-services

KDAB experts regularly take time out to deliver KDAB’s world class training, in-house or at open enrollment courses around the world. We are the market leaders for training in Qt, OpenGL and C++.

Contact us to find out more at training@kdab.com or visit our website: https://www.kdab.com/software-services/scheduled-training/

We are about 90 people, located all around the world. Our Head Office is in Sweden and we have other offices in Germany, France, the UK and the USA. https://www.kdab.com/about/contact/

27 10

YouTube Video UEw2Q0pZbjQwZ042Z2YtRy1vNnN5RndHcnRxM2tJdEVxSS41NkI0NEY2RDEwNTU3Q0M2

GridLayout in Qt Designer

Let's revisit Qt Designer once more, this time to discuss combo boxes. Mapping a QComboBox's entry to a specific value is easy in C++, but not so easy when the combo box is populated from within Qt Designer. How do we improve the situation?

The example code showcased in this video is available here: https://github.com/KDAB/kdabtv

The video is presented by Jesper Pedersen, who started with Qt back when Qt was widgets only and the version was 1.44, which gives him 21 years of experience with Qt. Since 2000 he has taught almost 100 Qt classes, ranging from Qt Widgets to QML. Heck, Jesper even taught a few classes on QTopia Core — Trolltech's initial attempt at creating a phone stack. Today Jesper holds a fancy business title, but that doesn't prevent him from coding both in his job and in his spare time.

About KDAB:
KDAB offers experienced software experts to help you deliver functional, high-performing and innovative software across embedded, mobile and desktop platforms for projects using C++, Qt, QML/Qt Quick, OpenGL, Qt 3D and more.  https://www.kdab.com/software-services

KDAB experts regularly take time out to deliver KDAB’s world class training, in-house or at open enrollment courses around the world. We are the market leaders for training in Qt, OpenGL and C++.

Contact us to find out more at training@kdab.com or visit our website: https://www.kdab.com/software-services/scheduled-training/

We are about 90 people, located all around the world. Our Head Office is in Sweden and we have other offices in Germany, France, the UK and the USA. https://www.kdab.com/about/contact/
Populating a Combobox from Qt Designer

Let's revisit Qt Designer once more, this time to discuss combo boxes. Mapping a QComboBox's entry to a specific value is easy in C++, but not so easy when the combo box is populated from within Qt Designer. How do we improve the situation?

The example code showcased in this video is available here: https://github.com/KDAB/kdabtv

The video is presented by Jesper Pedersen, who started with Qt back when Qt was widgets only and the version was 1.44, which gives him 21 years of experience with Qt. Since 2000 he has taught almost 100 Qt classes, ranging from Qt Widgets to QML. Heck, Jesper even taught a few classes on QTopia Core — Trolltech's initial attempt at creating a phone stack. Today Jesper holds a fancy business title, but that doesn't prevent him from coding both in his job and in his spare time.

About KDAB:
KDAB offers experienced software experts to help you deliver functional, high-performing and innovative software across embedded, mobile and desktop platforms for projects using C++, Qt, QML/Qt Quick, OpenGL, Qt 3D and more. https://www.kdab.com/software-services

KDAB experts regularly take time out to deliver KDAB’s world class training, in-house or at open enrollment courses around the world. We are the market leaders for training in Qt, OpenGL and C++.

Contact us to find out more at training@kdab.com or visit our website: https://www.kdab.com/software-services/scheduled-training/

We are about 90 people, located all around the world. Our Head Office is in Sweden and we have other offices in Germany, France, the UK and the USA. https://www.kdab.com/about/contact/

10 6

YouTube Video UEw2Q0pZbjQwZ042Z2YtRy1vNnN5RndHcnRxM2tJdEVxSS4yODlGNEE0NkRGMEEzMEQy

Populating a Combobox from Qt Designer

If you're submitting code for a review, there's nothing worse than getting nitpicked because you violated a style guideline of the project.
If you're doing the code review, there's nothing more annoying than nitpicking on small code style inconsistencies.

This is where clang-format can help you. Clang-format is a tool (based on the clang/LLVM compiler infrastructure) that can automatically reformat your source code. Not only can you run it manually to apply a given formatting, but you can set it up so that it automatically reformats the code when committing into git, or when saving in Qt Creator.

The example code showcased in this video is available here: https://github.com/KDAB/kdabtv

The video is presented by Jesper Pedersen, who started with Qt back when Qt was widgets only and the version was 1.44, which gives him 21 years of experience with Qt. Since 2000 he has taught almost 100 Qt classes, ranging from Qt Widgets to QML. Heck, Jesper even taught a few classes on QTopia Core — Trolltech's initial attempt at creating a phone stack. Today Jesper holds a fancy business title, but that doesn't prevent him from coding both in his job and in his spare time.

About KDAB:
KDAB offers experienced software experts to help you deliver functional, high-performing and innovative software across embedded, mobile and desktop platforms for projects using C++, Qt, QML/Qt Quick, OpenGL, Qt 3D and more.  https://www.kdab.com/software-services

KDAB experts regularly take time out to deliver KDAB’s world class training, in-house or at open enrollment courses around the world. We are the market leaders for training in Qt, OpenGL and C++.

Contact us to find out more at training@kdab.com or visit our website: https://www.kdab.com/software-services/scheduled-training/

We are about 90 people, located all around the world. Our Head Office is in Sweden and we have other offices in Germany, France, the UK and the USA. https://www.kdab.com/about/contact/
Using Clang-Format to Ensure Style Guidelines

If you're submitting code for a review, there's nothing worse than getting nitpicked because you violated some style guideline of the project.
If you're doing a code review, there's nothing more annoying than nitpicking on small code style inconsistencies.

This is where clang-format can help us. clang-format is a tool (based on the clang/LLVM compiler infrastructure) that can automatically reformat our source code. Not only we can run it manually to apply a given formatting, but we can set it up so that it automatically reformats the code when committing into git, or when saving in Qt Creator.

The example code showcased in this video is available here: https://github.com/KDAB/kdabtv

The video is presented by Jesper Pedersen, who started with Qt back when Qt was widgets only and the version was 1.44, which gives him 21 years of experience with Qt. Since 2000 he has taught almost 100 Qt classes, ranging from Qt Widgets to QML. Heck, Jesper even taught a few classes on QTopia Core — Trolltech's initial attempt at creating a phone stack. Today Jesper holds a fancy business title, but that doesn't prevent him from coding both in his job and in his spare time.

About KDAB:
KDAB offers experienced software experts to help you deliver functional, high-performing and innovative software across embedded, mobile and desktop platforms for projects using C++, Qt, QML/Qt Quick, OpenGL, Qt 3D and more. https://www.kdab.com/software-services

KDAB experts regularly take time out to deliver KDAB’s world class training, in-house or at open enrollment courses around the world. We are the market leaders for training in Qt, OpenGL and C++.

Contact us to find out more at training@kdab.com or visit our website: https://www.kdab.com/software-services/scheduled-training/

We are about 90 people, located all around the world. Our Head Office is in Sweden and we have other offices in Germany, France, the UK and the USA. https://www.kdab.com/about/contact/

21 3

YouTube Video UEw2Q0pZbjQwZ042Z2YtRy1vNnN5RndHcnRxM2tJdEVxSS41MjE1MkI0OTQ2QzJGNzNG

Using Clang-Format to Ensure Style Guidelines

About KDAB

If you like this blog and want to read similar articles, consider subscribing via our RSS feed.

Subscribe to KDAB TV for similar informative short video content.

KDAB provides market leading software consulting and development services and training in Qt, C++ and 3D/OpenGL. Contact us.

FacebookTwitterLinkedInEmail

Categories: KDAB Blogs / KDAB Labs / KDAB on Qt / Qt

Leave a Reply

Your email address will not be published. Required fields are marked *