What is difference between QQuickView and QQuickItem?

1.1k views Asked by At

I am suppose to inherit QQuickItem instead of QQuickView to write interface in C++ using QQuick class. From the explanation provided in Qt documents I understood QQuickView loads qml. QQuickView is used to integrate a displayable QML object into an application's user interface. And QQuickItem is like QWidget (I may be wrong here). The QQuickItem class provides the most basic of all visual items in Qt Quick. Can someone elaborate on it?

Thanks in advance

1

There are 1 answers

0
user2537594 On

Everything Qt does, even when that might involve QML and/or Quick, is rooted in the C++ language. But C++ has never been the most user-friendly, intuitive, language. Hence, QML is a user-friendly, intuitive, declarative LANGUAGE designed to program the Qt QML MODULE. And, just to obfuscate things a bit more, there is this thing called Quick which is "sorta" another way of referring to the Qt QML module which can be thought of as Qt's standard library of QML modules used to code user-friendly, intuitive, Quick GUIs for Qt applications.

Confused yet? Well, the good news is that Qt Creator is this really GREAT, USER-FRIENDLY, and INTUITIVE tool which can hide a LOT of the complexity of creating Qt applications whether they are pure C++ or C++ hidden within the mask of QML/Quick and/or Python. But, when Qt Creator's Project Wizard creates a Quick project for you, the main.cpp file it creates typically creates not a QQuickItem, not even a QQuickWindow, but rather a combination of a QQmlApplicationEngine and a QGuiApplication within which will be hidden ALL of the ABOVE ... more or less.

My best answer to your question is to just use Qt Creator's wizard to create a new Quick project and then plan on putting in the time to study WHAT and WHY the wizard did what it did to end up with a USER-FRIENDLY, INTUITIVE Quick project. YOu can also work through the excellent Qt tutorial which can be found here --> https://qmlbook.github.io/