Skip to content

Commit 88a8dee

Browse files
author
Richard Moe Gustavsen
committed
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 <andy.shaw@qt.io>
1 parent cf3686e commit 88a8dee

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

src/widgets/widgets/qwidgettextcontrol.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1887,8 +1887,6 @@ void QWidgetTextControlPrivate::contextMenuEvent(const QPoint &screenPos, const
18871887
Q_UNUSED(contextWidget);
18881888
#else
18891889
Q_Q(QWidgetTextControl);
1890-
if (!hasFocus)
1891-
return;
18921890
QMenu *menu = q->createStandardContextMenu(docPos, contextWidget);
18931891
if (!menu)
18941892
return;

0 commit comments

Comments
 (0)