diff --git a/share/qtcreator/dumper/qttypes.py b/share/qtcreator/dumper/qttypes.py index f54a41961b0..ab8b1aaa891 100644 --- a/share/qtcreator/dumper/qttypes.py +++ b/share/qtcreator/dumper/qttypes.py @@ -434,6 +434,27 @@ def qdump__QHashNode(d, value): d.putSubItem("value", val) +def qHashIteratorHelper(d, value): + typeName = str(value.type) + hashType = lookupType(typeName[0:typeName.rfind("::")]) + keyType = templateArgument(hashType, 0) + valueType = templateArgument(hashType, 1) + d.putNumChild(1) + d.putValue(" ") + if d.isExpanded(): + with Children(d): + typeName = "%sQHash<%s,%s>::Node" % (d.ns, keyType, valueType) + node = value["i"].cast(lookupType(typeName).pointer()) + d.putSubItem("key", node["key"]) + d.putSubItem("value", node["value"]) + +def qdump__QHash__const_iterator(d, value): + qHashIteratorHelper(d, value) + +def qdump__QHash__iterator(d, value): + qHashIteratorHelper(d, value) + + def qdump__QHostAddress(d, value): data = value["d"]["d"].dereference() if int(data["ipString"]["d"]["size"]): diff --git a/tests/manual/debugger/simple/simple_test_app.cpp b/tests/manual/debugger/simple/simple_test_app.cpp index e7438125247..de57acc03cb 100644 --- a/tests/manual/debugger/simple/simple_test_app.cpp +++ b/tests/manual/debugger/simple/simple_test_app.cpp @@ -913,6 +913,36 @@ namespace qhash { dummyStatement(&hash, &ob); } + void testQHashIntFloatIterator() + { + typedef QHash Hash; + Hash hash; + hash[11] = 11.0; + hash[22] = 22.0; + hash[33] = 33.0; + hash[44] = 44.0; + hash[55] = 55.0; + hash[66] = 66.0; + + Hash::iterator it1 = hash.begin(); + Hash::iterator it2 = it1; ++it2; + Hash::iterator it3 = it2; ++it2; + Hash::iterator it4 = it3; ++it3; + Hash::iterator it5 = it4; ++it4; + Hash::iterator it6 = it5; ++it5; + + BREAK_HERE; + // Expand hash. + // Check hash <6 items> Hash. + // Check hash.11 11 float. + // Check it1.first 11 int. + // Check it1.second 11 float. + // Check it1.first 55 int. + // Check it1.second 55 float. + // Continue. + dummyStatement(&hash, &it1, &it2, &it3, &it4, &it5, &it6); + } + void testQHash() { testQHash1(); @@ -922,6 +952,7 @@ namespace qhash { testQHash5(); testQHash6(); testQHash7(); + testQHashIntFloatIterator(); } } // namespace qhash