I’m trying to display multiple columns on a QComboBox. It’s almost finished, with one exception: the visible item on the combo box only displays one column. When expanded, everything looks good. I wouldn’t like to use a delegate. Sad thing is that once I had a code snippet that could do that…
Here is the relevant code for setting up the combo box:
QTableView *tblLan = new QTableView;
ui->comboBox->setView(tblLan);
//m_source is a custom model derived from QAbstractListModel with 3 columns
ui->comboBox->setModel(m_source);
//I only want to display the first 2 columns
tblLan->setColumnHidden(2,true);
//and the rest is code for making the tblLan appear like a list inside the combo box
...
Thanks in advance for any hints.
↧