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

TabBar does not display when setting contentItem property

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.9.0 Alpha
    • 5.7.1
    • Quick: Controls 2
    • None
    • Qt 5.7.1
    • 51eff608eb18b01d36fdab442930300a4af3df20

    Description

      Overwriting the contentItem property of TabBar to customise it (even with the stock implementation from the Controls2 template results in the tabbar not displaying.

      Simple reproduction example:

      import QtQuick 2.7
      import QtQuick.Controls 2.0
      import QtQuick.Layouts 1.0
      
      ApplicationWindow {
          visible: true
          width: 640
          height: 480
      
          TabBar {
              objectName: "tabbar"
              id: control
      
              width: parent.width
      
              // contentItem: implemtation taken from QtQuick Controls 2 template: C:\Qt\Qt5.7.1\5.7\Src\qtquickcontrols2\src\imports\controls\TabBar.qml
              contentItem: ListView {
                  objectName: "contentItem listview"
      
                  implicitWidth: contentWidth
                  implicitHeight: 40
      
                  model: control.contentModel
                  currentIndex: control.currentIndex
      
                  spacing: control.spacing
                  orientation: ListView.Horizontal
                  boundsBehavior: Flickable.StopAtBounds
                  flickableDirection: Flickable.AutoFlickIfNeeded
                  snapMode: ListView.SnapToItem
      
                  highlightMoveDuration: 0
                  highlightRangeMode: ListView.ApplyRange
                  preferredHighlightBegin: 40
                  preferredHighlightEnd: width - 40
              }
      
              TabButton {
                  objectName: "tabbutton"
                  text: "TabButton"
              }
          }
      }
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              Dynite Michael Cox
              Votes:
              2 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: