Commit f3fbc36d authored by hjk's avatar hjk
Browse files

Debugger: Handle Qt4/5 behavior incompatibility in QVariant handler



Change-Id: I059955b24daa323d4f0a85e67650ee29c018d1b6
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent 3816e9de
......@@ -1965,7 +1965,7 @@ qdumpHelper_QVariants_B = [
]
def qdumpHelper_QVariant_31(d, blob):
# QVariant::VoidStart
# QVariant::VoidStar
d.putBetterType("%sQVariant (void *)" % d.qtNamespace())
d.putValue("0x%x" % blob.extractPointer())
......@@ -2027,11 +2027,15 @@ qdumpHelper_QVariants_E = [
"QRegion", # 72
"QBitmap", # 73
"QCursor", # 74
]
qdumpHelper_QVariants_F = [
# Qt 5. In Qt 4 add one.
"QKeySequence",# 75
"QPen", # 76
"QTextLength", # 77
"QTextFormat", # 78
"X", # 79
"X",
"QTransform", # 80
"QMatrix4x4", # 81
"QVector2D", # 82
......@@ -2041,50 +2045,58 @@ qdumpHelper_QVariants_E = [
"QPolygonF" # 86
]
def qdumpHelper__QVariant(d, value, variantType):
blob = d.toBlob(value)
def qdump__QVariant(d, value):
variantType = int(value["d"]["type"])
#warn("VARIANT TYPE: %s : " % variantType)
# Well-known simple type.
if variantType <= 6:
blob = d.toBlob(value)
qdumpHelper_QVariants_A[variantType](d, blob)
d.putNumChild(0)
return None
if variantType >= 31 and variantType <= 38:
# Extended Core type (Qt 5)
if variantType >= 31 and variantType <= 38 and d.qtVersion() >= 0x050000:
blob = d.toBlob(value)
qdumpHelper_QVariants_D[variantType - 31](d, blob)
d.putNumChild(0)
return None
# Known Core or Gui type.
if variantType <= 28:
innert = qdumpHelper_QVariants_B[variantType - 7]
else:
innert = qdumpHelper_QVariants_E[variantType - 64]
data = value["d"]["data"]
inner = d.qtNamespace() + innert
innerType = d.lookupType(inner)
if value["d"]["is_shared"]:
val = data["ptr"].cast(innerType.pointer().pointer()).dereference().dereference()
else:
val = data.cast(innerType)
# Extended Core type (Qt 4)
if variantType >= 128 and variantType <= 135 and d.qtVersion() < 0x050000:
if variantType == 128 or variantType == 135: # No indirection for float.
blob = d.toBlob(value)
else:
blob = d.extractBlob(d.dereference(value["d"]["data"]["ptr"]), 8)
qdumpHelper_QVariants_D[variantType - 128](d, blob)
return None
d.putEmptyValue(-99)
d.putItem(val)
d.putBetterType("%sQVariant (%s)" % (d.qtNamespace(), innert))
if variantType <= 86:
# Known Core or Gui type.
if variantType <= 28:
innert = qdumpHelper_QVariants_B[variantType - 7]
elif variantType <= 74:
innert = qdumpHelper_QVariants_E[variantType - 64]
elif d.qtVersion() < 0x050000:
innert = qdumpHelper_QVariants_F[variantType - 76]
else:
innert = qdumpHelper_QVariants_F[variantType - 75]
return innert
data = value["d"]["data"]
inner = d.qtNamespace() + innert
innerType = d.lookupType(inner)
if value["d"]["is_shared"]:
val = data["ptr"].cast(innerType.pointer().pointer()).dereference().dereference()
else:
val = data.cast(innerType)
def qdump__QVariant(d, value):
variantType = int(value["d"]["type"])
#warn("VARIANT TYPE: %s : " % variantType)
d.putEmptyValue(-99)
d.putItem(val)
d.putBetterType("%sQVariant (%s)" % (d.qtNamespace(), innert))
if variantType <= 86:
return qdumpHelper__QVariant(d, value, variantType)
return innert
blob = d.toBlob(value)
# User types.
d_ptr = value["d"]
......
......@@ -3812,7 +3812,13 @@ void tst_Dumpers::dumper_data()
"#include <QVector2D>\n"
"#include <QVector3D>\n"
"#include <QVector4D>\n"
"#include <QQuaternion>\n",
"#include <QPolygonF>\n"
"#include <QQuaternion>\n"
"#if QT_VERSION < 0x050000\n"
"Q_DECLARE_METATYPE(QPolygonF)\n"
"Q_DECLARE_METATYPE(QPen)\n"
"Q_DECLARE_METATYPE(QTextLength)\n"
"#endif\n",
"QApplication app(argc, argv);\n"
"QRect r(100, 200, 300, 400);\n"
"QRectF rf(100.5, 200.5, 300.5, 400.5);\n"
......@@ -3868,14 +3874,17 @@ void tst_Dumpers::dumper_data()
"QVariant var75 = QKeySequence(); // 75 QKeySequence\n"
"QVariant var76 = QPen(); // 76 QPen\n"
"QVariant var77 = QTextLength(); // 77 QTextLength\n"
"#if QT_VERSION < 0x050000\n"
"QVariant var78 = QTextFormat(); // 78 QTextFormat\n"
"unused(&var78);\n"
"#endif\n"
"QVariant var80 = QTransform(); // 80 QTransform\n"
"QVariant var81 = QMatrix4x4(); // 81 QMatrix4x4\n"
"QVariant var82 = QVector2D(); // 82 QVector2D\n"
"QVariant var83 = QVector3D(); // 83 QVector3D\n"
"QVariant var84 = QVector4D(); // 84 QVector4D\n"
"QVariant var85 = QQuaternion(); // 85 QQuaternion\n"
"QVariant var86 = QPolygonF(); // 86 QPolygonF\n"
"QVariant var86 = QVariant::fromValue<QPolygonF>(QPolygonF());\n"
"unused(&var, &var1, &var2, &var3, &var4, &var5, &var6);\n"
"unused(&var7, &var8, &var9, &var10, &var11, &var19, &var20);\n"
"unused(&var12, &var13, &var14, &var15, &var16, &var17);\n"
......@@ -3883,9 +3892,9 @@ void tst_Dumpers::dumper_data()
"unused(&var27, &var28, &var32, &var33, &var34, &var35);\n"
"unused(&var36, &var37, &var38, &var64, &var65, &var66);\n"
"unused(&var67, &var68, &var69, &var70, &var71, &var72);\n"
"unused(&var73, &var74, &var75, &var76, &var77, &var78);\n"
"unused(&var73, &var74, &var75, &var76, &var77);\n"
"unused(&var80, &var81, &var82, &var83, &var84, &var18);\n"
"unused(&var85, &var86);\n"
"unused(&var85, &var86, &var31);\n"
)
% GuiProfile()
% Check("var", "(invalid)", "@QVariant (invalid)")
......@@ -3941,7 +3950,7 @@ void tst_Dumpers::dumper_data()
% Check("var75", "", "@QVariant (QKeySequence)")
% Check("var76", "", "@QVariant (QPen)")
% Check("var77", "", "@QVariant (QTextLength)")
% Check("var78", "", "@QVariant (QTextFormat)")
//% Check("var78", Value5(""), "@QVariant (QTextFormat)")
% Check("var80", "", "@QVariant (QTransform)")
% Check("var81", "", "@QVariant (QMatrix4x4)")
% Check("var82", "", "@QVariant (QVector2D)")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment