QmlApplicationViewer viewer; viewer.setMainQmlFile(QStringLiteral("main.qml")); viewer.show();
QmlApplicationViewer viewer; QString qmlFilePath = QApplication::applicationDirPath() + "/qml/Main.qml"; viewer.setMainQmlFile(qmlFilePath); viewer.showFullScreen();This example sets the QML file "Main.qml" located in the "qml" folder in the directory where the application is installed, as the main view of the application and shows the QmlApplicationViewer in full screen mode. Package library: Qt5Widgets (Qt 5) or QtQuickControls (Qt 6)