What is it about Rust that makes porting QT different from any other language?
C++ is notoriously hard to bind. The only high-quality Qt bindings I know of are Python ones (Pyside).
A Simple Rust GUI with QML
31–40 of 55 posts
Re: A Simple Rust GUI with QML
#32Gist that I've been developing for quick setup guides (PRs welcome!): https://gist.github.com/ErichDonGubler/c802e066de7068241f0e6... We're still trying to get this to work with Windows. I've been reporting on this issue here: https://github.com/White-Oak/qml-rust/issues/31 . Any suggestions to get this going would be appreciated! Developing with Rust/QML on Windows definitely seems possible at this point...that said…
It was a bit of a struggle, but I was able to get this going for Mac w/Homebrew. after `brew install qt5`, I had to `brew linkapps qt5` & `brew link --force qt5`. Then `ln -s /usr/local/opt/qt5/mkspecs /usr/local/mkspecs && ln -s /usr/local/opt/qt5/plugins /usr/local/plugins` which is super not ideal. I had some error and ran `brew install doxygen --with-qt5` which may not be necessary, but after these steps it built…
Re: A Simple Rust GUI with QML
#33Earlier quoted context omitted.
It was a bit of a struggle, but I was able to get this going for Mac w/Homebrew. after `brew install qt5`, I had to `brew linkapps qt5` & `brew link --force qt5`. Then `ln -s /usr/local/opt/qt5/mkspecs /usr/local/mkspecs && ln -s /usr/local/opt/qt5/plugins /usr/local/plugins` which is super not ideal. I had some error and ran `brew install doxygen --with-qt5` which may not be necessary, but after these steps it built…
BTW, the qt5 formula explicitly says it's keg-only because it "has CMake issues when linked".
Re: A Simple Rust GUI with QML
#34Just in case, Rust integration of Sciter is even easier: extern crate sciter; fn main() { let mut frame = sciter::Window::new(); frame.load_file("minimal.htm"); frame.run_app(); } Result: https://camo.githubusercontent.com/b7d9438384930801ba15d027d... Rust/Sciter integration: https://github.com/sciter-sdk/rust-sciter
Re: A Simple Rust GUI with QML
#35Earlier quoted context omitted.
> I would love to see something like the Flutter Engine[1] written in Rust, which is a layer tree that runs in an OpenGL context and includes text rendering, shape drawing, gesture recognition, scroll layers, a layout engine, etc. – all components necessary for modern mobile app development. WebRender and Servo together contain all of these.
Right, but those components exist as bindings for HTML/CSS/JS. It would be awesome to see a Rust UI framework built on top of them. It's certainly no coincidence that the top contributors to the Flutter engine are all Chromium contributors.
Fundamentally, it allows you to represent a scene-graph and render it efficiently. How you go about constructing and manipulating your scene graph is up to the application which uses it.
In Servo's case it parses HTML and CSS for structure and style and allows manipulations through JS through the DOM, but none of those are any concern for webrender.
Re: A Simple Rust GUI with QML
#36Just in case, Rust integration of Sciter is even easier: extern crate sciter; fn main() { let mut frame = sciter::Window::new(); frame.load_file("minimal.htm"); frame.run_app(); } Result: https://camo.githubusercontent.com/b7d9438384930801ba15d027d... Rust/Sciter integration: https://github.com/sciter-sdk/rust-sciter
Yeah but I feel like HTML GUIs are the antithesis of Rust. Granted, it may be the best option at the moment.
HTML UI at the end is just a set of few simple concepts (at least with Sciter):
1. UI is a composition of just two universal components: Element and Node (text, comment, etc).
2. UI is a single rooted tree of such blocks - DOM tree.
3. The tree can be styled by well known CSS means.
4. Events are delivered to particular UI elements using bubbling/sinking event propagation schema.
5. Any DOM Element may have so called behavior assigned to it. The behavior is either native (C/C++/Rust/Go/etc) or script function. All elements are normal DOM elements with corresponding behaviors attached.
I do not see how this simple setup can be an antithesis to anything.
Re: A Simple Rust GUI with QML
#37Because it has largely not been done before, part of me wonders how well Rust would work to build a large, complex GUI. All GUI code I've seen relies on inheritance and dynamic dispatch to structure APIs. I would love to see something like the Flutter Engine[1] written in Rust, which is a layer tree that runs in an OpenGL context and includes text rendering, shape drawing, gesture recognition, scroll layers, a layout…
Rust has dynamic dispatch, by using trait objects (https://doc.rust-lang.org/book/trait-objects.html). It also has something similar to interface inheritance ("trait Foo: Bar" means that everything that implements the trait Foo must also implement the trait Bar), and one can always do "C-style inheritance" (have the parent be the first field of the child) for structs.
Given that, I'd say building a large, complex GUI framework in Rust is possible. I also wonder how a GUI framework written for Rust (instead of Rust bindings to a framework for another language) would look like.
Re: A Simple Rust GUI with QML
#38Re: A Simple Rust GUI with QML
#39Earlier quoted context omitted.
PyQt5 does not seem to be maintained. The last couple of times I checked it, it was pretty dead: one maintainer with no time.
I think you have this backwards. PyQt5 is well maintained by a company that produces a GPL version and sells a commercially licensed version, which was Qt's original business model. Pyside was originally created by Nokia back when Nokia bought Qt, re-licensed it as LGPL, and needed LGPL python bindings. It's no longer maintained and only works with Qt4. Pyside 2 is a port of pyside to Qt 5 that seems to have some lev…
Re: A Simple Rust GUI with QML
#40Earlier quoted context omitted.
Right, but those components exist as bindings for HTML/CSS/JS. It would be awesome to see a Rust UI framework built on top of them. It's certainly no coincidence that the top contributors to the Flutter engine are all Chromium contributors.
WebRender is not coupled in any way to HTML/CSS/JS as far as I know (I've used it in an app). Fundamentally, it allows you to represent a scene-graph and render it efficiently. How you go about constructing and manipulating your scene graph is up to the application which uses it. In Servo's case it parses HTML and CSS for structure and style and allows manipulations through JS through the DOM, but none of those are a…