From 88a8deea86fe69448ca1586c2ee567a53dee1008 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Wed, 25 Oct 2017 11:48:17 +0200 Subject: 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 --- src/widgets/widgets/qwidgettextcontrol.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/widgets') 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 Q_UNUSED(contextWidget); #else Q_Q(QWidgetTextControl); - if (!hasFocus) - return; QMenu *menu = q->createStandardContextMenu(docPos, contextWidget); if (!menu) return; -- cgit v1.2.3