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

TabBar reset current index to -1 on completion

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.6.0 RC
    • 5.6.0 Alpha
    • Quick: Controls 2
    • None
    • 5e7d7dfc07ea00b53873a6ad5399f2400781f8b9

    Description

      Even if TabBar has items and even if it has explicitly set currentIndex, it resets it to -1

      import QtQuick 2.5
      import QtQuick.Layouts 1.3
      import Qt.labs.controls 1.0
      
      ApplicationWindow {
          visible: true
          width: 640
          height: 480
      
          ColumnLayout {
              anchors.fill: parent
      
              TabBar {
                  id: tabBar
      
                  Layout.fillHeight: false
                  Layout.fillWidth: true
      
                  // currentIndex: 0
      
                  TabButton {
                      text: "Test"
                  }
              }
      
              StackLayout {
                  Layout.fillHeight: true
                  Layout.fillWidth: true
                  currentIndex: tabBar.currentIndex
      
                  Rectangle {
                      anchors.fill: parent
                      color: "red"
                  }
              }
          }
      }
      

      To display the red rectangle, you should click on tab button. Even if you uncomment line and set currentIndex explicitly, it would reset back to -1.

      Attachments

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

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes