View Full Version : Q3ListViewItem background color
sreedhar
19th February 2006, 16:05
hi,
I want to set the background color to Q3ListViewItem. I am using QT4.1.
Thanks in advance,
bye.
sree
Bojan
19th February 2006, 22:54
I think you have to get the Q3ListView palette; and then use setBrush() with QPalette::Background color role to set the palette's background colour, and then set the Q3ListView's palette to the modified palette. You can also change the alternating row with the QPalette::AlternateBase colour role.
Bojan
sreedhar
20th February 2006, 12:11
Thanks for the reply,
In my Q3ListView I have Q3ListViewItems which depends on other Q3ListViewItems. And if i Selecet any one of them i want to set the background of all the dependents to gray
bye,
sreedhar
zlatko
20th February 2006, 13:50
And if i understand you cant change item colors?
I think you must subclass QListViewItem and play with reimplementing paintBrushes() or paintCell()
:o
sreedhar
22nd February 2006, 08:03
Thanks for the reply,
I reimplemented paintcell as shown below and it works fine
void QCexItem::paintCell( QPainter * p, const QColorGroup &cg,
int column, int width, int align)
{
const QBrush brush(Qt::lightgray);
p->fillRect(0,0, width, height(), brush);
Q3ListViewItem::paintCell( p, cg, column, width, align );
return;
}
but if i want to change the color of the text in the Q3ListVuewItem, i cannot do it ,
If you have any suggestions please do reply,
bye,
sree
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.