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

When reparenting a control that uses IconLabel (like Button) and has a binding to its parents height, its text will stop being rendered when the control is reparented back

XMLWordPrintable

    • 56ade46b4234bb828b8e4f9a6bf83b5687bd122e

      Simplified example

      import QtQuick 2.3
      import QtQuick.Controls 2.3
      
      ApplicationWindow {
          id: window
          visible: true
          width: 640
          height: 480
          title: qsTr("Stack")
      
          Button {
              text: "Toggle parent between Window and empty Item"
              anchors.bottom: parent.bottom
              onClicked: button.parent = (button.parent === window.contentItem ? emptyItem : window.contentItem)
          }
      
          Item {
              id: emptyItem
          }
      
          Button {
              id: button
              text: "Button"
              width: parent.width
              height: parent.height / 3
              onHeightChanged: print(height)
          }
      }
      

      Original use case

      When having a stackview and pushing a form that has ListView with Button as delegate, twice, the Button texts disappear. The Button needs to use the listview as a reference in height calculation for this to happen:

      This is not reproducible if the height is set to specific size, such as 50pixels.

      Resizing the Window so small that the list items disappear and then resizing the Window back makes the texts appear again.

      Steps to reproduce:

      • Run attached sample (main.qml) with qmlscene
      • Open Drawer -> Page 2
      • Go back (to close Page 2)
      • Open Drawer -> Page 2 again
      • EXPECTED: UI looks exactly the same no matter how many times the form is shown
      • ACTUAL: Button texts become invisible after second time the form is pushed to stackview

        1. qtbug67145_broken.png
          23 kB
          Jussi Witick
        2. qtbug67145_working.png
          34 kB
          Jussi Witick
        3. qtbug67145.zip
          2 kB
          Jussi Witick
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            mitch_curtis Mitch Curtis
            jussi_witick Jussi Witick
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes