×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Oct 2008
    Posts
    37

    PLZ help...QT S60 Example

    Hello,
    Can anyone please explain following code snippet


    virtual void setGeometry(const QRectF &rect)
    {
    QGraphicsWidget::setGeometry(rect);

    if (rect.size().width() > orig.size().width())
    p = orig.scaled(rect.size().toSize());
    else
    p = orig;
    }

    this code have been taken from following link following

    http://qt.nokia.com/doc/4.6/animatio...-main-cpp.html
    Am not able to understand
    1.How,where the function setGeometry is called.
    2.How the values of rect are getting changed.

    I am struggling with this from a long time....please help me by providing any kind of links related.

    Thanks a lot
    Regards
    Chirpylife

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

    Re: PLZ help...QT S60 Example

    Is it really S60 example?

    setGeometry is called in the main function.

    Unfortunately I was not able to understand the second question.

  3. #3
    Registered User
    Join Date
    Oct 2008
    Posts
    37

    Re: PLZ help...QT S60 Example

    hey Daniil,
    thanks a lot for your quick reply,
    I am using this example on N97 emulator...So I mentioned it as s60 example..Am sorry am new to this platform..
    ya setGeometry() is called in main ..@

    p1->setGeometry(QRectF(0.0, 0.0, 64.0, 64.0));

    But if you debug it this particular function is called repeatedly...
    and the value of the rectangle rect which is given as parameter width is changing...
    I think that this change in rect is occurred for animation purpose, but am not clear how this is being done.
    Hope you got my problem
    Thanks Danill

    Chirpylife

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

    Re: PLZ help...QT S60 Example

    Quote Originally Posted by chirpylife View Post
    But if you debug it this particular function is called repeatedly...
    and the value of the rectangle rect which is given as parameter width is changing...
    I think that this change in rect is occurred for animation purpose, but am not clear how this is being done.
    Animation of geometry property is defined in createStates and createAnimations.

  5. #5
    Regular Contributor
    Join Date
    Oct 2008
    Location
    Oslo, Norway
    Posts
    329

    Re: PLZ help...QT S60 Example

    Hi,

    Yes, setGeometry is called repeatedly for each object, because Qt animation framework and state machine are used for animating the 'geometry' property of the objects.

    The code you're asking about scales up the pixmap, if the size passed to setGeometry is bigger than the original size of the pixmap. As the end result, when you click on an object, there will be an animation where the object moves to the center of the scene and its size increases.

    Read up more here:

    http://doc.trolltech.com/solutions/4...animation.html
    http://doc.trolltech.com/solutions/4...chine-api.html

    BTW, there's nothing S60-specific in this example.

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. Python for S60 1.9.5 is now released
    By tvijayan in forum Symbian
    Replies: 8
    Last Post: 2009-05-30, 05:33
  3. Build Qt with S60 5.0 Public SDK
    By cavendishqi in forum [Archived] Qt General ( Qt技术)
    Replies: 1
    Last Post: 2009-05-27, 08:02
  4. Python for S60 1.9.1 released
    By tvijayan in forum Symbian
    Replies: 30
    Last Post: 2009-02-26, 06:16

Posting Permissions

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