Results 1 to 3 of 3

Thread: QGraphicsItem disapper when scrolling

  1. #1
    Join Date
    Oct 2013
    Posts
    4
    Platforms
    Unix/X11 Windows

    Default QGraphicsItem disapper when scrolling

    Dear Community,

    when I scroll on my QGraphicsScene, the added QGraphicsItems disappear.
    I don't know why this happens.
    I have overwritten the boundingRect() method and made sure that the Item is only drawing inside its boundingRect.

    Is it possible that overlapping of different boundingRects produce this issue?

    Does anybody have an idea why this happens?

    Have a look at the attached screenshots.

    Thanks a lot in advance!

    Best Regards
    Mark


    false.jpgright.jpgwithBoundingRects.jpg

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QGraphicsItem disapper when scrolling

    If your objects have overlapping rects with different Z-orders, and you are filling / clearing those rects with a white background color, then you could see those effects.

    What happens in your third image (with bounding rects drawn) when your scroll bars are active? Is the entire object drawn?
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  3. #3
    Join Date
    Oct 2013
    Posts
    4
    Platforms
    Unix/X11 Windows

    Default Re: QGraphicsItem disapper when scrolling

    I have no different Z-orders and I only draw the visable lines inside the bounding rect.
    In my opinion this happens because Qt thinks the Item (Line) isn't in the visible part of the scene.
    Therefore Qt decides to do not paint the whole item anymore.
    But why could that happen?

Similar Threads

  1. Replies: 7
    Last Post: 29th November 2010, 20:20
  2. Scrolling QTextEdit
    By mirluk in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 30th November 2009, 09:59
  3. Casting QGraphicsItem child from QGraphicsItem
    By patrik08 in forum Qt Programming
    Replies: 3
    Last Post: 29th August 2008, 16:37
  4. kinetic scrolling
    By ram136682 in forum Qt for Embedded and Mobile
    Replies: 2
    Last Post: 25th August 2008, 08:20
  5. Replies: 2
    Last Post: 28th June 2008, 17:31

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.