Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.1.0 , 5.1.1, 5.2.0 RC1
-
None
-
Win 8.1 x64 VS2012-ANGLE
Description
This is an issue I've seen for a while but it's hard to explain. I've shown the error in the following video. I'll try my best to explain it in simple terms as well.
Issue seems to be that if you change a layout property such as "visible" of a control right before hiding an ApplicationWindow, then the next time you go to show the same Window, the control gets rendered in an invalid position.
This is just for the render though as the Control if say it's a button is still only "interactable" from it's correct position.
In the above video I've shown this where "Button Two" is set to become visible when the Window is hidden. When it becomes visible and we see it, it's rendered elsewhere. However, even things like hover state and click events only respond from "where it should be" and not where it's actually got rendered. Just closing the window and opening it again, renders it fine.
This makes calling the close()/hide() functions lead to very strange behavior in production applications.
Am not sure if this occurs in OSX as well.
Code used in the Video example:
import QtQuick 2.1 import QtQuick.Controls 1.0 import QtQuick.Window 2.0 ApplicationWindow { id: rootWindow title: qsTr("Hello World") width: 640 height: 480 property bool someBool: false property ApplicationWindow win : ApplicationWindow { title: "hello" Button { id: buttonOne text: "One" anchors.top: parent.top anchors.horizontalCenter: parent.horizontalCenter anchors.margins: 10 onClicked: console.log("One Clicked") } Button { id: buttonTwo text: "Two" anchors.top: buttonOne.bottom anchors.horizontalCenter: parent.horizontalCenter anchors.margins: 10 onClicked: console.log("Two Clicked") visible: rootWindow.someBool } Button { id: buttonThree text: "Three" anchors.top: buttonTwo.bottom anchors.horizontalCenter: parent.horizontalCenter anchors.margins: 10 onClicked: console.log("Three Clicked") } } Button { anchors.left: parent.left text: "Open" onClicked: win.show(); } Button { anchors.right: parent.right text: "Close" onClicked: { rootWindow.someBool = !rootWindow.someBool win.close() } } }