Details
-
Bug
-
Resolution: Done
-
P2: Important
-
4.7.0
-
None
-
Mac
-
17cc89e918a969d85d2b46631ee8743288c7586d
Description
Setting a VisualItemModel for a Repeater has the effect of appending the items to the Repeater.
Take a look at the example code below. Click on one of the grey buttons to set the Repeater content to 3 Rectangles. Click the other grey button to set 3 different Rectangles. The Repeater ends up with 6 rectangles, even though Repeater.count says 3...
import Qt 4.7
Rectangle {
width: 200
height: 800
Column {
y: 200
Repeater
}
VisualItemModel {
id: model0
Rectangle
Rectangle
{ width: 100; height: 20; color: "green" }Rectangle
{ width: 100; height: 20; color: "blue" } }
VisualItemModel {
id: model1
Rectangle
Rectangle
{ width: 100; height: 20; color: "orange" }Rectangle
{ width: 100; height: 20; color: "pink" }}
Rectangle {
width: 100
height: 30
color: "grey"
Text
MouseArea {
anchors.fill: parent
onClicked:
}
}
Rectangle {
y: 40
width: 100
height: 30
color: "grey"
Text
MouseArea {
anchors.fill: parent
onClicked:
}
}
Text
{ y: 80; text: "Number of items = " + fred.count }}