I’m trying to display a QComboBox inside a QTableWidgetItem by setting it as its child, using this code:
QComboBox* qcb;
int r,c;
//......
qcb->setParent((QWidget*)tableWidget->item(r,c));
but that didn’t the job.
so how to fix that? thanks.
You do this via the QTableWidget
object itself.
void QTableWidget::setCellWidget ( int row, int column, QWidget * widget )
http://qt-project.org/doc/qt-4.8/qtablewidget.html#setCellWidget
Maybe you want to add a widget to a QTableWidget with
void QTableWidget::setCellWidget ( int row, int column, QWidget * widget )
and accessing it by
QWidget * QTableWidget::cellWidget ( int row, int column ) const
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With