seniorc
25th May 2014, 17:48
Hello,
I'm trying show QTableView in QComboBox.
Example Department is table in my database.
Query =
SELECT Dep.Code,Dep.Name FROM Dep
and I've tried this my code.
QSqlQueryModel* depModel = new QSqlQueryModel();
depModel->setQuery("SELECT Dep.Code,Dep.Name FROM Dep");
.
.
.
QTableView* cboxTable = new QTableView(this);
cboxTable->setModel(depModel);
QComboBox *courseComboBox = new QComboBox();
courseComboBox->setView(cboxTable);
but not work.Where is my problem ? I want see multiple columns.
Here is this problem stackoverflow link (http://stackoverflow.com/questions/23849874/qt-qcombobox-with-multiple-columns?noredirect=1#comment36704087_23849874)
I'm trying show QTableView in QComboBox.
Example Department is table in my database.
Query =
SELECT Dep.Code,Dep.Name FROM Dep
and I've tried this my code.
QSqlQueryModel* depModel = new QSqlQueryModel();
depModel->setQuery("SELECT Dep.Code,Dep.Name FROM Dep");
.
.
.
QTableView* cboxTable = new QTableView(this);
cboxTable->setModel(depModel);
QComboBox *courseComboBox = new QComboBox();
courseComboBox->setView(cboxTable);
but not work.Where is my problem ? I want see multiple columns.
Here is this problem stackoverflow link (http://stackoverflow.com/questions/23849874/qt-qcombobox-with-multiple-columns?noredirect=1#comment36704087_23849874)