What is the difference between QML Rectangle and Window?
-
I create a new Qt Quick application with default basic code. Now if I only replace 'Window' below with`Rectangle', this application never runs..more accurately it runs in the background but GUI never shows up.
What really is the difference between
Window
orRectangle
? Why does the application behaviors changes so much that it doesn't even run properly?@import QtQuick 2.3
import QtQuick.Window 2.2Window {
visible: true
width: 360
height: 360MouseArea { anchors.fill: parent onClicked: { Qt.quit(); } } Text { text: qsTr("Hello World") anchors.centerIn: parent }
}@
The main.cpp file is here
@#include <QGuiApplication>
#include <QQmlApplicationEngine>int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);QQmlApplicationEngine engine; engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); return app.exec();
}@