在 QGraphicsView 中移动项目
总的来说,我对 Qt 很陌生,尤其是 QGraphicsView
。当我在其中旋转 Qgraphicspixmapitem
时,它似乎也在移动。我发现这与 QGraphicsView 调整以保持场景可见有关。 我删除了滚动条,因为我不需要它们,并且我希望场景的部分内容在 QGraphicsView 不更改其视图的情况下退出视图。换句话说,我希望 QGraphicsView 中的所有内容都具有绝对位置,并且我不希望 QGraphicsView 改变其视点(或无论其名称如何,请纠正我)术语)。
I am new to Qt in general and QGraphicsView
in particular. When I rotate a Qgraphicspixmapitem
in it, it appears to move also. I have figured out that this has something to do with the QGraphicsView
adjusting to keep the scene in view.
I have removed the scroll bars because I don't need them and I want parts of the scene to go out of view without the QGraphicsView
changing its view. In other words, I want everything in my QGraphicsView
to have absolute positions and I don't want the QGraphicsView
to change its viewpoint (or whatever its called, do correct me on the terminologies).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要的功能是 QGraphicsView::setSceneRect :
因此,将视图的 sceneRect 设置为视图中所需场景的矩形,一切都应该很好。
The function you need is QGraphicsView::setSceneRect :
So, set the sceneRect for your view to the rectangle of the scene that you want in the view, and all should be good.