Select Git revision
Poncet Thomas authored
Carre.qml 5.02 KiB
import QtQuick 2.0
Item {
id: monCarre
width: 154
height: 154
property alias case9: case9
property alias case8: case8
property alias case7: case7
property alias case6: case6
property alias case5: case5
property alias case4: case4
property alias case3: case3
property alias case2: case2
property alias case1: case1
Rectangle {
id: backgroudcarre
color: "#ffffff"
border.width: 2
anchors.fill: parent
focus: true
Case {
id: case1
anchors.left: parent.left
anchors.top: parent.top
chiffreText: qsTr("9")
anchors.leftMargin: 2
anchors.topMargin: 2
MouseArea {
id: mouseArea1
focus: true
anchors.fill: parent
onClicked: {
console.log(Math.floor(monCarre.x/50)+1, Math.floor(monCarre.y/50)+1)
}
}
}
Case {
id: case2
x: 50
anchors.top: parent.top
chiffreText: qsTr("9")
anchors.topMargin: 2
anchors.horizontalCenter: parent.horizontalCenter
MouseArea {
id: mouseArea2
focus: true
anchors.fill: parent
onClicked: {
console.log(Math.floor(monCarre.x/50)+2, Math.floor(monCarre.y/50)+1)
}
}
}
Case {
id: case3
x: 100
y: 0
anchors.right: parent.right
anchors.top: parent.top
chiffreText: qsTr("9")
anchors.rightMargin: 2
anchors.topMargin: 2
MouseArea {
id: mouseArea3
focus: true
anchors.fill: parent
onClicked: {
console.log(Math.floor(monCarre.x/50)+3, Math.floor(monCarre.y/50)+1)
}
}
}
Case {
id: case4
x: 0
y: 50
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
chiffreText: qsTr("9")
anchors.leftMargin: 2
MouseArea {
id: mouseArea4
focus: true
anchors.fill: parent
onClicked: {
console.log(Math.floor(monCarre.x/50)+1, Math.floor(monCarre.y/50)+2)
}
}
}
Case {
id: case5
x: 50
y: 50
anchors.verticalCenter: parent.verticalCenter
chiffreText: "9"
anchors.horizontalCenter: parent.horizontalCenter
MouseArea {
id: mouseArea5
focus: true
anchors.fill: parent
onClicked: {
console.log(Math.floor(monCarre.x/50)+2, Math.floor(monCarre.y/50)+2)
}
}
}
Case {
id: case6
x: 0
y: 102
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
chiffreText: qsTr("9")
anchors.rightMargin: 2
MouseArea {
id: mouseArea6
focus: true
anchors.fill: parent
onClicked: {
console.log(Math.floor(monCarre.x/50)+3, Math.floor(monCarre.y/50)+2)
}
}
}
Case {
id: case7
y: 106
anchors.left: parent.left
anchors.bottom: parent.bottom
anchors.leftMargin: 2
anchors.bottomMargin: 2
MouseArea {
id: mouseArea7
focus: true
anchors.fill: parent
onClicked: {
console.log(Math.floor(monCarre.x/50)+1, Math.floor(monCarre.y/50)+3)
}
}
}
Case {
id: case8
x: 68
y: 114
anchors.bottom: parent.bottom
anchors.horizontalCenterOffset: 0
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottomMargin: 2
MouseArea {
id: mouseArea8
focus: true
anchors.fill: parent
onClicked: {
console.log(Math.floor(monCarre.x/50)+2, Math.floor(monCarre.y/50)+3)
}
}
}
Case {
id: case9
x: 115
y: 122
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.bottomMargin: 2
anchors.rightMargin: 2
MouseArea {
id: mouseArea9
focus: true
anchors.fill: parent
onClicked: {
console.log(Math.floor(monCarre.x/50)+3, Math.floor(monCarre.y/50)+3)
}
}
}
}
}