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

Item is positioned incorrectly when becomes visible

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • P2: Important
    • None
    • 5.3.2, 5.4.0
    • Quick: Layouts
    • None
    • Windows 7

    Description

      I have a RowLayout with three buttons with spacers between them. One button and one spacer are invisible like that:

      [B] <=> [B] <=> [B]
       |    |
       ------
         |
      invisible

      When the user presses the third button the first button and spacer become visible. After that all three buttons are positioned incorrectly like that:

      [B][B] <=> [B]

      See qml-layout-after-click.png.

      Expected (see qml-layout-expected.png):

      [B] <=> [B] <=> [B]

      Source code:

      import QtQuick 2.3
      import QtQuick.Controls 1.2
      import QtQuick.Layouts 1.1
      
      ApplicationWindow {
          visible: true
          width: 320
          height: 200
          title: qsTr("Hello World")
      
          RowLayout {
              anchors.fill: parent
      
              Button {
                  id: buttonStart
                  visible: false
      
                  text: "START"
              }
              Item {
                  Layout.fillWidth: true
                  visible: buttonStart.visible
              }
              Button {
                  text: "RX"
              }
              Item {
                  Layout.fillWidth: true
              }
              Button {
                  text: "EX"
                  onClicked: {
                      buttonStart.visible = true;
                  }
              }
          }
      }
      

      Steps to reproduce:

      Compile and run. Press "EX" button.

      Attachments

        1. qml-layout-after-click.png
          18 kB
          Dmitry
        2. qml-layout-expected.png
          10 kB
          Dmitry
        3. qml-layout-start.png
          17 kB
          Dmitry
        4. snippet_response.qml
          0.8 kB
          Jan Arve
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            smd Jan Arve
            dmitry64 Dmitry
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes