From a68e4f3b96a82a93898f381e8ddc7f50f9c89d40 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 9 Dec 2019 10:37:28 +0100 Subject: Use the new QMetaType API in QVariant Change-Id: I5495ee1159864ebd64083fadbfac7e07177ed406 Reviewed-by: Thiago Macieira --- src/widgets/kernel/qwidgetsvariant.cpp | 40 ++++------------------------------ 1 file changed, 4 insertions(+), 36 deletions(-) (limited to 'src/widgets/kernel') diff --git a/src/widgets/kernel/qwidgetsvariant.cpp b/src/widgets/kernel/qwidgetsvariant.cpp index 02b426988f..45a3bb3f7a 100644 --- a/src/widgets/kernel/qwidgetsvariant.cpp +++ b/src/widgets/kernel/qwidgetsvariant.cpp @@ -48,36 +48,6 @@ QT_BEGIN_NAMESPACE namespace { -static void construct(QVariant::Private *x, const void *copy) -{ - switch (x->type) { - case QMetaType::QSizePolicy: - v_construct(x, copy); - break; - default: - qWarning("Trying to construct an instance of an invalid type, type id: %i", x->type); - x->type = QMetaType::UnknownType; - return; - } - x->is_null = !copy; -} - -static void clear(QVariant::Private *d) -{ - switch (d->type) { - case QMetaType::QSizePolicy: - v_clear(d); - break; - default: - Q_ASSERT(false); - return; - } - - d->type = QMetaType::UnknownType; - d->is_null = true; - d->is_shared = false; -} - static bool isNull(const QVariant::Private *) { @@ -86,8 +56,8 @@ static bool isNull(const QVariant::Private *) static bool compare(const QVariant::Private *a, const QVariant::Private *b) { - Q_ASSERT(a->type == b->type); - switch(a->type) { + Q_ASSERT(a->type() == b->type()); + switch (a->type().id()) { case QMetaType::QSizePolicy: return *v_cast(a) == *v_cast(b); default: @@ -110,19 +80,17 @@ static bool convert(const QVariant::Private *d, int type, void *result, bool *ok static void streamDebug(QDebug dbg, const QVariant &v) { QVariant::Private *d = const_cast(&v.data_ptr()); - switch (d->type) { + switch (d->type().id()) { case QMetaType::QSizePolicy: dbg.nospace() << *v_cast(d); break; default: - dbg.nospace() << "QMetaType::Type(" << d->type << ')'; + dbg.nospace() << "QMetaType::Type(" << d->type().id() << ')'; } } #endif static const QVariant::Handler widgets_handler = { - construct, - clear, isNull, #ifndef QT_NO_DATASTREAM nullptr, -- cgit v1.2.3