From 51e940260af183228798c7741646ac88252e1f3b Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Thu, 17 Dec 2020 17:22:48 +0100 Subject: QInputControl: accept surrogate category character See also https://unicodebook.readthedocs.io/unicode_encodings.html#utf-16-surrogate-pairs . Fixes: QTBUG-89184 Change-Id: I04eff7f42f0030346603a7b31e4ac854a477030c Reviewed-by: Lars Knoll (cherry picked from commit e688b99995b8c624dbcea296c99fb89262d29e15) Reviewed-by: Qt Cherry-pick Bot --- src/gui/text/qinputcontrol.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/gui') diff --git a/src/gui/text/qinputcontrol.cpp b/src/gui/text/qinputcontrol.cpp index 3381fdb673..80d5e6af4e 100644 --- a/src/gui/text/qinputcontrol.cpp +++ b/src/gui/text/qinputcontrol.cpp @@ -79,6 +79,9 @@ bool QInputControl::isAcceptableInput(const QKeyEvent *event) const if (c.category() == QChar::Other_PrivateUse) return true; + if (c.isHighSurrogate() && text.length() > 1 && text.at(1).isLowSurrogate()) + return true; + if (m_type == TextEdit && c == QLatin1Char('\t')) return true; -- cgit v1.2.3