Results 1 to 8 of 8

Thread: ComboBox with multiple columns

  1. #1
    Join Date
    Aug 2007
    Location
    Fresno - Colombia
    Posts
    26
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default ComboBox with multiple columns

    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.

  2. #2
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: ComboBox with multiple columns

    did you search by forum? I've posted answer on this question.

  3. #3
    Join Date
    Jul 2008
    Posts
    69
    Thanks
    9
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: ComboBox with multiple columns

    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

  4. #4
    Join Date
    Aug 2007
    Location
    Fresno - Colombia
    Posts
    26
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: ComboBox with multiple columns

    I have searched on forum, finded about ItemDelegate but must read the documentation. You can read docs and the QT-4.3 book.

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: ComboBox with multiple columns

    The funny thing is I implemented a multicolumn combobox today It's about 10 lines of code in total

  6. #6
    Join Date
    Aug 2007
    Location
    Fresno - Colombia
    Posts
    26
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: ComboBox with multiple columns

    Ok, show us the code , and could you add some comments?

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: ComboBox with multiple columns

    I can't But 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

  8. #8
    Join Date
    Apr 2009
    Location
    Gdansk, Poland
    Posts
    11
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: ComboBox with multiple columns

    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.

Similar Threads

  1. Width QTableView for QCombobox with multiple columns
    By visor_ua in forum Qt Programming
    Replies: 7
    Last Post: 21st June 2011, 11:54
  2. Displaying Multiple Columns in QListView
    By millard in forum Qt Programming
    Replies: 8
    Last Post: 5th December 2007, 13:03
  3. how to corss compile for windows in Linux
    By safknw in forum Qt Programming
    Replies: 24
    Last Post: 13th May 2006, 06:23
  4. QCheckListItem with multiple columns?
    By ecphora in forum Qt Programming
    Replies: 7
    Last Post: 12th April 2006, 06:01

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.