diff options
author | Lars Knoll <lars.knoll@qt.io> | 2020-06-19 20:53:25 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2020-07-06 21:31:14 +0200 |
commit | df853fed66d891077ae2d04ecfa171d7e2cd5202 (patch) | |
tree | bf29d3718eeee1e17d1640841595de0ba8cda4cf /src/gui/text | |
parent | 3711bf85ae85c9398642ae276cbd90b5bfaa6688 (diff) |
Use qsizetype in QList
The change creates a slight source incompatibility. The main
things to take care of are
* code using printf statements on list.size(). Using qsizetype in
printf statements will always require a cast to work on both 32
and 64 bit.
* A few places where overloads now get ambiguous. One example is
QRandomGenerator::bounded() that has overloads for int, uint and
double, but not int64.
* Streaming list.size() to a QDataStream will change the format
depending on the architecture.
[ChangeLog][QtCore][QList] QList now uses qsizetype to index into
elements.
Change-Id: Iaff562a4d072b97f458417b670f95971bd47cbc6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/gui/text')
-rw-r--r-- | src/gui/text/qtextdocument_p.cpp | 2 | ||||
-rw-r--r-- | src/gui/text/qtextlayout.cpp | 2 | ||||
-rw-r--r-- | src/gui/text/qtextmarkdownimporter.cpp | 10 |
3 files changed, 7 insertions, 7 deletions
diff --git a/src/gui/text/qtextdocument_p.cpp b/src/gui/text/qtextdocument_p.cpp index 5198425b26..94efb4a94d 100644 --- a/src/gui/text/qtextdocument_p.cpp +++ b/src/gui/text/qtextdocument_p.cpp @@ -877,7 +877,7 @@ bool QTextDocumentPrivate::unite(uint f) int QTextDocumentPrivate::undoRedo(bool undo) { - PMDEBUG("%s, undoState=%d, undoStack size=%d", undo ? "undo:" : "redo:", undoState, undoStack.size()); + PMDEBUG("%s, undoState=%d, undoStack size=%d", undo ? "undo:" : "redo:", undoState, int(undoStack.size())); if (!undoEnabled || (undo && undoState == 0) || (!undo && undoState == undoStack.size())) return -1; diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index 53523f3abd..e9251d291b 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -1830,7 +1830,7 @@ void QTextLine::layout_helper(int maxGlyphs) int newItem = eng->findItem(line.from); Q_ASSERT(newItem >= 0); - LB_DEBUG("from: %d: item=%d, total %d, width available %f", line.from, newItem, eng->layoutData->items.size(), line.width.toReal()); + LB_DEBUG("from: %d: item=%d, total %d, width available %f", line.from, newItem, int(eng->layoutData->items.size()), line.width.toReal()); Qt::Alignment alignment = eng->option.alignment(); diff --git a/src/gui/text/qtextmarkdownimporter.cpp b/src/gui/text/qtextmarkdownimporter.cpp index caf7c097a3..72c445878c 100644 --- a/src/gui/text/qtextmarkdownimporter.cpp +++ b/src/gui/text/qtextmarkdownimporter.cpp @@ -177,7 +177,7 @@ int QTextMarkdownImporter::cbEnterBlock(int blockType, void *det) switch (blockType) { case MD_BLOCK_P: if (!m_listStack.isEmpty()) - qCDebug(lcMD, m_listItem ? "P of LI at level %d" : "P continuation inside LI at level %d", m_listStack.count()); + qCDebug(lcMD, m_listItem ? "P of LI at level %d" : "P continuation inside LI at level %d", int(m_listStack.count())); else qCDebug(lcMD, "P"); m_needsInsertBlock = true; @@ -243,7 +243,7 @@ int QTextMarkdownImporter::cbEnterBlock(int blockType, void *det) m_listFormat.setStyle(QTextListFormat::ListDisc); break; } - qCDebug(lcMD, "UL %c level %d", detail->mark, m_listStack.count() + 1); + qCDebug(lcMD, "UL %c level %d", detail->mark, int(m_listStack.count()) + 1); } break; case MD_BLOCK_OL: { if (m_needsInsertList) // list nested in an empty list @@ -255,7 +255,7 @@ int QTextMarkdownImporter::cbEnterBlock(int blockType, void *det) m_listFormat.setIndent(m_listStack.count() + 1); m_listFormat.setNumberSuffix(QChar::fromLatin1(detail->mark_delimiter)); m_listFormat.setStyle(QTextListFormat::ListDecimal); - qCDebug(lcMD, "OL xx%d level %d", detail->mark_delimiter, m_listStack.count() + 1); + qCDebug(lcMD, "OL xx%d level %d", detail->mark_delimiter, int(m_listStack.count()) + 1); } break; case MD_BLOCK_TD: { MD_BLOCK_TD_DETAIL *detail = static_cast<MD_BLOCK_TD_DETAIL *>(det); @@ -326,7 +326,7 @@ int QTextMarkdownImporter::cbLeaveBlock(int blockType, void *detail) if (Q_UNLIKELY(m_listStack.isEmpty())) { qCWarning(lcMD, "list ended unexpectedly"); } else { - qCDebug(lcMD, "list at level %d ended", m_listStack.count()); + qCDebug(lcMD, "list at level %d ended", int(m_listStack.count())); m_listStack.pop(); } break; @@ -363,7 +363,7 @@ int QTextMarkdownImporter::cbLeaveBlock(int blockType, void *detail) m_cursor->movePosition(QTextCursor::End); break; case MD_BLOCK_LI: - qCDebug(lcMD, "LI at level %d ended", m_listStack.count()); + qCDebug(lcMD, "LI at level %d ended", int(m_listStack.count())); m_listItem = false; break; case MD_BLOCK_CODE: { |