[LyX/master] Change zoom from an lfun without going through the slider
Pavel Sanda
sanda at lyx.org
Wed Jun 10 21:41:25 UTC 2026
commit 51fe34f90f4eb28dbefd6a1e4eb616da60c74b6c
Author: Guillaume MM <gm at lyx.org>
Date: Sun Jun 7 03:55:15 2026 +0200
Change zoom from an lfun without going through the slider
If we change zoom from an lfun directly, we set the value of the slider by
blocking signals. This prevents the slider from rounding our new zoom value.
This fixes zoom-out not being inverse to zoom-in.
---
src/frontends/qt/GuiView.cpp | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/frontends/qt/GuiView.cpp b/src/frontends/qt/GuiView.cpp
index 3edfdc29f8..aab3394c60 100644
--- a/src/frontends/qt/GuiView.cpp
+++ b/src/frontends/qt/GuiView.cpp
@@ -718,7 +718,6 @@ GuiView::GuiView(int id)
connect(zoom_slider_, SIGNAL(sliderMoved(int)), this, SLOT(zoomSliderMoved(int)));
connect(zoom_slider_, SIGNAL(valueChanged(int)), this, SLOT(zoomValueChanged(int)));
- connect(this, SIGNAL(currentZoomChanged(int)), zoom_slider_, SLOT(setValue(int)));
connect(zoom_in_, SIGNAL(clicked()), this, SLOT(zoomInPressed()));
connect(zoom_out_, SIGNAL(clicked()), this, SLOT(zoomOutPressed()));
@@ -1024,9 +1023,11 @@ void GuiView::saveUISettings() const
void GuiView::setCurrentZoom(const int v)
{
- // Avoid (only theoretical) recursive call
- if (zoom_slider_->value() != v)
- Q_EMIT currentZoomChanged(v);
+ {
+ // Avoid recursive call
+ const QSignalBlocker blocker(zoom_slider_);
+ zoom_slider_->setValue(v);
+ }
lyxrc.currentZoom = v;
zoom_value_->setText(toqstr(bformat(_("[[ZOOM]]%1$d%"), v)));
zoom_in_->setEnabled(currentBufferView() && v < zoom_slider_->maximum());
More information about the lyx-cvs
mailing list