Hacker News new | ask | show | jobs
by samiv 544 days ago
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.

1 comments

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