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

TabBar set wrong width for tabs dynamically created by Repeater

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P2: Important P2: Important
    • 5.6.0 RC
    • 5.6.0 Alpha
    • Quick: Controls 2
    • None
    • 4f2251caa995cab6b5231580b7b4c7e3be55ba14

      When tabs created dynamically by Repeater (by adding items into model), TabBar cannot set proper width for them. On adding tabs I also see this warning:
      QQuickItem::stackAfter: Cannot stack after 0x27c9a50, which must be a sibling

      I also only see newly added items when I set them as current. If remove line, that set added tab as current, this tab not even displayed.

      Also, if I uncomment code that defines second ListItem in tab model, on adding new tabs I see the following warnings:
      file:///mnt/store/Development/qt5.6_git/qml/Qt/labs/controls/TabBar.qml:52:18: QML ListView: Binding loop detected for property "currentIndex"

      import QtQuick 2.5
      import QtQuick.Layouts 1.1
      import Qt.labs.controls 1.0
      
      ApplicationWindow {
          visible: true
          width: 640
          height: 300
      
          ListModel {
              id: tabModel
      
              ListElement {
                  text: "Test 0"
              }
      //        ListElement {
      //            text: "Test 1"
      //        }
          }
      
          ColumnLayout {
              anchors.fill: parent
      
              TabBar {
                  id: tabBar
      
                  Layout.fillHeight: false
                  Layout.fillWidth: true
      
                  Repeater {
                      model: tabModel
                      delegate: TabButton {
                          text: model.text
                      }
                  }
              }
      
              Item {
                  Layout.fillHeight: true
                  Layout.fillWidth: true
              }
      
              Button {
                  Layout.fillHeight: false
                  Layout.fillWidth: false
                  Layout.alignment: Qt.AlignHCenter
                  text: "Add"
                  onClicked: {
                      tabModel.append({ "text": "Test new" })
                      tabBar.currentIndex = tabModel.count - 1
                  }
              }
          }
      }
      

        For Gerrit Dashboard: QTBUG-48993
        # Subject Branch Project Status CR V

            Unassigned Unassigned
            krnekit Nikita Krupenko
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes