diff options
author | Olivier Goffart <ogoffart@woboq.com> | 2019-12-02 17:54:48 +0100 |
---|---|---|
committer | Olivier Goffart <ogoffart@woboq.com> | 2020-01-23 16:46:51 +0100 |
commit | 73d1476fb1397948a4d806bd921fce372bd8d63b (patch) | |
tree | a476349c26627027d78c1279da00ef633323311f /src/widgets/kernel | |
parent | a78d66743171557d79b16c08be775e3ac15bb4ef (diff) |
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 <lars.knoll@qt.io>
Diffstat (limited to 'src/widgets/kernel')
-rw-r--r-- | src/widgets/kernel/qsizepolicy.cpp | 2 | ||||
-rw-r--r-- | src/widgets/kernel/qwidgetsvariant.cpp | 12 |
2 files changed, 7 insertions, 7 deletions
diff --git a/src/widgets/kernel/qsizepolicy.cpp b/src/widgets/kernel/qsizepolicy.cpp index 54bf8fe0dc..c4372a9fbc 100644 --- a/src/widgets/kernel/qsizepolicy.cpp +++ b/src/widgets/kernel/qsizepolicy.cpp @@ -439,7 +439,7 @@ void QSizePolicy::setControlType(ControlType type) noexcept */ QSizePolicy::operator QVariant() const { - return QVariant(QVariant::SizePolicy, this); + return QVariant(QMetaType::QSizePolicy, this); } #ifndef QT_NO_DATASTREAM diff --git a/src/widgets/kernel/qwidgetsvariant.cpp b/src/widgets/kernel/qwidgetsvariant.cpp index 41600d2143..edb166e8d5 100644 --- a/src/widgets/kernel/qwidgetsvariant.cpp +++ b/src/widgets/kernel/qwidgetsvariant.cpp @@ -51,12 +51,12 @@ namespace { static void construct(QVariant::Private *x, const void *copy) { switch (x->type) { - case QVariant::SizePolicy: + case QMetaType::QSizePolicy: v_construct<QSizePolicy>(x, copy); break; default: qWarning("Trying to construct an instance of an invalid type, type id: %i", x->type); - x->type = QVariant::Invalid; + x->type = QMetaType::UnknownType; return; } x->is_null = !copy; @@ -65,7 +65,7 @@ static void construct(QVariant::Private *x, const void *copy) static void clear(QVariant::Private *d) { switch (d->type) { - case QVariant::SizePolicy: + case QMetaType::QSizePolicy: v_clear<QSizePolicy>(d); break; default: @@ -73,7 +73,7 @@ static void clear(QVariant::Private *d) return; } - d->type = QVariant::Invalid; + d->type = QMetaType::UnknownType; d->is_null = true; d->is_shared = false; } @@ -88,7 +88,7 @@ static bool compare(const QVariant::Private *a, const QVariant::Private *b) { Q_ASSERT(a->type == b->type); switch(a->type) { - case QVariant::SizePolicy: + case QMetaType::QSizePolicy: return *v_cast<QSizePolicy>(a) == *v_cast<QSizePolicy>(b); default: Q_ASSERT(false); @@ -111,7 +111,7 @@ static void streamDebug(QDebug dbg, const QVariant &v) { QVariant::Private *d = const_cast<QVariant::Private *>(&v.data_ptr()); switch (d->type) { - case QVariant::SizePolicy: + case QMetaType::QSizePolicy: dbg.nospace() << *v_cast<QSizePolicy>(d); break; default: |