Results 1 to 8 of 8

Thread: ComboBox with multiple columns

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 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

  2. #2
    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?

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 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

  4. #4
    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 10: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, 10:54
  2. Displaying Multiple Columns in QListView
    By millard in forum Qt Programming
    Replies: 8
    Last Post: 5th December 2007, 12:03
  3. how to corss compile for windows in Linux
    By safknw in forum Qt Programming
    Replies: 24
    Last Post: 13th May 2006, 05:23
  4. QCheckListItem with multiple columns?
    By ecphora in forum Qt Programming
    Replies: 7
    Last Post: 12th April 2006, 05: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
  •  
Qt is a trademark of The Qt Company.