Qt问题:通过QGraphicsView 实现的地图浏览作为程序主界面左上角显示
Qt问题:通过QGraphicsView实现的地图浏览作为程序主界面左上角显示Qt新手请教问题:我在网上下载了一个基于QGraphicsView的地图浏览程序。通过Cla...
Qt问题:通过QGraphicsView 实现的地图浏览作为程序主界面左上角显示Qt新手请教问题:我在网上下载了一个基于QGraphicsView的地图浏览程序。通过Class MapWidget:public QGraphicsView 类实现的。请问怎么把这个地图浏览作为我程序主界面左上角显示,右侧下侧显示我的按钮。谢谢
展开
1个回答
展开全部
可以使用setSceneRect()设置QGraphicsScene的大小。如果不设置,则默认为scene中包含所有子元素的边界区域( itemsBoundingRect()函数的返回值)。
更详细的说明参看QGraphicsScene的文档,讲解很详细,看下面这段:
The scene's bounding rect is set by calling setSceneRect(). Items can be placed at any position on the scene, and the size of the scene is by default unlimited. The scene rect is used only for internal bookkeeping, maintaining the scene's item index. If the scene rect is unset, QGraphicsScene will use the bounding area of all items, as returned by itemsBoundingRect(), as the scene rect. However, itemsBoundingRect() is a relatively time consuming function, as it operates by collecting positional information for every item on the scene. Because of this, you should always set the scene rect when operating on large scenes.
更详细的说明参看QGraphicsScene的文档,讲解很详细,看下面这段:
The scene's bounding rect is set by calling setSceneRect(). Items can be placed at any position on the scene, and the size of the scene is by default unlimited. The scene rect is used only for internal bookkeeping, maintaining the scene's item index. If the scene rect is unset, QGraphicsScene will use the bounding area of all items, as returned by itemsBoundingRect(), as the scene rect. However, itemsBoundingRect() is a relatively time consuming function, as it operates by collecting positional information for every item on the scene. Because of this, you should always set the scene rect when operating on large scenes.
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询