Monitor QScrollArea's Bar Changes
how to monitor QScrollBarVertical Bar changes ?
Connect to the relevant signal?
You can get access to the scrollbars using QScrollArea::verticalScrollBar() and horizontalScrollBar().
have you tried to look in the docs?
There are signals for each value change.
thx 4 answers
and srry 4 asking w/o deep search
i wsolved with
QAbstractSlider *VBar= (QAbstractSlider *)scrollArea->verticalScrollBar();
You must not cast to QAbstractSlider pointer type. A QScrollBar inherits from QAbstractSlider, so you can safely assign directly:
QAbstractSlider *VBar= scrollArea->verticalScrollBar();
And you're better off to assign it to a QScrollBar pointer, to have access to the other methods too, if necessary. And yes, you do have access to QAbstractSlider's methods and signals too.