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

QML draws invisible items on certain conditions

    XMLWordPrintable

Details

    Description

      The red rectangle in the middle is drawn even if its visible property is false.
      Steps to reproduce:
      1. Press the blue rectangle on the top left
      -> Both blue and red rectangle disappear as expected
      2. Press the red rectangle on the top right
      -> Red rectangle's "show" property is set false
      3. Press the blue rectangle on the top left again
      -> Both blue and red rectangles are shown even though red rectangle's visible property is false!

      import QtQuick 2.0
      
      Rectangle {
          width: 230
          height: 300
          Rectangle {
              x: 10; y: 10
              width: 100; height: 50
              color: "blue"
              Text {
                  anchors { top: parent.top; topMargin: 5; horizontalCenter: parent.horizontalCenter }
                  text: a.visible ? "visible" : "invisible"
              }
              MouseArea {
                  anchors.fill: parent
                  onClicked: a.visible = !a.visible
              }
          }
          Rectangle {
              x: 120; y: 10
              width: 100; height: 50
              color: "red"
              Text {
                  id: text1
                  anchors { top: parent.top; topMargin: 5; horizontalCenter: parent.horizontalCenter }
                  text: b.visible ? "visible" : "invisible"
              }
              Text {
                  anchors { top: text1.bottom; topMargin: 5; horizontalCenter: parent.horizontalCenter }
                  text: b.show ? "show" : "noshow"
              }
              MouseArea {
                  anchors.fill: parent
                  onClicked: b.show = !b.show
              }
          }
          Rectangle {
              id: a
              color: "blue"
              anchors.centerIn: parent
              width: 100; height: 100
              Rectangle {
                  id: b
                  property bool show: true
                  visible: show
                  color: "red"
                  anchors.centerIn: parent
                  width: 50; height: 50
              }
          }
      }
      

      Attachments

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

        Activity

          People

            aalpert-nokia Alan Alpert (closed Nokia identity) (Inactive)
            skananoj Sami Kananoja
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes