QScrollArea get scroll or total offset

c++, pyqt, python, qt

Solution

QAbstractScrollArea provides methods to access its scroll bars (`horizontalScrollBar()` and `verticalScrollBar()`). Once you have that pointer, you have access to all the methods and signals available from QScrollBar and QAbstractSlider, including `value()` and `valueChanged()`.

Problem

Does QScrollArea have a way to find out how much it is scrolled? Do I need to do some accounting on all the scollContensBy() calls? I need to get the position of the mouse relative to an image label inside QScrollArea. I can only get the position relative to the current view, not the whole image.

Original source