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

Changing contentItem to ScrollView breaks scrollbar visibility

    XMLWordPrintable

Details

    • All
    • db8f3607e (dev), 4e535be5c (6.5), daca3c6d8 (tqtc/lts-6.2)

    Description

      After the fix for https://bugreports.qt.io/browse/QTBUG-104983

      https://codereview.qt-project.org/c/qt/qtdeclarative/+/422252

       

      There is still a problem:

      If a scrollview contentitem is assigned afterwards, as opposed as declared in,

      QQuickControlPrivate::unhideOldItem will be called unconditionally, disregarding current bindings between scrollbar policy and visiblity that may be declared in the controls style.

       

      so for instance if a scrollbar had a policy of AlwaysOff, it will be shown anyways.

       

      The attached minimal example will show a listview with the horizontal scrollbar shown even if has an alwaysoff policy

      import QtQuick
      import QtQuick.Controls
      
      ApplicationWindow {
          width: 640
          height: 480
          visible: true
      
          ListView {
              id: otherView
              clip: true
      
              model: 100
              delegate: Text {
                  text: modelData
              }
          }
      
          Component.onCompleted: cardsView.contentItem = otherView
      
          ScrollView {
              id: cardsView
              width: 200
              height: 200
              background: Rectangle {
                  color: "transparent"
                  border.width: 1
              }
      
              ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
          }
      }
      

      Attachments

        Issue Links

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

          Activity

            People

              mitch_curtis Mitch Curtis
              notmart Marco Martin
              Votes:
              3 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes