Results 1 to 3 of 3

Thread: setPalette works different with Qt 4.70 on QListWidget

  1. #1
    Join Date
    Apr 2009
    Posts
    29
    Thanks
    2
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default setPalette works different with Qt 4.70 on QListWidget

    Hi,

    I have a small problem with the new Qt 4.70 RC on Linux, it works different as the previous final version. I have a QListWidget and fill it with items via addItem, then I set the colours with QPalette:
    Qt Code:
    1. QListWidget *m_completionList;
    2. ...
    3. QPalette palette;
    4. palette.setBrush(QPalette::Active, QPalette::Base, QColor(255, 190, 190));
    5. Core::instance()->m_completionList->setPalette(palette);
    To copy to clipboard, switch view to plain text mode 

    With Qt 4.6 the QListWidget-Items appears in the selected colour but now only one small tin line at the button of the last item is coloured, here an example:


    or bigger:



    Has something changed in Qt 4.70 and I must change my code or is his a bug?

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

    Default Re: setPalette works different with Qt 4.70 on QListWidget

    Logically speaking your code shouldn't colour background of selected items. I would probably do this:
    Qt Code:
    1. palette.setColor(QPalette::Normal, QPalette::Highlight, QColor(255, 190, 190));
    To copy to clipboard, switch view to plain text mode 
    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.


  3. #3
    Join Date
    Apr 2009
    Posts
    29
    Thanks
    2
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: setPalette works different with Qt 4.70 on QListWidget

    Thank you for your fast reply!
    I changed the code to the suggested one but this changes nothing. The items are now completely white and the thin line is also disappeared.


Similar Threads

  1. How works tile() ?
    By looki in forum Qt Programming
    Replies: 0
    Last Post: 30th September 2008, 13:25
  2. DeleteLater works... but why?
    By TheGrimace in forum Qt Programming
    Replies: 11
    Last Post: 6th June 2007, 15:14
  3. How setEnabled() works on QFrames.
    By Doug Broadwell in forum Newbie
    Replies: 4
    Last Post: 18th October 2006, 19:55
  4. How simpletreeview example works?
    By igorko in forum Qt Programming
    Replies: 1
    Last Post: 19th June 2006, 09:59

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.