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)));
....
}
Run Code Online (Sandbox Code Playgroud)
在处理程序函数:: changed(int index)中我有
QComboBox* combo=(QComboBox*)table->cellWidget(_row,_col);
combo->currentIndex()
Run Code Online (Sandbox Code Playgroud)
要获取组合框的副本并获得新选择.
但我无法获得行/列.
当选择或更改嵌入项并且未设置currentRow()/ currentColumn()时,不会发出表cellXXXX信号.