Solved 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:
- What parts of the application do I have to change?
- What knowledge should I have in moving to QML?
- How different is QML from Qt Widgets in terms of functionality?(Do they also have signal/slot mechanism)(Do Qt Widgets have more functionality?)
- Is QML better in terms of performance?
- Do I have to use QMake insted of CMake?(I prefer CMake as some components of the application are suitable for CMake)
- Will I have better help if I buy a Qt License?(Faster in moving to QML)
- Based on your introduction, the GUI part
- Did you already follow Qt's documentation about building application with Qt Quick ?
- 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.
- Depends on what you want to do and what performance you seek.
- No, you can build your application using cmake as before.
- 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 :
- 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.