void GraphicsView::zoom(qreal s){
scale(s, s);
zoomLevel *= s;
}
void GraphicsView::zoomToWidth(){
zoom((qreal)width() / (scene->sceneRect().width() * zoomLevel)); //this causes both scroll bars to appear
if(horizontalScrollBar()->isVisible() && verticalScrollBar()->isVisible()){
//...
}
}
void GraphicsView::zoom(qreal s){
scale(s, s);
zoomLevel *= s;
}
void GraphicsView::zoomToWidth(){
zoom((qreal)width() / (scene->sceneRect().width() * zoomLevel)); //this causes both scroll bars to appear
if(horizontalScrollBar()->isVisible() && verticalScrollBar()->isVisible()){
//...
}
}
To copy to clipboard, switch view to plain text mode
But the if statement doesn't run, even though both scroll bars are visible. If I then immediately run zoomToWidth again, the if statement does run, so it seems like the scroll bars aren't being "updated" immediately. Is there a way to fix this?
Bookmarks