Is possible create or get a ComboBox with multiple columns? like Visual Basic does.
for example to show the result of a QSqlQuery with more than one column.
Is possible create or get a ComboBox with multiple columns? like Visual Basic does.
for example to show the result of a QSqlQuery with more than one column.
did you search by forum? I've posted answer on this question.
Did you find an answer ?
I m also looking to put multiple column to the comboBox. I search the forum but didn't find anything to help my need.
Does anybody have a good example?
Thanks
I have searched on forum, finded about ItemDelegate but must read the documentation. You can read docs and the QT-4.3 book.
The funny thing is I implemented a multicolumn combobox todayIt's about 10 lines of code in total
![]()
Ok, show us the code, and could you add some comments?
I can'tBut I can tell you that all you need to do is replace (using setView()) the default view (which is a QListView) of the combobox with a multicolumn one like QTreeView and optionally reimplement showPopup() to setup the geometry of the popup widget (you will probably want to make it wider than the combobox). Oh... and remember to use a multicolumn model with the widget
![]()
example:
QTableView *tv = new QTableView(this);
tv->setModel( model );
tv->horizontalHeader()->setVisible(false);
tv->verticalHeader()->setVisible(false);
tv->resizeColumnsToContents();
combo->setView(tv);
Last edited by olosie; 11th July 2009 at 11:24.
Bookmarks