[Kde-games-devel] QGraphicsView and fitInView
Pierre Maurier
pierre.maurier at gadz.org
Fri Feb 20 19:34:09 CET 2009
Hi,
I'm learning little by little to use the Qt Graphics View Framework.
I've got a little problem with fitInView :
I only have 1 QGraphicsItem in my QGraphicsScene (named gameScene) and I want
to Zoom-in to see the QGraphicsItem in big, taking the whole QGraphicsView
(named gameView).
The Bounding Rectangle is (approximately) [0, 0, 86, 86]
print self.gameScene.itemsBoundingRect() give me the right output :
PyQt4.QtCore.QRectF(0.0, 0.0, 85.999999999999986, 86.000000000000014)
But when I try that :
self.gameView.fitInView(self.gameScene.itemsBoundingRect(),
Qt.KeepAspectRatio)
I get something far from what I expected (The QGraphicsItem is very small and
have a lot of blank space around).
What is wrong with my code ? Maybe I'm not using the right function... What
should I use ?
I don't really know if I'm clear in my explanations...
Regards.
--
Pierre Maurier
More information about the kde-games-devel
mailing list