summaryrefslogtreecommitdiffstats
path: root/src/webengine/api/qquickwebengineview.cpp
diff options
context:
space:
mode:
authorJüri Valdmann <juri.valdmann@qt.io>2019-07-02 12:36:34 +0200
committerJüri Valdmann <juri.valdmann@qt.io>2019-07-08 09:34:06 +0200
commit3c34f95ad4a96737f66ab4933edb9e00abecdc24 (patch)
tree3249d3d1680a0f63e684a9564edff85cc51cc3dd /src/webengine/api/qquickwebengineview.cpp
parent76846a183e956abfa1ae950a6fe9e58edfeb2a56 (diff)
Disable Cut/Copy/Unselect actions when there's no selection
Fixes: QTBUG-76666 Change-Id: I74b9a26cd7be9a830f4eecd36db69777412ab316 Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
Diffstat (limited to 'src/webengine/api/qquickwebengineview.cpp')
-rw-r--r--src/webengine/api/qquickwebengineview.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp
index 583678aaf..60db2fcd5 100644
--- a/src/webengine/api/qquickwebengineview.cpp
+++ b/src/webengine/api/qquickwebengineview.cpp
@@ -413,6 +413,11 @@ void QQuickWebEngineViewPrivate::didUpdateTargetURL(const QUrl &hoveredUrl)
Q_EMIT q->linkHovered(hoveredUrl);
}
+void QQuickWebEngineViewPrivate::selectionChanged()
+{
+ updateEditActions();
+}
+
void QQuickWebEngineViewPrivate::recentlyAudibleChanged(bool recentlyAudible)
{
Q_Q(QQuickWebEngineView);
@@ -963,12 +968,14 @@ void QQuickWebEngineViewPrivate::updateAction(QQuickWebEngineView::WebAction act
break;
case QQuickWebEngineView::Cut:
case QQuickWebEngineView::Copy:
+ case QQuickWebEngineView::Unselect:
+ enabled = adapter->hasFocusedFrame() && !adapter->selectedText().isEmpty();
+ break;
case QQuickWebEngineView::Paste:
case QQuickWebEngineView::Undo:
case QQuickWebEngineView::Redo:
case QQuickWebEngineView::SelectAll:
case QQuickWebEngineView::PasteAndMatchStyle:
- case QQuickWebEngineView::Unselect:
enabled = adapter->hasFocusedFrame();
break;
default: