I am currently learning QML. I have a ScrollView that is not displaying the vertical scrollbar at all. I have tried this solution but it has not worked. The code (some stuff left out) is part of a larger code base available in this GitHub repository.
EDITS: I have updated the code to create a Minimal, Reproducible Example EDIT 2 Been trying to solve the problem. I found a solution but I don't understand why it works. When I place the ScrollView inside the StackView. The vertical scrollbar appears and works as expected.
import QtQuick 2.12
import QtQuick.Window 2.12
import QtQuick.Layouts 1.12
import QtQuick.Controls 2.12
Window {
id: top
visible: true
width: 640
height: 360
RowLayout {
spacing: 0
anchors.fill: parent
Pane {
id: mainbar
Layout.margins: 0
Layout.fillHeight: true
Layout.fillWidth: true
ColumnLayout {
spacing: 1
anchors.fill: parent
Rectangle {
Layout.fillHeight: true
Layout.fillWidth: true
ScrollView {
anchors.fill: parent
clip: true
StackView {
id: stack
anchors.fill: parent
initialItem: mainView
}
Component {
id: mainView
Column {
spacing: 10
Text {
text: stack.depth
}
Button {
text: "1"
}
Button {
text: "2"
}
Button {
text: "3"
}
Button {
text: "4"
}
Button {
text: "5"
}
Button {
text: "6"
}
Button {
text: "7"
}
Button {
text: "8"
}
Button {
text: "9"
}
}
}
}
}
}
}
}
}