aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2018-07-11 14:43:14 +0200
committerAqua-sama <aqua@iserlohn-fortress.net>2018-07-11 14:43:14 +0200
commit796382454c1f60ac5ecd92fe83001e5417434930 (patch)
tree1207bf2ce16f55fe1186f5736d44db2b477d9555 /src
parentRemove PageToolsMenu (diff)
downloadsmolbote-796382454c1f60ac5ecd92fe83001e5417434930.tar.xz
WebView: always add zoom widget to context menu
Diffstat (limited to 'src')
-rw-r--r--src/webengine/webview.cpp42
1 files changed, 21 insertions, 21 deletions
diff --git a/src/webengine/webview.cpp b/src/webengine/webview.cpp
index 8ae7eeb..b7258ea 100644
--- a/src/webengine/webview.cpp
+++ b/src/webengine/webview.cpp
@@ -182,33 +182,33 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
createWindow(QWebEnginePage::WebBrowserWindow)->load(ctxdata.linkUrl());
});
}
+ } else {
+ menu = page()->createStandardContextMenu();
+ }
- // zoom widget
- {
- menu->addSeparator();
+ // zoom widget
+ {
+ menu->addSeparator();
- auto *zoomSlider = new QSlider(Qt::Horizontal);
- zoomSlider->setMinimum(5);
- zoomSlider->setMaximum(50);
- zoomSlider->setValue(zoomFactor() * 10);
+ auto *zoomSlider = new QSlider(Qt::Horizontal);
+ zoomSlider->setMinimum(5);
+ zoomSlider->setMaximum(50);
+ zoomSlider->setValue(zoomFactor() * 10);
- auto *zoomAction = menu->addAction(tr("Zoom: %1x").arg(zoomFactor()));
- connect(zoomAction, &QAction::triggered, this, [zoomSlider]() {
- zoomSlider->setValue(10);
- });
+ auto *zoomAction = menu->addAction(tr("Zoom: %1x").arg(zoomFactor()));
+ connect(zoomAction, &QAction::triggered, this, [zoomSlider]() {
+ zoomSlider->setValue(10);
+ });
- connect(zoomSlider, &QSlider::valueChanged, this, [this, zoomAction](int value) {
- zoomAction->setText(tr("Zoom: %1x").arg(static_cast<qreal>(value) / 10));
- setZoomFactor(static_cast<qreal>(value) / 10);
- });
+ connect(zoomSlider, &QSlider::valueChanged, this, [this, zoomAction](int value) {
+ zoomAction->setText(tr("Zoom: %1x").arg(static_cast<qreal>(value) / 10));
+ setZoomFactor(static_cast<qreal>(value) / 10);
+ });
- auto *zoomWidgetAction = new QWidgetAction(this);
- zoomWidgetAction->setDefaultWidget(zoomSlider);
+ auto *zoomWidgetAction = new QWidgetAction(this);
+ zoomWidgetAction->setDefaultWidget(zoomSlider);
- menu->addAction(zoomWidgetAction);
- }
- } else {
- menu = page()->createStandardContextMenu();
+ menu->addAction(zoomWidgetAction);
}
menu->setMinimumWidth(250);