Cześć. W jaki sposób bo naciśnięciu przycisku wymalować kilka pól? Obecnie jest zrobione tak, że naciśniecie powoduje zmianę jednego pola na wybrany kolor, a ja chce 2/3/4 pola wymalować. Jak to zrobić?
Rectangle
{
SequentialAnimation on y
{
NumberAnimation { to: 100; easing.type: Easing.InBounce; duration: 2000 }
}
focus: true;
id: field
x: 5
y: 655
width: 255
height: 255
color: "#467fb4"
radius: 6
visible: false
Grid {
id: tileGrid
x: 5;
y: 5;
rows: 10
columns: 10
spacing: 5
Repeater {
id: repeater
visible: true
model: 100
Rectangle {
id: miniField
width: 200/10; height: 200/10
radius: 3
color: "#b0c5de"
Text{
anchors.centerIn: parent
color: "#f0f0f0"
text: index
}
MouseArea{
anchors.fill: parent
width: parent.width
height: parent.height
hoverEnabled: true
onClicked: {
miniField.state = 'move'
Script.add_ship(index, ship_x, ship_y);
}
onMouseXChanged: {
myX = parent.x
tileGrid2.x = myX + 10;
}
onMouseYChanged: {
myY = parent.y
tileGrid2.y = myY + 105;
}
}
states: [
State {
name: "move"
PropertyChanges {
target: miniField
color: "red"
}
}
]
}
}
}
}