feat(qbz-qt): phase 0 — crate skeleton + cxx-qt toolchain gate

New qbz-qt bin crate (cxx-qt 0.7 + QML) as the only default workspace
member in this worktree, so plain cargo build produces just the Qt
binary. Gate verified against system Qt 6.11.1 (codegen, moc,
qmltyperegistrar, qrc load, offscreen run all green).

km
This commit is contained in:
vicrodh committed 2026-07-27 11:36:18 -06:00
1 parent 82fea6257c
commit 469f83781d
6 files changed
+108

No files matched your search

+18
View File
@@ -0,0 +1,18 @@
[package]
name = "qbz-qt"
description = "Qt/QML frontend POC for QBZ (cxx-qt bridge over the UI-agnostic backend)"
version.workspace = true
edition.workspace = true
license.workspace = true
[[bin]]
name = "qbz-qt"
path = "src/main.rs"
[dependencies]
cxx = "1"
cxx-qt = "0.7"
cxx-qt-lib = { version = "0.7", features = ["qt_full"] }
[build-dependencies]
cxx-qt-build = "0.7"
+16
View File
@@ -0,0 +1,16 @@
use cxx_qt_build::{CxxQtBuilder, QmlModule};
fn main() {
CxxQtBuilder::new()
// Qt modules the bridge links against (Qt6 CMake in /usr/lib64/cmake).
.qt_module("Qml")
.qt_module("Quick")
.qt_module("QuickControls2")
.qml_module(QmlModule {
uri: "com.blitzfc.qbz",
rust_files: &["src/bridge.rs"],
qml_files: &["qml/Main.qml"],
..Default::default()
})
.build();
}
+21
View File
@@ -0,0 +1,21 @@
import QtQuick
import QtQuick.Controls
ApplicationWindow {
visible: true
width: 960
height: 600
title: "qbz-qt — toolchain gate"
Rectangle {
anchors.fill: parent
color: "#191922"
Text {
anchors.centerIn: parent
text: "qbz-qt phase 0 gate"
color: "#e8e8ef"
font.pixelSize: 20
}
}
}
+25
View File
@@ -0,0 +1,25 @@
//! Phase 0 toolchain-gate bridge.
//!
//! A single trivial QObject proves the cxx-qt codegen <-> Qt 6.11 pipeline
//! (qmltyperegistrar, moc, CMake link) before any real binding work lands.
#[cxx_qt::bridge]
mod qbz_bridge {
extern "RustQt" {
#[qobject]
#[qml_element]
#[qproperty(QString, greeting)]
type HelloBridge = super::HelloBridgeRust;
}
extern "C++" {
include!("cxx-qt-lib/qstring.h");
type QString = cxx_qt_lib::QString;
}
}
/// Rust side of the phase-0 object (constructed from QML if instantiated).
#[derive(Default)]
pub struct HelloBridgeRust {
greeting: cxx_qt_lib::QString,
}
+22
View File
@@ -0,0 +1,22 @@
//! qbz-qt — Qt/QML frontend POC entry point.
//!
//! Phase 0: boot a QML engine on the qrc module and show a gate window.
mod bridge;
use cxx_qt_lib::{QGuiApplication, QQmlApplicationEngine, QUrl};
fn main() {
let mut app = QGuiApplication::new();
let mut engine = QQmlApplicationEngine::new();
if let Some(engine) = engine.as_mut() {
engine.load(&QUrl::from(
"qrc:/qt/qml/com/blitzfc/qbz/qml/Main.qml",
));
}
if let Some(app) = app.as_mut() {
app.exec();
}
}