Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.10.0
-
None
-
77d7e870bbc39c1d0a5d85e549d69015623df815 (qt/qtdeclarative/dev) cb0cdef62efa835beb49904c502189a420a4183c (qt/qtdeclarative/6.2)
Description
When ScrollBar is customized with contentItem, and contentHeight of ListView is smaller than ListView height, scrollbar is always visible and it's height is equal to ListView height, doesn't matter that policy: ScrollBar.AsNeeded is set. If contentHeight is bigger than ListView height, everything works fine. If ScrollBar is not customized, everything works fine too.
import QtQuick 2.15 import QtQuick.Controls 2.15 ApplicationWindow { id: window visible: true width: 640 height: 480 ListView { id: myListView width: 200 height: 100 model: 1 spacing: 5 delegate: Rectangle { width: 200 height: 20 color: "red" Text { anchors.centerIn: parent text: index color: "white" } } ScrollBar.vertical: ScrollBar { id: scrollBar policy: ScrollBar.AsNeeded contentItem: Rectangle { implicitWidth: 6 implicitHeight: 10 radius: width / 2 color: scrollBar.pressed ? "#81e889" : "#c2f4c6" } } } }