[Qt-interest] NoScrollBar is coming
Sean Harmer
sean.harmer at maps-technology.com
Thu Aug 20 17:39:51 CEST 2009
On Thursday 20 Aug 2009 16:31:50 John McClurkin wrote:
> Sujan Dasmahapatra wrote:
> > Dear Mr Ferenc
> > I need to discuss something in this regard.When I create a
> > QGraphicsScene and a QGraphicsView, Do I need to do
> > QRectF rect;
> > scene->setSceneRect(rect);
> > view->setSceneRect(rect);
> >
> > What would be the optimized size of the rect ???? According to my
> > implementation I haven't set SceneRect and by default
> > ""The default policy is
> > Qt::ScrollBarAsNeeded" for both directions..."
> > So in my case when my object is going out of the view scrollbar should
> > come , why it's not coming ????
> >
> > I have read GraphicsView Framework still my doubt is under-development.
> > Could youhelp me in uderstanding these things .
> >
> > Thanks !!!!
>
> Sujan,
> You are manipulating objects in your QGraphicsScene and making them go
> out of the scene. However the QGraphicsScene has no visual properties,
> that is, it has no scrollbar. Only the QGraphicsView has scrollbars. The
> default behavior is to show scrollbars if the QGraphicsScene is larger
> than the QGraphicsView. Causing objects to move out of the scene does
> not automatically cause the scene to grow.
It does if you have not explicitly set a sceneRect. See:
http://doc.trolltech.com/4.6-snapshot/qgraphicsscene.html#sceneRect-prop
> Since the scene is always the
> same size as the view, the view does not show scrollbars. To get
> scrollbars to show, you need to change the size of the scene so that it
> fully includes the objects after you have manipulated them.
QGraphicsScene::itemsBoundingRect() can help here:
http://doc.trolltech.com/4.6-snapshot/qgraphicsscene.html#itemsBoundingRect
Sean
More information about the Qt-interest-old
mailing list