本文介绍了Qt - QGraphicsView没有ScrollBar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用QGraphicsScene显示一个图片在其全视图。但是,当我把QgraphicsScene里面的QGraphicsView,我得到一个滚动条。我试过这么多方式,但都是去静脉。因此,任何人都可以告诉我如何获得没有滚动条的完整视图。
I am trying to show a picture in it's full view using QGraphicsScene. But when ever I put the QgraphicsScene inside the QGraphicsView, I am getting a scroll bar. I tried so many ways But all are went to veins. So can anybody tell me how to obtain the full view without the scrollbar.
推荐答案
QGraphicsView v;
v.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
v.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
要在隐藏后以编程方式调整滚动,请使用 v.ensureVisible()
。
To adjust the scrolling programmatically once these have been hidden, use one of the overloads of v.ensureVisible()
.
这篇关于Qt - QGraphicsView没有ScrollBar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!