Results 1 to 4 of 4

Thread: QGraphicsItem being cut when the Item is partially Out Of GraphicsView

  1. #1
    Join Date
    Nov 2009
    Posts
    9
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QGraphicsItem being cut when the Item is partially Out Of GraphicsView

    Hi,

    I tried to draw a group of cutomized Line Items derived from QGraphicItem. When all the Items fit in the view, it is OK. However, when we do Zoom IN operation, then the Item that is half the way out of the view, is not being painted.

    To avoid this, I tried to make the exposedRect equal to boundingrect in the Paint Method of my customized GraphicItem Class.

    However there is no luck. It didn't serve the purpose. Can any one help me to resolve this issue.


    Thanks in Advance
    Gopikrishna
    Gopikrishna

  2. #2
    Join Date
    Feb 2007
    Location
    Karlsruhe, Germany
    Posts
    469
    Thanks
    17
    Thanked 90 Times in 88 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QGraphicsItem being cut when the Item is partially Out Of GraphicsView

    Hi Gopikrishna!

    Have you set your boundingRect correctly in item coordinates?

    Could you post your code, preferably something small that compiles :->

    Johannes

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

    gopikrishnav (23rd April 2010)

  4. #3
    Join Date
    Nov 2009
    Posts
    9
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QGraphicsItem being cut when the Item is partially Out Of GraphicsView

    Hi Johannes,

    It seems that the bounding rect is correct I will just send the source code soon.

    Thnaks for your time.

    Gopi
    Gopikrishna

  5. #4
    Join Date
    Nov 2009
    Posts
    9
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QGraphicsItem being cut when the Item is partially Out Of GraphicsView

    Dear All,

    At last I was able to solve the problem using the QPainter::drawPolyLine() API.
    This will club all the Lines in to a Polygon. This is slightly different from the Class QGraphicsPolyginItem. QPolygonItem will fill the item and join the first and last points.

    So, I thought of sharing this with you all.

    Thanks for your support.


    Gopi
    Gopikrishna

Similar Threads

  1. Replies: 2
    Last Post: 21st April 2010, 08:07
  2. Replies: 3
    Last Post: 16th September 2009, 05:10
  3. Replies: 1
    Last Post: 25th February 2009, 00:34
  4. Replies: 2
    Last Post: 19th December 2008, 15:57
  5. Replies: 1
    Last Post: 26th September 2006, 05:38

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.