From 73d1476fb1397948a4d806bd921fce372bd8d63b Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 2 Dec 2019 17:54:48 +0100 Subject: Replace most use of QVariant::type and occurrences of QVariant::Type I made a clazy automated check that replaced the use of QVariant::Type by the equivalent in QMetaType. This has been deprecated since Qt 5.0, but many uses were not yet removed. In addition, there was some manual changes to fix the compilation errors. Adapted the Private API of QDateTimeParser and QMimeDataPrivate and adjust QDateTimeEdit and QSpinBox. QVariant(QVariant::Invalid) in qstylesheet made no sense. But note that in QVariant::save, we actually wanted to use the non-user type. In the SQL module, many changes were actually reverted because the API still expects QVarient::Type. Change-Id: I98c368490e4ee465ed3a3b63bda8b8eaa50ea67e Reviewed-by: Lars Knoll --- src/gui/text/qtextdocument.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/gui/text/qtextdocument.cpp') diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp index 2d7f2bb844..46cfc79643 100644 --- a/src/gui/text/qtextdocument.cpp +++ b/src/gui/text/qtextdocument.cpp @@ -2234,7 +2234,7 @@ QVariant QTextDocument::loadResource(int type, const QUrl &name) } if (!r.isNull()) { - if (type == ImageResource && r.type() == QVariant::ByteArray) { + if (type == ImageResource && r.userType() == QMetaType::QByteArray) { if (qApp->thread() != QThread::currentThread()) { // must use images in non-GUI threads QImage image; @@ -3049,12 +3049,12 @@ QString QTextHtmlExporter::findUrlForImage(const QTextDocument *doc, qint64 cach for (; it != priv->cachedResources.constEnd(); ++it) { const QVariant &v = it.value(); - if (v.type() == QVariant::Image && !isPixmap) { + if (v.userType() == QMetaType::QImage && !isPixmap) { if (qvariant_cast(v).cacheKey() == cacheKey) break; } - if (v.type() == QVariant::Pixmap && isPixmap) { + if (v.userType() == QMetaType::QPixmap && isPixmap) { if (qvariant_cast(v).cacheKey() == cacheKey) break; } -- cgit v1.2.3