O'Reilly logo

Game Programming using Qt 5 Beginner's Guide - Second Edition by Lorenz Haas, Witold Wysota, Pavel Strakhov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Showing specific areas of the scene

As soon as the scene's bounding rectangle exceeds the viewport's size, the view will show scroll bars. Besides using them with the mouse to navigate to a specific item or point on the scene, you can also access them by code. Since the view inherits QAbstractScrollArea, you can use all its functions for accessing the scroll bars; horizontalScrollBar() and verticalScrollBar() return a pointer to QScrollBar, and thus you can query their range with minimum() and maximum(). By invoking value() and setValue(), you get and can set the current value, which results in scrolling the scene.

However, normally, you do not need to control free scrolling inside the view from your source code. The normal task would be ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required