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 | |
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')
-rw-r--r-- | src/gui/itemmodels/qstandarditemmodel.cpp | 2 | ||||
-rw-r--r-- | src/gui/painting/qpdf_p.h | 1 | ||||
-rw-r--r-- | src/gui/rhi/qrhivulkan.cpp | 2 | ||||
-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 |
6 files changed, 10 insertions, 9 deletions
diff --git a/src/gui/itemmodels/qstandarditemmodel.cpp b/src/gui/itemmodels/qstandarditemmodel.cpp index ebb4d641eb..869994d428 100644 --- a/src/gui/itemmodels/qstandarditemmodel.cpp +++ b/src/gui/itemmodels/qstandarditemmodel.cpp @@ -3132,7 +3132,7 @@ QMimeData *QStandardItemModel::mimeData(const QModelIndexList &indexes) const if (itemsSet.contains(item)) //if the item is selection 'top-level', stream its position stream << item->row() << item->column(); - stream << *item << item->columnCount() << item->d_ptr->children.count(); + stream << *item << item->columnCount() << int(item->d_ptr->children.count()); stack += item->d_ptr->children; } diff --git a/src/gui/painting/qpdf_p.h b/src/gui/painting/qpdf_p.h index c277539cfa..e775406e65 100644 --- a/src/gui/painting/qpdf_p.h +++ b/src/gui/painting/qpdf_p.h @@ -86,6 +86,7 @@ namespace QPdf { ByteStream &operator <<(const ByteStream &src); ByteStream &operator <<(qreal val); ByteStream &operator <<(int val); + ByteStream &operator <<(qint64 val) { return (*this << int(val)); } ByteStream &operator <<(const QPointF &p); // Note that the stream may be invalidated by calls that insert data. QIODevice *stream(); diff --git a/src/gui/rhi/qrhivulkan.cpp b/src/gui/rhi/qrhivulkan.cpp index ee75b0eb37..32515ea31a 100644 --- a/src/gui/rhi/qrhivulkan.cpp +++ b/src/gui/rhi/qrhivulkan.cpp @@ -505,7 +505,7 @@ bool QRhiVulkan::create(QRhi::Flags flags) for (const VkExtensionProperties &p : qAsConst(extProps)) devExts.append({ p.extensionName, p.specVersion }); } - qCDebug(QRHI_LOG_INFO, "%d device extensions available", devExts.count()); + qCDebug(QRHI_LOG_INFO, "%d device extensions available", int(devExts.count())); QVector<const char *> requestedDevExts; requestedDevExts.append("VK_KHR_swapchain"); 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: { |