PDA

View Full Version : QPushButton fade effect without animation



Kostanev
11th November 2008, 15:56
Hello guys,

I want to ask, is there a way to create QPushButton fade effect between two images or gradients without gif animation. Actually I want to create effect like this flash menu: http://forums.bots-united.com/.

Thanks,
Damyan Kostanev

aamer4yu
12th November 2008, 08:04
You can use timer for that. On mouse hover, start the timer... and change the color/alpha of the button.

spirit
12th November 2008, 08:07
or use Style sheets (http://doc.trolltech.com/4.4/stylesheet.html) :)

aamer4yu
12th November 2008, 08:09
But can style sheets give fading effect ? just wondering...

spirit
12th November 2008, 08:13
see an example of style sheet in Qt's example dir


QPushButton:hover {
background-color: khaki;
}

Kostanev
12th November 2008, 08:38
see an example of style sheet in Qt's example dir


QPushButton:hover {
background-color: khaki;
}


Yes, I know that the QPushButton have hover option, but how can that help me to create the fade effect?

spirit
12th November 2008, 08:40
you should have two pic: the first one for normal state and the second one for hover state and then change it.

The Storm
12th November 2008, 08:43
@spirit I think that you understand Kostanev wrong. :)
For me it looks like he have putted wrong thread title. It seems that he want animated fade effect. The timer option is good but I wonder too is there an easyer way to do that. :)

Kostanev
12th November 2008, 08:50
I am afraid that The Storm is right. The fault is mine.
I meant that I don't want to use external (GIF) animation, I want to create the effect between two images with Qt.

spirit
12th November 2008, 09:13
in this case you can use aamer4yu's suggest.

aamer4yu
12th November 2008, 10:30
You can check this example (http://doc.trolltech.com/qq/qq16-fader.html) .
It might help you :)

Kostanev
12th November 2008, 10:46
Thank you! I will test it asap... :)