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

TabBar does not display when setting contentItem property

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Done
    • Affects Version/s: 5.7.1
    • Fix Version/s: 5.9.0 Alpha
    • Component/s: Quick: Controls 2
    • Labels:
      None
    • Environment:
      Qt 5.7.1
    • Commits:
      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

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

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes