Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-35408

Invalid ApplicationWindow render after a close event with some layout changes

    XMLWordPrintable

Details

    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.

      Vimeo Link

      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:

      untitled
      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()
          }
        }
      }
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            lagocs Laszlo Agocs
            nosf Viv Rajkumar
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes