xeroblast
7th December 2010, 08:28
hi,
this is my code to display a QComboBox in a QTableWidget and using QSignalMapper to re-emit the signal but the output is Object::connect: No such signal QComboBox::currentIndexChanged()
QSignalMapper* signalMapper = new QSignalMapper(this);
QString val = tableUsers->item(y, x)->text();
QComboBox* dropdownPosition = new QComboBox();
QSqlQuery query;
query.exec("SELECT * FROM position");
int i = 0;
while (query.next()) {
dropdownPosition->addItem(query.value(1).toString());
if (val == query.value(1).toString()) dropdownPosition->setCurrentIndex(i);
i++;
}
query.clear();
tableUsers->setCellWidget(y, x, dropdownPosition);
connect(dropdownPosition, SIGNAL(currentIndexChanged()), signalMapper, SLOT(map()));
signalMapper->setMapping(dropdownPosition, QString("%1-%2").arg(y).arg(x));
connect(signalMapper, SIGNAL(mapped(const QString &)), this, SLOT(editUserPosition()));
am i doing it right? or there is something missing in my code? thanx for the help..
this is my code to display a QComboBox in a QTableWidget and using QSignalMapper to re-emit the signal but the output is Object::connect: No such signal QComboBox::currentIndexChanged()
QSignalMapper* signalMapper = new QSignalMapper(this);
QString val = tableUsers->item(y, x)->text();
QComboBox* dropdownPosition = new QComboBox();
QSqlQuery query;
query.exec("SELECT * FROM position");
int i = 0;
while (query.next()) {
dropdownPosition->addItem(query.value(1).toString());
if (val == query.value(1).toString()) dropdownPosition->setCurrentIndex(i);
i++;
}
query.clear();
tableUsers->setCellWidget(y, x, dropdownPosition);
connect(dropdownPosition, SIGNAL(currentIndexChanged()), signalMapper, SLOT(map()));
signalMapper->setMapping(dropdownPosition, QString("%1-%2").arg(y).arg(x));
connect(signalMapper, SIGNAL(mapped(const QString &)), this, SLOT(editUserPosition()));
am i doing it right? or there is something missing in my code? thanx for the help..