How to interact with checkbox actions ? (QTableView with QStandardItemModel)
Posted
by Claire Huang
on Stack Overflow
See other posts from Stack Overflow
or by Claire Huang
Published on 2010-05-07T00:27:56Z
Indexed on
2010/05/07
0:38 UTC
Read the original article
Hit count: 774
I'm using QTableView and QStandardItemModel to show some data.
For each row, there is a column which has a check Box, this check box is inserted by setItem, the code is as follows:
int rowNum;
QStandardItemModel *tableModel;
QStandardItem* __tmpItem = new QStandardItem();
__tmpItem->setCheckable(true);
__tmpItem->setCheckState(Qt::Unchecked);
tableModel->setItem(rowNum,0,__tmpItem);
Now I want to interact with the check box. If a check box changes its state by user (from checked to unchecked or vice versa), I want to do something on the corresponding data row.
I know I can use signal-slot to catch the change of checkbox, but since there are lots of data row, I don't want to connect each row one by one.
Is there anyway to interact with the check action more effectively? Thanks :)
© Stack Overflow or respective owner