-
Bug
-
Resolution: Invalid
-
Not Evaluated
-
None
-
5.9.2, 5.10.1
-
None
-
-
5783cc354b85ba9a77378da34d911a0cfdb31b73
Since QtQuick Controls 2, Scrollview does not let you scroll if you simply put a rectangle inside:
import QtQuick.Controls 2.2 //... ScrollView { id : scrollview anchors.fill: parent clip: true Rectangle { width : scrollview.width height: 400 gradient: Gradient { GradientStop { position: 0.0; color: "red" } GradientStop { position: 0.33; color: "yellow" } GradientStop { position: 1.0; color: "green" } } } }
Which is a simple variant of the example in the documentation (where a Label is used instead of the Rectangle): https://doc.qt.io/qt-5.11/qml-qtquick-controls2-scrollview.html .
A workaround is to anchors the Rectangle inside a Layout, e.g.
ScrollView { id : scrollview anchors.fill: parent clip: true ColumnLayout { width : scrollview.width height: 400 spacing: 0 Rectangle { anchors.fill : parent gradient: Gradient { GradientStop { position: 0.0; color: "red" } GradientStop { position: 0.33; color: "yellow" } GradientStop { position: 1.0; color: "green" } } } } }
Unless i missed it, this limitation is not mentioned anywhere.
ScrollView works as expected with QtQuick Controls 1.
For Gerrit Dashboard: QTBUG-69376 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
234228,4 | Doc: add "Sizing" section to ScrollView's docs | 5.11 | qt/qtquickcontrols2 | Status: MERGED | +2 | 0 |