[Kde-games-devel] QGraphicsView and fitInView

Pierre Maurier pierre.maurier at gadz.org
Sat Feb 21 00:00:25 CET 2009


Le vendredi 20 février 2009 22:53:26 Stefan Majewsky, vous avez écrit :
> On Freitag 20 Februar 2009 22:48:07 Pierre Maurier wrote:
> > I was doing it just one time in the __init__ func. Currently my little
> > app is not re-sizable.
> > I think I have found the solution of my problem, fitInView tries to get
> > the content viewable but don't seems to rescale it if it already fit in
> > the Widget (ie. if the content is smaller than the View). Am I right ?
>
> No, that is QGraphicsView.ensureVisible. fitInView always worked for me in
> the way you intended.
>
> Stefan
Very strange... I have made some tests and I have found that if I call 

self.gameView.fitInView(self.gameView.scene().itemsBoundingRect(), 
Qt.KeepAspectRatio)

in __init__ it don't works

but if I call it later (with a QTimer for exemple) it works !
-- 
Pierre Maurier



More information about the kde-games-devel mailing list