summaryrefslogtreecommitdiff
path: root/src/pdfquick
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2022-10-05 08:22:39 +0200
committerMarc Mutz <marc.mutz@qt.io>2022-10-11 17:36:36 +0200
commit39ebe4abccdc4e059a0e310a331f3fc392c84009 (patch)
treeaeca91ed813d6675693fcb9e71d8336c3d303cab /src/pdfquick
parent555beb85735f8ce92fdbff7358a6659820e4819c (diff)
downloadqtwebengine-39ebe4abccdc4e059a0e310a331f3fc392c84009.tar.gz
Port from container::count() and length() to size() - V4
This is a semantic patch using ClangTidyTransformator as in qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8, but extended to handle typedefs and accesses through pointers, too: const std::string o = "object"; auto hasTypeIgnoringPointer = [](auto type) { return anyOf(hasType(type), hasType(pointsTo(type))); }; auto derivedFromAnyOfClasses = [&](ArrayRef<StringRef> classes) { auto exprOfDeclaredType = [&](auto decl) { return expr(hasTypeIgnoringPointer(hasUnqualifiedDesugaredType(recordType(hasDeclaration(decl))))).bind(o); }; return exprOfDeclaredType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes)))); }; auto renameMethod = [&] (ArrayRef<StringRef> classes, StringRef from, StringRef to) { return makeRule(cxxMemberCallExpr(on(derivedFromAnyOfClasses(classes)), callee(cxxMethodDecl(hasName(from), parameterCountIs(0)))), changeTo(cat(access(o, cat(to)), "()")), cat("use '", to, "' instead of '", from, "'")); }; renameMethod(<classes>, "count", "size"); renameMethod(<classes>, "length", "size"); a.k.a qt-port-to-std-compatible-api V4 with config Scope: 'Container'. Change-Id: I3e6fef8eca212da0c4f0b464545ba96183b4476f Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/pdfquick')
-rw-r--r--src/pdfquick/qquickpdfselection.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/pdfquick/qquickpdfselection.cpp b/src/pdfquick/qquickpdfselection.cpp
index ff50bcb23..4776cb8b4 100644
--- a/src/pdfquick/qquickpdfselection.cpp
+++ b/src/pdfquick/qquickpdfselection.cpp
@@ -188,12 +188,12 @@ void QQuickPdfSelection::keyReleaseEvent(QKeyEvent *ev)
return;
// iOS sends MoveToPreviousWord first to get to the beginning of the word,
// and then SelectNextWord to select the whole word.
- int i = allText.lastIndexOf(WordDelimiter, m_fromCharIndex - allText.length());
+ int i = allText.lastIndexOf(WordDelimiter, m_fromCharIndex - allText.size());
if (i < 0)
i = 0;
else
i += 1; // don't select the space before the word
- auto sel = m_document->document()->getSelectionAtIndex(m_page, i, m_text.length() + m_fromCharIndex - i);
+ auto sel = m_document->document()->getSelectionAtIndex(m_page, i, m_text.size() + m_fromCharIndex - i);
update(sel);
QGuiApplication::inputMethod()->update(Qt::ImAnchorRectangle);
} else if (ev == QKeySequence::SelectNextWord) {
@@ -201,8 +201,8 @@ void QQuickPdfSelection::keyReleaseEvent(QKeyEvent *ev)
return;
int i = allText.indexOf(WordDelimiter, m_toCharIndex);
if (i < 0)
- i = allText.length(); // go to the end of m_textAfter
- auto sel = m_document->document()->getSelectionAtIndex(m_page, m_fromCharIndex, m_text.length() + i - m_toCharIndex);
+ i = allText.size(); // go to the end of m_textAfter
+ auto sel = m_document->document()->getSelectionAtIndex(m_page, m_fromCharIndex, m_text.size() + i - m_toCharIndex);
update(sel);
QGuiApplication::inputMethod()->update(Qt::ImCursorRectangle);
} else if (ev == QKeySequence::Copy) {