PDA

View Full Version : how to detect if QGraphicsTextItem is inside viewport



mihnen
10th September 2012, 23:04
I have a fixed size QGraphicsScene and fixed QGraphicsViewport with a single QGraphicsTextItem inside of it. I am trying to autosize the text inside of the viewport which is done by calling fitInView whenever the text changes. However if enough text is typed it will continue off the bottom of the view, what I want to do is have it stop accepting anymore text input if the graphicsitem's bounding rect is not completely inside the viewport. Any ideas?

wysota
11th September 2012, 00:19
Maybe QGraphicsItem::itemChange() can help?

mihnen
11th September 2012, 03:57
thanks I think that might do the trick.