hai I cahnged my code to Qml and js
import Qt 4.7
import "content"
import "content/Four_in_a_row.js" as Games
Rectangle {
id: game
property bool running: true
width: display.width; height: display.height + 10
Image {
id: boardImage
source: "content/pics/My_grid.png"
}
Column {
id: display
Grid {
id: board
width: boardImage.width; height: boardImage.height
columns: 3
Repeater {
model: 9
Four {
width: board.width/3
height: board.height/3
onClicked: {
if (game.running && Games.Play(index)) {
if (!Games.Move(index, "k"))
Games.computerTurn();
}
}
}
}
}
}
}
import Qt 4.7
import "content"
import "content/Four_in_a_row.js" as Games
Rectangle {
id: game
property bool running: true
width: display.width; height: display.height + 10
Image {
id: boardImage
source: "content/pics/My_grid.png"
}
Column {
id: display
Grid {
id: board
width: boardImage.width; height: boardImage.height
columns: 3
Repeater {
model: 9
Four {
width: board.width/3
height: board.height/3
onClicked: {
if (game.running && Games.Play(index)) {
if (!Games.Move(index, "k"))
Games.computerTurn();
}
}
}
}
}
}
}
To copy to clipboard, switch view to plain text mode
My_grid.png is a grid image. now it work like tic_tac_toe. I want to animate the ball as its falling through the grid(that's my aim).can I use 2 Grid in a qml file? how can I use it?
Bookmarks