Results 1 to 5 of 5

Thread: itemChange method

  1. #1
    Join Date
    Dec 2008
    Location
    Istanbul, TURKEY
    Posts
    537
    Thanks
    14
    Thanked 13 Times in 13 Posts
    Qt products
    Qt4
    Platforms
    Windows Android

    Default itemChange method

    Hi,

    I have a very trivial question.I'm getting some sort of odd values from the newPos.x() & newPos.y() values in itemChange method. The odd about it is the item's position is not returned in scene coordinates...Do you have any idea?
    Last edited by zgulser; 17th August 2009 at 07:36.

  2. #2
    Join Date
    Sep 2008
    Location
    Bangalore
    Posts
    659
    Thanks
    116
    Thanked 42 Times in 41 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: itemChange method

    QGraphicsItem::itemChange .. it will return only in item coordinates ...
    ex:
    QTDIR/demos/embeddeddialogs/customproxy.cpp

    use
    QPolygonF QGraphicsItem::mapToScene ( const QRectF & rect ) const

    to map the coordinates to scene ...
    "Behind every great fortune lies a crime" - Balzac

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

    zgulser (17th August 2009)

  4. #3
    Join Date
    Dec 2008
    Location
    Istanbul, TURKEY
    Posts
    537
    Thanks
    14
    Thanked 13 Times in 13 Posts
    Qt products
    Qt4
    Platforms
    Windows Android

    Default Re: itemChange method

    Hımm..thanks for your answer.

    By the way, what about the QGraphicsItem::contains(QPointF point) method? I mean does the point searched in the item's local coordinates? In the documentation, it says "local coordinates". Does it mean item's coordinate system? More clearly, what the mechanism behind the QGraphicsItem::contains(QPointF point) method?

    Thanks in advance.

  5. #4
    Join Date
    Sep 2008
    Location
    Bangalore
    Posts
    659
    Thanks
    116
    Thanked 42 Times in 41 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: itemChange method

    it says "local coordinates". Does it mean item's coordinate system?
    absolutly .... from docs it says ..
    Items live in their own local coordinate system
    QGrahpicsItem::contains() takes a point argument in item coordinates only ...

    The Graphics View Framework will explain u clearly than me ..
    "Behind every great fortune lies a crime" - Balzac

  6. #5
    Join Date
    Dec 2008
    Location
    Istanbul, TURKEY
    Posts
    537
    Thanks
    14
    Thanked 13 Times in 13 Posts
    Qt products
    Qt4
    Platforms
    Windows Android

    Default Re: itemChange method

    Ok buddy, thanks again.

    Oh, I'm about to forget to ask...If the item coordinate system is taken into account in contains method, how do I make sure that the given point to be searched will be mapped to item coordinate system. Do I really need to worry about that or QGraphicsView framework does the transformation automatically?
    Last edited by zgulser; 17th August 2009 at 09:50.

Similar Threads

  1. Replies: 5
    Last Post: 7th January 2010, 10:42
  2. method creation
    By MarkoSan in forum Newbie
    Replies: 6
    Last Post: 30th May 2007, 08:47
  3. Creating object of other class in Run() method
    By santosh.kumar in forum Qt Programming
    Replies: 2
    Last Post: 15th May 2007, 15:05
  4. Calling Recursivly loading function in Run() method of QThread
    By santosh.kumar in forum Qt Programming
    Replies: 2
    Last Post: 15th May 2007, 14:42
  5. Replies: 4
    Last Post: 10th March 2007, 18:01

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.