From 330a4f443539d68c7743c8d2e578d449ecfefd7b Mon Sep 17 00:00:00 2001 From: Soren Stoutner Date: Mon, 19 May 2025 14:54:36 -0700 Subject: [PATCH] Utilize the new zoomFactorChanged signal. https://redmine.stoutner.com/issues/845 --- src/widgets/TabWidget.cpp | 6 +++--- src/windows/BrowserWindow.cpp | 14 +------------- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/src/widgets/TabWidget.cpp b/src/widgets/TabWidget.cpp index 4f89cb3..e68180d 100644 --- a/src/widgets/TabWidget.cpp +++ b/src/widgets/TabWidget.cpp @@ -380,12 +380,12 @@ PrivacyWebEngineView* TabWidget::addTab(const bool removeUrlLineEditFocus, const } }); - // Update the zoom actions when changed by CTRL-Scrolling. This can be modified when is fixed. - connect(webEnginePagePointer, &QWebEnginePage::contentsSizeChanged, [webEnginePagePointer, this] () + // Update the zoom actions when they are changed. + connect(webEnginePagePointer, &QWebEnginePage::zoomFactorChanged, [webEnginePagePointer, this] (const qreal newZoomFactor) { // Only update the zoom actions if this is the current tab. if (webEnginePagePointer == currentWebEnginePagePointer) - Q_EMIT updateZoomActions(webEnginePagePointer->zoomFactor()); + Q_EMIT updateZoomActions(newZoomFactor); }); // Display find text results. diff --git a/src/windows/BrowserWindow.cpp b/src/windows/BrowserWindow.cpp index 597bd8b..c92c613 100644 --- a/src/windows/BrowserWindow.cpp +++ b/src/windows/BrowserWindow.cpp @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: GPL-3.0-or-later - * SPDX-FileCopyrightText: 2022-2024 Soren Stoutner + * SPDX-FileCopyrightText: 2022-2025 Soren Stoutner * * This file is part of Privacy Browser PC . * @@ -967,9 +967,6 @@ void BrowserWindow::decrementZoom() // Set the new zoom factor. tabWidgetPointer->applyOnTheFlyZoomFactor(currentZoomFactorDouble); - - // Update the on-the-fly action text. - updateZoomActions(currentZoomFactorDouble); } void BrowserWindow::editBookmarks() @@ -1103,9 +1100,6 @@ void BrowserWindow::getZoomFactorFromUser() { // Set the new zoom factor. tabWidgetPointer->applyOnTheFlyZoomFactor(newZoomFactorDouble); - - // Update the on-the-fly action text. - updateZoomActions(newZoomFactorDouble); } } @@ -1154,9 +1148,6 @@ void BrowserWindow::incrementZoom() // Set the new zoom factor. tabWidgetPointer->applyOnTheFlyZoomFactor(currentZoomFactorDouble); - - // Update the on-the-fly action text. - updateZoomActions(currentZoomFactorDouble); } void BrowserWindow::loadUrlFromLineEdit(const QString &url) const @@ -2317,7 +2308,4 @@ void BrowserWindow::zoomDefault() { // Set the new zoom factor. tabWidgetPointer->applyOnTheFlyZoomFactor(defaultZoomFactorDouble); - - // Update the on-the-fly action text. - updateZoomActions(defaultZoomFactorDouble); } -- 2.47.2