×

Discussion Board

Results 1 to 9 of 9

Thread: QT Animation

  1. #1
    Regular Contributor
    Join Date
    Mar 2007
    Posts
    102

    QT Animation

    Hi All,

    i'm making an applciation where i have to use animation like zoom, and in a first time I used an object Inherits from QGraphicsItem and I used to animate it QGraphicsAnimationItem.
    but i learn that if i create an object inherit s from QGraphicsItem i'm not able to use Slot and Signal because it isn't a QObject.
    For this i try to inheriths from two classes QObject and QGraphicsItem to have all the features that these classes have but i had a lot of problems. The question is: there's a method like setScaleAt(...) to QWidjet?
    Thanks.

  2. #2
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: QT Animation

    Quote Originally Posted by earendil View Post
    Hi All,

    i'm making an applciation where i have to use animation like zoom, and in a first time I used an object Inherits from QGraphicsItem and I used to animate it QGraphicsAnimationItem.
    but i learn that if i create an object inherit s from QGraphicsItem i'm not able to use Slot and Signal because it isn't a QObject.
    For this i try to inheriths from two classes QObject and QGraphicsItem to have all the features that these classes have but i had a lot of problems. The question is: there's a method like setScaleAt(...) to QWidjet?
    Thanks.
    Why don't you use QGraphicsObject?

  3. #3
    Regular Contributor
    Join Date
    Mar 2007
    Posts
    102

    Re: QT Animation

    Because i don't know that exist a class like it...
    I'll try with it...
    thanks

  4. #4
    Regular Contributor
    Join Date
    Mar 2007
    Posts
    102

    Re: QT Animation

    Hi follow what you say and now it's ok.
    But if I can i would like to do another question.
    My code is structured in this way:

    Code:
    QGraphicsScene *scene=new QGraphicsScene(0,0,360,640);
    MyQgraphicsObject *myItem=new MyQgraphicsObject;
    scene->addItem(myItem);
    QGraphicsView *view=new QGraphicsView(scene);
    
    QGraphicsItemAnimation *animation=new QGraphicsItemAnimation;
    animation->setItem(myItem);
    animation->setTimeLine(timer);
    animation->setScaleAt(0.5,0.7,0.7);
    timer->start();
    It does the trasformation but it does trasformation from up left corner even I would like that It does trasformation from the center of my Item.
    I try to use: setItem->setTransformOriginPoint(180,320);
    but id doesn't run.

    What could i do?

    Thanks.

  5. #5
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: QT Animation

    QGraphicsItemAnimation was deprecated in Qt 4.6, you should not use it in newly written code.
    http://qt.nokia.com/doc/4.6/animation-overview.html

  6. #6
    Regular Contributor
    Join Date
    Mar 2007
    Posts
    102

    Re: QT Animation

    I see that i should use QPropertyAnimation but into it there is not a method like setScaleAt (present into QGraphicsItemAnimation).
    Could you give me some idea?

  7. #7
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: QT Animation

    You are supposed to animate property "scale" of QGraphicsObject.

  8. #8
    Regular Contributor
    Join Date
    Mar 2007
    Posts
    102

    Re: QT Animation

    My QGraphicsObject is a part of chart. When user press zoom in or zoom out button i'd like to create animation of the zoom like QGraphicsItemAnimation did with QTimeLine.
    I try to use method setScale() of QGraphicsItem and it runs but i'm not able to create an animation
    Have you any suggestions?
    Thanks and sorry.

  9. #9
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: QT Animation

    The documentation contains a lot of examples how you can animate a property:
    http://qt.nokia.com/doc/4.6/animatio...-qt-properties

Similar Threads

  1. Qt for Symbian development resources
    By liuxg in forum [Archived] Qt General ( Qt技术)
    Replies: 55
    Last Post: 2011-01-26, 04:06
  2. kinetic scrolling
    By stalep in forum Nokia N9
    Replies: 10
    Last Post: 2009-12-08, 12:41
  3. Senior QT Client Developer (Dublin, Ireland)
    By marynyc in forum News and Announcements
    Replies: 0
    Last Post: 2009-06-02, 18:24

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×