path: root/src/widgets
diff options
authorRichard Moe Gustavsen <>2017-10-25 11:48:17 +0200
committerRichard Moe Gustavsen <>2017-10-27 08:01:11 +0000
commit88a8deea86fe69448ca1586c2ee567a53dee1008 (patch)
treedeb0000b63b8bc4d7cdad6241ae973656a786a5a /src/widgets
parentcf3686e2a4d5beb953b9a4a95334f9f080f7eaf7 (diff)
QWidgetTextControl: allow context menu to open for a QTextEdit with Qt::NoFocus set
Currently a context menu will only open when right-clicking on a text edit that has input focus. This means that you cannot e.g bring up the context menu to copy text for a text edit that doesn't accept input focus (but you are still allowed to select text with the mouse, which feels a bit contradictory). This is different from how QLineEdit works, and also different compared to how native applications work, at least after testing on macOS and Ubuntu. This patch will change this behavior, so that the context menu always open on both QPlainTextEdit and QTextEdit, even when they don't accept focus. Task-number: QTBUG-63868 Change-Id: Ibc4cbcc900077546828690ddc958820677211a5a Reviewed-by: Andy Shaw <>
Diffstat (limited to 'src/widgets')
1 files changed, 0 insertions, 2 deletions
diff --git a/src/widgets/widgets/qwidgettextcontrol.cpp b/src/widgets/widgets/qwidgettextcontrol.cpp
index aa5a3329e9..5712ea6151 100644
--- a/src/widgets/widgets/qwidgettextcontrol.cpp
+++ b/src/widgets/widgets/qwidgettextcontrol.cpp
@@ -1887,8 +1887,6 @@ void QWidgetTextControlPrivate::contextMenuEvent(const QPoint &screenPos, const
- if (!hasFocus)
- return;
QMenu *menu = q->createStandardContextMenu(docPos, contextWidget);
if (!menu)