PDA

View Full Version : Highlighting Current Selection



kavinsiva
1st June 2010, 07:59
Hi,

I have a MainWindow Application contains five Tool Buttons on it.By pressing Up,Down,Left and Right i can move around the button.While Moving i want to highlight the buttons .Please guide me to do this one

Regards

aamer4yu
1st June 2010, 09:32
How do you move ?
do you change focus ? or simulate button click ?

and what do you mean by highlighting ? what way you want ? background changed ? border in some color, or color overlay ?

kavinsiva
1st June 2010, 12:27
HI,

Like changing the Focus i am moving.Highlighting means Change the BackGround colour of the tool button

Regards

SixDegrees
1st June 2010, 13:03
You can try setFocus(). But you should be aware that highlighting on focus doesn't always appear; some styles don't draw focused widgets with highlighting. You can experiment with this in the Designer and see what different styles do, although results will also vary from platform to platform.

If you need to be certain, you can either select a style that supports highlighting, or you can add specialized rendering through a customized paint() routine or (possibly) through stylesheets.

aamer4yu
1st June 2010, 15:34
It would be nice if you subclass QPushButton / QToolButton and then draw highlight in the paintEvent function.