how to set fullscreen mode of a qml rectangle?
-
I put the following code into a small test qml app. It works fine. But the same code fails after it is inserted into a rectangle of a large project. What could block the change to fullscreen mode? I have made sure the state change is triggered and its change is printed on the screen with console.log
states: [ State { name: "EXPANDED" PropertyChanges { target: rect; x: 0 } PropertyChanges { target: rect; y: 0 } PropertyChanges { target: rect; width: Screen.width } PropertyChanges { target: rect; height: Screen.height } } ] transitions: [ Transition { ParallelAnimation { NumberAnimation { target: rect; property: "x"; duration: 400 } NumberAnimation { target: rect; property: "y"; duration: 400 } NumberAnimation { target: rect; property: "width"; duration: 400 } NumberAnimation { target: rect; property: "height"; duration: 400 } } } ] MouseArea { anchors.fill: rect onClicked: { rect.state = rect.state === "EXPANDED" ? "" : "EXPANDED" } }
-
Define "it fails".
What is the expected result and what is the actual result?What is the parent of your rectangle?
-
states: [ State { name: "EXPANDED" // these can be done in same property change: PropertyChanges { target: rect x: 0 y: 0 width: <parentid>.width height: <parentid>.height } } ]
Would anchor changes be better?
AnchorChanges { target: rect anchors.fill: <parentid> }
-
Define "it fails".
What is the expected result and what is the actual result?What is the parent of your rectangle?
-
@JoeCFD said in how to set fullscreen mode of a qml rectangle?:
Its parent is not the main window.
Then maybe you can try a parent change as well.
-
states: [ State { name: "EXPANDED" // these can be done in same property change: PropertyChanges { target: rect x: 0 y: 0 width: <parentid>.width height: <parentid>.height } } ]
Would anchor changes be better?
AnchorChanges { target: rect anchors.fill: <parentid> }
-
@JoeCFD said in how to set fullscreen mode of a qml rectangle?:
Its parent is not the main window.
Then maybe you can try a parent change as well.