Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QML useful if you know C++?
transistor47 last edited by
a question. If you know C ++, is learning QML useful? I do not understand what real use it has (I do not want to cause discomfort to anyone)
Thanks in advance
It depends on the type of application you are going to write.
fcarney last edited by
There are things QML just won't do, or won't do easily. For our applications we do visual stuff in QML and the working meat of the program in C++.
johngod last edited by
After I started using Qml, I only use c++ if absolutly need. Qml is much fun and faster to write. The Qml declarative language, the bindings and event handlers, after you get the grip of how it works, can make the logic easier and the code cleaner. Of course all depends of the type of app.
Ray Gray last edited by
There is no need for qml - if you like the feel and look of Windows 3.1!
KroMignon last edited by
@transistor47 QML is not required to develop a Qt application, but I can help you to quickly create a graphic user interface. Much more as doing all in pure C++.
But there are some dark sides when using QML:
- QML is slow and requires much more memory as a pure C++ application
- QML is compiled on the fly, so you can never be sure there is no typo is your QML as long as not all code has been covered!
- When a QML error occurs, the QML engine just stop execution at the error and all rest of your QML is not executed, this can be very hard to find!
So my recommendation is to use QML only to create the GUI, do all logical work in C++. This will save you many time and avoids you even more frustration!
Doing this at the beginning of development is the best you can do.
Of course you could do many things in QML, don't get caught by the dark side of the force ;-)
Tom_H last edited by
@transistor47 IMO, QML is much nicer to work with than C++. It is by far the best declarative UI language I've seen. The classic advice you'll hear, as @KroMignon said, is to do the UI in QML and the application logic in C++. But once you've taken the decision to use QML for UI, there's nothing to stop you from using it for application code, other than dogma. I chose a hybrid approach. In addition to UI, I use QML for sqlite database access, because it is so much easier and nicer to do it in QML than C++. Just take a look at some examples and you'll see what I mean. Also, because all my database access is in response to UI events, it's natural to handle it from QML. Furthermore, there's no performance hit because it simply wraps the sqlite C library which does all the real work.
Don't be afraid of the dark ;-)
6thC last edited by
KroMignon last edited by
So nothing comparable with actual Qt5/QML2, and not necessary compatible too!