Moving from Qt C++ Widgets application to QtQuick/QML.



  • I have made an application using Qt C++ Widgets, now I only want to change the UI part of my application to QML/QtQuick as it has a modern look and feel. I have built the application by using CMake
    My Questions are:

    1. What parts of the application do I have to change?
    2. What knowledge should I have in moving to QML?
    3. How different is QML from Qt Widgets in terms of functionality?(Do they also have signal/slot mechanism)(Do Qt Widgets have more functionality?)
    4. Is QML better in terms of performance?
    5. Do I have to use QMake insted of CMake?(I prefer CMake as some components of the application are suitable for CMake)
    6. Will I have better help if I buy a Qt License?(Faster in moving to QML)

    Thanks!


  • Lifetime Qt Champion

    Hi,

    1. Based on your introduction, the GUI part
    2. Did you already follow Qt's documentation about building application with Qt Quick ?
    3. Qt Quick is declarative while widgets are imperative. Yes there's also signals and slots and whole chapters dedicated to interface C++ and Qt Quick.
    4. Depends on what you want to do and what performance you seek.
    5. No, you can build your application using cmake as before.
    6. If you buy a commercial license, then you have access to the commercial support.


  • I'm not that much experienced in Qt/QML but here are the answers I can provide you until someone with more knowledge and experience than me, answer to you.

    1. What parts of the application do I have to change?
    I would say all (or most) of your ui files and your main.cpp file to load the qml part.

    2. What knowledge should I have in moving to QML?
    I started QML a few weeks ago by myself and I have to admit that QML has been quite simple to use for many reasons :

    • I did a bit of web development using some JavaScript and HTML
    • The Qt documentation is very nice, you will find almost everything in it
    • The forum is full of people who are providing great support and all together they have a HUGE knowledge

    So to answer the question I would say some basics on JS would be a good start. The QML itself is quite intuitive when you follow the documentation

    3. How different is QML from Qt Widgets in terms of functionality?(Do they also have signal/slot mechanism)(Do Qt Widgets have more functionality?)
    I'm not able to completly answer this question but from what I've done from now QML give me a quicker way to create UI. It does have the signal and slot mechanism even if it is quite transparent for you. You will find almost all of the "classic" UI component you can find on the Qt widgets via Qt Quick Controls and others.

    4. Is QML better in terms of performance?
    I think QML is not better in terms of pure performance. Here you will find an article on benchmark of pure C++ app vs QML/JS.
    I believe for the QML you should stick with the UI and make sure all the logic is kept on the C++ side. The JS should only be used to change graphics components. (Maybe I'm wrong if I am I'll be corrected by someone)

    5. Do I have to use QMake insted of CMake?(I prefer CMake as some components of the application are suitable for CMake)
    I have no idea about this question I let someone else answer to it I use qmake on my side.

    6. Will I have better help if I buy a Qt License?(Faster in moving to QML)
    I have no idea about this question too but what I can tell you is that there is plenty of documentations about QML and the forum here is a great help. I think it depends on your needs.

    It's been quite easy to me change from the Qt widget to the QML even though I'm not really much experienced. I have been able to create my own components, play with some animations, make some modern look pages on my app.
    Even if you are not able to make everything you want in QML you can make it in C++ and use on the QML side quite easily.


Log in to reply
 

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