Hacker News new | past | comments | ask | show | jobs | submit login

Qt has uic xml layout engine which was cumbersome to use, you weren’t discouraged from using c++ classes instead. The discouragement came later when Qt shifted towards qml (a bad shift as it’s just as unweildly, imo), now they discourage writing qml in c++ because the qml engine can get out of sync. Qt can prevent this but they want you to pay for a premium license for it. Slint is a sister to qt that does not have this restriction afaik.

I wish there would be an elegant c++ class/function based ui framework again.




Agreed that a C++ API for qml would be great. qml by itself is great though, I don't see why it is unweildy. If anything it's unpolished, there is stuff that is more difficult than it should be, but it's miles ahead of what there was before imo.


It is unwieldily because it abstracts logic into a different language and paradigm. You need double the cognitive understanding of qt now to know how it operates.


As someone with 10,000+ lines of C++ code and 10,000+ lines of QML code in his app[1] I can say this is false. It's actually much easier and straightforward to decouple the UI (QML) and logic (C++). It also makes such a great combo - QML is amazing to write UIs in and C++ is a fast, battle tested compiled language. I wrote a little bit about my app development if you're curious[2].

[1] https://get-notes.com

[2] https://rubymamistvalove.com/block-editor


By the same metric c++ qwidgets is amazing to write UIs and by keeping everything in c++ there is easily less abstraction, I can easily navigate my code, not jump between two different systems. There really is no great reason why qml objects couldn’t be c++ classes/functions. Decoupling does what for me, but introduce more syntax, documentation, and learning curves. You should give writing a Kde6 Kirigami app a try and experience the absolute pleasure of adding another abstraction layer onto qml, c++ to muck things up. Qml is the cooler brother of Uic, but at least uic was optional.


I'm very fond of QML's syntax, so can't quite understand why you don't like it. It has a learning curve, but I studied all the basics in a day (it's just so simple and intuitive, imo).

Not sure how "QML in C++" would look like, but it doesn't sound pretty. Recently someone published a declarative UI inside C++[1] (without a different syntax) but I felt a bit off with this approach. Maybe that's something you mean?

[1] https://github.com/brisklib/brisk

[2] https://news.ycombinator.com/item?id=42450963


I don’t know how else to explain it that compared to qwidgets where everything can be handled in code. Qml might be all the things it claims , elegance, separation of concerns, simple syntax, etc, but that still doesn’t eclipse my initial issue that it’s an unnecessary abstraction. You might not think it’s pretty but I think it’s pretty to only use c++.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: