Results 1 to 2 of 2

Thread: A list box with an specific style checkbox

  1. #1
    Join Date
    Aug 2012
    Posts
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: A list box with an specific style checkbox

    Hello,
    I need a check list box which its checkboxes look like an asterisk (just like the following picture):
    Sample.png
    I want to use these checkboxes to specify favorite items.
    I have created the above check list box by QListWidget and customize its items by deriving a delegate from QStyledItemDelegate. But I do not know how to realize that the cursor is located on the asterisk region to display hover effects and fill it when the user clicks on it. I derived a class from QListWidget and override its mouseMoveEvent but I did not find any way to get an item's position to calculate its asterisk position!


    Added after 34 minutes:


    WOW!
    I did not see visualRect function till now! That is exactly what I need. I solved my problem.
    Last edited by wxShayan; 29th December 2012 at 19:42.

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

    Default Re: A list box with an specific style checkbox

    All you need to do is provide a custom delegate with reimplemented QAbstractItemDelegate::editorEvent(). You needn't touch QListWidget.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 1
    Last Post: 24th August 2012, 11:23
  2. Help QT checkbox and text on list
    By jgaleanog in forum Qt Programming
    Replies: 1
    Last Post: 3rd November 2010, 14:40
  3. Do Qt Style Sheets support List-style-image?
    By daiheitan in forum Qt Programming
    Replies: 6
    Last Post: 12th March 2010, 01:41
  4. Drop down checkbox list
    By rbp in forum Qt Programming
    Replies: 2
    Last Post: 28th October 2008, 01:36
  5. Qt specific questions regaring coding style
    By Raistlin in forum Qt Programming
    Replies: 4
    Last Post: 26th February 2007, 09:14

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.