| ▲ | GuB-42 12 hours ago | |
Generally, QtWidgets is better suited for making traditional desktop UIs with dialog boxes, common controls, etc... It is not really in the spirit of QtWidgets to do things like custom behavior, animation, etc... You do whatever the host OS gives you, in fact, you don't even care, that's Qt's job. QML is better suited for apps that want full control of their UIs, styling, etc... Which is a more modern way (doesn't mean better!). It is clear that the author wants the latter, so QML it is. And yes, it makes sense to use a different language for the UI in this case, with C++ bindings, C++ is not that great for designing UIs. In fact, with QtWidgets, you typically don't use C++ to design your UI. Instead, you use Qt Designer, a graphical tool that works on .ui files (xml), that are then compiled into C++ classes that your derive from, which is a form of binding between two languages: C++ and .ui/xml. You can use C++ directly, sometimes you have to, like when the UI is dynamically generated, but for something like a dialog box, using the graphical tool is much more convenient. | ||
| ▲ | noodletheworld 8 hours ago | parent [-] | |
> Instead, you use Qt Designer, a graphical tool that works on .ui files (xml), that are then compiled into C++ classes that your derive from, which is a form of binding between two languages… There’s only one language; no bridge. No javascript. This is largely my point; qt designer already has a more-or-less declarative ui layout language, you just write your event handlers and code in c. If “declarative” is the reason you’re using QML (and it’s the only specific reason the OP mentioned) it’s probably the wrong reason to be using it. | ||