Qt - QGraphicsView without ScrollBar

后端 未结 2 1512
执念已碎
执念已碎 2021-02-04 16:59

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 man

2条回答
  •  盖世英雄少女心
    2021-02-04 17:59

    QGraphicsView v;
    v.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    v.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    

    To adjust the scrolling programmatically once these have been hidden, use one of the overloads of v.ensureVisible().

提交回复
热议问题