djvujke
18th March 2015, 19:29
Hi all,
writing an Bulls and Cows game, a Mastermind like game
http://qt-apps.org/content/show.php/4bullz?content=169027
I have tableview/model and i have lineEdit where you enter data; application checks the data and calculates score(bulls,cows)
bull = you have guessed the number and its in the right position
cow = you have guessed the number but not in good position
in 1 cell you have your guess and then currently i have cell bullz and cell cows
i'd like to replace this with following
in 1st cell your guess and in second cell images of bulls and cows;
But i don't know how to put in cell multiple and different images;
for example if you have 1 bull and 2 cows score how do i put that in the cell
I can put only one image
QStandardItem *itemScore = new QStandardItem();
for (int i=0; i<bulls;i++) {
itemScore->setData(QPixmap("Red-bull.png").scaledToHeight(35),Qt::DecorationRole);
}
for (int i=0; i<cows;i++) {
itemScore->setData(QPixmap("Yellow-cow.png").scaledToHeight(35),Qt::DecorationRole);
}
tmodel->setItem(row,3,itemScore);
thanks for helping
writing an Bulls and Cows game, a Mastermind like game
http://qt-apps.org/content/show.php/4bullz?content=169027
I have tableview/model and i have lineEdit where you enter data; application checks the data and calculates score(bulls,cows)
bull = you have guessed the number and its in the right position
cow = you have guessed the number but not in good position
in 1 cell you have your guess and then currently i have cell bullz and cell cows
i'd like to replace this with following
in 1st cell your guess and in second cell images of bulls and cows;
But i don't know how to put in cell multiple and different images;
for example if you have 1 bull and 2 cows score how do i put that in the cell
I can put only one image
QStandardItem *itemScore = new QStandardItem();
for (int i=0; i<bulls;i++) {
itemScore->setData(QPixmap("Red-bull.png").scaledToHeight(35),Qt::DecorationRole);
}
for (int i=0; i<cows;i++) {
itemScore->setData(QPixmap("Yellow-cow.png").scaledToHeight(35),Qt::DecorationRole);
}
tmodel->setItem(row,3,itemScore);
thanks for helping