I don't know about mapper, but here is how I initialize my combo boxes with db values:
// Retrieves the preferences to populate the dialog when it opens
void PreferencesDialog
::getPreferences(QString ctrlConn
) {
db.open();
model->setTable("preferences");
model->select();
record = model->record(0);
m_ui->cbPort->setCurrentIndex(m_ui->cbPort->findText(record.value("port").toString()));
// Retrieves the preferences to populate the dialog when it opens
void PreferencesDialog::getPreferences(QString ctrlConn)
{
QSqlDatabase db = QSqlDatabase::database(ctrlConn);
db.open();
QSqlRecord record;
QSqlTableModel* model = new QSqlTableModel(this, db);
model->setTable("preferences");
model->select();
record = model->record(0);
m_ui->cbPort->setCurrentIndex(m_ui->cbPort->findText(record.value("port").toString()));
To copy to clipboard, switch view to plain text mode
Does that help any?
Bookmarks