在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(); } }