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.
Not true at all! Have you tried PyQT? It was in my experience an absolute pleasure to use, and I think satisfies your main criteria. No reason why there couldn't be similar bindings for any given language you prefer, though I understand the merits of standardizing on one. But also the point is that the Qt runtime would be part of the browser, which is usually all C++ or Rust or whatever anyway - not the web programme…
A Simple Rust GUI with QML
41–50 of 55 posts
Re: A Simple Rust GUI with QML
#42Earlier quoted context omitted.
C++ is notoriously hard to bind. The only high-quality Qt bindings I know of are Python ones (Pyside).
How did PyQt manage to solve this problem?
Re: A Simple Rust GUI with QML
#43Earlier 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
#44or PyQt
Re: A Simple Rust GUI with QML
#45Earlier 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…
Sorry, I was thinking of Lua for Qt5 .. That was silly!
And, it is a pity about PySide, it was a neat project. :(
Re: A Simple Rust GUI with QML
#46Part 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.
The browser is an atrocious, non-sensical platform that was invented to display Hypertext, not to run apps. Now look what we got? 5 new JS frameworks per month, because of some minuscule, often fabricated productivity gain. Various competing improvements to make CSS somehow manageable and an untyped, arcane and hard to optimize language on top of it. And we still struggle to make decent looking and performing apps. It's stupid.
Re: A Simple Rust GUI with QML
#47Because 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…
After the initial bumps and scratches getting used to rust, I've found the experience to be better overall than I remember it being back in the day with C++ and Qt. I actually ended up implementing my own tiny version of signals and slots as I remembered them from Qt to handle interactions between the user and the stuff on the back end (mostly sqlite at this point). That in combination with a certain relaxed attitude about using Rc> for GUI stuff has put me in a place where I'm pretty confident that any normal GUI operation is pretty straightforward with rust.
The amount of boilerplate code seems pretty similar between the two. I think that a GUI framework specifically designed for rust might actually be a big win over other options here, but so far there isn't one that I know of that meets my needs. As it is, using the GTK components from rust is easier than using them from C (in my opinion), and comparable with my memory of using Qt in C++.
I've also found that the type system and the error handling are great compared to what I used before. They help not only in catching problems, but also in ensuring that the design is complete before I get too far into it. The code I'm writing now is much more reliable in terms of handling errors and covering corner cases than what I did back then in c++/qt. There is a price for this upfront in terms of aligning your mental model with what rust wants, especially if you're coming from the same background I was. Once that is done I don't think it's any more difficult to get stuff done here than it was there, and the results seem to be quite a bit more robust.
It wasn't all good times though - the initial unlearning/relearning curve was pretty rough for me. I've been programming professionally in various languages for about 15 years, and rust has taken longer for me to get comfortable with than any other language. That's including a wide variety of languages from various paradigms including constraint/logic programming (prolog and ciao), functional (lisp, ocaml, haskell, etc.), imperative (python,ruby,c/c++,javascript) and other more obscure ones. Something about the familiar features of algebraic data types, pattern matching, and type inference combined with the strict memory model caused a lot of mental interference that took me a long time to sort out.
The build system is actually one of the biggest reasons I stuck with rust through the pain of getting started. I really love cargo, to the point now that I can't stand the thought of going back to makefiles, cmake, or any other C++ build system I've tried. Cargo seems to just work, which means I spend less time fighting with obscure linker and compiler flags and more time getting things done. I'd put up with a lot from the language just to keep the build system, to be honest.
Overall developing a GUI app in rust has been a decent experience. If you're already comfortable with the language, I'd recommend spending the time to learn the GTK bindings. Once you internalize their basic operating scheme, the time required to get GUI stuff done with rust is comparable to other languages and toolkits, but you get the peculiar combination of benefits that come from using rust itself.
Re: A Simple Rust GUI with QML
#48Earlier quoted context omitted.
How did PyQt manage to solve this problem?
PyQt has a whole other project, called sip, in service to it. If I understand it correctly, sip generates the bindings semi-automatically with a lot of special cases for Qt. Compared to the other set of Python C++ library bindings I've used (Vtk), they're magnificent.
Re: A Simple Rust GUI with QML
#49Earlier 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
#50Earlier quoted context omitted.
PyQt has a whole other project, called sip, in service to it. If I understand it correctly, sip generates the bindings semi-automatically with a lot of special cases for Qt. Compared to the other set of Python C++ library bindings I've used (Vtk), they're magnificent.
Any tips you can give as far as starting to learn VTK, especially its Python bindings?