summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@woboq.com>2012-05-15 15:40:58 +0200
committerQt by Nokia <qt-info@nokia.com>2012-05-18 21:42:58 +0200
commit8df298665a1e637ab6d26d5fcc447d5502afe31a (patch)
tree9d36f54835b70b04bd6ae0bc72aee2a8ea659143 /src/corelib
parent6c06e14a49773ce5572935864ed6b9be219c6103 (diff)
Move QIcon metatype handlers back to QtGui
QIcon has been moved back from QWidget to QtGui, so the QIcon QVariant and QMetaType handler can now be moved back to QtGui. Also we can give back QIcon its old number, allowing to get rid of some compatibility hack when unstreaming QVariant Change-Id: I439d5c2987c06ecd619f394407850f678164afb8 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/kernel/qmetatype.cpp4
-rw-r--r--src/corelib/kernel/qmetatype.h49
-rw-r--r--src/corelib/kernel/qmetatype_p.h3
-rw-r--r--src/corelib/kernel/qvariant.cpp23
-rw-r--r--src/corelib/kernel/qvariant.h2
5 files changed, 36 insertions, 45 deletions
diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp
index 48cabeb636..e1cebc453d 100644
--- a/src/corelib/kernel/qmetatype.cpp
+++ b/src/corelib/kernel/qmetatype.cpp
@@ -845,11 +845,11 @@ bool QMetaType::save(QDataStream &stream, int type, const void *data)
case QMetaType::QVector3D:
case QMetaType::QVector4D:
case QMetaType::QQuaternion:
+ case QMetaType::QIcon:
if (!qMetaTypeGuiHelper)
return false;
qMetaTypeGuiHelper[type - FirstGuiType].saveOp(stream, data);
break;
- case QMetaType::QIcon:
case QMetaType::QSizePolicy:
if (!qMetaTypeWidgetsHelper)
return false;
@@ -1069,11 +1069,11 @@ bool QMetaType::load(QDataStream &stream, int type, void *data)
case QMetaType::QVector3D:
case QMetaType::QVector4D:
case QMetaType::QQuaternion:
+ case QMetaType::QIcon:
if (!qMetaTypeGuiHelper)
return false;
qMetaTypeGuiHelper[type - FirstGuiType].loadOp(stream, data);
break;
- case QMetaType::QIcon:
case QMetaType::QSizePolicy:
if (!qMetaTypeWidgetsHelper)
return false;
diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h
index 33e7fa43f1..74702540f2 100644
--- a/src/corelib/kernel/qmetatype.h
+++ b/src/corelib/kernel/qmetatype.h
@@ -127,26 +127,27 @@ QT_BEGIN_NAMESPACE
F(QBrush, 66, QBrush) \
F(QColor, 67, QColor) \
F(QPalette, 68, QPalette) \
- F(QImage, 69, QImage) \
- F(QPolygon, 70, QPolygon) \
- F(QRegion, 71, QRegion) \
- F(QBitmap, 72, QBitmap) \
- F(QCursor, 73, QCursor) \
- F(QKeySequence, 74, QKeySequence) \
- F(QPen, 75, QPen) \
- F(QTextLength, 76, QTextLength) \
- F(QTextFormat, 77, QTextFormat) \
- F(QMatrix, 78, QMatrix) \
- F(QTransform, 79, QTransform) \
- F(QMatrix4x4, 80, QMatrix4x4) \
- F(QVector2D, 81, QVector2D) \
- F(QVector3D, 82, QVector3D) \
- F(QVector4D, 83, QVector4D) \
- F(QQuaternion, 84, QQuaternion) \
- F(QPolygonF, 85, QPolygonF) \
+ F(QIcon, 69, QIcon) \
+ F(QImage, 70, QImage) \
+ F(QPolygon, 71, QPolygon) \
+ F(QRegion, 72, QRegion) \
+ F(QBitmap, 73, QBitmap) \
+ F(QCursor, 74, QCursor) \
+ F(QKeySequence, 75, QKeySequence) \
+ F(QPen, 76, QPen) \
+ F(QTextLength, 77, QTextLength) \
+ F(QTextFormat, 78, QTextFormat) \
+ F(QMatrix, 79, QMatrix) \
+ F(QTransform, 80, QTransform) \
+ F(QMatrix4x4, 81, QMatrix4x4) \
+ F(QVector2D, 82, QVector2D) \
+ F(QVector3D, 83, QVector3D) \
+ F(QVector4D, 84, QVector4D) \
+ F(QQuaternion, 85, QQuaternion) \
+ F(QPolygonF, 86, QPolygonF) \
+
#define QT_FOR_EACH_STATIC_WIDGETS_CLASS(F)\
- F(QIcon, 120, QIcon) \
F(QSizePolicy, 121, QSizePolicy) \
// ### FIXME kill that set
@@ -208,7 +209,7 @@ public:
LastCoreType = SChar,
FirstGuiType = QFont,
LastGuiType = QPolygonF,
- FirstWidgetsType = QIcon,
+ FirstWidgetsType = QSizePolicy,
LastWidgetsType = QSizePolicy,
HighestInternalId = LastWidgetsType,
@@ -232,11 +233,11 @@ public:
QObjectStar = 39, QWidgetStar = 40,
QVariantMap = 8, QVariantList = 9, QVariantHash = 28,
QFont = 64, QPixmap = 65, QBrush = 66, QColor = 67, QPalette = 68,
- QImage = 69, QPolygon = 70, QRegion = 71, QBitmap = 72, QCursor = 73,
- QKeySequence = 74, QPen = 75, QTextLength = 76, QTextFormat = 77,
- QMatrix = 78, QTransform = 79, QMatrix4x4 = 80, QVector2D = 81,
- QVector3D = 82, QVector4D = 83, QQuaternion = 84, QPolygonF = 85,
- QIcon = 120, QSizePolicy = 121,
+ QIcon = 69, QImage = 70, QPolygon = 71, QRegion = 72, QBitmap = 73,
+ QCursor = 74, QKeySequence = 75, QPen = 76, QTextLength = 77, QTextFormat = 78,
+ QMatrix = 79, QTransform = 80, QMatrix4x4 = 81, QVector2D = 82,
+ QVector3D = 83, QVector4D = 84, QQuaternion = 85, QPolygonF = 86,
+ QSizePolicy = 121,
User = 256
};
#endif
diff --git a/src/corelib/kernel/qmetatype_p.h b/src/corelib/kernel/qmetatype_p.h
index b593489963..cffc45c988 100644
--- a/src/corelib/kernel/qmetatype_p.h
+++ b/src/corelib/kernel/qmetatype_p.h
@@ -236,6 +236,9 @@ template<> struct TypeDefinition<QVector4D> { static const bool IsAvailable = fa
#ifdef QT_NO_QUATERNION
template<> struct TypeDefinition<QQuaternion> { static const bool IsAvailable = false; };
#endif
+#ifdef QT_NO_ICON
+template<> struct TypeDefinition<QIcon> { static const bool IsAvailable = false; };
+#endif
} //namespace QtMetaTypePrivate
QT_END_NAMESPACE
diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp
index cb50603354..3d3183a5c9 100644
--- a/src/corelib/kernel/qvariant.cpp
+++ b/src/corelib/kernel/qvariant.cpp
@@ -1669,18 +1669,12 @@ void QVariant::load(QDataStream &s)
// In Qt4 id == 128 was FirstExtCoreType. In Qt5 ExtCoreTypes set was merged to CoreTypes
// by moving all ids down by 97.
typeId -= 97;
- } else if (typeId == 69 /* QIcon */) {
- // In Qt5 after modularization project these types where moved to a separate module (and ids were downgraded)
- typeId = QMetaType::QIcon;
} else if (typeId == 75 /* QSizePolicy */) {
typeId = QMetaType::QSizePolicy;
- } else if (typeId >= 70) {
+ } else if (typeId > 75 && typeId <= 86) {
// and as a result these types received lower ids too
- if (typeId <= 74) { // QImage QPolygon QRegion QBitmap QCursor
- typeId -=1;
- } else if (typeId <= 86) { // QKeySequence QPen QTextLength QTextFormat QMatrix QTransform QMatrix4x4 QVector2D QVector3D QVector4D QQuaternion
- typeId -=2;
- }
+ // QKeySequence QPen QTextLength QTextFormat QMatrix QTransform QMatrix4x4 QVector2D QVector3D QVector4D QQuaternion
+ typeId -=1;
}
}
@@ -1744,18 +1738,11 @@ void QVariant::save(QDataStream &s) const
// In Qt4 id == 128 was FirstExtCoreType. In Qt5 ExtCoreTypes set was merged to CoreTypes
// by moving all ids down by 97.
typeId += 97;
- } else if (typeId == QMetaType::QIcon) {
- // In Qt5 after modularization project these types where moved to a separate module (and ids were downgraded)
- typeId = 69;
} else if (typeId == QMetaType::QSizePolicy) {
typeId = 75;
- } else if (typeId >= QMetaType::QImage) {
+ } else if (typeId >= QMetaType::QKeySequence && typeId <= QMetaType::QQuaternion) {
// and as a result these types received lower ids too
- if (typeId <= QMetaType::QCursor) {
- typeId +=1;
- } else if (typeId <= QMetaType::QQuaternion) {
- typeId +=2;
- }
+ typeId +=1;
}
}
s << typeId;
diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h
index 8ba27d2354..15fbfc991f 100644
--- a/src/corelib/kernel/qvariant.h
+++ b/src/corelib/kernel/qvariant.h
@@ -184,9 +184,9 @@ class Q_CORE_EXPORT QVariant
Vector4D = QMetaType::QVector4D,
Quaternion = QMetaType::QQuaternion,
PolygonF = QMetaType::QPolygonF,
+ Icon = QMetaType::QIcon,
LastGuiType = QMetaType::LastGuiType,
- Icon = QMetaType::QIcon,
SizePolicy = QMetaType::QSizePolicy,
UserType = QMetaType::User,