aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/webengine/webview.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/webengine/webview.cpp b/src/webengine/webview.cpp
index 0e48703..25f7b70 100644
--- a/src/webengine/webview.cpp
+++ b/src/webengine/webview.cpp
@@ -128,20 +128,31 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
buttonsLayout->setSpacing(2);
auto *backButton = new QToolButton(this);
+ backButton->setEnabled(history()->canGoBack());
backButton->setIcon(style()->standardIcon(QStyle::SP_ArrowBack));
- connect(backButton, &QToolButton::clicked, this, &WebView::back);
+ connect(backButton, &QToolButton::clicked, this, [this, menu]() {
+ this->back();
+ menu->close();
+ });
buttonsLayout->addWidget(backButton);
auto *forwardButton = new QToolButton(this);
+ forwardButton->setEnabled(history()->canGoForward());
forwardButton->setIcon(style()->standardIcon(QStyle::SP_ArrowForward));
- connect(forwardButton, &QToolButton::clicked, this, &WebView::forward);
+ connect(forwardButton, &QToolButton::clicked, this, [this, menu]() {
+ this->forward();
+ menu->close();
+ });
buttonsLayout->addWidget(forwardButton);
buttonsLayout->addStretch();
auto *refreshButton = new QToolButton(this);
refreshButton->setIcon(style()->standardIcon(QStyle::SP_BrowserReload));
- connect(refreshButton, &QToolButton::clicked, this, &WebView::reload);
+ connect(refreshButton, &QToolButton::clicked, this, [this, menu]() {
+ this->reload();
+ menu->close();
+ });
buttonsLayout->addWidget(refreshButton);
buttons->setLayout(buttonsLayout);