forked from UrFU-Programming/Pairs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.qml
51 lines (43 loc) · 1.25 KB
/
main.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import QtQuick 2.3
import QtQuick.Window 2.2
import Pairs 1.0
Window {
id: window
visible: true
width: 800
height: 600
minimumHeight: 400
minimumWidth: 400
Field {
id: field
}
Rectangle {
id: board
color: "lightgray"
anchors.fill: parent
anchors.margins: 10
Grid {
id: grid
rows: field.width
columns: field.height
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
spacing: 4
Repeater {
model: field.width * field.height
Rectangle {
id: cellItem
width: window.width/field.width - grid.spacing*1.5
height: window.height/field.height - grid.spacing*1.5
property Cell cell: field.cellAt(index % field.width, index / field.width)
Image {
anchors.fill:parent
source: "qrc:images/img/"+cell.key+".png"
fillMode: Image.PreserveAspectFit
anchors.centerIn: parent
}
}
}
}
}
}