Integrate Qml and Rust by building the QMetaObject at compile time.

Related tags

GUI qmetaobject-rs
Overview

QMetaObject crate for Rust

The qmetaobject crate is a crate which is used to expose rust object to Qt and QML.

Travis Build Status Appveyor Build status Crates.io Documentation

Objectives

  • Rust procedural macro (custom derive) to generate a QMetaObject at compile time.
  • Bindings for the main Qt types using the cpp! macro from the cpp crate.
  • Users of this crate should not require to type any line of C++ or use another build system beyond cargo.
  • Performance: Avoid any unnecessary conversion or heap allocation.

Presentation Blog Post: https://woboq.com/blog/qmetaobject-from-rust.html

Overview

#[macro_use] extern crate cstr;
extern crate qmetaobject;

use qmetaobject::*;

// The `QObject` custom derive macro allows to expose a class to Qt and QML
#[derive(QObject,Default)]
struct Greeter {
    // Specify the base class with the qt_base_class macro
    base: qt_base_class!(trait QObject),
    // Declare `name` as a property usable from Qt
    name: qt_property!(QString; NOTIFY name_changed),
    // Declare a signal
    name_changed: qt_signal!(),
    // And even a slot
    compute_greetings: qt_method!(fn compute_greetings(&self, verb: String) -> QString {
        format!("{} {}", verb, self.name.to_string()).into()
    })
}

fn main() {
    // Register the `Greeter` struct to QML
    qml_register_type::<Greeter>(cstr!("Greeter"), 1, 0, cstr!("Greeter"));
    // Create a QML engine from rust
    let mut engine = QmlEngine::new();
    // (Here the QML code is inline, but one can also load from a file)
    engine.load_data(r#"
        import QtQuick 2.6
        import QtQuick.Window 2.0
        // Import our Rust classes
        import Greeter 1.0

        Window {
            visible: true
            // Instantiate the rust struct
            Greeter {
                id: greeter;
                // Set a property
                name: "World"
            }
            Text {
                anchors.centerIn: parent
                // Call a method
                text: greeter.compute_greetings("hello")
            }
        }
    "#.into());
    engine.exec();
}

Features

  • Create object inheriting from QObject, QQuickItem, QAbstractListModel, QQmlExtensionPlugin, ...
  • Export Qt properties, signals, methods, ...
  • Also support #[derive(QGadget)] (same as Q_GADGET)
  • Create Qt plugin (see examples/qmlextensionplugins)
  • Partial scene graph support

Requires Qt >= 5.8

Cargo features

Cargo provides a way to enable (or disable default) optional features.

log

By default, Qt's logging system is not initialized, and messages from e.g. QML's console.log don't go anywhere. The "log" feature enables integration with log crate, the Rust logging facade.

The feature is enabled by default. To activate it, execute the following code as early as possible in main():

fn main() {
    qmetaobject::log::init_qt_to_rust();
    // don't forget to set up env_logger or any other logging backend.
}

chrono_qdatetime

Enables interoperability of QDate and QTime with Rust chrono package.

This feature is disabled by default.

webengine

Enables QtWebEngine functionality. For more details see the example.

This feature is disabled by default.

What if a binding for the Qt C++ API you want to use is missing?

It is quite likely that you would like to call a particular Qt function which is not wrapped by this crate.

In this case, it is always possible to access C++ directly from your rust code using the cpp! macro.

Example: from examples/graph/src/main.rs, the struct Graph is a QObject deriving from QQuickItem, QQuickItem::setFlag is currently not exposed in the API but we wish to call it anyway.

impl Graph {
    fn appendSample(&mut self, value: f64) {
        // ...
        let obj = self.get_cpp_object();
        cpp!(unsafe [obj as "QQuickItem *"] { obj->setFlag(QQuickItem::ItemHasContents); });
        // ...
    }
}

But ideally, we should wrap as much as possible so this would not be needed. You can request API as a github issue, or contribute via a pull request.

Comments
  • Fail to compilation: duplicate section `***' has different size

    Fail to compilation: duplicate section `***' has different size

    (1) My OS: windows 10 x64

    (2) My package management: MSYS2

    (3) The installed libraries related to QT include:

    local/mingw-w64-i686-qbs 1.18.0-2
        Qt Build Suite (mingw-w64)
    local/mingw-w64-i686-qt-creator 4.14.2-1
        Cross-platform IDE (mingw-w64)
    local/mingw-w64-i686-qt5 5.15.2-8 (mingw-w64-i686-qt mingw-w64-i686-qt5)
        A cross-platform application and UI framework (mingw-w64)
    local/mingw-w64-i686-qt5-static 5.15.2-2 (mingw-w64-i686-qt-static mingw-w64-i686-qt5-static)
        A cross-platform application and UI framework (mingw-w64-static)
    local/mingw-w64-i686-qtbinpatcher 2.2.0-4
        Patcher for Qt libraries (mingw-w64)
    local/mingw-w64-x86_64-qbs 1.18.0-2
        Qt Build Suite (mingw-w64)
    local/mingw-w64-x86_64-qt-creator 4.14.2-1
        Cross-platform IDE (mingw-w64)
    local/mingw-w64-x86_64-qt5 5.15.2-8 (mingw-w64-x86_64-qt mingw-w64-x86_64-qt5)
        A cross-platform application and UI framework (mingw-w64)
    local/mingw-w64-x86_64-qt5-static 5.15.2-2 (mingw-w64-x86_64-qt-static mingw-w64-x86_64-qt5-static)
        A cross-platform application and UI framework (mingw-w64-static)
    local/mingw-w64-x86_64-qtbinpatcher 2.2.0-4
        Patcher for Qt libraries (mingw-w64)
    

    (4) The installed libraries related to libcrypt include:

    local/libcrypt 2.1-3 (libraries)
        Encryption/Decryption library
    local/libcrypt-devel 2.1-3 (development)
        Libcrypt headers and libraries
    local/libgcrypt 1.9.2-1 (libraries)
        General purpose cryptographic library based on the code from GnuPG
    local/libgpg-error 1.42-1 (libraries)
        Support library for libgcrypt
    local/libhogweed 3.7.2-1 (libraries)
        A low-level cryptographic library
    local/libnettle 3.7.2-1 (libraries)
        A low-level cryptographic library
    local/libxxhash 0.8.0-1 (libraries)
        Extremely fast non-cryptographic hash algorithm
    local/mingw-w64-i686-libgcrypt 1.9.2-2
        General purpose cryptographic library based on the code from GnuPG (mingw-w64)
    local/mingw-w64-i686-libgpg-error 1.42-1
        Support library for libgcrypt (mingw-w64)
    local/mingw-w64-x86_64-libdvdcss 1.4.2-1
        Portable abstraction library for DVD decryption (mingw-w64)
    local/mingw-w64-x86_64-libgcrypt 1.9.2-2
        General purpose cryptographic library based on the code from GnuPG (mingw-w64)
    local/mingw-w64-x86_64-libgpg-error 1.42-1
        Support library for libgcrypt (mingw-w64)
    local/mingw-w64-x86_64-nettle 3.7.2-1
        A low-level cryptographic library (mingw-w64)
    local/mingw-w64-x86_64-xxhash 0.8.0-1
        Extremely fast non-cryptographic hash algorithm (mingw-w64)
    local/nettle 3.7.2-1 (net-utils)
        A low-level cryptographic library
    local/xxhash 0.8.0-1
        Extremely fast non-cryptographic hash algorithm
    

    (5) When I executes the command cargo run -p todos in mingw64.exe, the following error is shown:

    error: linking with `x86_64-w64-mingw32-gcc` failed: exit code: 1
      |
      = note: "x86_64-w64-mingw32-gcc" "-fno-use-linker-plugin" "-Wl,--nxcompat" "-Wl,--dynamicbase" "-Wl,--disable-auto-image-base" "-m64" "-Wl,--high-entropy-va" "H:\\symbol_link_source\\.rustup\\toolchains\\nightly-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\rsbegin.o" "-L" "H:\\symbol_link_source\\.rustup\\toolchains\\nightly-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.10dsjum8pcrztsh7.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.12o9lrwmspc88xdd.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.14q3crp5axgi1c0k.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.160zd0vuj5j8476n.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.1a5q71sm873kabcb.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.1axxkyz3td4u420v.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.1bpsvay1zd3gmyxi.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.1cldh9q9b8e81daw.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.1f95wj6p76k5qs74.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.1js4h6h69ydy71bb.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.1ldkfd71voahqcyu.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.1o0jgq7jtr0p9nk.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.1pwg26nlvkaspc1p.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.1rgal1zmhvwv76no.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.1rl96vgwtxc7v6pb.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.1so53f56acdpasyd.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.1tbxrd4ctbnwekf.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.20pljcdyyejw3ekv.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.21uoc3wyd1fstgjy.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.238c90tmezz6m2mj.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.263z2ubuorpjr1vf.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.26cb5xz16t4pbzpg.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.2dgausbqdsn60u8p.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.2dktrbi4g35dnykr.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.2dxoaxuc712dt5r0.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.2g9w0mb8syq9ihb6.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.2i9eo5am386raogg.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.2in9iff9qv0lpf2f.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.2isagcy4996lriqo.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.2jnagg4gz56nyn8d.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.2mzfx8uol7k854t3.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.2q4f8m64fxnolx79.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.2ss8t8zkooexm9qb.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.2t1vn3dsrpk1mexr.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.2vcedks0835xzjjx.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.2y8l2ml17ckxhvdd.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.308n6xvt606ex5i9.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.31h6nbvhsu0o3jsg.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.31i7xbrt2as5fmq4.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.38q0a3gi2eqpcr86.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.3acfkqvngljpixqj.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.3bz5jm22pgs1lqc1.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.3cuznll17iombe9c.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.3gesf84x1i55jxhp.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.3gjzrfnqmgfzjrqm.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.3kb83mh5dtvcg66p.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.3ohbfns4gk2j5yzn.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.3tfa441drqfuewjd.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.3tn72xpkp33ln9ze.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.3vbvmvki2ovd47ey.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.3vq9o1tjpchr84gg.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.3xl41wd24k1c1qn1.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.3ybobfoypattqvkh.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.3yna42bmogvo07dv.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.413qajnq2htatfb4.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.41ggz430cny5xk4z.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.41qi3z847vpxgi7v.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.43jhiw4qsqetri2j.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.44negdatoahn2frh.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.467fjx0vw20fv4sw.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.471uvbl12lfeo4ge.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.4ckhhjkfl6lvxuv6.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.4cxnsdgabd95vp3g.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.4d7bm26p81mnk6c2.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.4filed7q0lvpjw13.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.4j7fho4vpa8jip0c.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.4jx2nf0q9gyswxcw.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.4lz9bq4wr62mzupc.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.4n09xa3v3d7shue1.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.4pgaci2hyv33jmiy.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.4ubwvh1kbbk29ayn.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.4ukeubhx2eveechk.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.4wtvpirxzxy589en.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.4x7mf0rn498uob5b.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.4xq3c3ya176bwjlp.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.4ze7hsxqikpbvh3x.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.566d1kvmvkhqwjbn.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.56jc5vu5k0fa2j3m.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.581fx88f2mjlmoeh.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.5a4aiyyfanfsog2n.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.5aazdkg54u4n2g55.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.5awne1m6x70ngtgx.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.5bb4cm4h6pvtfk9.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.5bqn1ohj8z3jfxtc.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.5dcniekge0wyy1ke.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.5gey0b062knimwhg.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.7gl138rnfon4617.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.ae6jx9fkbo7j209.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.aldb6jsiuuqpu6n.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.el0vzpduhwyp57g.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.fe0arpx95g7xqza.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.h4z23b54bndbv09.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.oxnb8auker3jv9n.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.pdg1j5ns006octh.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.ph307haryfqr5l1.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.qh1hdtknk2hcykj.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.vi6pmax54gmn1wh.rcgu.o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.x66noukoj7872xp.rcgu.o" "-o" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.exe" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\todos-e0d45e23c7d9727d.hh09vytktfj4qaj.rcgu.o" "-Wl,--gc-sections" "-nodefaultlibs" "-L" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps" "-L" "H:\\github_projects\\qt_rs_todos\\target\\debug\\build\\qmetaobject-11ec537bbf8b6b87\\out" "-L" "H:\\github_projects\\qt_rs_todos\\target\\debug\\build\\qttypes-dd4c082e42378ffe\\out" "-L" "H:/symbol_link_source/msys64/mingw64/lib" "-L" "H:\\symbol_link_source\\.rustup\\toolchains\\nightly-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib" "-Wl,-Bstatic" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\libqmetaobject-e284a3ee801d53d3.rlib" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\liblog-f685979e2ab1ba7b.rlib" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\libcfg_if-b273423f0756ca72.rlib" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\libqttypes-929376424a1dde2b.rlib" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\libcpp-d5f17c73b9ae0b1b.rlib" "H:\\github_projects\\qt_rs_todos\\target\\debug\\deps\\liblazy_static-f392f42a3d2e534b.rlib" "-Wl,--start-group" "H:\\symbol_link_source\\.rustup\\toolchains\\nightly-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libstd-94f60f405c1748af.rlib" "H:\\symbol_link_source\\.rustup\\toolchains\\nightly-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libpanic_unwind-f56d3aec7c2576d9.rlib" "H:\\symbol_link_source\\.rustup\\toolchains\\nightly-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libobject-8e553c585536bfaf.rlib" "H:\\symbol_link_source\\.rustup\\toolchains\\nightly-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libaddr2line-3a82c272c5de0489.rlib" "H:\\symbol_link_source\\.rustup\\toolchains\\nightly-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libgimli-ef04c21117777245.rlib" "H:\\symbol_link_source\\.rustup\\toolchains\\nightly-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\librustc_demangle-b3ae962defb8b363.rlib" "H:\\symbol_link_source\\.rustup\\toolchains\\nightly-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libhashbrown-b441247297fa184b.rlib" "H:\\symbol_link_source\\.rustup\\toolchains\\nightly-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\librustc_std_workspace_alloc-19bb25a86d3a5b92.rlib" "H:\\symbol_link_source\\.rustup\\toolchains\\nightly-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libunwind-d7957714cc30050c.rlib" "H:\\symbol_link_source\\.rustup\\toolchains\\nightly-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libcfg_if-abd7bd18212580be.rlib" "H:\\symbol_link_source\\.rustup\\toolchains\\nightly-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\liblibc-80187982c9cf70bf.rlib" "H:\\symbol_link_source\\.rustup\\toolchains\\nightly-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\liballoc-4172a25dd8c4f2de.rlib" "H:\\symbol_link_source\\.rustup\\toolchains\\nightly-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\librustc_std_workspace_core-27282989cc5b80d2.rlib" "H:\\symbol_link_source\\.rustup\\toolchains\\nightly-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libcore-2f52c7ac303d5565.rlib" "-Wl,--end-group" "H:\\symbol_link_source\\.rustup\\toolchains\\nightly-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libcompiler_builtins-2b00c29940bf9d8a.rlib" "-Wl,-Bdynamic" "-lstdc++" "-lstdc++" "-lmsvcrtd" "-lQt5Cored" "-lQt5Guid" "-lQt5Widgetsd" "-lQt5Quickd" "-lQt5Qmld" "-ladvapi32" "-lws2_32" "-luserenv" "-lgcc_eh" "-l:libpthread.a" "-lmsvcrt" "-lmingwex" "-lmingw32" "-lgcc" "-lmsvcrt" "-luser32" "-lkernel32" "H:\\symbol_link_source\\.rustup\\toolchains\\nightly-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\rsend.o"
      = note: H:\github_projects\qt_rs_todos\target\debug\deps\libqttypes-929376424a1dde2b.rlib(cpp_closures.o): duplicate section `.data$_ZN7rustcpp8metadataE[_ZN7rustcpp8metadataE]' has different size
              H:/symbol_link_source/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lmsvcrtd
              H:/symbol_link_source/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lQt5Cored
              H:/symbol_link_source/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lQt5Guid
              H:/symbol_link_source/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lQt5Widgetsd
              H:/symbol_link_source/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lQt5Quickd
              H:/symbol_link_source/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lQt5Qmld
              collect2.exe: error: ld returned 1 exit status
    

    Do you give me a few of suggestions for how to compile the project? Maybe, are there certain libraries I missed in my local MSYS2? Or I shoundn't utilize MSYS2?

    opened by stuartZhang 29
  • Enum property

    Enum property

    Add property support for enums.

    I'm having a hard time finding the good way of registering correctly the enum. I'm going to keep searching, but in the mid-times if you have any input on what I'm doing, they would be welcomed.

    Registering

    I introduced a function register_metatype_enum<T: QEnum>() but:

    • The implementation I tried based on what was done for QMetaType doesn't work
      obj.prop: Enum.Value // cannot assign int to MyEnum
    
    • As a test I returned the meta-type id of i32, that make it half work (by making the QML think it's only an integer...)
     obj.prop: Enum.Value // works
     obj.prop: 958 // doesn't generate an error as it should
    

    QMetaObject data

    I'm also not really sure about the way I did some meta-object generation changes:

    • Adding the enum flag to the properties
    • Adding the related meta-objects into a meta-object (not absolutely sure I need them actually but the QML stack seems to use it for enumerators)

    For both of them I needed to edit the data stored inside QMetaObject during the lazy static initialization

    Contributing

    On a more general aspect:

    • Are you using rustfmt / cargo fmt ? If yes in which version ? I'm using format by default with rust 1.36 and a lot of the code-base is affected.
    • I forgot to check for it in my previous contributions but, are you using clippy for a warnings free code ?
    opened by Guiguiprim 21
  • Can't compile simple example

    Can't compile simple example

    Sorry if this is the wrong place to ask a question, I was not sure where to ask.

    When I clone the repository, everything compiles nicely. However, even the simplest code I write myself does not.

    Cargo.toml

    [package]
    name = "compile_test"
    version = "0.1.0"
    edition = "2018"
    
    [dependencies]
    qmetaobject = { git = "https://github.com/woboq/qmetaobject-rs"}
    qttypes = { git = "https://github.com/woboq/qmetaobject-rs"}
    cpp = "0.5.6"
    
    [build-dependencies]
    cpp_build = "0.5.6"
    

    build.rs

    fn main() {
        let qt_include_path = std::env::var("DEP_QT_INCLUDE_PATH").unwrap();
        let qt_library_path = std::env::var("DEP_QT_LIBRARY_PATH").unwrap();
    
        #[allow(unused_mut)]
            let mut config = cpp_build::Config::new();
    
        if cfg!(target_os = "macos") {
            config.flag("-F");
            config.flag(&qt_library_path);
        }
    
        config
            .include(&qt_include_path)
            .include(format!("{}/QtQuick", qt_include_path))
            .include(format!("{}/QtCore", qt_include_path))
            .build("src/main.rs");
    }
    

    main.rs

    fn main() {
        cpp::cpp!(unsafe [] {
            QQuickItem()
        })
    }
    

    Compiler output:

    ]$ cargo build
       Compiling compile_test v0.1.0 (/home/my_user_dir/code/compile_test)
    The following warnings were emitted during compilation:
    
    warning: src/main.rs: In function ‘void __cpp_closure_3236538559632315137()’:
    warning: src/main.rs:3:9: error: ‘QQuickItem’ was not declared in this scope
    warning:     3 |         QQuickItem()
    warning:       |         ^~~~~~~~~~
    
    error: failed to run custom build command for `compile_test v0.1.0 (/home/my_user_dir/code/compile_test)`
    
    Caused by:
      process didn't exit successfully: `/home/my_user_dir/code/compile_test/target/debug/build/compile_test-977a7d2952cf6a8a/build-script-build` (exit status: 1)
      --- stdout
      TARGET = Some("x86_64-unknown-linux-gnu")
      OPT_LEVEL = Some("0")
      HOST = Some("x86_64-unknown-linux-gnu")
      CXX_x86_64-unknown-linux-gnu = None
      CXX_x86_64_unknown_linux_gnu = None
      HOST_CXX = None
      CXX = None
      CXXFLAGS_x86_64-unknown-linux-gnu = None
      CXXFLAGS_x86_64_unknown_linux_gnu = None
      HOST_CXXFLAGS = None
      CXXFLAGS = None
      CRATE_CC_NO_DEFAULTS = None
      DEBUG = Some("true")
      CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
      CXX_x86_64-unknown-linux-gnu = None
      CXX_x86_64_unknown_linux_gnu = None
      HOST_CXX = None
      CXX = None
      CXXFLAGS_x86_64-unknown-linux-gnu = None
      CXXFLAGS_x86_64_unknown_linux_gnu = None
      HOST_CXXFLAGS = None
      CXXFLAGS = None
      CRATE_CC_NO_DEFAULTS = None
      CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
      running: "c++" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-I" "/home/my_user_dir/code/compile_test" "-I" "/usr/include/qt" "-I" "/usr/include/qt/QtQuick" "-I" "/usr/include/qt/QtCore" "-Wall" "-Wextra" "-std=c++11" "-o" "/home/my_user_dir/code/compile_test/target/debug/build/compile_test-9a41b8eb092cd6e1/out/rust_cpp/cpp_closures.o" "-c" "/home/my_user_dir/code/compile_test/target/debug/build/compile_test-9a41b8eb092cd6e1/out/rust_cpp/cpp_closures.cpp"
      cargo:warning=src/main.rs: In function ‘void __cpp_closure_3236538559632315137()’:
      cargo:warning=src/main.rs:3:9: error: ‘QQuickItem’ was not declared in this scope
      cargo:warning=    3 |         QQuickItem()
      cargo:warning=      |         ^~~~~~~~~~
      exit status: 1
    
      --- stderr
    
    
      error occurred: ToolExecError: Command "c++" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-I" "/home/my_user_dir/code/compile_test" "-I" "/usr/include/qt" "-I" "/usr/include/qt/QtQuick" "-I" "/usr/include/qt/QtCore" "-Wall" "-Wextra" "-std=c++11" "-o" "/home/my_user_dir/code/compile_test/target/debug/build/compile_test-9a41b8eb092cd6e1/out/rust_cpp/cpp_closures.o" "-c" "/home/my_user_dir/code/compile_test/target/debug/build/compile_test-9a41b8eb092cd6e1/out/rust_cpp/cpp_closures.cpp" with args "c++" did not execute successfully (status code exit status: 1).
    
    

    I believe it finds Qt includes and libs OK as I have qmake in my PATH and the paths visible in the compilation command are OK.

    I would appreciate any help I can get.

    Thanks!

    C-discussion A-docs 
    opened by mikolajsnioch 13
  • console.log() qml not working

    console.log() qml not working

    I am using env_logger as backend. I can see log messages from the Rust side. However, I cannot see the messages logged from QML. I thought this was added in #86 but I also found #163 so I'm not sure if it still works. So is it broken in QT6 or are there some additional steps required which are not mentioned in the README?

    System Information: QT: 6.1.2 Display Server: X11 Distro: Fedroa 34 Kernel: 5.12.17-300.fc34

    C-discussion 
    opened by Ayush1325 12
  • Allow overriding Qt header and lib paths with environment variables in qttypes/build.rs

    Allow overriding Qt header and lib paths with environment variables in qttypes/build.rs

    First checking whether the DEP_QT_INCLUDE_PATH and DEP_QT_LIBRARY_PATH allows compiling against different Qt versions than whatever qmake picks up on.

    This is useful for example when cross-compiling.

    opened by tnibler 12
  • Ubuntu touch support

    Ubuntu touch support

    Hey, first of all: thanks for this awesome project.

    I was trying to get this running on Ubuntu touch and I got it working partly. That means that I can get an example to compile and make it start an application window using only Rust, QML and qmetaobject-rs. This works.

    Unfortunately though, the application segfaults as soon as I try to export a QObject to QML including a qt_method, qt_property, or qt_signal. Note that the call to qml_register_type and exporting an empty QObject without a qt_method don't lead to a crash.

    I'm running the example from the readme.

    gdb backtrace:

    Thread 5 "QQmlThread" received signal SIGSEGV, Segmentation fault.
    [Switching to Thread 0xaf82a370 (LWP 22946)]
    0x2a03d80e in je_tcache_dalloc_small (slow_path=false, binind=<optimized out>, 
        ptr=0x2a06db4b, tcache=0xb3825000, tsd=<optimized out>)
        at /checkout/src/liballoc_jemalloc/../jemalloc/include/jemalloc/internal/tcache.h:424
    424	/checkout/src/liballoc_jemalloc/../jemalloc/include/jemalloc/internal/tcache.h: No such file or directory.
    (gdb) bt
    #0  0x2a03d80e in je_tcache_dalloc_small (slow_path=false, 
        binind=<optimized out>, ptr=0x2a06db4b, tcache=0xb3825000, 
        tsd=<optimized out>)
        at /checkout/src/liballoc_jemalloc/../jemalloc/include/jemalloc/internal/tcache.h:424
    #1  je_arena_dalloc (slow_path=false, tcache=0xb3825000, ptr=0x2a06db4b, 
        tsdn=<optimized out>)
        at /checkout/src/liballoc_jemalloc/../jemalloc/include/jemalloc/internal/arena.h:1441
    #2  je_idalloctm (slow_path=false, is_metadata=false, tcache=0xb3825000, 
        ptr=0x2a06db4b, tsdn=<optimized out>)
        at include/jemalloc/internal/jemalloc_internal.h:1170
    #3  je_iqalloc (slow_path=false, tcache=0xb3825000, ptr=0x2a06db4b, 
        tsd=<optimized out>) at include/jemalloc/internal/jemalloc_internal.h:1187
    #4  ifree (tsd=<optimized out>, slow_path=false, tcache=0xb3825000, 
        ptr=0x2a06db4b)
        at /checkout/src/liballoc_jemalloc/../jemalloc/src/jemalloc.c:1896
    #5  free (ptr=0x2a06db4b)
        at /checkout/src/liballoc_jemalloc/../jemalloc/src/jemalloc.c:2016
    #6  0xb5f12c1c in ?? () from /usr/lib/arm-linux-gnueabihf/libQt5Qml.so.5
    Backtrace stopped: previous frame identical to this frame (corrupt stack?)
    

    Using Rust nightly and the system allocator instead of jemalloc:

    *** Error in `/opt/click.ubuntu.com/rust-example.timsueberkrueb/0.1.0/lib/arm-linux-gnueabihf/bin/qt-rust-ut': 
    free(): invalid pointer: 0x2a029215 ***
    
    Thread 5 "QQmlThread" received signal SIGABRT, Aborted.
    [Switching to Thread 0xaff273c0 (LWP 14110)]
    __libc_do_syscall () at ../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:47
    47	../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S: No such file or directory.
    

    Given those symptoms, do you have an idea what could go wrong, or what I could do to debug this issue further? Thanks a lot for any hints!

    opened by timsueberkrueb 11
  • Support older Qt versions, down to 5.6

    Support older Qt versions, down to 5.6

    Hi!

    I know 5.6 is kinda old (an LTS that has known life from 2016-03-16 until 2019-03-16), but this is still what SailfishOS uses, and will probably be that for a while, until they switch to 5.12 (or hopefully something even more recent).

    With the eye on keeping the difference between my qmetaobject-sfos-rs fork and your upstream as small as possible, I'd like to introduce cfg flags on all functionality between 5.6 and 5.most-recent. This should not impact upstream, but should provide me with a way more maintainable set of patches.

    I hope this is alright for you folks! If it is, I will start adding the relevant cfg flags to all structs and methods that require them.

    TODO:

    • [ ] Perhaps update the readme for minimum needed Qt version?
    • [ ] git rebase --autosquash
    • [ ] Should we annotate the docs of relevant public functions with their respective Qt versions?
    • [ ] Rebase my fork and test whether it works!
    opened by rubdos 10
  • Proposal: use prelude::*

    Proposal: use prelude::*

    This is the proposal draft to include a prelude module into qmetaobject crate, similar to the one in Rust standard library and many other existing crates. The purpose of the module shall be to re-export all or most of public items from the crate. Questions to consider:

    • [ ] should all items be exported or only subset of them?
    • [ ] if not all, then how to define a subset?

    certainly relates to #81

    C-feature-request 
    opened by ratijas 10
  • Shorten paths and modernize imports

    Shorten paths and modernize imports

    Most noticeably, std::ffi::CStr[ing] and ::std::os::raw::c_void.


    Just a clean-up, because I needed QMetaType in a good shape.

    The more I play with QVariant implementations, the more I think QMetaType belongs to qttypes crate. I can not justify that they are not split in different packages.

    C-enhancement A-docs 
    opened by ratijas 9
  • qml_register singleton

    qml_register singleton

    Registers a QML singleton object.

    This has the same purpose as the C++ qmlRegisterSingletonType function but uses qmlRegisterSingletonInstance, which was introduced in Qt 5.14, to avoid the need for a callback.

    I am not sure if ownership and destruction are handled correctly, so please check carefully ;)

    opened by surban 9
  • Silence deprecation warning in Graph example

    Silence deprecation warning in Graph example

               Such solution
    
    much compatibility
                                   very fix
    
                          wow
    

    After spending a day trying to figure out this new shiny undocumented experimental Qt Rhi, I finally gave up and implemented a workaround that disables compiler's deprecation warnings altogether. Those old QSGSimpleMaterial{,Shader} classes ain't going to be removed from Qt5 which is on a life support at this point; and we know for sure they are already gone in Qt6. So, there's just no point seeing these warning over and over again.

    C-cleanup O-linux O-windows-gnu A-C++ 
    opened by ratijas 8
  • the trait bound `String: Deref` is not satisfied

    the trait bound `String: Deref` is not satisfied

    my rustc version: rustc 1.66.0-nightly (0da281b60 2022-10-27)

    error[E0277]: the trait bound `String: Deref` is not satisfied
    
       --> qmetaobject/src/qmetatype.rs:438:87
    
        |
    
    438 |     const CONVERSION_TO_STRING: Option<fn(&Self) -> QString> = Some(|s| QString::from(&*s as &str));
    
        |                                                                                       ^^^ the trait `~const Deref` is not implemented for `String`
    
        |
    
    note: the trait `Deref` is implemented for `String`, but that implementation is not `const`
    
       --> qmetaobject/src/qmetatype.rs:438:87
    
        |
    
    438 |     const CONVERSION_TO_STRING: Option<fn(&Self) -> QString> = Some(|s| QString::from(&*s as &str));
    
        |                                                                                       ^^^
    
    
    
    For more information about this error, try `rustc --explain E0277`.
    

    I try to fix the issuse, it's work.

    diff --git a/qmetaobject/src/qmetatype.rs b/qmetaobject/src/qmetatype.rs
    
    index 1d06100..f9bf9ce 100644
    
    --- a/qmetaobject/src/qmetatype.rs
    
    +++ b/qmetaobject/src/qmetatype.rs
    
    @@ -435,7 +435,7 @@ where
    
     }
    
     
    
     impl QMetaType for String {
    
    -    const CONVERSION_TO_STRING: Option<fn(&Self) -> QString> = Some(|s| QString::from(&*s as &str));
    
    +    const CONVERSION_TO_STRING: Option<fn(&Self) -> QString> = Some(|s| QString::from(s.as_str()));
    
         const CONVERSION_FROM_STRING: Option<fn(&QString) -> Self> = Some(|s| s.to_string());
    
     }
    
    
    
    opened by mingjunyang 2
  • Add qputenv implementation

    Add qputenv implementation

    Add qputenv implementation to add environment variable programmatically so that it'll possible to initialize virtual keyboard safely.

    Ex: qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"))

    opened by gmittone 1
  • Adding an example to illustrate custom QObject nesting

    Adding an example to illustrate custom QObject nesting

    After spending several days figuring out how to put a QObject inside another QObject's struct and finally finding out thanks to #26, I made a little example to illustrate how to do it. I hope it will help other users who are struggling to do something similar.

    opened by aeyno 0
  • Unable to cross-compile from Linux to Windows using `mingw-w64`

    Unable to cross-compile from Linux to Windows using `mingw-w64`

    cargo run --target x86_64-pc-windows-gnu --bin graph gave the following errors: https://gist.github.com/melvyn2/6c34ef3f82ecddca072fb8202c77bff8#file-build-log

    It's a whole lot of undefined reference to errors to c++ standard symbols, like __gxx_personality_seh0 and __cxa_rethrow, along with Qt symbols like QtSharedPointer::ExternalRefCountData::operator delete(void*). Searching around, this seems to be caused by not linking in libstc++, but checking the linker call it's being included. I'm able to cross-compile and run other rust projects with my current setup, so I'm not sure what's breaking here exactly.

    opened by melvyn2 4
  • `qttypes::QPainter` unsound

    `qttypes::QPainter` unsound

    QPainter is declared as a cpp_class!, but QPainter can't be moved in memory because the QPainterPrivate holds a q_ptr pointer to the origial QPainter.

    https://github.com/woboq/qmetaobject-rs/blob/808d31267a18392f4761b0711d4d2dce058222f6/qttypes/src/lib.rs#L1279-L1284

    We would need to somehow put the QPainter on the heap. But that'd be an incompatible change for people using it via the cpp! macro.

    opened by ogoffart 0
Releases(v0.2.7)
Owner
Woboq GmbH
Woboq GmbH
A react-inspired UI library for building multimedia desktop apps with rust and vulkan.

narui A react-inspired UI library for building multimedia desktop apps with rust and vulkan. declarative UI with Ergonomics similar to React with hook

apertus° - open source cinema 42 Jan 1, 2023
🖼 A Rust library for building user interfaces on the web with WebGL.

wasm-ui Hey! Welcome to my little experiment. It's a Rust library for building user interfaces on the web. You write the interface in Rust, and wasm-u

Harry 10 Dec 1, 2022
Real-time UI for bots, microservices, and IoT

Real-time UI for bots, microservices, and IoT

RillRate 399 Jan 7, 2023
💡 Experimental real-time global illumination renderer 🦀

?? kajiya Experimental real-time global illumination renderer made with Rust and Vulkan Its general goal is to get as close as possible to path-traced

Embark 3.8k Jan 3, 2023
Deno is a simple, modern and secure runtime for JavaScript and TypeScript that uses V8 and is built in Rust.

Deno Deno is a simple, modern and secure runtime for JavaScript and TypeScript that uses V8 and is built in Rust. Features Secure by default. No file,

Derek Jones 2 Aug 13, 2022
Rust bindings to Core Foundation and other low level libraries on Mac OS X and iOS

core-foundation-rs Compatibility Targets macOS 10.7 by default. To enable features added in macOS 10.8, set Cargo feature mac_os_10_8_features. To hav

Servo 685 Jan 2, 2023
Rust bindings and wrappers for GLib, GDK 3, GTK+ 3 and Cairo.

THIS REPOSITORY IS DEPRECATED SEE: https://github.com/rust-gnome rgtk Rust bindings and wrappers for GLib, GDK 3, GTK+ 3 and Cairo. Building rgtk expe

Jeremy Letang 124 Jul 10, 2022
Unofficial Linux QQ client, based on GTK4 and libadwaita, developed with Rust and Relm4.

GTK QQ (WIP) Unofficial Linux QQ client, based on GTK4 and libadwaita, developed with Rust and Relm4. Screenshots Light Dark Note The two screenshots

Lomírus 198 Dec 24, 2022
A powerful color picker and formatter, built with GTK and Rust

Eyedropper A powerful color picker and formatter. More screenshots Features Pick a Color Enter a color in Hex-Format Parse RGBA/ARGB Hex-Colors View c

Jonathan 108 Dec 24, 2022
A simple, clean, and beautiful WYSIWYG Markdown editor and content-management system

ScribeDown Current version: v0.0.1 Feature level: See the roadmap Beautiful, Clean, Writer-Oriented The goal of ScribeDown is to make Markdown the bes

Alex Dumas 4 Dec 20, 2022
A collection of components and widgets that are built for bevy_ui and the ECS pattern

Widgets for Bevy UI A collection of components and widgets that are built for bevy_ui and the ECS pattern. Current State This was started recently and

Gabriel Bourgeois 3 Sep 2, 2022
Build beautiful desktop apps with flutter and rust. 🌠 (wip)

flutter-rs Build flutter desktop app in dart & rust. Get Started Install requirements Rust flutter sdk Develop install the cargo flutter command cargo

null 2k Dec 26, 2022
SixtyFPS is a toolkit to efficiently develop fluid graphical user interfaces for any display: embedded devices and desktop applications. We support multiple programming languages, such as Rust, C++ or JavaScript.

SixtyFPS is a toolkit to efficiently develop fluid graphical user interfaces for any display: embedded devices and desktop applications. We support multiple programming languages, such as Rust, C++ or JavaScript.

SixtyFPS 5.5k Jan 1, 2023
A cross-platform GUI library for Rust focused on simplicity and type-safety

A cross-platform GUI library for Rust, inspired by Elm

Héctor Ramón 17.5k Jan 8, 2023
Highly customizable finder with high performance. Written in Rust and uses GTK

Findex Highly customizable finder with high performance. Written in Rust and uses GTK Installation Automatic Binary Clone from https://aur.archlinux.o

MD Gaziur Rahman Noor 442 Jan 1, 2023
GUI based tool to sort and categorize images written in Rust

ImageSieve GUI based tool to sort out images based on similarity, categorize them according to their creation date and archive them in a target folder

Florian Fetz 67 Dec 14, 2022
A simple note taking application written in Rust and GTK4

Rnote A simple note taking application written in Rust and GTK4. Rnote aims to be a simple but functional note taking application for freehand drawing

Felix Zwettler 3.4k Jan 5, 2023
Sycamore - A reactive library for creating web apps in Rust and WebAssembly

Sycamore What is Sycamore? Sycamore is a modern VDOM-less web library with fine-grained reactivity. Lightning Speed: Sycamore harnesses the full power

Sycamore 1.8k Jan 5, 2023
A GUI for NordVPN on Linux that maintains feature parity with the official clients, written with Rust and GTK.

Viking for NordVPN This project aims to provide a fully usable and feature-complete graphical interface for NordVPN on Linux. While it attempts to clo

Jacob Birkett 2 Oct 23, 2022