fix: Redundant condition in qplaintextedit

The redundancy in the conditional judgment exists
because QApplicationPrivate::keypadNavigationEnabled()
appears in both conditional branches. Specifically, the
conditional expression can be simplified because
!A || (A && B) is equivalent to !A || B.

Change-Id: I071e349ea4f67a03f89136e2156eb5918a65214f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 792373595d9d9d45f5c43e6a9e3f90c1b7ad54d8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Tian Shilin 2024-08-22 14:20:01 +08:00 committed by Qt Cherry-pick Bot
parent 6c8d2e042c
commit 001afe49b4

View File

@ -1671,8 +1671,7 @@ void QPlainTextEdit::keyPressEvent(QKeyEvent *e)
break;
case Qt::Key_Back:
case Qt::Key_No:
if (!QApplicationPrivate::keypadNavigationEnabled()
|| (QApplicationPrivate::keypadNavigationEnabled() && !hasEditFocus())) {
if (!QApplicationPrivate::keypadNavigationEnabled() || !hasEditFocus()) {
e->ignore();
return;
}