KDDockWidgets, an advanced implementation framework for QDockWidget

KDQDockWidget

The Group KDAB is a software consultancy for Qt, C ++ and OpenGL applications for different platforms (desktop, embedded and mobile), in addition to that provides tutoring to develop Qt applications from scratch and in transferring all popular frames to Qt.

Over the years, KDAB has contributed and funded the development of QDockWidget. But because changes and bug fixes took many days to implement, using QdockWidget, It turned out not to be a good option, thus giving the birth of KDDockWidgets.

KDDockWidgets is an advanced docking framework for QDockWidgets, with which it expands its use by adding functions that QDockWidgets do not support.

QdockWidget natively combines GUI code with logic with state, what your makes it very difficult to move forward with new features, which causes great complexity in its implementation within the different platforms. Since it is a basic component of a series of graphical user interfaces, with it you can move entire window elements (toolbars, widget groups, etc.) wherever you want.

However, KDAB argued that QDockWidgets code maintenance is not very easy, as he comments that:

KDDockWidgets was born out of my need to preserve my sanity after having worked on two projects that required extensive customization. One where we tried to work directly upstream but the rate of regression ended up being too much.

And another one where I took the route of using private APIs, fake mouse events, and event filters, which seemed like a good idea at first, but ended up being a world of pain. Also, our clients were getting more creative with their requests, so it was clear that we needed a better docking framework.

The main problem is its design, quite monolithic but configurable (we can choose the functions available to the user, even if few people do, for the animations), with a spaghetti code (happily mixing the logic and the component state). Therefore, any change can create a large number of regressions.

That is why KDAB has decided to create KDDockWidgets, with which it seeks to greatly simplify the QDockWidgets design, while facilitating its adaptation to particular situations.

KDDockWidgets provides the following functions:

  • Being able to dock widgets in a floating window and dock that group to the main window
  • Dock to any window, not just the main window
  • Docking to the center of the main window
  • Support for detachable tabs in the central widget within the main window
  • Being able to detach tabs from a tab bar in a docking area
  • Ability to combine several tabs by combining various components.
  • Expose internal help widgets so that the user can customize them or provide their own.
  • Component groups can freely switch from an external window (which only contains this component group) to the main window (a feature partially implemented in Qt 5.10).
  • Customize tab widgets
  • Customize title bars
  • Customize window frames
  • In addition to highlighting that the main change is the addition of precise indicators to remove elements from the GUI, in addition to the fact that the notion of central widget disappears, since as such it is no longer a specific element.

The new organization clearly separates the logic from the graphical interface, so that the underlying runtime is can easily be reused for Qt Quick interfaces (which is ultimately expected). It also makes it easy to customize the interface, the user can provide their own widgets for any part of the interface.

In addition, KDDockWidgets is intended to be a framework, so you can easily override the interfaces to provide custom appearance and behavior. KDDockWidgets is an open source framework, which is under the GPLv2 and GPLv3 licenses.

The KDDockWidgets code as well as a demo of it are available In the following link.


The content of the article adheres to our principles of editorial ethics. To report an error click here!.

Be the first to comment

Leave a Comment

Your email address will not be published.

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.