I know that the use of QML is quite new in Qt and I was wondering if I should design my application using Qt Designer or QML. I will be using a MVC pattern and my main concern if I use QML for the GUI is that it might not be easy to integrate inside the rest of my C++ app.
Feel free to give your personal advice, I would greatly appreciate it. Thank you!
Qt is de-facto the most suitable framework for the commercial application of a cross-platform GUI library available for C++, Python, Go, Haskell and some other languages. Of course, developers are free to choose from among many other frameworks for designing user interfaces: wxWidgets, JUCE, CEGUI, Tk or even GTK.
QML is the language; its JavaScript runtime is the custom V4 engine, since Qt 5.2; and Qt Quick is the 2D scene graph and the UI framework based on it. These are all part of the Qt Declarative module, while the technology is no longer called Qt Declarative.
It offers a highly readable, declarative, JSON-like syntax with support for imperative JavaScript expressions, and it allows components to be easily reused and customized within a user interface.
Qt Designer UI files represent the widget tree of the form in XML format. The forms can be processed: At compile time, which means that forms are converted to C++ code that can be compiled.
QML is primarily intended for mobile platforms. Due to its youth and its concern for varied platform interface conventions, it lacks standard controls like buttons and combo boxes (but see the Components project). If you're on mobile, or your UI requires a highly customized visual style, QML might be worth considering. Be prepared for a lot of extra work in designing custom controls. Integrating QML and C++ is still pretty rough in my opinion. I would personally recommend using QML only for simpler apps, only on mobile platforms, and only with JavaScript. Under the right circumstances I might consider writing custom QML elements in C++.
Qt's C++ API isn't going away anytime soon. It's also designed with the desktop in mind and will do a better job of meeting user expectations on desktop platforms. If you're on the desktop, I would recommend sticking to C++ and Designer. Even after QML matures a bit, it probably won't be the right solution for most desktop apps.
It looks like things are beginning to change. I haven't tried the new components myself yet, and documentation seems a little sparse (or at least, out of the way), but this could eventually remove the greatest barrier to using QML on the desktop. It remains to be seen whether this will get support in the long term, but if you're willing to accept the risk of being an early adopter, I think QML may now be a viable choice for desktop apps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With