Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QML or Widgets
maxwell31 last edited by
I have to develop a data analysis desktop software which will need to do quite a bit of plotting. I wanted to use QGraphicsView for making my plots. Then I read http://blog.qt.io/blog/2017/01/19/should-you-be-using-qgraphicsview/ where the opinion is to use QML instead of QGraphicsView. This makes me wonder whether I should choose QML over Widgets? I have not too much experience with both.
Without more information the (my) thumb rule is:
When you plan to target desktop systems, go with QtWidgets.
If you want to go for mobile devices, go with QML.
maxwell31 last edited by
Some more information: The software is about controlling a laboratory device form a PC. But it should not only controll the device, it should also offer a lot of data analysis and visualization. Most likely this software will be in use for the next 15 years.
There is nothing to stop you from using both.
Say c++ for controlling and widgets for that part and QML for
Also if you keep a clear separation between data / processing and the
presentation. It wont be that hard to switch GUI later.
Some more information: The software is about controlling a laboratory device form a PC. But it should not only controll the device, it should also offer a lot of data analysis and visualization.
i meant what are the contents of the application, what type of visualizations, what controls are you planning, etc.
But i still think QtWidgets its the way to go for you.
For the basic GUI see the QtWidgets module.
Most likely this software will be in use for the next 15 years.
thats a hard promise to keep up to nowadays ;)
QWidgets have no native GPU-support so everything you show/animate etc will be rendert by the CPU. For basic buttons, icons, and images that is no problem, neither for desktop pcs nor mobile devices.
You can create GPU-supported QWidgets(e.g. QOpenGLWidget) but that is time consuming and compicated.
QML has native GPU-Support that makes it the predestined type for "fancy" UI-s with lots of animations, slides, movies, fadeins, fade outs or for your case rapidly changing plot values.
But as a interpreter language, its "relatively" slow in calculating stuff, say Pixel manipulation or calculating plot points.
But there is nothing stopping your from mixing both languages.
Main QML-Application with cpp-backend
Main cpp-application with QML-Enging to display stuff.
you can even have a QWidget - UI with QML- Widgets
BKBK last edited by
I like your rule of thumb. Our devices are not really mobile but are small and embedded. May I presume that for your rule they are equivalent?
I am a newbie to QML files. Please point me to a good description and difference between QML and QtWidgets.
KevinMQt last edited by
@BKBK The Qt Documentation is a great resource for the differences between QML and QT Widgets. You can start here. https://doc.qt.io/qt-5/topics-ui.html
For embedded, Bo Thorsen (CEO of Viking Software) says QML is good for Embedded because:
- It's well suited for adding animation.
- It's great for simple UI's.
- Creating your own custom look'n'feel UI.
The talk is from 2017: https://www.youtube.com/watch?v=Vh7BxaYuszo
(21:36 - 24:05)