Qt & Technical Deep Dive

Fast C++-to-QML Properties

B07 5.11.2019 15:00 - 15:30

Bookmark and Share

Simon Davydov
Simon Davydov
Sukhoi JSC

Qt Quick is becoming the de-facto choice on mobile and embedded platforms. It is also widely spread in automotive and simulation software. We use Qt Quick for simulating jet planes cockpit with full indication where typical on-screen action involves up to thousands of parameters changing simultaneously. The primary language of Qt Quick is QML, which is extremely popular amongst developers and designers. It allows quick prototyping, fast development cycles, platform independence, live updates (REPL), and even more. One of the foundation pillars of QML is its property-based expressions. Properties can be seen here and there gluing UI parts together, powering UI logic, binding to each other, appearing as variables in JS code. Less often, properties serve as interlanguage communication. Properties can be stated as a bidirectional universal C++-QML (not only C++) key-value data interface accessible throughout the UI. Named packs of properties are called property maps with the vanilla exemplar named QQmlPropertyMap, which “provides a convenient way to expose domain data to the UI layer” (Qt Docs). Leveraging property maps greatly reduce the need for the C++ data layers, which can lead to more robust, maintainable, extensible products. On the other side is QQmlPropertyMap poor performance on insertion and updating operations allows no more than a few hundred properties online on desktop-class hardware. In this talk, we discuss some alternatives to QQmlPropertyMap, their trade-offs, and limits. Finally, we come to FastProperyMap which is by in order of magnitude more performant on both insertion and updates, making it suitable even for embedded devices. The audience is expected to be familiar with the Qt Meta-Object system, but no in-depth knowledge is required.