musti
16th November 2007, 10:13
I have combobox with model like this
cityModel = new QSqlTableModel(this);
cityModel->setTable("cities"); // (city_id, city_name)
cityModel->select();
comboBox_city->setModel(cityModel);
comboBox_city->setModelColumn(1);
comboBox_city->setCurrentIndex(0);
I want to change current index of combobox to row of city_id has 15 value?
Please help me.
Following line doesnt work.
comboBox_city->setCurrentIndex(comboBox_city->findData(query.value(rec.indexOf("city_id"))) );
cityModel = new QSqlTableModel(this);
cityModel->setTable("cities"); // (city_id, city_name)
cityModel->select();
comboBox_city->setModel(cityModel);
comboBox_city->setModelColumn(1);
comboBox_city->setCurrentIndex(0);
I want to change current index of combobox to row of city_id has 15 value?
Please help me.
Following line doesnt work.
comboBox_city->setCurrentIndex(comboBox_city->findData(query.value(rec.indexOf("city_id"))) );