[ACCEPTED]-What's the difference between QQuickView and QQuickWindow?-qt-quick
From the Qt documentation:
The QQuickView 15 class provides a window for displaying a 14 Qt Quick user interface.
QQuickView is 13 a convenience subclass of QQuickWindow which 12 will automatically load and display a 11 QML scene when given the URL of the main 10 source file.
So QQuickView is a subclass 9 of QQuickWindow which manages displaying 8 a scene from a QML file and could be used 7 easily like:
QQuickView *view = new QQuickView;
view->setSource(QUrl::fromLocalFile("myqmlfile.qml"));
view->show();
For displaying a graphical QML 6 scene in a window you can also use the QQuickWindow 5 class.
Also from the Qt documentation:
A QQuickWindow 4 always has a single invisible root item. To 3 add items to this window, reparent the 2 items to the root item or to an existing item 1 in the scene.
So it can be used like:
QQmlApplicationEngine engine;
engine.load(QUrl("myqmlfile.qml"));
QObject *topLevel = engine.rootObjects().value(0);
QQuickWindow *window = qobject_cast<QQuickWindow *>(topLevel);
window->show();
More Related questions
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.