summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Kudryavtsev <[email protected]>2023-10-04 14:40:40 +0300
committerQt Cherry-pick Bot <[email protected]>2023-10-06 17:42:51 +0000
commitcf5519e983123b787990b688f7c702744c8837c7 (patch)
tree3af08675b3c875e667a1f9a204789868ba7fcc6e
parent4bb9f9f48da1d29718f1ece8a11c748c8b415c69 (diff)
qtextdocument: use qsizetype more
in Qt::mightBeRichText, Qt::convertFromPlainText and emitFrameStyle to support large strings Pick-to: 6.2 Change-Id: I7187bd81d3cbcc11ba898e015bd2a8ec64e3bf34 Reviewed-by: MÃ¥rten Nordheim <[email protected]> (cherry picked from commit 33d606412d8c2dc9ad3c0129af5bc8a74ce650be) Reviewed-by: Qt Cherry-pick Bot <[email protected]> (cherry picked from commit f4cd637c8a13310e5952c30677ce144ec3d22633)
-rw-r--r--src/gui/text/qtextdocument.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp
index a6675422cd3..1c61416376e 100644
--- a/src/gui/text/qtextdocument.cpp
+++ b/src/gui/text/qtextdocument.cpp
@@ -65,7 +65,7 @@ bool Qt::mightBeRichText(const QString& text)
{
if (text.isEmpty())
return false;
- int start = 0;
+ qsizetype start = 0;
while (start < text.size() && text.at(start).isSpace())
++start;
@@ -88,7 +88,7 @@ bool Qt::mightBeRichText(const QString& text)
if (QStringView{text}.mid(start, 5).compare("<!doc"_L1, Qt::CaseInsensitive) == 0)
return true;
- int open = start;
+ qsizetype open = start;
while (open < text.size() && text.at(open) != u'<'
&& text.at(open) != u'\n') {
if (text.at(open) == u'&' && QStringView{text}.mid(open + 1, 3) == "lt;"_L1)
@@ -96,7 +96,7 @@ bool Qt::mightBeRichText(const QString& text)
++open;
}
if (open < text.size() && text.at(open) == u'<') {
- const int close = text.indexOf(u'>', open);
+ const qsizetype close = text.indexOf(u'>', open);
if (close > -1) {
QString tag;
for (int i = open+1; i < close; ++i) {
@@ -131,12 +131,12 @@ bool Qt::mightBeRichText(const QString& text)
*/
QString Qt::convertFromPlainText(const QString &plain, Qt::WhiteSpaceMode mode)
{
- int col = 0;
+ qsizetype col = 0;
QString rich;
rich += "<p>"_L1;
- for (int i = 0; i < plain.size(); ++i) {
+ for (qsizetype i = 0; i < plain.size(); ++i) {
if (plain[i] == u'\n'){
- int c = 1;
+ qsizetype c = 1;
while (i+1 < plain.size() && plain[i+1] == u'\n') {
i++;
c++;
@@ -3437,7 +3437,7 @@ void QTextHtmlExporter::emitFrameStyle(const QTextFrameFormat &format, FrameType
{
const auto styleAttribute = " style=\""_L1;
html += styleAttribute;
- const int originalHtmlLength = html.size();
+ const qsizetype originalHtmlLength = html.size();
if (frameType == TextFrame)
html += "-qt-table-type: frame;"_L1;