PDA

View Full Version : setPalette works different with Qt 4.70 on QListWidget



Fred
2nd September 2010, 20:29
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:


QListWidget *m_completionList;
...
QPalette palette;
palette.setBrush(QPalette::Active, QPalette::Base, QColor(255, 190, 190));
Core::instance()->m_completionList->setPalette(palette);

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:
http://img11.myimg.de/Small18694.png (http://www.myimg.de)

or bigger:
http://img11.myimg.de/Big085fe.png (http://www.myimg.de)


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

wysota
2nd September 2010, 20:51
Logically speaking your code shouldn't colour background of selected items. I would probably do this:

palette.setColor(QPalette::Normal, QPalette::Highlight, QColor(255, 190, 190));

Fred
2nd September 2010, 21:07
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.

http://img11.myimg.de/Pic9eaa2.png (http://www.myimg.de)