summaryrefslogtreecommitdiff
path: root/qml/Square.qml
blob: 216929062d6b08ca33cd8d3e2248d3922c8370ad (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import QtQuick 2.0

Rectangle {
    property int i: 0
    property string piece: ""
    property string image: piece !== "" ? "qrc:///images/" + piece + ".svg" : ""

    width: page.width / 8
    height: this.width
    color: ((i >> 3 ^ i) & 1) == 0 ? "#e8ebef" : "#7d8796"
    border.color: "yellow"
    border.width: 0

    MouseArea {
        anchors.fill: parent
        onClicked: functions.select(i);
    }
    Image {
        id: piece_image
        sourceSize.width: parent.width
        sourceSize.height: parent.height
        source: image
    }
}