From 8fd64d22ac7892b061a09c42c72aacf033b80876 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Nowacki?= Date: Wed, 12 Oct 2011 17:32:26 +0200 Subject: Make usage of internal QVariant space. Each QVariant instance has internal storage which may be used for well-know basic types. This patch changes the behavior by delegating type dependent operation to QMetaType class which knows more types than QVariant itself. The patch significantly reduce amount of code in QVariant implementation. There are few side effects of this patch: - better performance: * for Core types when using Gui (QGuiVariant is able to construct Core types) * for small custom types (QVariant::Private::Data is used for all types that has size small enough) - comparing two QVariants can give different result for small custom types (binary comparison instead of pointer comparison) Change-Id: Ic17fa500d6a882110bfba896fd456c8e6c7a63a9 Reviewed-by: Olivier Goffart --- src/widgets/kernel/qwidgetsvariant.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/widgets') diff --git a/src/widgets/kernel/qwidgetsvariant.cpp b/src/widgets/kernel/qwidgetsvariant.cpp index 1a21d91829..dcffa0e87e 100644 --- a/src/widgets/kernel/qwidgetsvariant.cpp +++ b/src/widgets/kernel/qwidgetsvariant.cpp @@ -106,6 +106,10 @@ static bool compare(const QVariant::Private *a, const QVariant::Private *b) { Q_ASSERT(a->type == b->type); switch(a->type) { +#ifndef QT_NO_ICON + case QVariant::Icon: + return false; +#endif case QVariant::SizePolicy: return *v_cast(a) == *v_cast(b); default: -- cgit v1.2.3