Results 1 to 3 of 3

Thread: QCombox with multiple items (or similar widget)

  1. #1
    Join Date
    Apr 2021
    Posts
    8
    Qt products
    Qt5
    Platforms
    Windows

    Default QCombox with multiple items (or similar widget)

    Hi,
    is it possible for a QCombobox to show multiple items that can be selected? Or do I have to use another widget? In this case what is this windget?
    I need to use an input widget like the one in the image that come from a Java application.
    Thank you

    combobox.png

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,229
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QCombox with multiple items (or similar widget)

    The screen shot you show is not a "combo box", it is a list. A combo box is a single line edit that has a drop down list of choices from which you can select a single item.

    You want a QListWidget or QListView (depending on whether you let the list use its own internal item model (widget) or you provide an external item model for the source of choices (view).

    If you want to allow the user to select multiple items, then you have to set the QAbstractItemModel::SelectionMode to the desired selection behavior.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  3. #3
    Join Date
    Apr 2021
    Posts
    8
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QCombox with multiple items (or similar widget)

    Thank you, I wasn't sure that it is a combobox! I will try with a QlistWidget soon

Similar Threads

  1. Replies: 3
    Last Post: 20th July 2011, 01:49
  2. Replies: 1
    Last Post: 8th January 2009, 21:56
  3. Replies: 27
    Last Post: 14th May 2008, 11:39
  4. Looking for a Widget Similar to QListWidget
    By stealth86 in forum Qt Programming
    Replies: 4
    Last Post: 7th August 2007, 23:15
  5. Replies: 2
    Last Post: 19th April 2006, 20:11

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.