aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2022-10-05 08:19:25 +0200
committerMarc Mutz <marc.mutz@qt.io>2022-10-06 11:53:12 +0200
commit07f4c776a1450be43fa87af1faf80706dd167344 (patch)
treeb62b3d21f09709785663e0b1414681eea0c809d5
parentf939e46d75af1f4ae8119f5b7c1adb22a8c9f60c (diff)
Port from container::count() and length() to size()
This is a semantic patch using ClangTidyTransformator as in qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8: auto QtContainerClass = anyOf( expr(hasType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes))))).bind(o), expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o)); makeRule(cxxMemberCallExpr(on(QtContainerClass), callee(cxxMethodDecl(hasAnyName({"count", "length"), parameterCountIs(0))))), changeTo(cat(access(o, cat("size"), "()"))), cat("use 'size()' instead of 'count()/length()'")) a.k.a qt-port-to-std-compatible-api with config Scope: 'Container', with the extended set of container classes recognized. Done-with: Jarkko Koivikko <jarkko.koivikko@code-q.fi> Change-Id: I28ad3f9b59bcfd2db9401c8d4ecc0800c57a3b17 Reviewed-by: Jarkko Koivikko <jarkko.koivikko@code-q.fi>
-rw-r--r--src/plugins/cerence/cerencecommon/xt9ldbmanager.cpp2
-rw-r--r--src/plugins/cerence/hwr/plugin/t9writeinputmethod.cpp22
-rw-r--r--src/plugins/cerence/hwr/plugin/t9writeworker.cpp4
-rw-r--r--src/plugins/cerence/xt9/plugin/xt9awinputmethod.cpp2
-rw-r--r--src/plugins/cerence/xt9/plugin/xt9awinputmethodprivate.cpp2
-rw-r--r--src/plugins/cerence/xt9/plugin/xt9cpinputmethod.cpp2
-rw-r--r--src/plugins/cerence/xt9/plugin/xt9kinputmethod.cpp2
-rw-r--r--src/plugins/cerence/xt9/xt9common/xt9cpime.cpp4
-rw-r--r--src/plugins/cerence/xt9/xt9common/xt9kime.cpp8
-rw-r--r--src/plugins/hangul/hangul.cpp16
-rw-r--r--src/plugins/hangul/hangulinputmethod.cpp4
-rw-r--r--src/plugins/hunspell/module/hunspellinputmethod.cpp22
-rw-r--r--src/plugins/hunspell/module/hunspellinputmethod_p.cpp4
-rw-r--r--src/plugins/hunspell/module/hunspellwordlist.cpp4
-rw-r--r--src/plugins/hunspell/module/hunspellworker.cpp24
-rw-r--r--src/plugins/myscript/plugin/myscriptinputmethod.cpp4
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/wnnEngine/kanaconverter.cpp4
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/wnnEngine/openwnnclauseconverterjajp.cpp28
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/wnnEngine/openwnndictionary.cpp12
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/wnnEngine/openwnnenginejajp.cpp12
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/wnnEngine/romkan.cpp8
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/wnnEngine/wnnlookuptable.cpp2
-rw-r--r--src/plugins/openwnn/openwnninputmethod.cpp16
-rw-r--r--src/plugins/pinyin/pinyindecoderservice.cpp4
-rw-r--r--src/plugins/pinyin/pinyininputmethod.cpp24
-rw-r--r--src/plugins/tcime/3rdparty/tcime/phrasedictionary.cpp8
-rw-r--r--src/plugins/tcime/3rdparty/tcime/zhuyintable.cpp6
-rw-r--r--src/plugins/tcime/tcinputmethod.cpp22
-rw-r--r--src/plugins/thai/thaiinputmethod.cpp2
-rw-r--r--src/styles/svgimageprovider.cpp2
-rw-r--r--src/virtualkeyboard/handwritinggesturerecognizer.cpp4
-rw-r--r--src/virtualkeyboard/qvirtualkeyboardinputcontext.cpp2
-rw-r--r--src/virtualkeyboard/qvirtualkeyboardinputcontext_p.cpp8
-rw-r--r--src/virtualkeyboard/qvirtualkeyboardselectionlistmodel.cpp2
-rw-r--r--src/virtualkeyboard/shadowinputcontext.cpp2
-rw-r--r--src/virtualkeyboard/shifthandler.cpp2
-rw-r--r--tests/auto/dictionarymanager/tst_dictionarymanager.cpp2
-rw-r--r--tests/manual/x11vkbwrapper/handleatspievents.cpp2
38 files changed, 150 insertions, 150 deletions
diff --git a/src/plugins/cerence/cerencecommon/xt9ldbmanager.cpp b/src/plugins/cerence/cerencecommon/xt9ldbmanager.cpp
index 0d207c3c..86c92a68 100644
--- a/src/plugins/cerence/cerencecommon/xt9ldbmanager.cpp
+++ b/src/plugins/cerence/cerencecommon/xt9ldbmanager.cpp
@@ -87,7 +87,7 @@ void Xt9LdbManager::closeAll()
QString Xt9LdbManager::findDictionary(const QLocale &locale) const
{
QStringList languageCountry = locale.name().split(QLatin1String("_"));
- if (languageCountry.length() != 2)
+ if (languageCountry.size() != 2)
return QString();
const QString language_ISO_639_1 = languageCountry[0].toUpper();
const QString country = languageCountry[1].toUpper();
diff --git a/src/plugins/cerence/hwr/plugin/t9writeinputmethod.cpp b/src/plugins/cerence/hwr/plugin/t9writeinputmethod.cpp
index 00f20bcc..9589ebab 100644
--- a/src/plugins/cerence/hwr/plugin/t9writeinputmethod.cpp
+++ b/src/plugins/cerence/hwr/plugin/t9writeinputmethod.cpp
@@ -71,9 +71,9 @@ public:
textCaseList.clear();
return;
}
- while (length < textCaseList.length())
+ while (length < textCaseList.size())
textCaseList.removeLast();
- while (length > textCaseList.length())
+ while (length > textCaseList.size())
textCaseList.append(textCase);
}
@@ -82,7 +82,7 @@ public:
QString result;
QVirtualKeyboardInputEngine::TextCase textCase = QVirtualKeyboardInputEngine::TextCase::Lower;
for (int i = 0; i < str.length(); ++i) {
- if (i < textCaseList.length())
+ if (i < textCaseList.size())
textCase = textCaseList.at(i);
result.append(textCase == QVirtualKeyboardInputEngine::TextCase::Upper ? str.at(i).toUpper() : (preferLowercase ? str.at(i).toLower() : str.at(i)));
}
@@ -1359,9 +1359,9 @@ public:
}
// Check for hard limit on the size the trace list
- if (traceList.count() >= traceListHardLimit) {
+ if (traceList.size() >= traceListHardLimit) {
worker->waitForAllTasksOfType<T9WriteAddArcTask>();
- while (traceListHardLimit < traceList.count())
+ while (traceListHardLimit < traceList.size())
delete traceList.takeFirst();
}
@@ -1839,8 +1839,8 @@ public:
}
// Enforce hard limit for number of traces
- if (traceList.count() >= traceListHardLimit) {
- qCDebug(lcT9Write) << "T9WriteInputMethodPrivate::processResult(): Clearing traces (hard limit):" << traceList.count();
+ if (traceList.size() >= traceListHardLimit) {
+ qCDebug(lcT9Write) << "T9WriteInputMethodPrivate::processResult(): Clearing traces (hard limit):" << traceList.size();
clearTraces();
}
}
@@ -1924,7 +1924,7 @@ public:
if (countActiveTraces() > 0)
return false;
- QVariantMap gesture(gestureRecognizer.recognize(traceList.mid(traceList.length() - 1, 1)));
+ QVariantMap gesture(gestureRecognizer.recognize(traceList.mid(traceList.size() - 1, 1)));
if (gesture.isEmpty())
return false;
@@ -1984,9 +1984,9 @@ public:
inputModes.removeAt(inputMode != QVirtualKeyboardInputEngine::InputMode::Dialable ?
indexOfDialableInputMode :
indexOfNumericInputMode);
- if (inputModes.count() > 1) {
+ if (inputModes.size() > 1) {
int inputModeIndex = inputModes.indexOf(static_cast<const int>(inputMode)) + 1;
- if (inputModeIndex >= inputModes.count())
+ if (inputModeIndex >= inputModes.size())
inputModeIndex = 0;
ic->inputEngine()->setInputMode(static_cast<QVirtualKeyboardInputEngine::InputMode>(inputModes.at(inputModeIndex)));
}
@@ -2580,7 +2580,7 @@ int T9WriteInputMethod::selectionListItemCount(QVirtualKeyboardSelectionListMode
{
Q_UNUSED(type);
Q_D(T9WriteInputMethod);
- return d->wordCandidates.count();
+ return d->wordCandidates.size();
}
QVariant T9WriteInputMethod::selectionListData(QVirtualKeyboardSelectionListModel::Type type, int index, QVirtualKeyboardSelectionListModel::Role role)
diff --git a/src/plugins/cerence/hwr/plugin/t9writeworker.cpp b/src/plugins/cerence/hwr/plugin/t9writeworker.cpp
index 9286b187..546c59be 100644
--- a/src/plugins/cerence/hwr/plugin/t9writeworker.cpp
+++ b/src/plugins/cerence/hwr/plugin/t9writeworker.cpp
@@ -414,7 +414,7 @@ int T9WriteWorker::removeAllTasks()
{
idleSema.acquire();
QMutexLocker guard(&taskLock);
- int count = taskList.count();
+ int count = taskList.size();
for (QSharedPointer<T9WriteTask> task : taskList) {
task->runSema.release();
}
@@ -439,7 +439,7 @@ void T9WriteWorker::waitForAllTasks()
int T9WriteWorker::numberOfPendingTasks()
{
QMutexLocker guard(&taskLock);
- return taskList.count();
+ return taskList.size();
}
void T9WriteWorker::run()
diff --git a/src/plugins/cerence/xt9/plugin/xt9awinputmethod.cpp b/src/plugins/cerence/xt9/plugin/xt9awinputmethod.cpp
index 69db29c6..f0794be2 100644
--- a/src/plugins/cerence/xt9/plugin/xt9awinputmethod.cpp
+++ b/src/plugins/cerence/xt9/plugin/xt9awinputmethod.cpp
@@ -152,7 +152,7 @@ int Xt9AwInputMethod::selectionListItemCount(QVirtualKeyboardSelectionListModel:
{
Q_UNUSED(type)
Q_D(Xt9AwInputMethod);
- return d->selectionList.count();
+ return d->selectionList.size();
}
QVariant Xt9AwInputMethod::selectionListData(QVirtualKeyboardSelectionListModel::Type type, int index, QVirtualKeyboardSelectionListModel::Role role)
diff --git a/src/plugins/cerence/xt9/plugin/xt9awinputmethodprivate.cpp b/src/plugins/cerence/xt9/plugin/xt9awinputmethodprivate.cpp
index b1689795..4bb3c691 100644
--- a/src/plugins/cerence/xt9/plugin/xt9awinputmethodprivate.cpp
+++ b/src/plugins/cerence/xt9/plugin/xt9awinputmethodprivate.cpp
@@ -53,7 +53,7 @@ void Xt9AwInputMethodPrivate::selectionListSelectItem(int index)
Q_Q(Xt9AwInputMethod);
Xt9DeferredSelectionListUpdate deferredSelectionListUpdate(this);
- if (index >= 0 && index < selectionList.count()) {
+ if (index >= 0 && index < selectionList.size()) {
QVirtualKeyboardInputContext *ic = q->inputContext();
const QString &selectedWord = selectionList.at(index);
diff --git a/src/plugins/cerence/xt9/plugin/xt9cpinputmethod.cpp b/src/plugins/cerence/xt9/plugin/xt9cpinputmethod.cpp
index fc906fc9..f8a59334 100644
--- a/src/plugins/cerence/xt9/plugin/xt9cpinputmethod.cpp
+++ b/src/plugins/cerence/xt9/plugin/xt9cpinputmethod.cpp
@@ -100,7 +100,7 @@ int Xt9CpInputMethod::selectionListItemCount(QVirtualKeyboardSelectionListModel:
{
Q_UNUSED(type)
Q_D(Xt9CpInputMethod);
- return d->selectionList.count();
+ return d->selectionList.size();
}
QVariant Xt9CpInputMethod::selectionListData(QVirtualKeyboardSelectionListModel::Type type, int index, QVirtualKeyboardSelectionListModel::Role role)
diff --git a/src/plugins/cerence/xt9/plugin/xt9kinputmethod.cpp b/src/plugins/cerence/xt9/plugin/xt9kinputmethod.cpp
index 7f725b09..956df3cf 100644
--- a/src/plugins/cerence/xt9/plugin/xt9kinputmethod.cpp
+++ b/src/plugins/cerence/xt9/plugin/xt9kinputmethod.cpp
@@ -29,7 +29,7 @@ void Xt9KInputMethod::update()
Q_D(Xt9KInputMethod);
if (d->xt9Ime()->hasActiveInput()) {
- if (d->selectionList.length() > 0) {
+ if (d->selectionList.size() > 0) {
d->learnWord(d->selectionList.at(0));
d->setAutoSpaceAllowed(false);
d->selectionListSelectItem(0);
diff --git a/src/plugins/cerence/xt9/xt9common/xt9cpime.cpp b/src/plugins/cerence/xt9/xt9common/xt9cpime.cpp
index 216c68c1..5dff7495 100644
--- a/src/plugins/cerence/xt9/xt9common/xt9cpime.cpp
+++ b/src/plugins/cerence/xt9/xt9common/xt9cpime.cpp
@@ -53,7 +53,7 @@ public:
for (int i = 0; i < codes.size(); ++i) {
cangjieBuf[i] = GetCangjieSymb(codes.at(i).unicode());
}
- return QString::fromUtf16(reinterpret_cast<const char16_t *>(cangjieBuf.constData()), cangjieBuf.length());
+ return QString::fromUtf16(reinterpret_cast<const char16_t *>(cangjieBuf.constData()), cangjieBuf.size());
}
QString convertFrom(const QString &codes) const override
@@ -62,7 +62,7 @@ public:
for (int i = 0; i < codes.size(); ++i) {
cangjieBuf[i] = GetCangjieMappingSymb(codes.at(i).unicode());
}
- return QString::fromUtf16(reinterpret_cast<const char16_t *>(cangjieBuf.constData()), cangjieBuf.length());
+ return QString::fromUtf16(reinterpret_cast<const char16_t *>(cangjieBuf.constData()), cangjieBuf.size());
}
};
diff --git a/src/plugins/cerence/xt9/xt9common/xt9kime.cpp b/src/plugins/cerence/xt9/xt9common/xt9kime.cpp
index 9a2205d2..76173728 100644
--- a/src/plugins/cerence/xt9/xt9common/xt9kime.cpp
+++ b/src/plugins/cerence/xt9/xt9common/xt9kime.cpp
@@ -12,16 +12,16 @@ public:
{
QVector<ushort> jamoBuf(codes.size());
memcpy(jamoBuf.data(), codes.utf16(), static_cast<size_t>(jamoBuf.size()) * sizeof(ushort));
- XT9_VAPI(ET9KCompatibilityJamoToJamo, jamoBuf.data(), static_cast<ET9U32>(jamoBuf.length()));
- return QString::fromUtf16(reinterpret_cast<const char16_t *>(jamoBuf.constData()), jamoBuf.length());
+ XT9_VAPI(ET9KCompatibilityJamoToJamo, jamoBuf.data(), static_cast<ET9U32>(jamoBuf.size()));
+ return QString::fromUtf16(reinterpret_cast<const char16_t *>(jamoBuf.constData()), jamoBuf.size());
}
QString convertFrom(const QString &codes) const override
{
QVector<ushort> jamoBuf(codes.size());
memcpy(jamoBuf.data(), codes.utf16(), static_cast<size_t>(jamoBuf.size()) * sizeof(ushort));
- XT9_VAPI(ET9KJamoToCompatibilityJamo, jamoBuf.data(), static_cast<ET9U32>(jamoBuf.length()));
- return QString::fromUtf16(reinterpret_cast<const char16_t *>(jamoBuf.constData()), jamoBuf.length());
+ XT9_VAPI(ET9KJamoToCompatibilityJamo, jamoBuf.data(), static_cast<ET9U32>(jamoBuf.size()));
+ return QString::fromUtf16(reinterpret_cast<const char16_t *>(jamoBuf.constData()), jamoBuf.size());
}
};
diff --git a/src/plugins/hangul/hangul.cpp b/src/plugins/hangul/hangul.cpp
index d6e3f384..60f352ec 100644
--- a/src/plugins/hangul/hangul.cpp
+++ b/src/plugins/hangul/hangul.cpp
@@ -37,7 +37,7 @@ const int Hangul::SCount = Hangul::LCount * Hangul::NCount; // 11172
QString Hangul::decompose(const QString &source)
{
QString result;
- const int len = source.length();
+ const int len = source.size();
for (int i = 0; i < len; i++) {
QChar ch = source.at(i);
int SIndex = (int)ch.unicode() - SBase;
@@ -80,7 +80,7 @@ QString Hangul::decompose(const QString &source)
QString Hangul::compose(const QString &source)
{
- const int len = source.length();
+ const int len = source.size();
if (len == 0)
return QString();
@@ -112,7 +112,7 @@ QString Hangul::compose(const QString &source)
TIndex = finals.indexOf(unicode);
if (TIndex != -1) {
last = QChar((int)lastUnicode + TIndex);
- result.replace(result.length() - 1, 1, last);
+ result.replace(result.size() - 1, 1, last);
continue;
}
@@ -137,7 +137,7 @@ QString Hangul::compose(const QString &source)
HangulMedialIndex VIndexD = it.value();
int VDiff = (int)VIndexD - (int)VIndexA;
last = QChar((int)lastUnicode + VDiff * TCount);
- result.replace(result.length() - 1, 1, last);
+ result.replace(result.size() - 1, 1, last);
continue;
}
}
@@ -162,7 +162,7 @@ QString Hangul::compose(const QString &source)
// Remove the previous final jamo from the syllable,
// making the current syllable of form LV
last = QChar((int)lastUnicode - TIndex);
- result.replace(result.length() - 1, 1, last);
+ result.replace(result.size() - 1, 1, last);
// Make new syllable of form LV
last = QChar(SBase + (LIndex * VCount + VIndex) * TCount);
@@ -183,7 +183,7 @@ QString Hangul::compose(const QString &source)
HangulFinalIndex TIndexA, TIndexB;
unpackDoubleFinal(key, TIndexA, TIndexB);
last = QChar((int)lastUnicode - TIndex + (int)TIndexA);
- result.replace(result.length() - 1, 1, last);
+ result.replace(result.size() - 1, 1, last);
// Add new syllable by combining the initial jamo
// and the current vowel
@@ -212,7 +212,7 @@ QString Hangul::compose(const QString &source)
HangulFinalIndex TIndexD = it.value();
int TDiff = (int)TIndexD - (int)TIndexA;
last = QChar((int)lastUnicode + TDiff);
- result.replace(result.length() - 1, 1, last);
+ result.replace(result.size() - 1, 1, last);
continue;
}
}
@@ -231,7 +231,7 @@ QString Hangul::compose(const QString &source)
int VIndex = (int)unicode - VBase;
if (VIndex >= 0 && VIndex < VCount) {
last = QChar(SBase + (LIndex * VCount + VIndex) * TCount);
- result.replace(result.length() - 1, 1, last);
+ result.replace(result.size() - 1, 1, last);
continue;
}
}
diff --git a/src/plugins/hangul/hangulinputmethod.cpp b/src/plugins/hangul/hangulinputmethod.cpp
index 8023ac36..eaadbcfa 100644
--- a/src/plugins/hangul/hangulinputmethod.cpp
+++ b/src/plugins/hangul/hangulinputmethod.cpp
@@ -51,8 +51,8 @@ bool HangulInputMethod::keyEvent(Qt::Key key, const QString &text, Qt::KeyboardM
if (key == Qt::Key_Backspace) {
int contextLength = cursorPosition > 1 ? 2 : 1;
QString hangul = Hangul::decompose(ic->surroundingText().mid(cursorPosition - contextLength, contextLength));
- int length = hangul.length();
- if (hangul.length() > 1) {
+ int length = hangul.size();
+ if (hangul.size() > 1) {
ic->commit(Hangul::compose(hangul.left(length - 1)), -contextLength, contextLength);
accept = true;
}
diff --git a/src/plugins/hunspell/module/hunspellinputmethod.cpp b/src/plugins/hunspell/module/hunspellinputmethod.cpp
index e82cab2a..a066c927 100644
--- a/src/plugins/hunspell/module/hunspellinputmethod.cpp
+++ b/src/plugins/hunspell/module/hunspellinputmethod.cpp
@@ -83,7 +83,7 @@ bool HunspellInputMethod::keyEvent(Qt::Key key, const QString &text, Qt::Keyboar
{
QString word = d->wordCandidates.wordAt(0);
if (!word.isEmpty()) {
- word.remove(word.length() - 1, 1);
+ word.remove(word.size() - 1, 1);
ic->setPreeditText(word);
if (!word.isEmpty()) {
d->wordCandidates.updateWord(0, word);
@@ -105,7 +105,7 @@ bool HunspellInputMethod::keyEvent(Qt::Key key, const QString &text, Qt::Keyboar
update();
break;
}
- if (text.length() > 0) {
+ if (text.size() > 0) {
QChar c = text.at(0);
QString word = d->wordCandidates.wordAt(0);
bool addToWord = d->isValidInputChar(c) && (!word.isEmpty() || !d->isJoiner(c));
@@ -121,7 +121,7 @@ bool HunspellInputMethod::keyEvent(Qt::Key key, const QString &text, Qt::Keyboar
- No space before the cursor
- No spefic characters before the cursor; minus and apostrophe
*/
- if (!surroundingText.isEmpty() && cursorPosition == surroundingText.length()) {
+ if (!surroundingText.isEmpty() && cursorPosition == surroundingText.size()) {
QChar lastChar = surroundingText.at(cursorPosition - 1);
if (!lastChar.isSpace() &&
lastChar != QLatin1Char(Qt::Key_Minus) &&
@@ -148,7 +148,7 @@ bool HunspellInputMethod::keyEvent(Qt::Key key, const QString &text, Qt::Keyboar
emit selectionListActiveItemChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList, d->wordCandidates.index());
}
accept = true;
- } else if (text.length() > 1) {
+ } else if (text.size() > 1) {
bool addSpace = !word.isEmpty() || d->autoSpaceAllowed;
update();
d->autoSpaceAllowed = true;
@@ -200,7 +200,7 @@ QVariant HunspellInputMethod::selectionListData(QVirtualKeyboardSelectionListMod
{
const QString wordCandidate(d->wordCandidates.wordAt(index));
const QString word(d->wordCandidates.wordAt(0));
- int wordCompletionLength = wordCandidate.length() - word.length();
+ int wordCompletionLength = wordCandidate.size() - word.size();
result.setValue((wordCompletionLength > 0 && wordCandidate.startsWith(word)) ? wordCompletionLength : 0);
break;
}
@@ -284,15 +284,15 @@ bool HunspellInputMethod::reselect(int cursorPosition, const QVirtualKeyboardInp
return false;
if (reselectFlags.testFlag(QVirtualKeyboardInputEngine::ReselectFlag::WordAfterCursor)) {
- for (int i = cursorPosition; i < surroundingText.length(); ++i) {
+ for (int i = cursorPosition; i < surroundingText.size(); ++i) {
QChar c = surroundingText.at(i);
if (!d->isValidInputChar(c))
break;
word.append(c);
}
- while (replaceFrom > -word.length()) {
- int lastPos = word.length() - 1;
+ while (replaceFrom > -word.size()) {
+ int lastPos = word.size() - 1;
if (!d->isJoiner(word.at(lastPos)))
break;
word.remove(lastPos, 1);
@@ -302,17 +302,17 @@ bool HunspellInputMethod::reselect(int cursorPosition, const QVirtualKeyboardInp
if (word.isEmpty())
return false;
- if (reselectFlags.testFlag(QVirtualKeyboardInputEngine::ReselectFlag::WordAtCursor) && replaceFrom == -word.length())
+ if (reselectFlags.testFlag(QVirtualKeyboardInputEngine::ReselectFlag::WordAtCursor) && replaceFrom == -word.size())
return false;
if (d->isJoiner(word.at(0)))
return false;
- if (d->isJoiner(word.at(word.length() - 1)))
+ if (d->isJoiner(word.at(word.size() - 1)))
return false;
d->wordCandidates.updateWord(0, word);
- ic->setPreeditText(word, QList<QInputMethodEvent::Attribute>(), replaceFrom, word.length());
+ ic->setPreeditText(word, QList<QInputMethodEvent::Attribute>(), replaceFrom, word.size());
d->autoSpaceAllowed = false;
if (d->updateSuggestions()) {
diff --git a/src/plugins/hunspell/module/hunspellinputmethod_p.cpp b/src/plugins/hunspell/module/hunspellinputmethod_p.cpp
index a25a789d..393bbf88 100644
--- a/src/plugins/hunspell/module/hunspellinputmethod_p.cpp
+++ b/src/plugins/hunspell/module/hunspellinputmethod_p.cpp
@@ -99,7 +99,7 @@ bool HunspellInputMethodPrivate::updateSuggestions()
QString word = wordCandidates.wordAt(0);
if (!word.isEmpty() && dictionaryState != HunspellInputMethodPrivate::DictionaryNotLoaded) {
wordCandidateListChanged = true;
- if (word.length() >= wordCompletionPoint) {
+ if (word.size() >= wordCompletionPoint) {
if (hunspellWorker) {
QSharedPointer<HunspellWordList> wordList(new HunspellWordList(wordCandidates));
@@ -282,7 +282,7 @@ void HunspellInputMethodPrivate::addToDictionary()
if (activeWordIndex == 0) {
if (blacklistedWords->removeWord(word) > 0) {
saveCustomDictionary(blacklistedWords, QLatin1String("blacklist"));
- } else if (word.length() > 1 && !wordFlags.testFlag(HunspellWordList::SpellCheckOk) && !userDictionaryWords->contains(word)) {
+ } else if (word.size() > 1 && !wordFlags.testFlag(HunspellWordList::SpellCheckOk) && !userDictionaryWords->contains(word)) {
userDictionaryWords->appendWord(word);
saveCustomDictionary(userDictionaryWords, QLatin1String("userdictionary"));
} else {
diff --git a/src/plugins/hunspell/module/hunspellwordlist.cpp b/src/plugins/hunspell/module/hunspellwordlist.cpp
index ec55d4d3..6c4a8df0 100644
--- a/src/plugins/hunspell/module/hunspellwordlist.cpp
+++ b/src/plugins/hunspell/module/hunspellwordlist.cpp
@@ -154,8 +154,8 @@ QString HunspellWordList::findWordCompletion(const QString &word)
QString bestMatch;
for (int i = 0, count = _list.size(); i < count; ++i) {
const QString &wordB(_list[i]);
- if (wordB.length() > bestMatch.length() &&
- word.length() < wordB.length() &&
+ if (wordB.size() > bestMatch.size() &&
+ word.size() < wordB.size() &&
wordB.startsWith(word, Qt::CaseInsensitive))
bestMatch = wordB;
}
diff --git a/src/plugins/hunspell/module/hunspellworker.cpp b/src/plugins/hunspell/module/hunspellworker.cpp
index 584a2572..85a94888 100644
--- a/src/plugins/hunspell/module/hunspellworker.cpp
+++ b/src/plugins/hunspell/module/hunspellworker.cpp
@@ -125,7 +125,7 @@ void HunspellBuildSuggestionsTask::run()
suggestCapitalization = true;
}
/* Prioritize word completions, missing punctuation or missing accents */
- } else if ((normalizedWordCandidate.length() > word.length() &&
+ } else if ((normalizedWordCandidate.size() > word.size() &&
normalizedWordCandidate.startsWith(word)) ||
wordCandidate.contains(QLatin1Char('\''))) {
wordList->insertWord(lastWordCompletionIndex++, wordCandidate);
@@ -184,30 +184,30 @@ int HunspellBuildSuggestionsTask::levenshteinDistance(const QString &s, const QS
{
if (s == t)
return 0;
- if (s.length() == 0)
- return t.length();
- if (t.length() == 0)
- return s.length();
- QList<int> v0(t.length() + 1);
- QList<int> v1(t.length() + 1);
+ if (s.size() == 0)
+ return t.size();
+ if (t.size() == 0)
+ return s.size();
+ QList<int> v0(t.size() + 1);
+ QList<int> v1(t.size() + 1);
for (int i = 0; i < v0.size(); i++)
v0[i] = i;
for (int i = 0; i < s.size(); i++) {
v1[0] = i + 1;
- for (int j = 0; j < t.length(); j++) {
+ for (int j = 0; j < t.size(); j++) {
int cost = (s[i].toLower() == t[j].toLower()) ? 0 : 1;
v1[j + 1] = qMin(qMin(v1[j] + 1, v0[j + 1] + 1), v0[j] + cost);
}
for (int j = 0; j < v0.size(); j++)
v0[j] = v1[j];
}
- return v1[t.length()];
+ return v1[t.size()];
}
QString HunspellBuildSuggestionsTask::removeAccentsAndDiacritics(const QString& s)
{
QString normalized = s.normalized(QString::NormalizationForm_D);
- for (int i = 0; i < normalized.length();) {
+ for (int i = 0; i < normalized.size();) {
QChar::Category category = normalized[i].category();
if (category <= QChar::Mark_Enclosing) {
normalized.remove(i, 1);
@@ -238,7 +238,7 @@ void HunspellAddWordTask::run()
tmpWord.reserve(64);
for (int i = 0, count = wordList->size(); i < count; ++i) {
const QString word(wordList->wordAt(i));
- if (word.length() < 2)
+ if (word.size() < 2)
continue;
Hunspell_add(hunspell, QByteArray { fromUtf16(word) }.constData());
if (HunspellAddWordTask::alternativeForm(word, tmpWord))
@@ -248,7 +248,7 @@ void HunspellAddWordTask::run()
bool HunspellAddWordTask::alternativeForm(const QString &word, QString &alternativeForm)
{
- if (word.length() < 2)
+ if (word.size() < 2)
return false;
if (!word.mid(1).isLower())
return false;
diff --git a/src/plugins/myscript/plugin/myscriptinputmethod.cpp b/src/plugins/myscript/plugin/myscriptinputmethod.cpp
index 90b84ddf..9f1559ef 100644
--- a/src/plugins/myscript/plugin/myscriptinputmethod.cpp
+++ b/src/plugins/myscript/plugin/myscriptinputmethod.cpp
@@ -243,7 +243,7 @@ public:
m_itemIndex = -1;
- for (int i = 0; i < m_items.count(); i++) {
+ for (int i = 0; i < m_items.size(); i++) {
CandidateItem *candidateItem = m_items.at(i).second;
delete candidateItem;
}
@@ -1035,7 +1035,7 @@ int MyScriptInputMethod::selectionListItemCount(QVirtualKeyboardSelectionListMod
if (type != QVirtualKeyboardSelectionListModel::Type::WordCandidateList)
return 0;
- return d->wordCandidates.count();
+ return d->wordCandidates.size();
}
QVariant MyScriptInputMethod::selectionListData(QVirtualKeyboardSelectionListModel::Type type, int index, QVirtualKeyboardSelectionListModel::Role role)
diff --git a/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/kanaconverter.cpp b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/kanaconverter.cpp
index 2b200b9e..f29efe94 100644
--- a/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/kanaconverter.cpp
+++ b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/kanaconverter.cpp
@@ -50,7 +50,7 @@ public:
static bool createCandidateString(const QString &input, const WnnLookupTable &map, QString &outBuf)
{
outBuf.clear();
- for (int index = 0, length = input.length(); index < length; index++) {
+ for (int index = 0, length = input.size(); index < length; index++) {
QString out = map.value(input.mid(index, 1));
if (out.isEmpty())
return false;
@@ -167,7 +167,7 @@ QList<WnnWord> KanaConverter::createPseudoCandidateList(const QString &inputHira
Q_D(KanaConverter);
QList<WnnWord> list;
- if (inputHiragana.length() == 0) {
+ if (inputHiragana.size() == 0) {
return list;
}
diff --git a/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/openwnnclauseconverterjajp.cpp b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/openwnnclauseconverterjajp.cpp
index e948456f..1e033aa6 100644
--- a/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/openwnnclauseconverterjajp.cpp
+++ b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/openwnnclauseconverterjajp.cpp
@@ -49,7 +49,7 @@ public:
/* get clauses with ancillary word */
int max = CLAUSE_COST * 2;
- for (int split = 1; split < input.length(); split++) {
+ for (int split = 1; split < input.size(); split++) {
/* get ancillary patterns */
QString str = input.mid(split);
QList<WnnWord> fzks = getAncillaryPattern(str);
@@ -147,7 +147,7 @@ public:
QList<WnnWord> getAncillaryPattern(const QString &input)
{
- if (input.length() == 0) {
+ if (input.size() == 0) {
return QList<WnnWord>();
}
@@ -161,7 +161,7 @@ public:
dict->clearApproxPattern();
dict->setDictionary(6, 400, 500);
- for (int start = input.length() - 1; start >= 0; start--) {
+ for (int start = input.size() - 1; start >= 0; start--) {
QString key = input.mid(start);
if (mFzkPatterns.contains(key)) {
@@ -178,7 +178,7 @@ public:
}
/* concatenate sequence of ancillary words */
- for (int end = input.length() - 1; end > start; end--) {
+ for (int end = input.size() - 1; end > start; end--) {
QString followKey = input.mid(end);
if (!mFzkPatterns.contains(followKey))
continue;
@@ -204,7 +204,7 @@ public:
QList<WnnWord> getIndependentWords(const QString &input, bool all)
{
- if (input.length() == 0)
+ if (input.size() == 0)
return QList<WnnWord>();
QMap<QString, QList<WnnWord> > &wordBag = all ? mAllIndepWordBag : mIndepWordBag;
@@ -261,12 +261,12 @@ public:
void addAutoGeneratedCandidates(const QString &input, QList<WnnWord> &wordList, bool all)
{
Q_UNUSED(all);
- wordList.append(WnnWord(input, input, mPosDefault, (CLAUSE_COST - 1) * input.length()));
+ wordList.append(WnnWord(input, input, mPosDefault, (CLAUSE_COST - 1) * input.size()));
}
WnnClause defaultClause(const QString &input)
{
- return WnnClause(input, input, mPosDefault, (CLAUSE_COST - 1) * input.length());
+ return WnnClause(input, input, mPosDefault, (CLAUSE_COST - 1) * input.size());
}
/** Score(frequency value) of word in the learning dictionary */
@@ -351,7 +351,7 @@ QList<WnnClause> OpenWnnClauseConverterJAJP::convert(const QString &input)
return convertResult;
/* do nothing if the length of input exceeds the limit */
- if (input.length() > OpenWnnClauseConverterJAJPPrivate::MAX_INPUT_LENGTH)
+ if (input.size() > OpenWnnClauseConverterJAJPPrivate::MAX_INPUT_LENGTH)
return convertResult;
/* try single clause conversion */
@@ -367,18 +367,18 @@ QSharedPointer<WnnSentence> OpenWnnClauseConverterJAJP::consecutiveClauseConvert
/* clear the cache which is not matched */
QList<QSharedPointer<WnnSentence> > sentence;
- for (int i = 0; i < input.length(); i++) {
+ for (int i = 0; i < input.size(); i++) {
sentence.append(QSharedPointer<WnnSentence>());
}
/* consecutive clause conversion */
- for (int start = 0; start < input.length(); start++) {
+ for (int start = 0; start < input.size(); start++) {
if (start != 0 && sentence[start - 1] == NULL) {
continue;
}
/* limit the length of a clause */
- int end = input.length();
+ int end = input.size();
if (end > start + 20) {
end = start + 20;
}
@@ -403,7 +403,7 @@ QSharedPointer<WnnSentence> OpenWnnClauseConverterJAJP::consecutiveClauseConvert
QString key = input.mid(start, end - start);
clauses.clear();
- if (end == input.length()) {
+ if (end == input.size()) {
/* get the clause which can be the end of the sentence */
d->singleClauseConvert(clauses, key, d->mPosEndOfClause1, false);
} else {
@@ -424,8 +424,8 @@ QSharedPointer<WnnSentence> OpenWnnClauseConverterJAJP::consecutiveClauseConvert
}
/* return the result of the consecutive clause conversion */
- if (sentence[input.length() - 1] != NULL) {
- return sentence[input.length() - 1];
+ if (sentence[input.size() - 1] != NULL) {
+ return sentence[input.size() - 1];
}
return QSharedPointer<WnnSentence>();
}
diff --git a/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/openwnndictionary.cpp b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/openwnndictionary.cpp
index abcf060c..871a58f4 100644
--- a/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/openwnndictionary.cpp
+++ b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/openwnndictionary.cpp
@@ -340,7 +340,7 @@ public:
return NJ_SET_ERR_VAL(NJ_FUNC_SEARCH_WORD, NJ_ERR_INVALID_PARAM);
}
- if (keyString.length() > NJ_MAX_LEN) {
+ if (keyString.size() > NJ_MAX_LEN) {
/* If too long key string was specified, return "No result is found" */
work.flag &= ~NJ_JNI_FLAG_ENABLE_CURSOR;
work.flag &= ~NJ_JNI_FLAG_ENABLE_RESULT;
@@ -468,8 +468,8 @@ public:
int setApproxPattern(const QString &src, const QString &dst)
{
- if (src.isEmpty() || src.length() > 1 ||
- dst.isEmpty() || dst.length() > 3) {
+ if (src.isEmpty() || src.size() > 1 ||
+ dst.isEmpty() || dst.size() > 3) {
/* If a invalid parameter was specified, return an error code */
return NJ_SET_ERR_VAL(NJ_FUNC_SET_APPROX_PATTERN, NJ_ERR_INVALID_PARAM);
}
@@ -543,7 +543,7 @@ public:
QStringList getApproxPattern(const QString &src)
{
- if (src.isEmpty() || src.length() > 1)
+ if (src.isEmpty() || src.size() > 1)
return QStringList();
NJ_CHAR from[NJ_MAX_CHARSET_FROM_LEN + NJ_TERM_LEN];
@@ -614,7 +614,7 @@ public:
return NJ_SET_ERR_VAL(NJ_FUNC_SET_STROKE, NJ_ERR_INVALID_PARAM);
}
- if (stroke.length() > NJ_MAX_LEN) {
+ if (stroke.size() > NJ_MAX_LEN) {
/* If a invalid parameter was specified, return an error code */
return NJ_SET_ERR_VAL(NJ_FUNC_SET_STROKE, NJ_ERR_YOMI_TOO_LONG);
}
@@ -632,7 +632,7 @@ public:
return NJ_SET_ERR_VAL(NJ_FUNC_SET_CANDIDATE, NJ_ERR_INVALID_PARAM);
}
- if (candidate.length() > NJ_MAX_RESULT_LEN) {
+ if (candidate.size() > NJ_MAX_RESULT_LEN) {
/* If a invalid parameter was specified, return an error code */
return NJ_SET_ERR_VAL(NJ_FUNC_SET_CANDIDATE, NJ_ERR_CANDIDATE_TOO_LONG);
}
diff --git a/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/openwnnenginejajp.cpp b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/openwnnenginejajp.cpp
index f66d4942..1a13f72d 100644
--- a/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/openwnnenginejajp.cpp
+++ b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/openwnnenginejajp.cpp
@@ -143,7 +143,7 @@ public:
bool addCandidate(QSharedPointer<WnnWord> word)
{
if (word.isNull() || word->candidate.isEmpty() || mCandTable.contains(word->candidate)
- || word->candidate.length() > OpenWnnEngineJAJP::MAX_OUTPUT_LENGTH) {
+ || word->candidate.size() > OpenWnnEngineJAJP::MAX_OUTPUT_LENGTH) {
return false;
}
/*
@@ -170,14 +170,14 @@ public:
int setSearchKey(const ComposingText &text, int maxLen)
{
QString input = text.toString(ComposingText::LAYER1);
- if (0 <= maxLen && maxLen <= input.length()) {
+ if (0 <= maxLen && maxLen <= input.size()) {
input = input.mid(0, maxLen);
mExactMatchMode = true;
} else {
mExactMatchMode = false;
}
- if (input.length() == 0) {
+ if (input.size() == 0) {
mInputHiragana.clear();
mInputRomaji.clear();
return 0;
@@ -186,7 +186,7 @@ public:
mInputHiragana = input;
mInputRomaji = text.toString(ComposingText::LAYER0);
- return input.length();
+ return input.size();
}
void clearPreviousWord()
@@ -292,7 +292,7 @@ int OpenWnnEngineJAJP::convert(ComposingText &text)
}
QSharedPointer<WnnSentence> sentence;
- if (input.length() != 0) {
+ if (input.size() != 0) {
sentence = d->mClauseConverter.consecutiveClauseConvert(input);
}
if (!head.isNull()) {
@@ -307,7 +307,7 @@ int OpenWnnEngineJAJP::convert(ComposingText &text)
for (QList<WnnClause>::ConstIterator it = sentence->elements.constBegin();
it != sentence->elements.constEnd(); it++) {
const WnnClause &clause = *it;
- int len = clause.stroke.length();
+ int len = clause.stroke.size();
ss.append(StrSegment(clause, pos, pos + len - 1));
pos += len;
}
diff --git a/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/romkan.cpp b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/romkan.cpp
index 3a555e2b..f3be31d6 100644
--- a/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/romkan.cpp
+++ b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/romkan.cpp
@@ -126,20 +126,20 @@ bool Romkan::convertImpl(ComposingText &text, const WnnLookupTable &table) const
for (int i = start; i < RomkanPrivate::MAX_LENGTH; i++) {
key.append(str[i].string);
}
- bool upper = key.at(key.length() - 1).isUpper();
+ bool upper = key.at(key.size() - 1).isUpper();
QString match = table[key.toLower()];
if (!match.isEmpty()) {
if (upper) {
match = match.toUpper();
}
QList<StrSegment> out;
- if (match.length() == 1) {
+ if (match.size() == 1) {
out.append(StrSegment(match, str[start].from, str[RomkanPrivate::MAX_LENGTH - 1].to));
text.replaceStrSegment(ComposingText::LAYER1, out, RomkanPrivate::MAX_LENGTH - start);
} else {
- out.append(StrSegment(match.left(match.length() - 1),
+ out.append(StrSegment(match.left(match.size() - 1),
str[start].from, str[RomkanPrivate::MAX_LENGTH - 1].to - 1));
- out.append(StrSegment(match.mid(match.length() - 1),
+ out.append(StrSegment(match.mid(match.size() - 1),
str[RomkanPrivate::MAX_LENGTH - 1].to, str[RomkanPrivate::MAX_LENGTH - 1].to));
text.replaceStrSegment(ComposingText::LAYER1, out, RomkanPrivate::MAX_LENGTH - start);
}
diff --git a/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/wnnlookuptable.cpp b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/wnnlookuptable.cpp
index a9dc5dda..cd094295 100644
--- a/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/wnnlookuptable.cpp
+++ b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/wnnlookuptable.cpp
@@ -54,7 +54,7 @@ void WnnLookupTable::create(const QMap<QString, QString> &map, const QString &ta
std::sort(keys.begin(), keys.end(), [] (const QString &lhs, const QString &rhs) {
return strcmp(lhs.toUtf8().constData(), rhs.toUtf8().constData()) < 0;
});
- file.write(QString("static const int %1Length = %2;\n").arg(tablePrefix).arg(keys.count()).toUtf8().constData());
+ file.write(QString("static const int %1Length = %2;\n").arg(tablePrefix).arg(keys.size()).toUtf8().constData());
file.write(QString("static const char *%1Key[%1Length];\n").arg(tablePrefix).toUtf8().constData());
file.write(QString("static const char *%1Value[%1Length];\n").arg(tablePrefix).toUtf8().constData());
file.write(QString("const char *%1Key[] = {\n").arg(tablePrefix).toUtf8().constData());
diff --git a/src/plugins/openwnn/openwnninputmethod.cpp b/src/plugins/openwnn/openwnninputmethod.cpp
index d07b8e3f..745edd14 100644
--- a/src/plugins/openwnn/openwnninputmethod.cpp
+++ b/src/plugins/openwnn/openwnninputmethod.cpp
@@ -203,7 +203,7 @@ public:
} else if (layer == ComposingText::LAYER2) {
- highlightEnd = composingText.toString(layer, 0, 0).length();
+ highlightEnd = composingText.toString(layer, 0, 0).size();
/* highlights the first segment */
QTextCharFormat textFormat;
@@ -212,20 +212,20 @@ public:
attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, 0, highlightEnd, textFormat));
}
- if (highlightEnd != 0 && highlightEnd < displayText.length()) {
+ if (highlightEnd != 0 && highlightEnd < displayText.size()) {
/* highlights remaining text */
QTextCharFormat textFormat;
textFormat.setBackground(QBrush(QColor(0xF0, 0xFF, 0xFF)));
textFormat.setForeground(QBrush(Qt::black));
- attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, highlightEnd, displayText.length() - highlightEnd, textFormat));
+ attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, highlightEnd, displayText.size() - highlightEnd, textFormat));
}
}
QTextCharFormat textFormat;
textFormat.setUnderlineStyle(QTextCharFormat::SingleUnderline);
- attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, 0, displayText.length(), textFormat));
+ attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, 0, displayText.size(), textFormat));
- int displayCursor = composingText.toString(layer, 0, cursor - 1).length();
+ int displayCursor = composingText.toString(layer, 0, cursor - 1).size();
attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, displayCursor, 1, QVariant()));
Q_Q(OpenWnnInputMethod);
@@ -251,7 +251,7 @@ public:
displayCandidates();
} else {
composingText.setCursor(ComposingText::LAYER1,
- composingText.toString(ComposingText::LAYER1).length());
+ composingText.toString(ComposingText::LAYER1).size());
clearCandidates();
}
break;
@@ -479,7 +479,7 @@ public:
{
if (str.isEmpty())
return false;
- ushort ch = str.at(str.length() - 1).unicode();
+ ushort ch = str.at(str.size() - 1).unicode();
return (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z');
}
@@ -661,7 +661,7 @@ bool OpenWnnInputMethod::keyEvent(Qt::Key key, const QString &text, Qt::Keyboard
if (d->composingText.size(ComposingText::LAYER1) > 0) {
if (d->activeConvertType == OpenWnnInputMethodPrivate::CONVERT_TYPE_RENBUN) {
d->composingText.setCursor(ComposingText::LAYER1,
- d->composingText.toString(ComposingText::LAYER1).length());
+ d->composingText.toString(ComposingText::LAYER1).size());
d->exactMatchMode = false;
d->clearFocusCandidate();
} else {
diff --git a/src/plugins/pinyin/pinyindecoderservice.cpp b/src/plugins/pinyin/pinyindecoderservice.cpp
index 8e809ff6..9613dd9e 100644
--- a/src/plugins/pinyin/pinyindecoderservice.cpp
+++ b/src/plugins/pinyin/pinyindecoderservice.cpp
@@ -103,7 +103,7 @@ void PinyinDecoderService::setLimits(int maxSpsLen, int maxHzsLen)
int PinyinDecoderService::search(const QString &spelling)
{
QByteArray spellingBuf = spelling.toLatin1();
- return int(im_search(spellingBuf.constData(), spellingBuf.length()));
+ return int(im_search(spellingBuf.constData(), spellingBuf.size()));
}
int PinyinDecoderService::deleteSearch(int pos, bool isPosInSpellingId, bool clearFixedInThisStep)
@@ -157,7 +157,7 @@ QString PinyinDecoderService::candidateAt(int index)
Q_ASSERT(index >= 0);
QList<QChar> candidateBuf;
candidateBuf.resize(kMaxSearchSteps + 1);
- if (!im_get_candidate(size_t(index), (char16 *)candidateBuf.data(), candidateBuf.length() - 1))
+ if (!im_get_candidate(size_t(index), (char16 *)candidateBuf.data(), candidateBuf.size() - 1))
return QString();
candidateBuf.last() = u'\0';
return QString(candidateBuf.data());
diff --git a/src/plugins/pinyin/pinyininputmethod.cpp b/src/plugins/pinyin/pinyininputmethod.cpp
index 297da328..cec2a659 100644
--- a/src/plugins/pinyin/pinyininputmethod.cpp
+++ b/src/plugins/pinyin/pinyininputmethod.cpp
@@ -91,8 +91,8 @@ public:
if (surface.isEmpty())
return false;
QList<int> splStart = pinyinDecoderService->spellingStartPositions();
- isPosInSpl = (surface.length() <= splStart[fixedLen + 1]);
- posDelSpl = isPosInSpl ? fixedLen - 1 : surface.length() - 1;
+ isPosInSpl = (surface.size() <= splStart[fixedLen + 1]);
+ posDelSpl = isPosInSpl ? fixedLen - 1 : surface.size() - 1;
return true;
}
@@ -105,8 +105,8 @@ public:
else
chooseDecodingCandidate(candId);
- if (composingStr.length() > 0) {
- if ((candId >= 0 || finishSelection) && composingStr.length() == fixedLen) {
+ if (composingStr.size() > 0) {
+ if ((candId >= 0 || finishSelection) && composingStr.size() == fixedLen) {
QString resultStr = getComposingStrActivePart();
q->inputContext()->commit(resultStr);
tryPredict();
@@ -144,7 +144,7 @@ public:
candidatesList.append(pinyinDecoderService->fetchCandidates(candidatesList.size(), fetchMore, fixedLen));
if (index == 0 && totalChoicesNum == 1) {
int surfaceDecodedLen = pinyinDecoderService->pinyinStringLength(true);
- if (surfaceDecodedLen < surface.length())
+ if (surfaceDecodedLen < surface.size())
candidatesList[0] = candidatesList[0] + surface.mid(surfaceDecodedLen).toLower();
}
}
@@ -158,7 +158,7 @@ public:
int result = 0;
if (candId < 0) {
- if (surface.length() > 0) {
+ if (surface.size() > 0) {
if (posDelSpl < 0) {
result = pinyinDecoderService->search(surface);
} else {
@@ -172,7 +172,7 @@ public:
} else {
QString resultStr;
if (totalChoicesNum == 1) {
- QString undecodedStr = candId < candidatesList.length() ? candidatesList.at(candId) : QString();
+ QString undecodedStr = candId < candidatesList.size() ? candidatesList.at(candId) : QString();
resultStr = pinyinDecoderService->candidateAt(0).mid(0, fixedLen) + undecodedStr;
}
resetToIdleState();
@@ -190,7 +190,7 @@ public:
QString fullSent = pinyinDecoderService->candidateAt(0);
fixedLen = pinyinDecoderService->fixedLength();
composingStr = fullSent.mid(0, fixedLen) + surface.mid(splStart[fixedLen + 1]);
- activeCmpsLen = composingStr.length();
+ activeCmpsLen = composingStr.size();
// Prepare the display string.
QString composingStrDisplay;
@@ -200,14 +200,14 @@ public:
if (!totalChoicesNum)
totalChoicesNum = 1;
} else {
- activeCmpsLen = activeCmpsLen - (surface.length() - surfaceDecodedLen);
+ activeCmpsLen = activeCmpsLen - (surface.size() - surfaceDecodedLen);
composingStrDisplay = fullSent.mid(0, fixedLen);
for (int pos = fixedLen + 1; pos < splStart.size() - 1; pos++) {
composingStrDisplay += surface.mid(splStart[pos], splStart[pos + 1] - splStart[pos]);
if (splStart[pos + 1] < surfaceDecodedLen)
composingStrDisplay += QLatin1String(" ");
}
- if (surfaceDecodedLen < surface.length())
+ if (surfaceDecodedLen < surface.size())
composingStrDisplay += surface.mid(surfaceDecodedLen);
}
q->inputContext()->setPreeditText(composingStrDisplay);
@@ -232,7 +232,7 @@ public:
totalChoicesNum = 1;
surface.clear();
- fixedLen = tmp.length();
+ fixedLen = tmp.size();
composingStr = tmp;
activeCmpsLen = fixedLen;
@@ -265,7 +265,7 @@ public:
Q_Q(PinyinInputMethod);
QVirtualKeyboardInputContext *inputContext = q->inputContext();
return inputMode == QVirtualKeyboardInputEngine::InputMode::Pinyin &&
- composingStr.length() == fixedLen &&
+ composingStr.size() == fixedLen &&
inputContext &&
!inputContext->inputMethodHints().testFlag(Qt::ImhNoPredictiveText);
}
diff --git a/src/plugins/tcime/3rdparty/tcime/phrasedictionary.cpp b/src/plugins/tcime/3rdparty/tcime/phrasedictionary.cpp
index 6bc62d84..3c6f6de1 100644
--- a/src/plugins/tcime/3rdparty/tcime/phrasedictionary.cpp
+++ b/src/plugins/tcime/3rdparty/tcime/phrasedictionary.cpp
@@ -30,7 +30,7 @@ PhraseDictionary::PhraseDictionary() :
QStringList PhraseDictionary::getWords(const QString &input) const
{
- if (input.length() != 1)
+ if (input.size() != 1)
return QStringList();
// Phrases are stored in an array consisting of three character arrays.
@@ -42,7 +42,7 @@ QStringList PhraseDictionary::getWords(const QString &input) const
// char[1][] { 0, 2, 4 }
// char[2][] { a, a', b, b', c}
const Dictionary &dict = dictionary();
- if (dict.length() != 3)
+ if (dict.size() != 3)
return QStringList();
const DictionaryEntry &words = dict[0];
@@ -55,8 +55,8 @@ QStringList PhraseDictionary::getWords(const QString &input) const
const DictionaryEntry &offsets = dict[1];
const DictionaryEntry &phrases = dict[2];
int offset = (int)offsets[index].unicode();
- int count = (index < offsets.length() - 1) ?
- ((int)offsets[index + 1].unicode() - offset) : (phrases.length() - offset);
+ int count = (index < offsets.size() - 1) ?
+ ((int)offsets[index + 1].unicode() - offset) : (phrases.size() - offset);
QStringList result;
for (int i = 0; i < count; ++i)
diff --git a/src/plugins/tcime/3rdparty/tcime/zhuyintable.cpp b/src/plugins/tcime/3rdparty/tcime/zhuyintable.cpp
index ce68618b..b7baef78 100644
--- a/src/plugins/tcime/3rdparty/tcime/zhuyintable.cpp
+++ b/src/plugins/tcime/3rdparty/tcime/zhuyintable.cpp
@@ -66,11 +66,11 @@ int ZhuyinTable::getInitials(QChar initials) noexcept
int ZhuyinTable::getFinals(QStringView finals) noexcept
{
- if (finals.length() == 0)
+ if (finals.size() == 0)
// Syllables ending with no finals can still be valid.
return 0;
- if (finals.length() > 2)
+ if (finals.size() > 2)
return -1;
// Compute the index instead of direct lookup the whole array to save
@@ -96,7 +96,7 @@ int ZhuyinTable::getFinals(QStringView finals) noexcept
return -1;
}
- if (finals.length() == 1)
+ if (finals.size() == 1)
return index;
for (int i = 0; i < endingFinals.size(); ++i) {
diff --git a/src/plugins/tcime/tcinputmethod.cpp b/src/plugins/tcime/tcinputmethod.cpp
index ebb3b18c..c887062a 100644
--- a/src/plugins/tcime/tcinputmethod.cpp
+++ b/src/plugins/tcime/tcinputmethod.cpp
@@ -59,7 +59,7 @@ public:
QString pickHighlighted() const
{
- return (highlightIndex >= 0 && highlightIndex < candidates.count()) ? candidates[highlightIndex] : QString();
+ return (highlightIndex >= 0 && highlightIndex < candidates.size()) ? candidates[highlightIndex] : QString();
}
void reset()
@@ -101,7 +101,7 @@ public:
{
bool accept = false;
if (!input.contains(QChar(0x91CD)) && CangjieTable::isLetter(c)) {
- if (input.length() < (cangjieDictionary.simplified() ? CangjieTable::MAX_SIMPLIFIED_CODE_LENGTH : CangjieTable::MAX_CODE_LENGTH)) {
+ if (input.size() < (cangjieDictionary.simplified() ? CangjieTable::MAX_SIMPLIFIED_CODE_LENGTH : CangjieTable::MAX_CODE_LENGTH)) {
input.append(c);
ic->setPreeditText(input);
if (setCandidates(wordDictionary->getWords(input), true)) {
@@ -119,7 +119,7 @@ public:
}
accept = true;
} else if (c.unicode() == 0x96E3) {
- if (input.length() == 1) {
+ if (input.size() == 1) {
Q_ASSERT(input.at(0).unicode() == 0x91CD);
input.append(c);
ic->setPreeditText(input);
@@ -132,7 +132,7 @@ public:
bool checkSpecialCharInput()
{
- if (input.length() == 1 && input.at(0).unicode() == 0x91CD) {
+ if (input.size() == 1 && input.at(0).unicode() == 0x91CD) {
static const QStringList specialChars1 = QStringList()
<< QChar(0xFF01) << QChar(0x2018) << QChar(0x3000) << QChar(0xFF0C)
<< QChar(0x3001) << QChar(0x3002) << QChar(0xFF0E) << QChar(0xFF1B)
@@ -151,7 +151,7 @@ public:
}
q->inputContext()->setPreeditText(candidates[highlightIndex]);
return true;
- } else if (input.length() == 2 && input.at(0).unicode() == 0x91CD && input.at(1).unicode() == 0x96E3) {
+ } else if (input.size() == 2 && input.at(0).unicode() == 0x91CD && input.at(1).unicode() == 0x96E3) {
static const QStringList specialChars2 = QStringList()
<< QChar(0x3008) << QChar(0x3009) << QChar(0xFE31) << QChar(0x2013)
<< QChar(0xFF5C) << QChar(0x300C) << QChar(0x300D) << QChar(0xFE40)
@@ -192,12 +192,12 @@ public:
QChar tone = strippedTones.pair[1].at(0);
if (c == ZhuyinTable::DEFAULT_TONE) {
if (tone != ZhuyinTable::DEFAULT_TONE)
- input.remove(input.length() - 1, 1);
+ input.remove(input.size() - 1, 1);
} else {
if (tone == ZhuyinTable::DEFAULT_TONE)
input.append(c);
else
- input.replace(input.length() - 1, 1, c);
+ input.replace(input.size() - 1, 1, c);
}
} else if (ZhuyinTable::getInitials(c) > 0) {
// Insert the initial or replace the original initial.
@@ -255,7 +255,7 @@ public:
if (!syllables.isEmpty()) {
if (ZhuyinTable::isYiWuYuFinals(syllables.at(0))) {
results[1] = syllables.at(0);
- if (syllables.length() > 1)
+ if (syllables.size() > 1)
results[2] = syllables.at(1);
} else {
results[2] = syllables.at(0);
@@ -435,7 +435,7 @@ bool TCInputMethod::keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModif
case Qt::Key_Backspace:
if (!d->input.isEmpty()) {
- d->input.remove(d->input.length() - 1, 1);
+ d->input.remove(d->input.size() - 1, 1);
ic->setPreeditText(d->input);
#if QT_CONFIG(cangjie)
if (!d->checkSpecialCharInput()) {
@@ -455,7 +455,7 @@ bool TCInputMethod::keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModif
break;
default:
- if (text.length() == 1)
+ if (text.size() == 1)
accept = d->compose(text.at(0));
if (!accept)
update();
@@ -473,7 +473,7 @@ int TCInputMethod::selectionListItemCount(QVirtualKeyboardSelectionListModel::Ty
{
Q_UNUSED(type);
Q_D(TCInputMethod);
- return d->candidates.count();
+ return d->candidates.size();
}
QVariant TCInputMethod::selectionListData(QVirtualKeyboardSelectionListModel::Type type, int index, QVirtualKeyboardSelectionListModel::Role role)
diff --git a/src/plugins/thai/thaiinputmethod.cpp b/src/plugins/thai/thaiinputmethod.cpp
index af7fc44f..670b7958 100644
--- a/src/plugins/thai/thaiinputmethod.cpp
+++ b/src/plugins/thai/thaiinputmethod.cpp
@@ -45,7 +45,7 @@ bool ThaiInputMethod::keyEvent(Qt::Key key,
const QString &text,
Qt::KeyboardModifiers modifiers)
{
- const bool isMark = text.length() == 2 && text.at(0) == QLatin1Char(' ');
+ const bool isMark = text.size() == 2 && text.at(0) == QLatin1Char(' ');
#ifdef QT_HUNSPELLINPUTMETHOD_LIB
if (isMark) {
const QString mark(text.right(1));
diff --git a/src/styles/svgimageprovider.cpp b/src/styles/svgimageprovider.cpp
index ab34dc4e..fa8345ba 100644
--- a/src/styles/svgimageprovider.cpp
+++ b/src/styles/svgimageprovider.cpp
@@ -27,7 +27,7 @@ QPixmap SvgImageProvider::requestPixmap(const QString &id, QSize *size, const QS
QVariantMap params;
for (const QString &param : paramList) {
QStringList keyValue = param.split(QLatin1Char('='), Qt::SkipEmptyParts);
- if (keyValue.length() == 2)
+ if (keyValue.size() == 2)
params[keyValue[0]] = keyValue[1];
}
const auto widthIt = params.constFind(QLatin1String("width"));
diff --git a/src/virtualkeyboard/handwritinggesturerecognizer.cpp b/src/virtualkeyboard/handwritinggesturerecognizer.cpp
index 2d64c3f7..27254245 100644
--- a/src/virtualkeyboard/handwritinggesturerecognizer.cpp
+++ b/src/virtualkeyboard/handwritinggesturerecognizer.cpp
@@ -27,7 +27,7 @@ int HandwritingGestureRecognizer::dpi() const
QVariantMap HandwritingGestureRecognizer::recognize(const QList<QVirtualKeyboardTrace *> traceList)
{
- if (traceList.count() > 0 && traceList.count() < 3) {
+ if (traceList.size() > 0 && traceList.size() < 3) {
// Swipe gesture detection
// =======================
@@ -64,7 +64,7 @@ QVariantMap HandwritingGestureRecognizer::recognize(const QList<QVirtualKeyboard
const QVirtualKeyboardTrace *trace = traceList.at(traceIndex);
const QVariantList &points = trace->points();
QVector2D swipeVector;
- const int pointCount = points.count();
+ const int pointCount = points.size();
int pointIndex = 0;
if (pointCount >= 2) {
diff --git a/src/virtualkeyboard/qvirtualkeyboardinputcontext.cpp b/src/virtualkeyboard/qvirtualkeyboardinputcontext.cpp
index 8c1ec631..5697b23b 100644
--- a/src/virtualkeyboard/qvirtualkeyboardinputcontext.cpp
+++ b/src/virtualkeyboard/qvirtualkeyboardinputcontext.cpp
@@ -107,7 +107,7 @@ void QVirtualKeyboardInputContext::setPreeditText(const QString &text, QList<QIn
if (!d->testAttribute(attributes, QInputMethodEvent::TextFormat)) {
QTextCharFormat textFormat;
textFormat.setUnderlineStyle(QTextCharFormat::SingleUnderline);
- attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, 0, text.length(), textFormat));
+ attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, 0, text.size(), textFormat));
}
} else if (d->_forceCursorPosition != -1) {
d->addSelectionAttribute(attributes);
diff --git a/src/virtualkeyboard/qvirtualkeyboardinputcontext_p.cpp b/src/virtualkeyboard/qvirtualkeyboardinputcontext_p.cpp
index 831d823f..0d35d25e 100644
--- a/src/virtualkeyboard/qvirtualkeyboardinputcontext_p.cpp
+++ b/src/virtualkeyboard/qvirtualkeyboardinputcontext_p.cpp
@@ -225,7 +225,7 @@ void QVirtualKeyboardInputContextPrivate::forceCursorPosition(int anchorPosition
forceAnchorPosition = -1;
_forceCursorPosition = cursorPosition;
if (cursorPosition > this->cursorPosition)
- _forceCursorPosition += preeditText.length();
+ _forceCursorPosition += preeditText.size();
commit();
} else {
forceAnchorPosition = anchorPosition;
@@ -502,13 +502,13 @@ void QVirtualKeyboardInputContextPrivate::invokeAction(QInputMethod::Action acti
if (inputEngine->clickPreeditText(cursorPosition))
break;
- bool reselect = !inputMethodHints.testFlag(Qt::ImhNoPredictiveText) && selectedText.isEmpty() && cursorPosition < preeditText.length();
+ bool reselect = !inputMethodHints.testFlag(Qt::ImhNoPredictiveText) && selectedText.isEmpty() && cursorPosition < preeditText.size();
if (reselect) {
QVirtualKeyboardScopedState reselectState(this, State::Reselect);
_forceCursorPosition = this->cursorPosition + cursorPosition;
commit();
inputEngine->reselect(this->cursorPosition, QVirtualKeyboardInputEngine::ReselectFlag::WordBeforeCursor);
- } else if (!preeditText.isEmpty() && cursorPosition == preeditText.length()) {
+ } else if (!preeditText.isEmpty() && cursorPosition == preeditText.size()) {
commit();
}
}
@@ -611,7 +611,7 @@ bool QVirtualKeyboardInputContextPrivate::testAttribute(const QList<QInputMethod
int QVirtualKeyboardInputContextPrivate::findAttribute(const QList<QInputMethodEvent::Attribute> &attributes, QInputMethodEvent::AttributeType attributeType) const
{
- const int count = attributes.count();
+ const int count = attributes.size();
for (int i = 0; i < count; ++i) {
if (attributes.at(i).type == attributeType)
return i;
diff --git a/src/virtualkeyboard/qvirtualkeyboardselectionlistmodel.cpp b/src/virtualkeyboard/qvirtualkeyboardselectionlistmodel.cpp
index 0ccffe34..9cece734 100644
--- a/src/virtualkeyboard/qvirtualkeyboardselectionlistmodel.cpp
+++ b/src/virtualkeyboard/qvirtualkeyboardselectionlistmodel.cpp
@@ -296,7 +296,7 @@ void QVirtualKeyboardSelectionListModel::selectionListChanged(QVirtualKeyboardSe
if (static_cast<QVirtualKeyboardSelectionListModel::Type>(type) == QVirtualKeyboardSelectionListModel::Type::WordCandidateList)
d->wclAutoCommitWord = ((oldCount > 1 || (oldCount == 1 && d->wclAutoCommitWord)) && newCount == 1 &&
Settings::instance()->wclAutoCommitWord() &&
- dataAt(0).toString().length() > 1);
+ dataAt(0).toString().size() > 1);
if (d->rowCount != oldCount)
emit countChanged();
}
diff --git a/src/virtualkeyboard/shadowinputcontext.cpp b/src/virtualkeyboard/shadowinputcontext.cpp
index 78138eab..72c0c90f 100644
--- a/src/virtualkeyboard/shadowinputcontext.cpp
+++ b/src/virtualkeyboard/shadowinputcontext.cpp
@@ -185,7 +185,7 @@ void ShadowInputContext::update(Qt::InputMethodQueries queries)
newCursorPosition - newAnchorPosition, QVariant()));
QInputMethodEvent inputEvent(QString(), attributes);
if (updateSurroundingText)
- inputEvent.setCommitString(newSurroundingText, -cursorPosition, surroundingText.length());
+ inputEvent.setCommitString(newSurroundingText, -cursorPosition, surroundingText.size());
QGuiApplication::sendEvent(d->inputItem, &inputEvent);
}
diff --git a/src/virtualkeyboard/shifthandler.cpp b/src/virtualkeyboard/shifthandler.cpp
index 13e44c31..559f9752 100644
--- a/src/virtualkeyboard/shifthandler.cpp
+++ b/src/virtualkeyboard/shifthandler.cpp
@@ -281,7 +281,7 @@ void ShiftHandler::autoCapitalize()
} else { // space after sentence-ending character triggers auto-capitalization
QString text = d->inputContext->surroundingText();
text.truncate(cursorPosition);
- if (text.trimmed().length() == 0)
+ if (text.trimmed().size() == 0)
setShiftActive(!preferLowerCase);
else if (text.endsWith(QLatin1Char(' ')))
setShiftActive(d->sentenceEndingCharacters.contains(QStringView{text}.right(2)[0])
diff --git a/tests/auto/dictionarymanager/tst_dictionarymanager.cpp b/tests/auto/dictionarymanager/tst_dictionarymanager.cpp
index 538b2bfb..8c7c4c06 100644
--- a/tests/auto/dictionarymanager/tst_dictionarymanager.cpp
+++ b/tests/auto/dictionarymanager/tst_dictionarymanager.cpp
@@ -29,7 +29,7 @@ void tst_dictionarymanager::testCreateDictionary()
QVERIFY(dictionarySpy.isValid());
QStringList wordList = QStringList() << "myword";
dictionary->setContents(wordList);
- QCOMPARE(dictionarySpy.count(), 1);
+ QCOMPARE(dictionarySpy.size(), 1);
QVERIFY(dictionaryManager->availableDictionaries().contains("custom"));
}
diff --git a/tests/manual/x11vkbwrapper/handleatspievents.cpp b/tests/manual/x11vkbwrapper/handleatspievents.cpp
index b71ab88a..7b2c0743 100644
--- a/tests/manual/x11vkbwrapper/handleatspievents.cpp
+++ b/tests/manual/x11vkbwrapper/handleatspievents.cpp
@@ -113,7 +113,7 @@ void HandleATSPIEvents::setKeyboardVisible(const bool visible)
void HandleATSPIEvents::storeFocusElement(const qint8 role)
{
m_focuses.append(role);
- qCDebug(lcHandleAtspiEvents) << "*****INSERTED FOCUS ELEMENT*****" << role << "TOTAL:" << m_focuses.length();
+ qCDebug(lcHandleAtspiEvents) << "*****INSERTED FOCUS ELEMENT*****" << role << "TOTAL:" << m_focuses.size();
}
/**