View Full Version : qtableview and images in the cell

18th March 2015, 19:29
Hi all,

writing an Bulls and Cows game, a Mastermind like game

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++) {
for (int i=0; i<cows;i++) {

thanks for helping

19th March 2015, 07:40
Just generate an image, i.e. drawing into a QPixmap or QImage using QPainter.


19th March 2015, 19:59
thanks for the replay

i'll try to implement qpainter.drawImage