I'm using 4.4.3, so I'm trying to create a proof-of-concept page and playing with display widgets. I have a table with 2 columns (ID, Description) and want to store the ID in a Data Value field and Description in a Text Value field, and ID field invisible and Description field visible. I know how to do this in .Net C#, but how do I do this in Qt?
This is what I've done:
_model->setQuery("select lookupid, lookupdescr from tblLookup");
cmbBox->clear();
cmbBox->setModel(_model);
QComboBox *cmbBox = Concept::ui.cmbItems;
QSqlQueryModel *_model = new QSqlQueryModel;
_model->setQuery("select lookupid, lookupdescr from tblLookup");
cmbBox->clear();
cmbBox->setModel(_model);
To copy to clipboard, switch view to plain text mode
But, only the ID field is shown, so I used:
cmbBox->setModelColumn(1);
cmbBox->setModelColumn(1);
To copy to clipboard, switch view to plain text mode
but either the primary key shows up, and the rest of the Description text, or only the first item and the second item is not visible.
I've been searching for help, but the documentation doesn't tell me how to do this. I want to get the ID from the selected item, but not show it.
Bookmarks