开发者

QCheckBox inside QTableWidget, clicking on label won't alter state

If I call QTableWidget.setCellWidget with a widget that contains a QCheckBox then clicking on the label of that checkbox will not alter the state. It appears as though the table is consuming part of the mouse events. If I click on the box directly it will alter state. Clicking on t开发者_运维问答he box or the label will cause the checkbox to get focus.

Is there anyway to get the checkbox to behave normally within the table?


This is not a real answer but what you want seems to work in my small test program. I'll show it here in the hope it will help you:

int main(int argc, char* argv[])
{
    QApplication app(argc, argv);

    QTableWidget table(1, 1);
    QCheckBox check("Test");
    table.setCellWidget(0, 0, &check);
    table.show();

    return app.exec();
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜