How to get the row number of the QComboBox in QTableWidget
Posted
by dreamxiuhuishan
on Stack Overflow
See other posts from Stack Overflow
or by dreamxiuhuishan
Published on 2010-05-22T13:36:12Z
Indexed on
2010/05/22
13:40 UTC
Read the original article
Hit count: 385
qtablewidget
|qcombobox
Here is the code, but it dos not work. Who can create the code. Thanks very much!
void add() {
QComboBox *ziduan = new QComboBox;
ziduan->addItem("??","nd");
int row =0;
int col =1;
QSignalMapper* signalMapper = new QSignalMapper(this);
connect(ziduan, SIGNAL(currentIndexChanged(int)), signalMapper, SLOT(map()));
signalMapper->setMapping(ziduan, QString("%1-%2").arg(row).arg(col));
connect(signalMapper, SIGNAL(mapped(const QString &)),this, SIGNAL(changeZiduan(const QString &)));
}
void sqlGenerator::changeZiduan(const QString &position) {
QStringList coordinates = position.split("-");
int row = coordinates[0].toInt();
int col = coordinates[1].toInt();
}
© Stack Overflow or respective owner