QML or Widgets



  • Hi,

    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.


  • Moderators

    @maxwell31
    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.



  • 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.


  • Qt Champions 2016

    @maxwell31

    Hi
    There is nothing to stop you from using both.
    Say c++ for controlling and widgets for that part and QML for
    plotting etc.
    Also if you keep a clear separation between data / processing and the
    presentation. It wont be that hard to switch GUI later.


  • Moderators

    @maxwell31 said in QML or Widgets:

    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.

    For the data visualizations you can check out the QtDataVisualization and QtCharts module.
    Both modules also provide QML types, but still i suggest you should go with QtWidgets.

    Most likely this software will be in use for the next 15 years.

    thats a hard promise to keep up to nowadays ;)



  • hi @maxwell31
    @raven-worx rule of thumb is usually correct, but let me expand a bit why thats the case.

    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
    or
    Main cpp-application with QML-Enging to display stuff.

    you can even have a QWidget - UI with QML- Widgets



  • @raven-worx
    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.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.