PDA

View Full Version : disabling highlight effect for qlistwidget items



sushmacr
1st April 2010, 13:41
Hi All,

I am developing a screen which is a list of thumbnails. I am using a qlistwidget and for each item in the list a qframe is set with setItemWidget(). I am able to render the image in the QFrame of the list item but on selecting the list item the row including the qframe gets highlighted. The highlighting effect is causing a repaint and the image in the thumbnail gets painted with the highlight color. Is there any way to restrict the area of selection for listwidgetitem? or disable single click for listitem? or disable highlight effect on listitem selection?

axeljaeger
3rd April 2010, 16:01
Why do you use a QListWIdget at all when you just want to show some widget one above each other? Why not a QScrollView with a QVBoxLayout? Your architecture using one widget for each row is doomed to fail performance and resource wise if you intend to use more than say 50 items.

sushmacr
4th April 2010, 08:31
its thumbnail with description text so use of qlistwidget is serving the purpose. I have control on the items and the number or rows is atmost max 5 so there is no problem related to resource.....the only issue i am facing is with the highlight.

faldzip
4th April 2010, 08:37
I'd suggest revising your architecture and use just your own item delegate (which is responsible for example for drawing items - so you can draw thumbnail, description and do not draw highlight).

axeljaeger
4th April 2010, 09:24
If you using your own widgets for the items and do not use the functionality provided by QListWidget at all, you can disable selecting in the listview at all and only use it as a layout manager.

sushmacr
5th April 2010, 08:16
Can you suggest what would be best to use in my case? Requirement is a list of thumbnails+text as item. Selection allowed for each such item in list without highlight....

aamer4yu
5th April 2010, 09:31
Selection allowed for each such item in list without highlight....
How will you then identify if the item is selected or not ?

In any case, delegates is the proper thing to render items in a custom way.

sushmacr
5th April 2010, 10:27
I meant to say restrict the highlight area (like highlight only text section) so that the image doesnt get painted with highlight color. If this is possible in QListWidget only then my problem is solved or else i need to change to item delegates.

aamer4yu
5th April 2010, 16:53
restrict the highlight area (like highlight only text section) so that the image doesnt get painted with highlight color
Not possible without delegates as far as I know.