GithubHelp home page GithubHelp logo

qml-rust's Introduction

QML-rust - bindings for Qt Quick

Build Status Crates.io

Bindings are based on DOtherSide C bindings for QML Library is mostly feature-compliant with other bindings based on the library, but lacks some minor features and has quite a few bugs.

Examples

All examples are located in a folder examples/, under example_name.rs and example_name.qml names.

  • cargo run --example properties for setting properties from Rust to QML.
  • cargo run --example listmodel for an example of providing QML with list model from Rust.
  • cargo run --example listmodel_macro for the same example, but using Q_LISTMODEL! and Q_LISTMODEL_ITEM! macro.
  • cargo run --example sigslots for an example of how to create your own QObject with signals and slots, and to communicate between QML and Rust. Also shows how to use Q_OBJECT! macro.
  • cargo run --example qobjects for an example of how to use Q_OBJECT! macro with different types.
  • cargo run --example qvarlists for an example of how to use qvarlist! macro to easily form QVariant (used to pass data to QML) of a complex array.
  • cargo run --example threaded for an example of multithreading.
  • cargo run --example qmlregister for an example of how to register and use your own types from Rust in QML.
  • An example in examples/resources (should be run manually by cargo run) shows how to use qrc resources.

Requires CMake, Make, Qt (Core, Gui, Widgets, Quick), pkg-config (only for OS X and GNU/Linux) and, of course, Rust.

To run tests: RUST_TEST_THREADS=1 cargo test

In-app examples

  • Architect - an app showing some git stats, using qml-rust to provide properties and lists to QML in here.
  • Kefia - A simple package manager, that provides a QListModel to QML, registers a QObject with slots and communicates between QML and Rust, here.

Status

Done:

  • Basic initialization and execution.
  • Providing properties to QML files.
  • QAbstractListModels - provides changable models for QML items (early draft, still lacks proper mutability).
  • QObjects: slots, signals (limited properties support). Emitting signals and receiving slots works.
  • Registering your own QML types (singletons or not) from Rust code.

To be done:

  • the library is mostly done, but some stuff is lacking polish, like possible memory leaks or better macro designs.

qml-rust's People

Contributors

white-oak avatar flanfly avatar sifyfy avatar archshift avatar nbigaouette avatar rustonaut avatar

Watchers

Marc Baldauf avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.