Hacker News new | ask | show | jobs
by rubymamis 544 days ago
> I use Qt myself and one of the best things about the framework and toolkit is the UI tooling that allows me to drag and drop and visually create my UIs in the UI Designer app.

But then it's not trivial to write responsive/adaptive applications. In contrast, QML makes it extremely easy to build such apps.

I used to build UIs in the designer as well[1] but after studying QML there's no going back. Here's a new project I program solely in QML (and C++ for the logic)[2].

[1] https://github.com/nuttyartist/notes

[2] https://www.get-vox.com/

1 comments

Huh, can you elaborate what you mean by this

"But then it's not trivial to write responsive/adaptive applications."

Personally I prefer the widgets over QML mostly because QML is just too poorly typed and checked + you normally need to do a bunch of integration work between the QML and the C++ code. I do see the appeal though.

I mean that it's much easier to write apps that change their layout based on window size. Especially if you want to target both a desktop app and a mobile app using the same codebase. QML is great for that.

QML is definitely getting better in regard to type checking. For example, you can annotate a list with a type:

property list<int> myNumbers: [1, 2, 3]

You can annotate a signal with the expected types:

signal onThisChange(x: int, str : string)

Etc.

You can also ENABLE_TYPE_COMPILER[1][2] to convert QML files to C++ which require you to type your code in order to work, but I don't really have experience with that.

I'm sure there are even more examples I'm missing. There was a discussion regarding TypeScript support in QML[3] but I guess they decided to do it their own way[4].

[1] https://doc.qt.io/qt-6/qtqml-qml-type-compiler.html

[2] https://www.qt.io/blog/compiling-qml-to-c-qtquick-controls-a...

[3] https://bugreports.qt.io/browse/QTBUG-63600

[4] https://bugreports.qt.io/browse/QTBUG-68791