Results 1 to 9 of 9

Thread: Where can I find a list of QPropertyAnimation setProperty values?

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

    Question Where can I find a list of QPropertyAnimation setProperty values?

    Hi guys,

    I think its strange that I have to go through random posts here and there to try to gather a list of possible values for the QPropertyAnimation's setProperty() function.


    Example:
    If you want to move a widget using QPropertyAnimation, you need to supply it an argument setProperty("geometry")
    if you want to modify the opacity of an item you need to supply it an argument of "opacity"

    If you want to change its ycoordinates you need to supply "yaxis"

    Where is there a list of all of these? How do these people know what to supply it?

  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: Where can I find a list of QPropertyAnimation setProperty values?

    property is a virtue of QObject. So the list of properties depends on the QObject you have set in QPropertyAnimation.

    Am not sure about the "yaxis" since you didnt mention the type of object. it seems to be a value of enum Axis. And I dont know where it is used until you can tell which object you used it on

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

    technoViking (11th November 2009)

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

    Default Re: Where can I find a list of QPropertyAnimation setProperty values?

    Ahh I see...

    Well I'm using a widget and I'm putting it in a graphic scene by using a proxy widget.

    But what confuses me is I can move the widget using "geometry" and I can set its transparency by modifying "opacity"

    but when I look here at all the properties in QGraphicsItem, I don't see "geometry" being a property...but if its not a property how am I moving it? Is it a property of some other class it may have inherited from?

    I'm looking here: http://www.riverbankcomputing.co.uk/...phicsitem.html

    opacity is there I see.

  5. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Where can I find a list of QPropertyAnimation setProperty values?

    You can't animate QGraphicsItem using QPropertyAnimation. It is so simply because QGraphicsItem has no properties. You can animate subclasses of QGraphicsObject like QGraphicsWidget. You can find the list of their properties in their docs - "geometry" is a property of QWidget and QGraphicsWidget. I don't know how this exactly maps to PyQt as properties are not listed there so I guess you may have to rely on C++ docs or wait for PyQt for Qt4.6.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. #5
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Where can I find a list of QPropertyAnimation setProperty values?

    Quote Originally Posted by wysota View Post
    You can't animate QGraphicsItem using QPropertyAnimation. It is so simply because QGraphicsItem has no properties.
    But you can add properties with a small "trick":
    Animations and the Graphics View Framework

    When you want to animate QGraphicsItems, you also use QPropertyAnimation. However, QGraphicsItem does not inherit QObject. A good solution is to subclass the graphics item you wish to animate. This class will then also inherit QObject. This way, QPropertyAnimation can be used for QGraphicsItems. The example below shows how this is done. Another possibility is to inherit QGraphicsWidget, which already is a QObject.

    Qt Code:
    1. class Pixmap : public QObject, public QGraphicsPixmapItem
    2. {
    3. Q_OBJECT
    4. Q_PROPERTY(QPointF pos READ pos WRITE setPos)
    5. ...
    To copy to clipboard, switch view to plain text mode 

    As described in the previous section, we need to define properties that we wish to animate.

    Note that QObject must be the first class inherited as the meta-object system demands this.

  7. #6
    Join Date
    Oct 2009
    Posts
    47
    Thanks
    10

    Default Re: Where can I find a list of QPropertyAnimation setProperty values?

    Well now i'm confused...

    I thought my objects are QGraphicItems? Some other user just told me that because I'm using a ProxyWidget (you need a proxyWidget to add a widget to a graphic scene), he said a ProxyWidget inherits from a QGRaphicsWidget.

    Either way I have this widget/graphics item in the scene and QPropertyAnimation is working on it and I didn't mess around with Q_Property.

    Is it becuase the proxy widget inherits things from QObject, is that why I can use PropertyAnimation?

    38 public functions inherited from QGraphicsWidget
    29 public functions inherited from QObject
    132 public functions inherited from QGraphicsItem
    33 public functions inherited from QGraphicsLayoutItem
    Last edited by technoViking; 11th November 2009 at 20:00.

  8. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Where can I find a list of QPropertyAnimation setProperty values?

    You have already answered your own question by the last quote.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  9. #8
    Join Date
    Oct 2009
    Posts
    47
    Thanks
    10

    Default Re: Where can I find a list of QPropertyAnimation setProperty values?

    Thanks for the responce, so why would you have to use the Q_Property to define the properties yourself if you can simply inherit it from a class? Seems like less work but maybe its for overhead reasons. I'm very new to Qt and I hvan't touched C++ in years so I may be asking dumb questions.

  10. #9
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Where can I find a list of QPropertyAnimation setProperty values?

    Quote Originally Posted by technoViking View Post
    Thanks for the responce, so why would you have to use the Q_Property to define the properties yourself if you can simply inherit it from a class?
    Nobody said you should do that. But QGraphicsItem doesn't inherit any properties. Only QGraphicsWidget and its subclasses do (from QGraphicsObject and its descendants).
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Qt and VC++ instalation problem
    By gui.br in forum Installation and Deployment
    Replies: 6
    Last Post: 21st July 2009, 07:13
  2. problems installing Qt opensource with msvc2008 support
    By odin1985 in forum Installation and Deployment
    Replies: 6
    Last Post: 24th May 2008, 09:06

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.