代码拉取完成,页面将自动刷新
同步操作将从 src-anolis-os/qt5-qtbase 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From: Tang Haixiang <[email protected]>
Date: Tue Apr 06 16:08:13 2021 +0800
Subject: QInputControl: accept surrogate category character
Upstream: https://codereview.qt-project.org/c/qt/qtbase/+/327425
---
Index: qtbase-opensource-src/src/gui/text/qinputcontrol.cpp
===================================================================
--- qtbase-opensource-src.orig/src/gui/text/qinputcontrol.cpp
+++ qtbase-opensource-src/src/gui/text/qinputcontrol.cpp
@@ -79,6 +79,9 @@ bool QInputControl::isAcceptableInput(co
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;
Index: qtbase-opensource-src/tests/auto/gui/text/qinputcontrol/tst_qinputcontrol.cpp
===================================================================
--- qtbase-opensource-src.orig/tests/auto/gui/text/qinputcontrol/tst_qinputcontrol.cpp
+++ qtbase-opensource-src/tests/auto/gui/text/qinputcontrol/tst_qinputcontrol.cpp
@@ -58,6 +58,52 @@ void tst_QInputControl::isAcceptableInpu
QTest::newRow("printable-latin-with-ctrl-shift") << QString(QLatin1Char('a')) << Qt::KeyboardModifiers(Qt::ControlModifier | Qt::ShiftModifier) << false;
QTest::newRow("printable-hebrew") << QString(QChar(0x2135)) << Qt::KeyboardModifiers() << true;
QTest::newRow("private-use-area") << QString(QChar(0xE832)) << Qt::KeyboardModifiers() << true;
+ QTest::newRow("good-surrogate-0") << QString::fromUtf16(u"\U0001F44D") << Qt::KeyboardModifiers() << true;
+ {
+ const QChar data[] = { QChar(0xD800), QChar(0xDC00) };
+ const QString str = QString(data, 2);
+ QTest::newRow("good-surrogate-1") << str << Qt::KeyboardModifiers() << true;
+ }
+ {
+ const QChar data[] = { QChar(0xD800), QChar(0xDFFF) };
+ const QString str = QString(data, 2);
+ QTest::newRow("good-surrogate-2") << str << Qt::KeyboardModifiers() << true;
+ }
+ {
+ const QChar data[] = { QChar(0xDBFF), QChar(0xDC00) };
+ const QString str = QString(data, 2);
+ QTest::newRow("good-surrogate-3") << str << Qt::KeyboardModifiers() << true;
+ }
+ {
+ const QChar data[] = { QChar(0xDBFF), QChar(0xDFFF) };
+ const QString str = QString(data, 2);
+ QTest::newRow("good-surrogate-4") << str << Qt::KeyboardModifiers() << true;
+ }
+ {
+ const QChar data[] = { QChar(0xD7FF), QChar(0xDC00) };
+ const QString str = QString(data, 2);
+ QTest::newRow("bad-surrogate-1") << str << Qt::KeyboardModifiers() << false;
+ }
+ {
+ const QChar data[] = { QChar(0xD7FF), QChar(0xDFFF) };
+ const QString str = QString(data, 2);
+ QTest::newRow("bad-surrogate-2") << str << Qt::KeyboardModifiers() << false;
+ }
+ {
+ const QChar data[] = { QChar(0xDC00), QChar(0xDC00) };
+ const QString str = QString(data, 2);
+ QTest::newRow("bad-surrogate-3") << str << Qt::KeyboardModifiers() << false;
+ }
+ {
+ const QChar data[] = { QChar(0xD800), QChar(0xE000) };
+ const QString str = QString(data, 2);
+ QTest::newRow("bad-surrogate-4") << str << Qt::KeyboardModifiers() << false;
+ }
+ {
+ const QChar data[] = { QChar(0xD800) };
+ const QString str = QString(data, 1);
+ QTest::newRow("bad-surrogate-5") << str << Qt::KeyboardModifiers() << false;
+ }
QTest::newRow("multiple-printable") << QStringLiteral("foobar") << Qt::KeyboardModifiers() << true;
QTest::newRow("rlm") << QString(QChar(0x200F)) << Qt::KeyboardModifiers() << true;
QTest::newRow("rlm-with-ctrl") << QString(QChar(0x200F)) << Qt::KeyboardModifiers(Qt::ControlModifier) << true;
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。