QtQuick vs QtQml (Qt 6.2)
-
I'm used to starting QML files with
import QtQuick
but some documentation pages haveimport QtQml
instead. e.g. https://doc.qt.io/qt-6/qtqml-index.htmlLikewise, looking at examples of CMake, sometimes I see
find_package(Qt6 6.2 COMPONENTS Quick REQUIRED) ... target_link_libraries(... PRIVATE Qt6::Quick)
and other times I see
find_package(Qt6 6.2 COMPONENTS Qml REQUIRED) ... target_link_libraries(... PRIVATE Qt6::Qml)
What's the difference? And which should we be using for Qt 6.2+?
-
@VietNguen said in QtQuick vs QtQml (Qt 6.2):
In short QML to handle the interface part
QT handles the backend.That's not helping and pretty vague.
Qt is the framework. QML is a language part of the Qt framework. There is a QtQml QML module providing non-visual types. There is a QtQuick QML module providing visual types.
-
QML is the language (so when you import it, you get basic non-visual types), QtQuick is the collection of components.
And which should we be using for Qt 6.2+?
Best use both.
-
The QtQuick documentation says:
The Qt Quick module is the standard library for writing QML applications. While the Qt QML module provides the QML engine and language infrastructure, the Qt Quick module provides all the basic types necessary for creating user interfaces with QML. It provides a visual canvas and includes types for creating and animating visual components, receiving user input, creating data models and views and delayed object instantiation.
Use both.
-
@VietNguen said in QtQuick vs QtQml (Qt 6.2):
In short QML to handle the interface part
QT handles the backend.That's not helping and pretty vague.
Qt is the framework. QML is a language part of the Qt framework. There is a QtQml QML module providing non-visual types. There is a QtQuick QML module providing visual types.