这是一个您可以扩展的简单示例:
Window {
visible: true
width: 640
height: 480
Rectangle {
anchors.centerIn: parent
width: 200
height: 200
color: "yellow"
Flickable {
id: view
anchors.fill: parent
contentWidth: 200
contentHeight: col.height
property real span : contentY + height
Column {
id: col
x: 90
spacing: 2
Repeater {
model: 50
delegate: Rectangle {
width: 10
height: 10
color: inView ? "blue" : "red"
property bool inView: y > view.contentY && y < view.span
}
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
显然,一个完整的解决方案也将在计算中包括项目的高度。如有必要,您还可以在 x 轴上进行检查。
| 归档时间: |
|
| 查看次数: |
1284 次 |
| 最近记录: |