Results 1 to 2 of 2

Thread: How to realiably create the boundingRect()

  1. #1
    Join Date
    Jan 2009
    Posts
    34
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question How to realiably create the boundingRect()

    Hi.

    I create the bounding rectangle as I update the position of an QGraphicsItem (inherited). To check if it is what I want, I paint the boundingRect() at the end of the object's paint(). This looks okay.

    My problem is that I see inconsistency on mousePressEvents() Sometimes it works just fine (checking along the border of the drawn boundingRect()) Sometimes it doesn't work at all. I suspect that some transformation or rotation has "warped" my bounding rectangle as the Scene sees it, but I'm not too knowledgable when it comes to transformation matrixes and scene/screen/object coordinates. How can I control that the boundingRect is the same as the mouse pointer sees it and the object sees it?

  2. #2
    Join Date
    Jan 2009
    Posts
    34
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to realiably create the boundingRect()

    "Solution":

    There was a problem in defining the rectangle returned from boundingRect().

    I had defined it as a point to point rectangle but had not taken into account that upper left must indeed be upper left. And after some transformations of the graphics view, upper left was anything _but_ upper left from my point of view.

    The system only recognized as within the bounding box where the two rectangles would overlap.

    The biggest problem was that when I tried actually drawing the returned boundingRect(), it looked perfectly all right.

    Time for a break!

Tags for this Thread

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.