125 points · by jandeboevrie · 2y ago · 105 comments
I would also add an opinion: Qt is a great fit for Rust. GUI toolkits (=presentation layer) is best done declaratively and QML does an amazing job at it. Keep in mind that making a GUI kit, specially for 5 platforms in a way that it runs and feels uniformly across them all is a herculean task that returns no benefits because even if I can write some GUI in a "rusty" way, it won't suddenly speed up things because GUI is almost never a bottleneck.
With declarative + nonstandard we end up with some declarations, which are not the GUI we expect it to be, plus imperative code that mutates this anyway. So it's like we don't have the advantages of declarations, and we still need to write the code to build the GUI.
I'm still waiting for nice Qt bindings for Rust, as qmetaobject-rs seems to be QML-only?
Granted, my experience is with SwiftUI and Jetpack Compose, not QML but it doesn’t seem like developing complex (especially full fat desktop-style) apps with declarative frameworks is as nice as it could be.
But there are some really good systems available. .NET WPF is great overall for example. I could of course complain about how things are implemented and how mvvm is not baked in and how converters are too big and many other details. But I never needed to hack around the declarative part - that always just worked.
I was convinced that XAML was the perfect answer for rust and had the idea that I could write an independent XAML library/engine that rust appdevs would use and then match to a backend that would codegen the XAML into code that utilizes its corresponding api.
I had a sample that worked with both imgui and one of the other rust gui engines (not immediate mode) to prove it could be done. Biggest benefit was abstraction from actual ui toolkit choice (inspired by Windows where you can use a subset of the same XAML with WPF, Avalonia, WinUI 3, UWP, Noesis, Uno) and being able to take an imperative ui library like ImGUI and use it in a declarative fashion. Moreover, you could reuse existing XAML designers or avail yourself of XAML export functionality in some design software, without having any of that be rust-specific.
I put out feelers in the community to gauge interest but I think XAML is too foreign to most FOSS devs that picked up Rust early on and people couldn’t see what I saw in it (having worked with XAML for over a decade in C# land).
I got to the point where I could build a basic app with it fine, and I might pick it up again if I find the right project, but it just never seemed like it was adding anything, just making simple things more convoluted to me. I also found the C# community to be pretty hostile and insular, not in an intentional way, just more of a "hey we really want to help but everyone is too dumb and lazy to learn these hundreds of 'basic' things", and there's no good places to learn outside of noisy discords, SEO Spam q&a sites, and weird and vaguely hostile chatrooms.
With tools like xournal++ or other things like document processors, you can usually define your own panels, reorganize them, move them around, add icons or separators, etc, and all of that in a drag&drop fashion, live from the program running.
I feel like having a (compile-time) declarative description of that wouldn't cut it, or be very abstract, with most of the logic outside of the declarative description. Another option might be something that's "runtime declarative", and drag&dropping icons and panels around just change the ui definition?
But yeah I've had same issues when using QtQuick for desktop use cases.
All doable, just a pain.
I'm a big fan of QML, but I've avoided Qt on Rust for some time due to poor experiences with earlier bindings a while ago.
At the time, using GTK, imgui, etc were a bit friendlier on Rust than Qt. Hoping this has changed.
But my point was mainly about the (almost) impossibility of building a well functioning cross platform UI kit. I honestly believe that effort should not be spent in that direction when a reasonably open source and well functioning option already exists.
Nor are any of the other things people use Rust for, but that doesn't seem to reduce the enthusiasm any.
Other than that, beginners to the codebase tend to break property bindings without realizing. There are a few tools to catch this at runtime, but would be nice to do this at compile time.
Also not all of the "Desktop widgets" were readily available in QML in Qt 5 (not sure what the status in Qt 6), and you tend to roll your own Table Views etc.. and those ones need even more work to work like native widgets, supporting keyboard navigation etc...
Overall Qt5/QML was fun to work with, but I did miss a few bits that were readily available on QWidgets.
Button {
text: "Save"
enabled: textField.text.length > 0 // this is reactive to the value of a TextField
onClicked: Backend.save()
}
as soon as you try to for example implement the save method in JS/QML this starts to become very painful as it often ends up with a lot of spaghetti code. The very cool thing with QML is that the save function can be simply implemented in C++ like this. Backend::save()
{
// call QFile/QNetworkRequest/...
}
It force the programmer to split their logic from the UI layer which I don't consider a bad thing.I tried to write a basic serial console app using QtQuick some years ago but the functionality was just too anaemic. I don't really understand how you can write a serious GUI app with QtQuick/QML. If it's just very basic controls, sure. As soon as you need something slightly complicated it totally falls down in ways that QtWidgets don't.
Also the scoping rules of QML make no sense. Children can refer to parents which totally breaks encapsulation.
I love Qt, but QML is meh at best.
Anyhow, this might be a controversial opinion, but the best experience I've had with WYSIWYG UI designers was with Netbeans Swing Editor and VS Windows Forms Editor. The IDE integration was seamless.
Yeah those are great, although I would then add classical VB, Delphi and C++ Builder as well.
I recently tried and failed. It was either doing absolute positioning or failing completely - for example dropping components onto grid would just place them into cell 0,0. There was no way to design form with mouse.
I used a lot of different UI designers in the past and all of them were heaps and bounds better.
As sibling points out NetBeans Swing designer (with Matisse/GroupLayout) is the best, along with VS WinForms (although these tend to be non-scalabale)
Sure that if you put the extra effort you can make QML look native, but it makes you wonder if desktop is in fact a goal for the framework.
I commented on my opinion on Qt/Qml once before: https://news.ycombinator.com/item?id=35652347
I'm mentioning this here because, as already noted in my previous post, HN threads on Qt have this bizarre tendency to attract some really weird FUD/shit-flinging.
Qt is nothing like Electron. It is nowhere near that, or "underperfoming" in comparsion. In my previous post, I even specifically mentioned how the projection I was on was replacing a Chromium + REST backed based stack on an embedded device with Qt, because that was a slow resource hog in comparison. Somehow I have my doubts that comments like that come from actual experience.
This has been false for the past 20 years but people feel the need to write it in a comment any time they read "qt" in a title.
https://www.ics.com/sites/default/files/images/licensing.png
https://i0.wp.com/embeddeduse.com/wp-content/uploads/2023/01...
I've lost track of things and I know companies that still stick to Qt 5.6 because of the licensing issues..
I guess I misread the chart. Can you explain what it means for QtQuick to be purple under the GPL/LGPL section?
If your existing app is a QWidgets app, then not sure how much benefit you'd have when mixing QML/QtQuick with your QWidgets side of things. We did implement such a thing at a little project before... where the "canvas of items" was written in QML and the remainder of the UI was QWidgets. For our usecase, it was good.
When using QtQuickControls2 , i have started falling back to RowLayout, ColumnLayout, GridLayout etc: https://doc.qt.io/qt-6/qtquicklayouts-overview.html - which are similar to what we've had in QWidgets
[1] https://github.com/thp/pyotherside [2] https://github.com/delijati/fosdem-qml/tree/master
I've kind of given up on Qt, though:
- they seem to want to go in the QML direction, and if I wanted to use JS I wouldn't be using a C++ library
- their interpretation of LGPL has historically required making the entire Qt library downloadable from your website, which is inconvenient. (This may have changed with Qt 6?)
- it never looks or works quite right on macOS. In particular, text in comboboxes is just not centered vertically correctly, and it drives me nuts.
Doesn't resize decently, doesn't respect user's settings.
And a browser is much much slower and bigger than a qt application.
About HTML+CSS, that’s just incorrect.
Go and try Tailwindcss and then tell me how bad HTML is at resizing.
Of course, QML is trying to beat the browser at it's own game, but can't match the billions invested in browser performance.
Qt classic is dead, and QML is a less featured, less documented, underperforming copy of Electron.
It's not less featured, it's differently featured: it has features that have been directly designed to create user interfaces. Unlike HTML and CSS!
The documentation is very good, actually. Of course, if you are already familiar with the web stack, it may seem obscure to you.
Additionally, its documentation is one of the best in the market.
In short, it’s not super hard to beat electron especially in terms of disk/memory.
Now, that said. Many of you think you suffer because web=slow, JavaScript=bad yadda yadda. But this is often not true at all, which almost always turns up in apples-to-apples benchmarks. In fact, the suffering is almost always because of lazy/hypey/bloated stacks full of ads/multiple cloud backends for metrics, ads, logging, etc etc/poor coding standars etc etc. So the long answer is that Tauri won’t help with those deeper issues.