KDAB contributions to Qt 5.6
Qt 5.6 has just been released! Packed with incredible new features, 5.6 is also the first long term support release of Qt: it will be supported for the next 3 years, giving developers a solid foundation for their current and upcoming projects. Once more, KDAB is confirmed to be the largest independent contributor to Qt, as clearly demonstrated by the commit activity graph in Qt (KDAB is the green one):
In this post I will summarize some of the contributions to Qt 5.6 that were developed by KDAB engineers. In no particular order:
Support for Windows Embedded Compact 2013
KDAB is fulfilling its role as the maintainer of the Windows Embedded platform. We are glad to announce that Windows Embedded Compact 2013 is now fully supported by Qt 5.6. Many other fixes for Windows Embedded 7 were also landed.
High DPI fixes in Qt Quick
A crucial feature of high DPI-enabled applications is the ability of react to DPI changes, which may happen for instance if an application’s window gets dragged between two screens with a different DPI. KDAB introduced the required infrastructure for Qt Quick applications to detect DPI changes and redraw their contents to the new DPI, which allows elements such as Text to always match the native display’s resolution.
FreeType support for OS X
One of the strongest points of Qt-based applications is their ability of matching the native style of the platform they run on. However, in certain scenarios, we may prefer our application to have consistent UIs across different operating systems, even if that means not following the native look and feel. A prominent aspect of this is font rendering: Qt by default uses the platform’s font rasterizer, which means having fonts rendered in a different depending on the OS. However, thanks to KDAB’s effort, it is possible to use FreeType as the font rasterizer on Linux, Windows, and starting from Qt 5.6, OS X too. This makes it possible to build applications with consistent pixel-perfect text rendering across all these operating systems.
When it comes to a big library like Qt it is often difficult to find bottlenecks and opportunities for optimization. There are simply too many possible code paths, and applications using Qt may be triggering any subset of them, often in non-trivial ways. These code paths need to be instrumented and benchmarked, and fixes need to be developed in case bottlenecks are found. Then, even when a particular code path doesn’t show up in a profiler, it is important that the codebase, as a whole, gets constantly audited by using state of the art tools (such as clazy, maintained by KDAB engineer Sérgio Martins), in order to remove all possible source of slowness. Last, it is important that Qt’s footprint gets reduced by using the proper C++ constructs that help the compiler generate more efficient and compact code. KDAB is committed to keep Qt at the highest quality. KDAB engineers have provided countless performance improvements to Qt 5.6. The complete list is too long to be reported in this narrow margin, so here’s just a few items:
- The meta-object compiler’s (moc) parser has been optimized, and in certain cases, made twice as fast.
- Reading integers out of a MySQL database via a prepared statement is now 33% faster.
- Application startup on systems using fontconfig is now considerably faster due to a removal of a O(n²) algorithm.
- Thanks to clazy, lots of accidental deep copies of containers were removed from Qt, as well as anti-patterns that allocate potential huge temporary containers (such as qDeleteAll(hash.keys())).
- Calls to reserve() were added in many places where it was possible to determine the number of elements that were going to be added to containers.
- Qt containers and container-like classes gained a number of methods (reverse iterators, key iterators for associative containers, full comparison operators, etc.) that allow to write code which is more efficient and results to less text in the executable.
A special mention goes to KDAB’s senior engineer Marc Mutz, who has contributed over 330 commits to the 5.6 release. Thanks, Marc!
Qt 3D 2.0 technical preview
Qt 3D continues to be a major area of investment for KDAB as we see this as an important area for future growth of Qt. Qt 5.6 sees the introduction of many new features to Qt 3D including (but not limited to):
- Instanced rendering – this allows to draw many (potentially dozens of thousands) copies of a mesh in a single OpenGL draw call. This saves a huge amount of CPU time and allows great performance for things like grass, crowds, rocks, particles, and so on.
- Primitive restart – another way of being able to draw multiple distinct meshes using a single draw call (for better performance).
- Support for many more 3D renderer states including clip planes, stencil operations and blending functionality.
- New Input API – easily extensible to other input devices and allows mapping multiple physical devices to logical controllers.
- New Logic aspect – allows code to be executed once per frame. Very useful for some use cases and good for prototyping new features in the future.
- Lots of API improvements, bug fixes and examples.
We are now performing API polishing ready for the release of Qt 3D alongside Qt 5.7 later this year.
- As part of the KDAB’s Qt on Android maintainership, more than 100 fixes and improvements were applied all across the board to Qt modules, Qt Creator and qbs.
- KDAB is the maintainer for the CMake support in Qt, and for Qt 5.6 we’ve landed several bug fixes.
- The QtPurchasing module received several iOS-related fixes.
KDAB believes that it is critical for our business to contribute to the Qt framework and C++ thinking, to keep pushing these technologies forward to ensure they remain competitive.