在QComboBox 的currentIndexChanged(int) 信号的SLOT中获取sender()获取该对象。
connect(comboxCircleType, SIGNAL(currentIndexChanged(int)), this, SLOT(slotCurrentIndexChanged(int)));
QTableWidget* table = new QTableWidget()
connect(comboxCircleType, SIGNAL(currentIndexChanged(int)), this, SLOT(slotCurrentIndexChanged(int)));
}
And in the slot, you can use sender()
to identify the combo box which emitted the signal.
void MainWindow::slotCurrentIndexChanged(const QString& text)
{
QComboBox* combo = qobject_cast<QComboBox*>(sender());
if (combo)
{
qDebug() << "row: " << combo->property("row").toInt();
qDebug() << "column: " << combo->property("column").toInt();
}
}
获取嵌入在QTableWidget中的QCombBox对象所处的行列信息
原文:https://www.cnblogs.com/iseekv/p/11438716.html