November 23, 2010

Sandberg Sandberg
Lab Rat
1 posts

Detecting what is shown on the display

 

Hi,

I’m having a problem, which I hope that someone here can help me with.

I have a QGraphicsView and a QGraphicsScene. The QGraphicsScene contains a number of tiles (images), and I’m interested in figuring out which items are not on the screen, i.e is not currently shown. The scene is larger than the display, and hence not everything is shown.

I’ve tried to use the items method in QGraphicsScene (to figure out what is on the screen and from that derive what it not on the screen) and it does not give me what I want. I assume that the incorrect results are because, the QGraphicsView are translated and rotated.

Giving the transformation of the QGraphicsView to the QGraphicsScene items method, does not solve this issue.

Any one has any ideas ? .. Some simple way to detect what is currently on the display/screen or what is not ?

3 replies

November 23, 2010

Antonio Di Monaco Antonio Di Monaco
Lab Rat
117 posts

Hi,

QGraphicsItem has isVisible() function … is that what you need?

T.

P.S.: Oops, I make a mistake … that function is not related to “QGraphicsView” visibility .. sorry …

November 23, 2010

Sandberg Sandberg
Lab Rat
1 posts

I think i found a solution. If I use the items method of QGraphicsView, it seems to work. I was using it from QGraphicsScene, and that for some reason didn’t work.

November 23, 2010

Antonio Di Monaco Antonio Di Monaco
Lab Rat
117 posts

I see … anyway, that’s not reported in the documentation clearly.

T.

 
  ‹‹ problems with trying to get D3DX9/10 to work in Qt      Interactive content fixed in/on view while it scrolls over scene? ››

You must log in to post a reply. Not a member yet? Register here!