Results 1 to 4 of 4

Thread: QGraphicsItem::scenePos() or pos()

  1. #1
    Join Date
    Aug 2006
    Location
    Bangalore,India
    Posts
    419
    Thanks
    37
    Thanked 53 Times in 40 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Wink QGraphicsItem::scenePos() or pos()

    This may sound like dumb simple question but I rather felt its better to clarify.
    I am 100% sure that I am not using "parent - children" amongst QGraphicsItems in my app. So is it better to use scenePos() or pos() ? Any performance differences ?
    The biggest difference between time and space is that you can't reuse time.
    -- Merrick Furst

  2. #2
    Join Date
    Aug 2006
    Location
    Bangalore,India
    Posts
    419
    Thanks
    37
    Thanked 53 Times in 40 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: QGraphicsItem::scenePos() or pos()

    Is there absolutely no answer from anyone?
    The biggest difference between time and space is that you can't reuse time.
    -- Merrick Furst

  3. #3
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QGraphicsItem::scenePos() or pos()

    It should be quite easy to judge:
    Qt Code:
    1. QPointF QGraphicsItem::pos() const
    2. {
    3. return d_ptr->pos; // returns a member variable of the private implementation class (the pos is maintained while moving the item)
    4. }
    5.  
    6. QPointF QGraphicsItem::scenePos() const
    7. {
    8. return mapToScene(0, 0); // uses QMatrix to map (0,0) to scene coords
    9. }
    To copy to clipboard, switch view to plain text mode 
    Use the power of provided Qt sources!
    J-P Nurmi

  4. #4
    Join Date
    Aug 2006
    Location
    Bangalore,India
    Posts
    419
    Thanks
    37
    Thanked 53 Times in 40 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: QGraphicsItem::scenePos() or pos()

    Quote Originally Posted by jpn View Post
    Use the power of provided Qt sources!
    Very correct, should have done that Probably it might help other newbies atleast
    The biggest difference between time and space is that you can't reuse time.
    -- Merrick Furst

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.