Fix zoom slider toolbuttons not disabling properly

Authored by rkflx on Oct 22 2017, 9:30 AM.

Description

Fix zoom slider toolbuttons not disabling properly

Summary:
Moving the zoom slider should disable the zoom buttons next to it when
reaching the maximum or minimum value respectively, but this was only
the case when changing sliding direction again. This lag is caused by
the SignalBlocker in ZoomWidget::setZoom used to enable a smoother
scroll, but disabling synchronisation of QSlider::sliderPosition and
QSlider::value at the same time. The fix is inspired by 84910f85152f.

In addition, when resizing the window in "Fit" zoom mode, the button to
zoom out would not get disabled, even though "Fit" is the minimum zoom
level. This is caused by calculating the minimum zoom in
updateZoomSnapValues based on the old window geometry. Therefore,
updateZoomSnapValues should be called only after
resizeAdapterWidget.

Note: Compared to a similar approach in D7972#152758, we avoid calling
resizeAdapterWidget unnecessarily and also stop resizeAdapterWidget
and setGeometry calling each other in a potentially infinite loop.
Trying to move updateZoomSnapValues inside of resizeAdapterWidget
sadly breaks the zoom slider when advancing to the next image.

Depends on D7972.

Test Plan:
Tried various combinations of zoom (Fit, slider, keyboard) and view
modes (browse, view single image, compare images, thumbnails, birds eye
view) while resizing the window and switching between images.
Toolbuttons get disabled as they should and no (new) bugs were observed.
Nevertheless please test carefully, as this part of the code base is
quite complex.

Reviewers: KDE Applications, ngraham, vtasoulas, gateau

Reviewed By: ngraham, gateau

Differential Revision: https://phabricator.kde.org/D8241

Details

Committed
rkflxOct 22 2017, 9:37 AM
Reviewer
ngraham
Differential Revision
D8241: Fix zoom slider toolbuttons not disabling properly
Parents
R260:e014d581e52b: Scroll wheel and touchpad zoom in smaller increments
Branches
Unknown
Tags
Unknown