I'm trying to create a Scrollbar for a rectangle that holds automatically generated rectangles , i want the scrollbar to stop when i scroll down if there are no more rectangles to view, same thing for scroll up, i have serached the internet and found most examples talks about listview whereas i'm not using that , i have tried using the Flickable component but it didn't work out for me
here is my code:
Flickable {
id: flickArea
anchors.fill: parent
contentWidth: cRects.createRects(w).width; contentHeight: cRects.createRects(w).height
flickableDirection: Flickable.VerticalFlick
clip: true
Rectangle {
id: rectangle17
x: 127
y: 107
width: 200
height: 200
color: "#ffffff"
opacity: 0
Item {
id: cRects
function createRects(w) {
var z = 10
var t = 20
var itemList = []
/* if(w == 2)
z = 60*/
for (var i = 0; i < w; i++) {
itemList[i] = Qt.createQmlObject(
'import QtQuick 2.0; Rectangle { width: 325; height: 35;'
+ ' x: ' + t + '; y: ' + z + '; color: "#ffffff"; radius: 32; border.width: 2; border.color: "#ada9a9" }',
rectangle17, "createItems()");
z = z + 40
// t = t - 40
}
return itemList
}
//property variant items: cRects.createItems()
}
}
}
Any ideas on how this can be fixed
thanks