hi,
I want to set the background color to Q3ListViewItem. I am using QT4.1.
Thanks in advance,
bye.
sree
hi,
I want to set the background color to Q3ListViewItem. I am using QT4.1.
Thanks in advance,
bye.
sree
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
The march of progress:
C:
printf("%10.2f", x);
C++:
cout << setw(10) << setprecision(2) << showpoint << x;
Java:
java.text.NumberFormat formatter = java.text.NumberFormat.getNumberInstance();
formatter.setMinimumFractionDigits(2);
formatter.setMaximumFractionDigits(2);
String s = formatter.format(x);
for (int i = s.length(); i < 10; i++) System.out.print(' ');
System.out.print(s);
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
And if i understand you cant change item colors?
I think you must subclass QListViewItem and play with reimplementing paintBrushes() or paintCell()
![]()
a life without programming is like an empty bottle![]()
Thanks for the reply,
I reimplemented paintcell as shown below and it works fine
void QCexItem:aintCell( QPainter * p, const QColorGroup &cg,
int column, int width, int align)
{
const QBrush brush(Qt::lightgray);
p->fillRect(0,0, width, height(), brush);
Q3ListViewItem:aintCell( 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
Bookmarks