The whole problem is I tried to implement it, but always faced some issues, Like, ScrollView Covers the whole content or I get the issue where my Column-item
Cannot anchor to an item that isn't a parent or sibling.
The screen of my the whole tab is here
Tab where I need to place scrollview
Rectangle{
id:root
color: "white"
anchors.fill: parent
Rectangle{
id:label
color: "#F6F6F6"
width: root.width
height: root.height * 0.20
z: parent.z + 4
Text{
width: label.width
height: label.height
text: getImageName()
font.family: "Abel"
font.pointSize: 24
color: "#4A3F35"
lineHeight: 24
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
}
}
Column {
anchors.top: label.bottom
anchors.horizontalCenter: root.horizontalCenter
anchors.topMargin: label.height * 0.5
spacing: label.height * 0.3
Repeater {
id:secondTabRepeater
model: getAmountOfMountedVolumes()
Rectangle{
id:driveInfoRectangle
width: root.width * 0.87
height: root.height * 0.20
color:"white"
radius: 5
border.color: getUsbDevice(index)
border.width: 2
//border.color: "#4A3F35"
Text {
id: memorySizeText
text: getUsbSpace(index) + " Gb"
anchors.fill: parent
font.family: "Abel"
font.pointSize: 22
color: "#4A3F35"
lineHeight: 22
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
}
Text {
id: drivePathText
text: getUsbDevice(index)
anchors.fill: parent
anchors.bottomMargin: 5
font.family: "Abel"
font.pointSize: 14
color: "#4A3F35"
lineHeight: 12
verticalAlignment: Text.AlignBottom
horizontalAlignment: Text.AlignHCenter
}
}
}
}
}
Try This : I add ScrollBar
inside one Flickable
to your code and now it works.
import QtQuick 2.12
import QtQuick.Window 2.12
import QtQuick.Controls 2.5
Window {
visible: true
width: 640
height: 480
title: qsTr("Hello World")
Rectangle{
id:root
color: "white"
anchors.fill: parent
Rectangle{
id:label
color: "#F6F6F6"
width: root.width
height: root.height * 0.20
z: parent.z + 4
Text{
width: label.width
height: label.height
text:"Example"
font.family: "Abel"
font.pointSize: 24
color: "#4A3F35"
lineHeight: 24
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
}
}
Flickable{
width: parent.width
height: parent.height
contentHeight: mColumnId.implicitHeight
contentWidth: mColumnId.implicitWidth
Column {
id:mColumnId
anchors.top: label.bottom
anchors.horizontalCenter: root.horizontalCenter
anchors.topMargin: label.height * 0.5
spacing: label.height * 0.3
Repeater {
id:secondTabRepeater
model: 10
Rectangle{
id:driveInfoRectangle
width: root.width * 0.87
height: root.height * 0.20
color:"white"
radius: 5
border.color: getUsbDevice(index)
border.width: 2
//border.color: "#4A3F35"
Text {
id: memorySizeText
text: getUsbSpace(index) + " Gb"
anchors.fill: parent
font.family: "Abel"
font.pointSize: 22
color: "#4A3F35"
lineHeight: 22
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
}
Text {
id: drivePathText
text: getUsbDevice(index)
anchors.fill: parent
anchors.bottomMargin: 5
font.family: "Abel"
font.pointSize: 14
color: "#4A3F35"
lineHeight: 12
verticalAlignment: Text.AlignBottom
horizontalAlignment: Text.AlignHCenter
}
}
}
}
ScrollBar.vertical: ScrollBar{}
ScrollBar.horizontal: ScrollBar{}
}
}
}