【发布时间】:2015-04-30 22:28:40
【问题描述】:
我在使用 QML/C++ 项目时遇到了一个小问题。我正在使用中继器在 Rectangle 内绘制点,这些点来自模型。这是我的代码:
main.qml
Rectangle {
id: rect
height:500
width:500
Repeater {
id: pointsRepeater
model: qListPoints
Point {
}
}
}
qListPoints 来自我写的 C++:
Q_PROPERTY( QVariant qListPoints READ getListPoints NOTIFY listPointsChanged)
所以基本上当我添加或更新一个列表点时,我会发出 listPointsChanged() 并且我的 main.qml 从列表中重新绘制新的或更新的点。我的问题是当我向列表中添加点并发出 listPointsChanged() 时,所有点都被重绘,这就像一个缓慢的频闪效果。我只想重新绘制新点。可能吗 ?
提前谢谢你。
【问题讨论】:
-
qListPoints 包含什么?
-
它包含 QList
其中 QObjects 来自我的 Point 类