Details
-
Bug
-
Resolution: Done
-
Not Evaluated
-
Qt Creator 2.8.1
-
None
-
qt5, linux and GDB
-
ab52154010a3b4f15fa7df355ee2239c0b8bf35a
Description
In debugger when viewinf the internal data stored in a QMap<Key,Value> object in auto mode, the various item are ordered using an automatic index (strange concept for a map where element are accessed by key only).
More troublesome, the item are not sorted by key, thus making verification of content very difficult. This is also affecting the compact mode.
I have tried it only with qt5.
In order to fix it i propose the following change in the qttypes.py script:
def buildSortedKeyList(node, keyList,add = 0): left = node["left"] if not isNull(left): buildSortedKeyList(left,keyList,1) if (add): keyList.append(node.dereference()) right = node["right"] if not isNull(right): buildSortedKeyList(right,keyList,1) def qdumpHelper__Qt5_QMap(d, value, forceLong): d_ptr = value["d"].dereference() n = int(d_ptr["size"]) check(0 <= n and n <= 100*1000*1000) checkRef(d_ptr["ref"]) d.putItemCount(n) d.putNumChild(n) if d.isExpanded(): if n > 10000: n = 10000 keyType = d.templateArgument(value.type, 0) valueType = d.templateArgument(value.type, 1) isCompact = d.isMapCompact(keyType, valueType) # Note: The space in the QMapNode lookup below is # important for LLDB. nodeType = d.lookupType(d.ns + "QMapNode<%s, %s>" % (keyType, valueType)) if isCompact: innerType = valueType else: innerType = nodeType with Children(d, n, childType=innerType): toDo = [] i = -1 node = d_ptr["header"] buildSortedKeyList(node,toDo) while len(toDo): node = toDo[0].cast(nodeType) toDo = toDo[1:] i += 1 warn(" DATA: %s"%node) with SubItem(d, i): d.putField("iname", d.currentIName) if isCompact: if forceLong: d.putName("[%s] %s" % (i, node["key"])) else: d.putMapName(node["key"]) d.putItem(node["value"]) else: qdump__QMapNode(d, node)