So, I'm a newbie in Qt and my intent is to familiarize myself with Qt Graphics. However, most of the guides on the internet suggest to use QML instead Qt C++ when it comes to dealing with graphics.
Here is my question: What is the difference between Qt C++ and QML? What does QML give us, that Qt C++ does not?
If you want to have a Qt app that looks like an native OS app then you must go with QtWidgets. QML allows you to write a much more custom UI. However, in my opinion, QML is simply awesome to write UI's. The way you declare and connect things is blazing fast.
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 is a good choice for businesses that want to build software for several platforms or target both Android and iOS users.
If you want a mature and easy framework that is quite well documented and has a great cross platform IDE (QtCreator), go for Qt. If you are a true developer and not just looking for a good paying job, you would learn both.
It's actually not so much a question of QML vs C++, rather it is a question of what UI technology to use with Qt:
Leaving aside HTML5 and OpenGL, the question QtWidgets vs QtQuick has been discussed in other placed, for example at Qt Quick vs. Qt Widget and at this Qt DevDays 2014 presentation.
My personal opinion: Use QtWidgets for traditional desktop applications, and QtQuick for mobile and embedded (devices with touchscreen), unless you have good reasons to do otherwise. QtWidgets has better and more mature support for traditional desktop controls, while QtQuick is better for animations and completely custom styling.
One reason to use QtQuick on the desktop is when you want lots of custom animations and styling, at the cost of fighting a bit more with traditional desktop controls such a toolbars, menubars, drag&drop etc.
When choosing QtWidgets, the language is always C++ (well, unless you use the Python bindings). While you can use the Qt Designer tool to visually create UIs, in the end those get compiled to C++.
When choosing QtQuick, the language for the UI parts will be QML and JavaScript. However, in any moderately large QtQuick application, you will at some point also have a C++ part - for example to interface with other C and C++ libraries, for operations that don't have an associated JavaScript API or simply for quicker and more maintainable code than JS. C++ classes and objects can be accessed from QML, check the documentation for more details.
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