[SOLVED] Rectangle as root element in .qml file
-
I use Qt 5.5.0 MSVC 2013, 32bit.
I want to create minimal QtQuick application. When I chooseNew Project - Qt Quick ApplicationI got project with 2 QML files: main.qml and MainForm.ui.qml. Since I do not need them, I delete second one and paste following to main.qml:Import QtQuick 2.4 Rectangle{ id: root visible: true color: "gray" width: 400 height: 800 }But when I run project I got nothing. I see application in Task Manager but there is no application window.
Question: Is it possible to create .qml file with Rectangle as a root element? -
I use Qt 5.5.0 MSVC 2013, 32bit.
I want to create minimal QtQuick application. When I chooseNew Project - Qt Quick ApplicationI got project with 2 QML files: main.qml and MainForm.ui.qml. Since I do not need them, I delete second one and paste following to main.qml:Import QtQuick 2.4 Rectangle{ id: root visible: true color: "gray" width: 400 height: 800 }But when I run project I got nothing. I see application in Task Manager but there is no application window.
Question: Is it possible to create .qml file with Rectangle as a root element?@fatinbrain The template for creating
Qt Quick ApplicationaddsQQmlApplicationEngineto launch the QML. ButQQmlApplicationEnginedont work directly withRectangleorItemas root element but requires any window likeWindoworApplicationWindow.
So to make it work forRectangleuse QQuickView instead ofQQmlApplicationEngine. -
@p3c0 Checkmate! Thanks.