...
for(int row=0;row<10;++row)
for(int col=0;col<10;++col){
frame->setMaximumSize(50,50);
frame->setMinimumSize(50,50);
frame->setStyleSheet(//set color, corner radius etc//);
tableWidget->setCellWidget(row,col,frame);
}
tableWidget->resizeColumnsToContents();
tableWidget->resizeRowsToContents();
connect(tableWidget,SIGNAL(cellClicked(int,int)),this,SLOT(yourSlot(int,int)));
...
...
tw = new QTableWidget(10,10,this);
for(int row=0;row<10;++row)
for(int col=0;col<10;++col){
QFrame *frame = new QFrame;
frame->setMaximumSize(50,50);
frame->setMinimumSize(50,50);
frame->setStyleSheet(//set color, corner radius etc//);
tableWidget->setCellWidget(row,col,frame);
}
tableWidget->resizeColumnsToContents();
tableWidget->resizeRowsToContents();
connect(tableWidget,SIGNAL(cellClicked(int,int)),this,SLOT(yourSlot(int,int)));
...
To copy to clipboard, switch view to plain text mode
Then in the slot change the color of the frame in the appropriate cell, according to which color button is checked, with
Bookmarks