在QTableWidget的每一行中,有一个单元格包含一个下拉框。
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)));
....
}
在处理函数::changed(int index)中,我有
QComboBox* combo=(QComboBox*)table->cellWidget(_row,_col);
combo->currentIndex()
为了获取下拉框的副本并获得新的选择。
但是我无法获得行/列。
当选择或更改嵌入项目时,没有任何表格cellXXXX信号被发出,并且currentRow()/currentColumn()未设置。