One cell in each row of a QTableWidget contains a combobox
for (each row in table ... ) {
QComboBox* combo = new QComboBox();
table->setCellWidget(row,col,combo);
combo->setCurrentIndex(node.type());
connect(combo, SIGNAL(currentIndexChanged(int)),this, SLOT(changed(int)));
....
}
In the handler function ::changed(int index) I have
QComboBox* combo=(QComboBox*)table->cellWidget(_row,_col);
combo->currentIndex()
To get back a copy of the combobox and get the new selection.
But I can't get the row/col.
None of the table cellXXXX signals is emitted when an embedded item is selected or changed and currentRow()/currentColumn() aren't set.
No need for the signal mapper... When the combobox is created you can simply add two custom properties to it:
combo->setProperty("row", (int) nRow);
combo->setProperty("col", (int) nCol);
In the handler function you can get a pointer back to the sender of the signal (your combobox).
Now by asking for the properties you can have your row/col back:
int nRow = sender()->property("row").toInt();
int nCol = sender()->property("col").toInt();