I have Qt Creator 2.6.1.
I created simple Qt Qucik 2.0 project from project templates and changed main.qml file on this:
import QtQuick 2.0
Rectangle {
width: 360
height: 360
color: "red"
MouseArea {
anchors.fill: parent
onClicked: parent.height = 180
}
}
If i will click on rectangle it should be reduced in half. And it is occured, but window is not reduced.
What is a best solution, if i want that main window must repeat geometry of main qml rectangle?
UPDATE. One solution was found. See Amit Tomar answer. But is exist more easier solution, for example, using QtQuick 5.0: Qt Quick Window QML Types ?
You are changing the geometry of your qml, not the Viewer. To do so:
Steps:
main.cpp
myclass.h
main.qml