In Qt, I have created a QGraphicsScene as shown below.
m_scene = new QGraphicsScene(0,0,152,720);
m_view = new QGraphicsView(m_scene);
Now the window is created with horizontal and vertical scrollbars. Since I don’t want to use horizontal scroll bar, it used the code
m_view->setHorizontalScrollBarPolicy (Qt::ScrollBarAlwaysOff);
But at this time, there is no horizontal scrollbar and the width is not 150, it is 140 something. How to get accurate width without horizontal scrollbar?
If you want to get the inner width of your QGraphicsView, you can simply subtract the width of the scrollbar from the total width. This is how I would do it:
int innerWidth = width();
if (verticalScrollBar()) innerWidth -= verticalScrollBar()->width();