In recent years, a lot has been happening to improve performance, maintainability and tooling of QML. Some of those improvements can only take full effect when your code follows modern best practices. Here are 10 things you can do in order to modernize your QML code and take full advantage of QML’s capabilities. 1. Use […]
Blog Archives
Formatting Selected Text in QML Quasi-Backporting Qt 6.7 QML cursorSelection to Older Versions
Motivation Let’s say we’re working on a QML project that involves a TextEdit. There’s some text in it: here is some text We want to select part of this text and hit ctrl+B to make it bold: here is some text In Qt Widgets, this is trivial, but not so much in QML – we […]
Anchoring Qt Quick Components Instantiated with JSON Factory Design Techniques - Parts 3 & 4
Curious about how to programmatically instantiate arbitrary QML components? Explore a pure QML implementation of the factory pattern with this blog series. In part 3, we evaluate a technique for anchoring nested components, and how to mitigate the risk for remote code execution.
Laying Out Components with Qt Quick and JSON Factory Design Techniques - Part 2
Did you know you can programmatically instantiate arbitrary QML components? Dive into a pure QML implementation of the factory pattern with this blog series. In part 2, we explore techniques for laying out the nested components, and learn about the quirks behind QML's Loader.
Recursive Instantiation with Qt Quick and JSON Factory Design Techniques - Part 1
Recently I was tasked to come up with an architecture for remote real time instantiation and updating of arbitrary QML components. This entry shows how you can use a simple variation of the factory method pattern in QML for instantiating arbitrary components. I’ve split my findings into 3 blog entries, each one covering a slightly […]
Incredibly Simple QR Generation in QML Wrapping tiny JS libraries in QML to do quick and simple things effortlessly and elegantly.
The Need for Simple & Modular QR Generation in QML Recently, our designer Nuno Pinheiro needed to generate QR codes for an Android app in QML and started asking around about a simple way to do this. The best existing QML solution was QZXing, a Qt/QML wrapper for the 1D/2D barcode image processing library ZXing. […]
Fun with Paths and URLs in QML Managing Your QML Assets with Ease
There are a few small, and sometimes already quite old, features in Qt that, when combined, can be a very nice way to deal with assets in your QML application — especially if some of them live on the file system, some in a resource, and some may need localization or translation. Let’s dive in! […]
CXX-Qt Safe Rust Bindings for Qt
At KDAB, we have been investigating how to integrate Rust with Qt in a safe and idiomatic way. The solution we are currently working on is called CXX-Qt. It’s available in the GitHub and on crates.io. This blog post discusses the journey of CXX-Qt — where it started, where it can be used right now, […]
QML Component Design The Two-Way Binding Problem and How to Avoid It
In a well-designed QML application, the UI is built using re-usable components, while the data and logic live in C++ based components we call controllers here. The QML part of the application uses these components (that themselves may be written in QML or C++) to build up the user interface and connect these components with […]
Wayland on Windows Run a Wayland Compositor Directly in Your Windows Machine
Qt provides both a Wayland platform to run Qt applications as Wayland clients in a Wayland compositor and a library to build that, but only on Linux. The WSL subsystem makes that possible on Windows.