Hacker News new | ask | show | jobs
by samiv 544 days ago
The one thing I have to wonder is:

  How many people really want to spend time programming their UIs?
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.

I find that for any non-trivial application this type of boilerplate is best done with good tooling that just works and lets the UI to be knocked up fast and efficiently.

I also wrote an UI system for my game engine but it's completely drag & drop in the editor. Styling (skinning) is also via UI builder.

Source:

https://github.com/ensisoft/detonator/tree/master/uikit

Live demo:

https://ensisoft.com/demos/ui/game.html

Question, how do you handle arbitrary clipping masks ? In my solution clipping masks require evaluating all the widget parent's clipping rects and writing them to stencil buffer before rendering the current widget. This is unfortunately quite slow...

1 comments

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

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