Results 1 to 12 of 12

Thread: QPushButton fade effect without animation

  1. #1
    Join Date
    Sep 2007
    Posts
    21
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question QPushButton fade effect without animation

    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

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QPushButton fade effect without animation

    You can use timer for that. On mouse hover, start the timer... and change the color/alpha of the button.

  3. #3
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QPushButton fade effect without animation

    or use Style sheets
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  4. #4
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QPushButton fade effect without animation

    But can style sheets give fading effect ? just wondering...

  5. #5
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QPushButton fade effect without animation

    see an example of style sheet in Qt's example dir
    Qt Code:
    1. QPushButton:hover {
    2. background-color: khaki;
    3. }
    To copy to clipboard, switch view to plain text mode 
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  6. #6
    Join Date
    Sep 2007
    Posts
    21
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QPushButton fade effect without animation

    Quote Originally Posted by spirit View Post
    see an example of style sheet in Qt's example dir
    Qt Code:
    1. QPushButton:hover {
    2. background-color: khaki;
    3. }
    To copy to clipboard, switch view to plain text mode 
    Yes, I know that the QPushButton have hover option, but how can that help me to create the fade effect?

  7. #7
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QPushButton fade effect without animation

    you should have two pic: the first one for normal state and the second one for hover state and then change it.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  8. #8
    Join Date
    Aug 2007
    Posts
    166
    Thanks
    16
    Thanked 14 Times in 14 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QPushButton fade effect without animation

    @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.

  9. #9
    Join Date
    Sep 2007
    Posts
    21
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QPushButton fade effect without animation

    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.

  10. #10
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QPushButton fade effect without animation

    in this case you can use aamer4yu's suggest.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  11. #11
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QPushButton fade effect without animation

    You can check this example .
    It might help you

  12. The following user says thank you to aamer4yu for this useful post:

    Kostanev (12th November 2008)

  13. #12
    Join Date
    Sep 2007
    Posts
    21
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QPushButton fade effect without animation

    Thank you! I will test it asap...

Similar Threads

  1. Qpushbutton
    By iamhere in forum Qt Programming
    Replies: 5
    Last Post: 15th October 2008, 05:40

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.