Results 1 to 9 of 9

Thread: disabling highlight effect for qlistwidget items

  1. #1
    Join Date
    Mar 2010
    Posts
    9
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default disabling highlight effect for qlistwidget items

    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?

  2. #2
    Join Date
    Jan 2006
    Location
    Frankfurt
    Posts
    500
    Thanks
    1
    Thanked 52 Times in 52 Posts
    Platforms
    MacOS X Unix/X11

    Default Re: disabling highlight effect for qlistwidget items

    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.
    It's nice to be important but it's more important to be nice.

  3. #3
    Join Date
    Mar 2010
    Posts
    9
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: disabling highlight effect for qlistwidget items

    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.

  4. #4
    Join Date
    Jan 2008
    Location
    Poland
    Posts
    687
    Thanks
    4
    Thanked 140 Times in 132 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: disabling highlight effect for qlistwidget items

    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).
    I would like to be a "Guru"

    Useful hints (try them before asking):
    1. Use Qt Assistant
    2. Search the forum

    If you haven't found solution yet then create new topic with smart question.

  5. #5
    Join Date
    Jan 2006
    Location
    Frankfurt
    Posts
    500
    Thanks
    1
    Thanked 52 Times in 52 Posts
    Platforms
    MacOS X Unix/X11

    Default Re: disabling highlight effect for qlistwidget items

    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.
    It's nice to be important but it's more important to be nice.

  6. #6
    Join Date
    Mar 2010
    Posts
    9
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: disabling highlight effect for qlistwidget items

    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....

  7. #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: disabling highlight effect for qlistwidget items

    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.

  8. #8
    Join Date
    Mar 2010
    Posts
    9
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: disabling highlight effect for qlistwidget items

    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.

  9. #9
    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: disabling highlight effect for qlistwidget items

    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.

Similar Threads

  1. Move items up and down in QListWidget
    By araglin in forum Newbie
    Replies: 7
    Last Post: 31st August 2016, 11:05
  2. QListWidget syntax highlight
    By Ken_Afford in forum Qt Programming
    Replies: 1
    Last Post: 22nd January 2010, 15:54
  3. Replies: 2
    Last Post: 12th October 2008, 14:42
  4. Hover and Highlight QTable and QTree Items
    By VireX in forum Qt Programming
    Replies: 41
    Last Post: 18th May 2007, 21:55
  5. Getting all items of a QListWidget
    By Codepoet in forum Qt Programming
    Replies: 3
    Last Post: 17th January 2006, 22:52

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
  •  
Qt is a trademark of The Qt Company.