Skip to main content

A Cross-Platform Rust UI Framework via Qt’s Bridging Technology

Comments

Rust has achieved something extraordinary: it genuinely excites people to write software. But when it comes to building a real user interface, the ecosystem is still finding its footing. There are numerous options to pick your Rust UI framework from, including those gaining traction, like Iced and egui. Most of the available UI frameworks, however, are still establishing themselves in production environments and fall short in feature-richness. Qt Bridges, a bridging technology in public beta for Rust, brings something different to the table: over three decades of real-world use, commercial support, and a framework that already runs in automotive dashboards, medical devices, and industrial systems worldwide. Qt Bridge for Rust makes that maturity available to Rust developers, providing access to a UI framework that lets you keep your Rust codebase while using Qt Quick’s feature-rich UI libraries and APIs, hardware acceleration, and genuine cross-platform support.

Previous efforts to bring Qt to the Rust ecosystem laid important groundwork: qmetaobject-rs, a pioneering effort that proved you could integrate QML and Rust, is now passively maintained, though it still has an active user base, and CXX-Qt, while excellent, is designed for teams already living in C++. At the same time, demand for Rust in systems, embedded, and cross-platform applications keeps growing, and Rust developers need a UI layer that matches their backend.

What is Qt Bridge for Rust?

Qt Bridges is a future bridging technology that will enable a single frontend implementation to be used with a variety of backend languages. For Rust, it offers a rich, production-grade alternative for existing Rust UI frameworks. Currently, the Rust bridge is available as public beta.

The Rust bridge connects your Rust application logic directly to Qt Quick, Qt’s proven UI framework, the same one powering automotive dashboards, medical devices, and industrial interfaces worldwide. You only use Rust; there’s no C++ headers, no manual FFI, no prior Qt expertise required. You write Rust, the bridge handles the rest. Our aim is to make using our Rust UI framework look like Rust, feel like Rust, and produce errors like Rust. The UI is described in QML, Qt's declarative language, with JavaScript available for dynamic logic. This may not immediately appeal to every Rust developer, most prefer compile-time guarantees over runtime flexibility, but in practice we have found it to be a genuinely pleasant experience. QML's rapid iteration on the UI side pairs surprisingly well with Rust's strict compile-time guarantees on the application logic side.

Between the two, a minimalistic API based on attribute macros and traits facilitates seamless interaction. A particularly interesting challenge is the ownership and aliasing model, which couldn't differ more between the two languages. Yet we consider our solution both elegant and practical. The JavaScript object model is represented using native Rust types: each QML object is exposed to Rust as a shared reference, Rc<RefCell<T>>, with borrow rules enforced at runtime. The QML engine holds the same shared reference and must adhere to Rust's invariants when invoking functions on it. Constructions in QML that would violate Rust's aliasing model are mostly absent in idiomatic QML; where they do occur, the engine rejects them with a clear error at runtime. Considerable effort has gone into making this interaction reliable and smooth in practice.

The result is fully safe Rust API for application logic, with a QML layer that performs comparably to one backed by C++. Hardware acceleration, cross-platform support (Linux, macOS, and Windows) out of the box, and an attribute-macro and trait API that feels native to Rust, are all included.

Try Qt Bridges for Rust

See how to get started

How does the Qt Bridge Work as a Rust UI Framework?

When you write an application using Rust and QML, Qt Bridge for Rust generates native, Qt-based wrappers for your Rust types at compile time. These wrappers handle all interoperability tasks, object instantiation, method invocation, property access, signal emission, and so on. With these in place, Rust types can be references directly in QML, as in the following example:

Rust

QML

use qtbridge::{QApp, qobject};

 

#[derive(Default)]

pub struct Backend {

}

 

#[qobject]

impl Backend {

    #[qslot]

    fn say_hello(&self) {

            println!("Hello World!");

    }

}

 

import QtQuick

import QtQuick.Controls

import hello_world

 

ApplicationWindow {

    visible: true

    Backend { id: backend }

    Button {

        anchors.centerIn: parent

        text: "Hello World!"

        onClicked: backend.say_hello()

    }

}

All the C++ is encapsulated in the qtbridge crate and you will never write or see any of it. In the currently available Qt Bridges version for the Rust UI framework, a C++ compiler and toolchain are still required, since cargo is rebuilding all crates from source code. We are working on a way to remove this requirement, for example by providing prebuild binaries in our crates. The user code itself is completely C++ free.

Getting Started with the Rust Bridge

Qt Bridge is an almost ordinary Rust crate: add qtbridge as a dependency in Cargo.toml and use cargo to build and run as usual. The one exception to the ordinary Rust workflow is that a C++ toolchain and qmake must be available on your PATH, reflecting Qt Bridge's C++ foundations. See our documentation for setup details and platform-specific instructions.

From there, decorate your structs with the #[qobject] macro and use them directly in QML. Our examples and documentation show what's possible. If you are using Ubtunu 26.04 or a similar Linux distribution you can use the following commands to install all requirements, download and run the hello world example:

# 1. Install Qt6 dependencies (Ubuntu 26.04)

sudo apt install -y qt6-base-dev qt6-declarative-dev qt6-base-private-dev

# 2. Install Rust via rustup

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

source $HOME/.cargo/env

# 3. Clone the examples repository

git clone https://github.com/qt/qtbridge-rust-examples.git

cd qtbridge-rust-examples/hello_world

# 4. Set qmake and run

export QMAKE=qmake6

cargo run

 

For an IDE, we recommend Visual Studio Code with the rust-analyzer and Qt QML plugins. Be aware that the two plugins do not currently share type information, so Rust types will appear unrecognized in QML files. This is a known limitation we are working to address.

What’s Next

Try it out, learn more in documentation, and please provide your feedback.

Try Qt Bridges for Rust

See how to get started

We’re now working towards the Rust bridge to reach a Technology Preview (TP) state with a refined version.

Your feedback is very valuable for growing this into the best Rust UI framework option, so we hope to hear from you. Use the Qt Bridges Forum for any discussion and sign up to stay up-to-date on the project news.

Comments

Subscribe to our blog

Try Qt 6.11 Now!

Download the latest release here: www.qt.io/download

Qt 6.11 is now available, with new features and improvements for application developers and device creators.

We're Hiring

Check out all our open positions here and follow us on Instagram to see what it's like to be #QtPeople.