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

Qt-interest Archive, March 2002
changing widget colors


Message 1 in thread

Hi,
with setPalleteBackgroundColor and setPaletteForegroundColor methods I can
easily change the colors of the text and the background of a i.e. QListView.
I do not, however, know, how to change the color of the highlighted text and
of the highlight bar. Does anyone know? Thanks in advance.

-- 
 [ signature omitted ] 

Message 2 in thread

Try this:

QPushButton btn;
QPalette pal(Qt::red);
btn.setPalette(pal);

----- Original Message -----
From: "Tomek Jarzynka" <tomee@cpi.pl>
To: <qt-interest@trolltech.com>
Sent: Wednesday, March 20, 2002 3:33 PM
Subject: changing widget colors


> Hi,
> with setPalleteBackgroundColor and setPaletteForegroundColor methods I can
> easily change the colors of the text and the background of a i.e.
QListView.
> I do not, however, know, how to change the color of the highlighted text
and
> of the highlight bar. Does anyone know? Thanks in advance.
>
> --
> tomasz k. jarzynka / 601 706 601 / tomee@.cpi.pl
>
> "Bóg nie zsyła nam rozpaczy, aby nas zabić,
> lecz by nowe pobudzić w nas życie."
>
> --
> List archive and information: http://qt-interest.trolltech.com
>


Message 3 in thread

Hi Tomek,

to change the colour of the highlighted text or the highlighted bar, you should
override the method QListViewItem::paintCell(). You find an example in
$QTDIR/examples/listviews/listviews.cpp.

Best regards,
Burkhard



Tomek Jarzynka wrote:

> Hi,
> with setPalleteBackgroundColor and setPaletteForegroundColor methods I can
> easily change the colors of the text and the background of a i.e. QListView.
> I do not, however, know, how to change the color of the highlighted text and
> of the highlight bar. Does anyone know? Thanks in advance.
>
> --
> tomasz k. jarzynka / 601 706 601 / tomee@.cpi.pl
>
> "Bóg nie zsy³a nam rozpaczy, aby nas zabiæ,
> lecz by nowe pobudziæ w nas ¿ycie."
>
> --
> List archive and information: http://qt-interest.trolltech.com