Skip to content
Commit 1069882e authored by rk flx's avatar rk flx
Browse files

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 84910f85.

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
parent e014d581
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment