aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/browsertab.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/browsertab.cpp b/src/browsertab.cpp
index e870fe0..cc89155 100644
--- a/src/browsertab.cpp
+++ b/src/browsertab.cpp
@@ -1552,20 +1552,18 @@ void BrowserTab::on_text_browser_customContextMenuRequested(const QPoint pos)
menu.addSeparator();
+ if (ui->text_browser->textCursor().hasSelection()) {
+ menu.addAction("Copy to clipboard", [this]() {
+ this->ui->text_browser->copy();
+ }, QKeySequence("Ctrl+C"));
+ }
+
connect(menu.addAction("Select all"), &QAction::triggered, [this]() {
this->ui->text_browser->selectAll();
});
menu.addSeparator();
- QAction * copy = menu.addAction("Copy to clipboard");
- copy->setShortcut(QKeySequence("Ctrl+C"));
- connect(copy, &QAction::triggered, [this]() {
- this->ui->text_browser->copy();
- });
-
- menu.addSeparator();
-
QAction * viewsrc = menu.addAction("View document source");
viewsrc->setShortcut(QKeySequence("Ctrl+U"));
connect(viewsrc, &QAction::triggered, [this]() {