Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 2

Qt-interest Archive, March 2007
QTable and selection color


Message 1 in thread

Hello.

I'm using qt-3.x and I have implemented a table which changes the
color of the text in the cells according the state of the application.
If I select a row I'v got the dark blue bar with white
text but that's not what I want. The color of the text should not be
changed and the color of the selection bar should be much lighter or
any other color like light gray or something like that.
I've don't find any information about changing the selection color.
So how can I change this behaviour.

Thanks in advance
Wolfgang

-- 
 [ signature omitted ] 

Message 2 in thread

Hi,

Wolfgang Leideck escribió:
> Hello.
>
> I'm using qt-3.x and I have implemented a table which changes the
> color of the text in the cells according the state of the application.
> If I select a row I'v got the dark blue bar with white
> text but that's not what I want. The color of the text should not be
> changed and the color of the selection bar should be much lighter or
> any other color like light gray or something like that.
> I've don't find any information about changing the selection color.
> So how can I change this behaviour.
Just change the HighlightedText value for selected text cells and the 
Highlight property for selected background cells on your table's 
palette. This will give you control over colors.

Regards,
Javier


--
 [ signature omitted ] 

Message 3 in thread

Hello,

thanks for the answer. But how can change the highlighted text of one row.
Not every row of the table changes the color of the text in the cells, so the
HighlightedText property doesn't work for me because it will set for
the whole table,
isn't it?
And QTableItem doesn't provide a function to change the palette, at
least I didn't found in the class description.

Thanks in advance
Wolfgang

2007/3/8, Javier Díaz <jdiaz@xxxxxxxxxxx>:
> Hi,
> Just change the HighlightedText value for selected text cells and the
> Highlight property for selected background cells on your table's
> palette. This will give you control over colors.



-- 
 [ signature omitted ] 

Message 4 in thread

Wolfgang Leideck escribió:
> Hello,
>
> thanks for the answer. But how can change the highlighted text of one 
> row.
Ok, now I realize what you want.
> Not every row of the table changes the color of the text in the cells, 
> so the
> HighlightedText property doesn't work for me because it will set for
> the whole table,
> isn't it?
You're right.
> And QTableItem doesn't provide a function to change the palette, at
> least I didn't found in the class description.
That's a hard reality. QTableItem can't help much.

Well, if you want to change the color for individual rows I suggest you 
to modify paintCell() and check in if the row you're about to paint you 
want in a different color. As you can see, this function receive a 
QColorGroup arg that uses to paint the cell. In my case, I modify this 
colorgroup to change textcolor for two special rows in my table. Of 
course you may need what rows you want with different color.

Hope this helps you,

Javier

--
 [ signature omitted ]