diff --git a/src/kiwixapp.cpp b/src/kiwixapp.cpp index cbd3269..204f182 100644 --- a/src/kiwixapp.cpp +++ b/src/kiwixapp.cpp @@ -241,15 +241,12 @@ void KiwixApp::createAction() CREATE_ACTION(ZoomInAction, "Zoom in"); SET_SHORTCUT(ZoomInAction, QKeySequence::ZoomIn); - HIDE_ACTION(ZoomInAction); CREATE_ACTION(ZoomOutAction, "Zoom out"); SET_SHORTCUT(ZoomOutAction, QKeySequence::ZoomOut); - HIDE_ACTION(ZoomOutAction); CREATE_ACTION(ZoomResetAction, "Zoom reset"); SET_SHORTCUT(ZoomResetAction, QKeySequence(Qt::CTRL+Qt::Key_0)); - HIDE_ACTION(ZoomResetAction); CREATE_ACTION(HelpAction, "Help"); SET_SHORTCUT(HelpAction, QKeySequence::HelpContents); diff --git a/src/tabwidget.cpp b/src/tabwidget.cpp index 16743ba..d655019 100644 --- a/src/tabwidget.cpp +++ b/src/tabwidget.cpp @@ -32,6 +32,30 @@ TabWidget::TabWidget(QWidget *parent) : } this->closeTab(index); }); + connect(app->getAction(KiwixApp::ZoomInAction), &QAction::triggered, + this, [=]() { + auto current = this->currentWidget(); + QUITIFNULL(current); + auto zoomFactor = current->zoomFactor(); + zoomFactor += 0.1; + zoomFactor = max(min(zoomFactor, 5.0), 0.25); + current->setZoomFactor(zoomFactor); + }); + connect(app->getAction(KiwixApp::ZoomOutAction), &QAction::triggered, + this, [=]() { + auto current = this->currentWidget(); + QUITIFNULL(current); + auto zoomFactor = current->zoomFactor(); + zoomFactor -= 0.1; + zoomFactor = max(min(zoomFactor, 5.0), 0.25); + current->setZoomFactor(zoomFactor); + }); + connect(app->getAction(KiwixApp::ZoomResetAction), &QAction::triggered, + this, [=]() { + auto current = this->currentWidget(); + QUITIFNULL(current); + current->setZoomFactor(1.0); + }); } WebView* TabWidget::createNewTab(bool setCurrent)