S
S
Slavka2016-04-05 11:44:15
Qt
Slavka, 2016-04-05 11:44:15

Qt convert QTableWidgetItem to QPushButtom?

In general, I have buttons in the table, and I sometimes need to change the properties of these buttons, I try to make a pointer to this button, but nothing comes out of me, that's what I tried

QPushButton *pButton = qobject_cast<QPushButton*>((QObject*)ui->ViewData->item(i, 7));
                if (!pButton){
                    qDebug() << "Fail";
                    continue;
                }

Every time pointer is empty

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yaroslav, 2016-04-05
@torwig

You can try casting QTableWidgetItem* not to QObject* but to QWidget*.
How do you add buttons to table cells?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question