Skip to content

KDAB contributions to Qt 5.4

Qt 5.4 was released just last week! The new release comes right on schedule (following the 6-months development cycle of the Qt 5 series), and brings a huge number of new features.

KDAB engineers have contributed lots of code to Qt during the last few months. Once more, KDAB is the second largest contributor to Qt (the first being The Qt Company itself). The commit stream has been constant, as you can see in this graph showing the last 16 weeks:

Contributions to Qt by employer (excluding Digia), from here</a>

Contributions to Qt by employer (excluding Digia), from here

In this blog post I’ll show some of the notable features developed by KDAB engineers that you are going to find in Qt 5.4.

Qt WebChannel

The Qt WebChannel module has been introduced to fill the gap left when Qt switched from WebKit 1 (QWebView) to WebKit 2 (WebView in QML) and Blink (QtWebEngine). That is: the possibility of having QObject instances exposed in the JavaScript environment of a loaded page.

The ultimate cause of this lost feature is that modern HTML engines employ multiple processes for performance and security reasons, and therefore the same kind of deep integration that the WebKit Bridge made possible was not available any more.

The WebChannel brings back this awesome functionality, and it extends it even further — it is now possible to export QObjects to any remote browser, that is, not only the WebViews owned by the very same Qt application.

For more information, please refer to this blog post by my colleague Milian Wolff.

The Declarative State Machine Framework

Back in the day, Qt 4.6 introduced a State Machine Framework based on SCXML. It consisted of a few C++ classes to build state machines out of individual states and transitions, and had quite a nice feature set: it supported parallel states, final states, history states, guarded transitions and so on.

Unfortunately, writing state machines by hand requires a lot of boilerplate C++ code. For instance, in order to add a transition to a new state, we must create a new QState object, create a new transition object, and finally add the transition.

Ford Motor Company, in a technical partnership with KDAB, has generously contributed high-level QML wrappers for the C++ state machine. The new technology goes under the name of Declarative State Machine Framework; it uses QML as a Domain Specific Language (DSL) for writing declarative state machines, while being backed by the full C++ state machine framework.

DSM allows users to create state machines using QML, therefore removing the need of boilerplate code, resulting in a nice and compact representation for state machines.

What’s more, it also allows removing the imperative bits from the state machine (that is, which properties should be updated when entering a state); it instead enables any given QML element to bind its property to whether the state machine is in a state or not.

Please refer to the module documentation for more information, as well as the short talk by my colleague Kevin Funk from this year’s Qt Developer Days.

QNX co-maintainership

Due to KDAB’s sustained efforts into supporting QNX, we’re very pleased to hear that my colleague Rafael Roquetto has been nominated co-maintainer of the QNX support in Qt. He’s going to join the ranks with our colleague Bogdan Vatra, maintainer of the Android support. Congratulations, Rafael!

Other contributions

In no particular order:

qmllint

qmllint is a syntax checker for QML files. You can therefore run it on your QML files before shipping them with your application, or add a qmllint step to your CI system / SCM hooks. If you want to know more, please refer to this blog post by my colleague Sérgio Martins.

New hooking system for tooling

Qt has always had a number of private entry points that were supposed to be used by debugging/profiling tools. Unfortunately, due to aggressive compiler optimizations, those hooks were almost always compiled out in release builds, and therefore their usage on any platform but Linux/GCC was extremely problematic.

KDAB’s Senior Engineer Volker Krause developed a solution for this problem, which can be found in Qt 5.4.

The main user of this feature is of course GammaRay, one of the KDAB’s flagship products. GammaRay is a free software solution that provides high level debugging for Qt, allowing the developer to inspect individual subsystems of any complex application.

Lots of bugfixes

Working on real projects, we do know that code does not always behave as advertised. At the same time, we strive to make Qt the best product for cross-platform, high-performance application development.

Therefore, it should not be a surprise that KDAB engineers fixed over 50 reported bugs between Qt 5.3 and Qt 5.4 (and, of course, fixed even more problems which didn’t even have an associated bug report!). Only a few weeks ago KDAB launched a new service, FixMyQtBug, to help companies building products using Qt which are struggling against upstream bugs; our skills and dedication show that we indeed are the experts when it comes to Qt, and we are willing to fix your Qt bugs as well.

4 thoughts on “KDAB contributions to Qt 5.4”

  1. Where are the Digia commits in your graph? Did the guys at Digia really do nothing before they were renamed to Qt Company?

    1. Giuseppe D'Angelo

      Not really 🙂 As the caption says, those are the commits excluding the ones by Digia. Unfortunately the script didn’t detect the renaming of the company, so you get also the ones belonging to The Qt Company; but see here for the overall per-employer stats.

  2. I just wanted to thank you and Ford for the Declarative State Machine Framework. I explored its use recently by implementing a calculator and I was quite pleased with the results. You can find the code here: https://github.com/pkobrien/calculator-qml/blob/master/src/qml/StateMachine.qml. Now that I’ve reread your blog post I’m thinking that I might be able to make the code a bit less imperative. Any comments or suggestions for improving my use of the DSM would be greatly appreciated.

  3. I got a question about DSM
    how can I include trigger event data?
    previous qt lab project had that capability
    Sorry to ask this here I have no idea where else to ask

Leave a Reply

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