Results 1 to 4 of 4

Thread: List withembedded check boxes

  1. #1
    Join Date
    Jan 2007
    Posts
    91
    Thanks
    21
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default List withembedded check boxes

    Hello,
    This is a simple question, I hope:

    I want to create a scrollable list with a string and a checkbox by each item.

    What is the best way to do this? Which control:

    Here's the example:

    [] Option 1
    [] Option 2
    [] Option 3
    ...

    Recommendations of which control to use?

    - BRC

  2. #2
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: List withembedded check boxes

    Quote Originally Posted by bruccutler View Post
    What is the best way to do this?
    Recommendations of which control to use?
    It depends on what approach you want to use : custom model or convinience view.
    Basically you can do that through item delegates (for a custom model) or using the setItemWidget() method of QListWidget...

    Both methods will achieve what you need but one is significantly easier but far less flexible than the other...

    Hope this helps.
    Current Qt projects : QCodeEdit, RotiDeCode

  3. #3
    Join Date
    Jan 2007
    Posts
    91
    Thanks
    21
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Cool Re: List withembedded check boxes

    Quote Originally Posted by fullmetalcoder View Post
    It depends on what approach you want to use : custom model or convinience view.
    Basically you can do that through item delegates (for a custom model) or using the setItemWidget() method of QListWidget...

    Both methods will achieve what you need but one is significantly easier but far less flexible than the other...

    Hope this helps.
    Initially, because of time schedule, I'm all for convenience and less flexible. So, which is which? I assume the setItemWidget is the simpler of the two, correct?
    - BRC

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: List withembedded check boxes

    Sounds like a QListView (or a QListWidget) with checkable items.

    QListWidgetItem::setFlags(), Qt::ItemIsUserCheckable
    J-P Nurmi

  5. The following user says thank you to jpn for this useful post:

    bruccutler (7th March 2007)

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.