[SOLVED] ScrollView scrollbars visibility issue
-
Hello everyone,
I am currently playing with ScrollViews containing a ListView instance. In my understanding, scrollbars should be visible everytime the width/height of ListView contentItem exceed the ScrollView one.
So I test these two cases. The first, with a simple Rectangle, bigger than its ScrollView container:
@import QtQuick 2.3
import QtQuick.Controls 1.2Item {
width: 600
height: 600ScrollView {
anchors.fill: parentRectangle {
width: 800
height: 800
color: "red"
}
}
}@
which behave as expected. The second one use a ListView instead of a dummy Rectangle:
@import QtQuick 2.3
import QtQuick.Controls 1.2Item {
width: 300
height: 400ScrollView {
anchors.fill: parentListView{
id: listView
width: 500
height: 400model: 20
delegate: Row {
Rectangle {
height: 250
width: 200
color: index % 2 == 0 ? "red" : "blue"
}
Rectangle {
height: 250
width: 200
color: index % 2 == 1 ? "red" : "blue"
}
}
}
}
}
@Here come my issue, or something I don't understand. In this case, why the vertical scrollbar appears and not the horizontal one? Thanks in advance for some enlighentment.
-
Hi,
As far as I understand the flickableitem for the scrollview here is the ListView, so content size of the ScrollView will the same as that of the ListView which is not defined in above example. Try setting contentWidth to ListView and it should work. May be there's better explanation than this.
More info "here":http://qt-project.org/doc/qt-5/qml-qtquick-controls-scrollview.html