Rewrite Qt Widget app to Qt Quick (Controls)?
-
Hi,
We have worked on a Qt Widgets app for a while, and now we're considering a rewrite to Qt Quick / Qt Quick controls, for the extra control it gives on how it behaves and not just looks. However, it's quite an undertaking, and I would only want to do it for the right reason, so I'd like to run it by the forum.
We want our app to look (somewhat) native, hence the initial choice for Qt Widgets. But nowadays, there are also Qt Controls to help with that.
Basically, my question comes down to: how much can you integrate QML widgets/animations in a Widget app so that you can add some customization in terms of behaviour and animation? You can't use QML delegates in a Widget QListView for example; that would have been useful. Are there other ways of doing that? Or do I have to put in a QQuickView(qt5)/QDeclarativeView(qt4) and load a QListView as QML element in it? Can you still use a C++ QAbstractListModel as model?
Qt Creator is an example of what I mean. Basically it's a desktop app, but it has a custom widgets and animations. I looked at the Qt Creator source code to get some ideas (because that is a mix of Widgets and Qt Quick), but I couldn't actually (quickly) see if that is a Widget app with QML, or the other way around.
-
Hi,
The most important question is: What is the reason behind your team's decision to rewrite your GUI in Qt Quick?
A widget-based view needs a widget-based delegate. A Qt Quick-based view needs a Qt Quick delegate.
You can embed a Qt Quick component inside a widget using "QQuickWidget":http://qt-project.org/doc/qt-5/qquickwidget.html. You cannot embed a widget inside Qt Quick.
Qt Creator's GUI is mainly made of Qt Widgets. Only the Welcome screen is Qt Quick.
-
Qt Creator is based on QWidgets at its heart. There are three plugins (out of more than 50 plugins in the default setup) that have a Qt Quick based Gui (Welcome screen and the QML Designer and QML Profiler). So if you run Qt Creator from the command line with '-noload Welcome -noload QmlDesigner -noload QmlProfiler' you are looking pretty much at a pure QWidget application. This includes all the theming, progress bar animation etc.
-
It'd be curious to know what widgets are just themed and which ones are new. Perhaps I'll dig into the source again on a rainy day.
Anyway, thanks for the info.