获取嵌入在QTableWidget中的QCombBox对象所处的行列信息

 

在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();
    }
}
posted @ 2019-08-31 13:34  陈书沐  阅读(583)  评论(0编辑  收藏  举报