Live data from Hacker News

A Simple Rust GUI with QML

vandenoever.info

11–20 of 55 posts

Re: A Simple Rust GUI with QML

#12

Part of me wonders how much better web programming could have been a decade ago if QT was the standard that browsers implemented, and we just shipped around QT frontends that ran sandboxed in the browser.

And instead of JS, we'd be stuck with C++. Not an improvement.

At least the frontend stack with the largest deployment—HTML, CSS, and JS—has a garbage collector and is memory safe. With C#/VB.NET on Windows, Swift on Mac/iOS, and Java on Android ascendant, this is now obviously the way to go. Imagine if we had permanently made the mistake of saddling the Web with manual, error-prone memory management.

Re: A Simple Rust GUI with QML

#13
post #9

Because 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…

> 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.

Re: A Simple Rust GUI with QML

#14

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 recent one: Lisp (ECL) with QML integration: https://gitlab.com/eql/EQL5/wikis/home (see QML link: direct Lisp function calls from QML, examples of QML generation from Lisp).

Re: A Simple Rust GUI with QML

#15
post #11

Earlier quoted context omitted.

C++ is notoriously hard to bind. The only high-quality Qt bindings I know of are Python ones (Pyside).

What about PyQt5? Or does it work differently?

PyQt5 does not seem to be maintained. The last couple of times I checked it, it was pretty dead: one maintainer with no time.

Re: A Simple Rust GUI with QML

#16
post #9

Because 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…

> 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.

It would be genuinely exciting to see some of that tech being used for a Rust GUI library. Nobody seems to be working on that yet though, I don't think.

Re: A Simple Rust GUI with QML

#17

Part of me wonders how much better web programming could have been a decade ago if QT was the standard that browsers implemented, and we just shipped around QT frontends that ran sandboxed in the browser.

And instead of JS, we'd be stuck with C++. Not an improvement. At least the frontend stack with the largest deployment—HTML, CSS, and JS—has a garbage collector and is memory safe. With C#/VB.NET on Windows, Swift on Mac/iOS, and Java on Android ascendant, this is now obviously the way to go. Imagine if we had permanently made the mistake of saddling the Web with manual, error-prone memory management.

> Imagine if we had permanently made the mistake of saddling the Web with manual, error-prone memory management.

Sounds like WebAssembly :)

Re: A Simple Rust GUI with QML

#18

Part of me wonders how much better web programming could have been a decade ago if QT was the standard that browsers implemented, and we just shipped around QT frontends that ran sandboxed in the browser.

And instead of JS, we'd be stuck with C++. Not an improvement. At least the frontend stack with the largest deployment—HTML, CSS, and JS—has a garbage collector and is memory safe. With C#/VB.NET on Windows, Swift on Mac/iOS, and Java on Android ascendant, this is now obviously the way to go. Imagine if we had permanently made the mistake of saddling the Web with manual, error-prone memory management.

Theres some truth around it. While QML may be nice I found the total experience of the QT stack lacking. It's still required to do large parts of the application in C++, since QML is mainly the View part. The impedance mismatch between the c++ and QML parts is huge compared to an environment that only uses a single language. I was part of some embedded system projects that used Actionscript (Adobe AIR) for some former projects and moved to QT in newer ones. For me personally it felt like a step backwards, from being able to implement the whole application in a single language with reasonable properties into a split world where I still need to use native code with all it's downsides. I don't want to say Actionscript is great here (it's for me somewhere between plain ES5 JS and Typescript) - I would also prefer a uniform Java or C# experience (as available on Android or Windows platforms) compared to a mixed C++/QML setup.

I see the main proposition of QT/QML in providing a framework that is not tied to a particular platform. The main thing that comes close are browser engines, but many people will find their huge footprints too large for using them for embedded applications (or partly even standalone desktop apps).

Re: A Simple Rust GUI with QML

#19
post #9

Because 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…

There's Conrod: https://github.com/PistonDevelopers/conrod

Re: A Simple Rust GUI with QML

#20

Earlier quoted context omitted.

And instead of JS, we'd be stuck with C++. Not an improvement. At least the frontend stack with the largest deployment—HTML, CSS, and JS—has a garbage collector and is memory safe. With C#/VB.NET on Windows, Swift on Mac/iOS, and Java on Android ascendant, this is now obviously the way to go. Imagine if we had permanently made the mistake of saddling the Web with manual, error-prone memory management.

> Imagine if we had permanently made the mistake of saddling the Web with manual, error-prone memory management. Sounds like WebAssembly :)

Which is why I'm glad that Web Assembly is offered in addition to a language with a garbage collector and a low learning curve.

(Note that, of course, I'm not opposed to wasm's existence: it's important for many use cases.)

Post reply on HN