path: root/src/widgets
diff options
authorJędrzej Nowacki <>2011-10-12 17:32:26 +0200
committerQt by Nokia <>2011-11-09 10:11:34 +0100
commit8fd64d22ac7892b061a09c42c72aacf033b80876 (patch)
tree9c0d04049188ad5ff726419279ee88c3fdd0d1bf /src/widgets
parent2b39be6dd5d111482e5df06ac6dea18ca338d9f0 (diff)
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 <>
Diffstat (limited to 'src/widgets')
1 files changed, 4 insertions, 0 deletions
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;
case QVariant::SizePolicy:
return *v_cast<QSizePolicy>(a) == *v_cast<QSizePolicy>(b);