Results 1 to 3 of 3

Thread: how do you use the QPropertyAnimation to effect opacity on a widget?

  1. #1
    Join Date
    Oct 2009
    Posts
    47
    Thanks
    10

    Exclamation how do you use the QPropertyAnimation to effect opacity on a widget?

    Hi guys,

    So what I want to do is use the QPropertyAnimation to effect the opacity of a widget to get a fade effect.

    So i have the following:

    note: proxy is a widget I added to the graphics scene.

    Qt Code:
    1. QPropertyAnimation *propAnimationFade;
    2. propAnimationFade = new QPropertyAnimation(proxy, "setOpacity");
    3. propAnimationFade->setDuratoin(1000);
    4. propAnimationFade->setStartValue(1.0);
    5. propAnimationFade->setEndValue(0.0);
    6. propAnimationFade->start();
    To copy to clipboard, switch view to plain text mode 


    This however doens't work.... I think the reason it doesn't work is because I'm not supplying the right field when I create the QPropertyAnimation, I use "setOpacity" and i'm not sure if thats correct or not....

    Any help would be great!

  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: how do you use the QPropertyAnimation to effect opacity on a widget?

    As you said proxy is a widget, widget has property windowOpacity.

    If you use graphicsItem, property would be opacity

    In your case, setOpacity is a function, not property.

  3. #3
    Join Date
    Oct 2009
    Posts
    47
    Thanks
    10

    Default Re: how do you use the QPropertyAnimation to effect opacity on a widget?

    Hi thanks for your help.

    I used " opacity" and it worked great...but I'm a little confused because it is a proxy widget that I add to a graphic scene.

    So if opacity worked then that means it must be a graphics item correct? Some other poster said a proxy widget inherits from a graphics widget.

Similar Threads

  1. QDockWidget inside another widget in the center?
    By Antebios in forum Qt Programming
    Replies: 1
    Last Post: 16th February 2010, 07:06
  2. Remove widget from a QList
    By Eos Pengwern in forum Newbie
    Replies: 4
    Last Post: 16th October 2009, 21:25
  3. Playbutton functionality
    By uchennaanyanwu in forum Qt Programming
    Replies: 5
    Last Post: 31st July 2008, 22:29
  4. How to Open & Close a Widget ?!!
    By Fatla in forum Qt Programming
    Replies: 6
    Last Post: 13th June 2008, 20:39
  5. Tricky problem with ARGB widget / UpdateLayeredWindow
    By nooky59 in forum Qt Programming
    Replies: 3
    Last Post: 21st February 2008, 10:35

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.