mohit_king
10th July 2011, 11:54
Hi, I am new to QML and so I am learning it by creating a simple tic tac toe game......
My problem is mentioned below:
I have used Grid to display all of the 9 rectangle blocks for tic tac toe game.....
Grid {
x: 22
y: 7
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
columns: 3
spacing: 3
Block11 {
id: block11
text: ""
MouseArea {
anchors.fill: parent
}
onClicked: [problem is here]
}
Block12 {...}
.
.
.
.
.
Block33{.....}
I have problem in the onClicked section. When user clicks anyone of these blocks then an image "x.png" should be displayed on that block, but i am unable to do so....
I,ve tried following:
Block11 {
id: block11
text: ""
MouseArea {
anchors.fill: parent
}
onClicked: Image{
source: "x.png"
anchors.centerIn: parent
}
but the above code gives an error.....i've also tried to find a way from many sites but was unsuccessful......please help.....
My problem is mentioned below:
I have used Grid to display all of the 9 rectangle blocks for tic tac toe game.....
Grid {
x: 22
y: 7
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
columns: 3
spacing: 3
Block11 {
id: block11
text: ""
MouseArea {
anchors.fill: parent
}
onClicked: [problem is here]
}
Block12 {...}
.
.
.
.
.
Block33{.....}
I have problem in the onClicked section. When user clicks anyone of these blocks then an image "x.png" should be displayed on that block, but i am unable to do so....
I,ve tried following:
Block11 {
id: block11
text: ""
MouseArea {
anchors.fill: parent
}
onClicked: Image{
source: "x.png"
anchors.centerIn: parent
}
but the above code gives an error.....i've also tried to find a way from many sites but was unsuccessful......please help.....