PDA

View Full Version : A list box with an specific style checkbox



wxShayan
29th December 2012, 20:42
Hello,
I need a check list box which its checkboxes look like an asterisk (just like the following picture):
8545
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. :)

wysota
30th December 2012, 13:53
All you need to do is provide a custom delegate with reimplemented QAbstractItemDelegate::editorEvent(). You needn't touch QListWidget.