aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/plugins/tcime/plugin/tcinputmethod.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/plugins/tcime/plugin/tcinputmethod.cpp b/src/plugins/tcime/plugin/tcinputmethod.cpp
index 73a4b900..3460079d 100644
--- a/src/plugins/tcime/plugin/tcinputmethod.cpp
+++ b/src/plugins/tcime/plugin/tcinputmethod.cpp
@@ -44,6 +44,8 @@
#include <QLibraryInfo>
#include <QFileInfo>
+#include <array>
+
QT_BEGIN_NAMESPACE
namespace QtVirtualKeyboard {
@@ -231,7 +233,7 @@ public:
input.replace(0, 1, c);
} else if (ZhuyinTable::getFinals(QStringView(&c, 1)) > 0) {
// Replace the finals in the decomposed of syllables and tones.
- QList<QChar> decomposed = decomposeZhuyin();
+ std::array<QChar, 4> decomposed = decomposeZhuyin();
if (ZhuyinTable::isYiWuYuFinals(c)) {
decomposed[1] = c;
} else {
@@ -240,9 +242,9 @@ public:
// Compose back the text after the finals replacement.
input.clear();
- for (int i = 0; i < decomposed.length(); ++i) {
- if (!decomposed[i].isNull())
- input.append(decomposed[i]);
+ for (QChar ch : decomposed) {
+ if (!ch.isNull())
+ input.append(ch);
}
} else {
return false;
@@ -258,9 +260,9 @@ public:
return true;
}
- QList<QChar> decomposeZhuyin()
+ std::array<QChar, 4> decomposeZhuyin()
{
- QList<QChar> results = {QChar::Null, QChar::Null, QChar::Null, QChar::Null};
+ std::array<QChar, 4> results = {};
auto strippedTones = ZhuyinTable::stripTones(input);
if (strippedTones.ok) {
// Decompose tones.