Hi! I have a SQLite database with a table names monitored_directories. I would like to list the column original_path of this table in a QListWidget, where I can then edit the elements to upgrade my database. After reading documentation and examples I came up with this:
tableModel->setTable("monitored_directories");
tableModel->select();
mapper->setModel(tableModel);
mapper->addMapping(listDir, tableModel->fieldIndex("original_path"));
mapper->toFirst();
tableModel = new QSqlRelationalTableModel(this, LBTGlobals::getInstance()->dbManager->db);
tableModel->setTable("monitored_directories");
tableModel->select();
mapper = new QDataWidgetMapper(this);
mapper->setModel(tableModel);
mapper->setItemDelegate(new QSqlRelationalDelegate(this));
mapper->addMapping(listDir, tableModel->fieldIndex("original_path"));
mapper->toFirst();
To copy to clipboard, switch view to plain text mode
The QListWidet listDir is empty, event if I have records in the table. What am I doing wrong?
Thanks for any advice!
Bookmarks