Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QGraphicsView draw items not visible in view...
Forum Update on Tuesday, May 27th 2025

QGraphicsView draw items not visible in view...

Scheduled Pinned Locked Moved Unsolved General and Desktop
qgraphicsview
2 Posts 2 Posters 677 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Dariusz
    wrote on 15 Apr 2022, 21:01 last edited by
    #1

    Hey

    I have a graph with some lines. Some of the lines are very large, and the bounding box extend pass the screen, Sadly at that point QGraphicsView decides to not draw item & my line dissapears.

    Say if i Have a rect item at 500/500, and inside that item I have a path that stretches all the way to 0,0. But my view only show 100x100 rect. So the rect far away + path of it does not render.

    How can I "force" qgraphicsView to draw items regardless of their visibility on screen?

    TIA

    J 1 Reply Last reply 16 Apr 2022, 07:26
    0
    • D Dariusz
      15 Apr 2022, 21:01

      Hey

      I have a graph with some lines. Some of the lines are very large, and the bounding box extend pass the screen, Sadly at that point QGraphicsView decides to not draw item & my line dissapears.

      Say if i Have a rect item at 500/500, and inside that item I have a path that stretches all the way to 0,0. But my view only show 100x100 rect. So the rect far away + path of it does not render.

      How can I "force" qgraphicsView to draw items regardless of their visibility on screen?

      TIA

      J Online
      J Online
      JonB
      wrote on 16 Apr 2022, 07:26 last edited by
      #2

      @Dariusz
      I admit I have not tried it, but it would seem very strange to me if "Sadly at that point QGraphicsView decides to not draw item & my line dissapears.". I would expect it merely to clip whatever there is to the visible view area; if it omitted it completely QGraphicsView would surely be unusable.

      Say if i Have a rect item at 500/500, and inside that item I have a path that stretches all the way to 0,0.

      What do you mean by this? Are you putting further line items on top of a rect item as children? The vital thing is that you must not draw outside a QGraphicsItem::boundingRect() and QGraphicsItem::childrenBoundingRect(). If you do, the view will misdraw. You can override QGraphicsItem::boundingRect() for your items if you need to. Is this perhaps your situation?

      1 Reply Last reply
      0

      2/2

      16 Apr 2022, 07:26

      • Login

      • Login or register to search.
      2 out of 2
      • First post
        2/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved