And now for something completely different: QtQuick.Controls 2 for the desktop!

As you might know, the QtQuick.Controls 1 module has been officially deprecated since Qt 5.11; this had been in the air already since quite some time, given that the development of the module had almost stopped. It looks like The Qt Company is mostly investing on the more performing QtQuick.Controls 2 module, and is inviting developers to switch over to that — at least for new projects.

However, there currently isn't a style available that would make an application using the QtQuick.Controls 2 look native on the desktop. There has been an attempt at it, but it soon turned into a custom style for the KDE desktop environment. So, some time ago I decided to give it a try: I started by forking the project of the KDE guys and as a first step I removed the dependency on the KDE libraries.

A button generated by the QML QQC2 desktop style
A traditional QPushButton
The difference (enhanced in Gimp, or you wouldn't see a thing)

It's a work in progress, and it probably has a long way to go before it's usable for a real world product, but I'm trying my best to turn it into something you can trust: this is a project where Test Driven Development fits very well, because in order to ensure pixel by pixel visual compatibility (that's my goal indeed!) I'm running a test where I create the same widget using the QtWidgets module and with this QQC2 style, and comparing the resulting surfaces for equality. In the pictures above you can see how the Button element looked earlier today (before I fixed it 🙂), compared to a traditional QPushButton: the test code creates a visual diff of the two images, and the test passes only if the resulting image is pitch black (with a very small tolerance for possible differences in font antialiasing).

For the time being I'm focusing my attention on the visual appearance of the individual widgets and their implicit size, but I'll soon add tests (and code) for layouts and interaction behaviours. I also need to extend the tests: they are currently run in GitLab CI for Linux only (where I can test the Fusion and the Windows styles), but I hope to find a way to run them in AppVeyor and on Mac OS. By the way, if someone knows of a CI service which would allow me to run my graphical tests on a Mac, please let me know in the comments.

This is an early notice that the project exists; if you have some time and energy to spare, you are very welcome to help me with the development.

Comments

There's also webmention support.