0

I have QPushButton object and a QLabel object laid out in a QGridLayout layout. This QGridLayout is set to a QGroupBox object. How do I now retrieve the QPushButton that is effectively present in this group box? I have tried the following code but it does not return a valid QPushButton object.

    QGroupBox *grpBox = 0;
    grpBox = (QGroupBox *)ui.tableWidget->cellWidget(fromRow, 0);
    QGridLayout * gridLayout = (QGridLayout *)grpBox->layout();
    QPushButton *btn = gridLayout->findChild<QPushButton *>("+");

Thanks, Rakesh.

4

1 回答 1

0

findChild 确实有效。它应该在 QGroupBox 对象上调用。

于 2012-07-12T08:30:40.650 回答