Results 1 to 7 of 7

Thread: Custom ListWidget(QCheckBox + Icon + Text)

  1. #1
    Join Date
    Sep 2008
    Posts
    58
    Thanks
    11
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Exclamation Custom ListWidget(QCheckBox + Icon + Text)

    Hi,

    I am newbie to qt, I wanted to create custom QListWidget with CheckBox + Icon + Text. as show in attached file.

    I am able to get Icon + Text by using Iconview mode.But I don't know how to add checkbox.

    Can anybody direct/suggest me what should i read(do), how to make this possible??

    Thanks in Advance.
    Nirav
    Attached Images Attached Images
    Last edited by nrabara; 12th May 2010 at 14:41. Reason: updated contents

  2. #2
    Join Date
    Feb 2008
    Posts
    98
    Thanks
    2
    Thanked 24 Times in 24 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Custom ListWidget(QCheckBox + Icon + Text)

    You may create a widget (manually or through Qt Designer) which contains the checkbox and a couple of QLabels, one for the image and another for the filename. They can be layed out horizontally. Then use QListWidget::setItemWidget().

  3. The following user says thank you to victor.fernandez for this useful post:

    ntp (10th December 2010)

  4. #3
    Join Date
    Feb 2008
    Posts
    491
    Thanks
    12
    Thanked 142 Times in 135 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: Custom ListWidget(QCheckBox + Icon + Text)

    Also, that can be achieved with QListWidgetItem::setCheckState()

  5. #4
    Join Date
    Sep 2008
    Posts
    58
    Thanks
    11
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Custom ListWidget(QCheckBox + Icon + Text)

    Thanks for your suggestion,

    But I dough, because my contain is dynamic i.e I want to show wallpaper in thumbnail view with name and checkbox for selection.

    Can you suggest me what should I do in this case??

  6. #5
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Custom ListWidget(QCheckBox + Icon + Text)

    Did you have a look at QListWidgetItem::setCheckState() as said above ?

  7. #6
    Join Date
    Sep 2008
    Posts
    58
    Thanks
    11
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Custom ListWidget(QCheckBox + Icon + Text)

    Thanks,

    I am able to get checkbox for each listwidgetitem, But I still have one problem.

    How can I increase the checkbox size?

  8. #7
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Custom ListWidget(QCheckBox + Icon + Text)

    Not sure about the exact solution. But delegates are what you will need.
    Have a look at QItemDelegate::drawCheckI am not sure how to do with QStyledItemDelegate though.

Similar Threads

  1. QCheckBox with long text label
    By Ferdous in forum Newbie
    Replies: 5
    Last Post: 29th October 2011, 19:05
  2. Text Alignment in a ListWidget
    By Krish_ng in forum Qt Programming
    Replies: 2
    Last Post: 21st July 2007, 02:19
  3. Text under the Icon
    By QiT in forum Newbie
    Replies: 3
    Last Post: 1st April 2007, 17:42
  4. Icon Text Alignment
    By nupul in forum Newbie
    Replies: 3
    Last Post: 1st May 2006, 04:47
  5. Rightjustify text in listwidget
    By Morea in forum Qt Programming
    Replies: 1
    Last Post: 24th March 2006, 10:17

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.