Sign up for the KDAB Newsletter
Stay on top of the latest news, publications, events and more.
Go to Sign-up
Find what you need - explore our website and developer resources
26 November 2024
CXX-Qt is KDAB's extension to CXX, which adds Qt features like properties, signals and slots to CXX. In this step-by-step tutorial, we implement a QAbstractItemModel subclass, which is key to exposing structured data to QML.
At the end we'll have a small Todo app that drives the data entirely from Rust and doesn't even need any C++ code.
Links:
* QAbstractListModel documentation: https://doc.qt.io/qt-6/qabstractlistmodel.html
* KDAB Training Courses: https://training.kdab.com/
* CXX-Qt repository: https://github.com/KDAB/cxx-qt/
* CXX-Qt documentation: https://kdab.github.io/cxx-qt/book/
* CXX-Qt Zulip: https://cxx-qt.zulipchat.com/
* CXX documentation: https://cxx.rs/
You can also take a look at our other resources to get started with CXX-Qt:
* The CXX-Qt Book: https://kdab.github.io/cxx-qt/book/
* CXX-Qt Github Repository: https://github.com/KDAB/cxx-qt/
Example code used in this video:
- https://github.com/KDAB/cxx-qt/tree/main/examples/qml_minimal
- https://github.com/KDAB/cxx-qt/tree/main/examples/todo_app
00:00 Welcome & Final app
01:45 QAbstractItemModel and QAbstractListModel
02:45 Project Setup
05:00 Rust backend struct
07:45 Importing Qt types
11:45 Declaring a QAbstractListModel subclass in Rust
17:45 QEnum for data roles
18:15 Implementing QAbstractItemModel functions
26:30 QML GUI with a Rust model
30:30 Building the app
33:30 Adding mutability
44:20 Final app
45:45 Summary & Outro
All 'How to Integrate C++ and Rust' videos: https://www.youtube.com/playlist?list=PL6CJYn40gN6jOg_cPqRfXMNriHknKy4VW
Stay on top of the latest news, publications, events and more.
Go to Sign-up
Learn Rust
In collaboration with our partners Ferrous Systems, KDAB provides a variety of introductory and advanced training courses for the Rust language.
Learn more
Learn Modern C++
Our hands-on Modern C++ training courses are designed to quickly familiarize newcomers with the language. They also update professional C++ developers on the latest changes in the language and standard library introduced in recent C++ editions.
Learn more