Fix slow scrolling by wheel after setting a custom scrollbar

The bug was introduced by 410aa20f073b5e45e73366773b7d173f840a9cfe
(QAIV - allow users to control single step in ScrollPerPixel mode).

QAbstractSliderPrivate::viewMayChangeSingleStep is reponsible
for the expected behavior when scrolling by wheel. It is set to
true by default, but calling QAbstractScrollArea::set*ScrollBar()
results to always setting it to false. So we should copy
viewMayChangeSingleStep manually from the old scrollbar.

Change-Id: I2ee218054e473fa96785b123805e3943a5d74dbd
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
This commit is contained in:
Alexander Volkov 2016-04-05 11:27:53 +03:00
parent a057d42305
commit 1735ca57a8

View File

@ -269,6 +269,7 @@ void QAbstractScrollAreaPrivate::replaceScrollBar(QScrollBar *scrollBar,
scrollBar->setOrientation(oldBar->orientation());
scrollBar->setPageStep(oldBar->pageStep());
scrollBar->setSingleStep(oldBar->singleStep());
scrollBar->d_func()->viewMayChangeSingleStep = oldBar->d_func()->viewMayChangeSingleStep;
scrollBar->setSliderDown(oldBar->isSliderDown());
scrollBar->setSliderPosition(oldBar->sliderPosition());
scrollBar->setTracking(oldBar->hasTracking());