From 6f58f4ba509e34f6d4bec3cf2a51b581ea216988 Mon Sep 17 00:00:00 2001 From: hjk Date: Fri, 10 Jul 2015 10:09:25 +0200 Subject: [PATCH] Debugger: Basic type display switching for QVariantMap items This is not a complete solution (that would need to pass information on typedefs and artificial types like "QVariant (QVariantMap)" between dumper and gui, but allows switching to compact display for individual items. Change-Id: I47d15356e5decf9411af4acc8fa7a0f0cfbd045f Reviewed-by: Christian Stenger --- share/qtcreator/debugger/dumper.py | 35 +++++++++++++++-------------- share/qtcreator/debugger/qttypes.py | 7 ++++++ 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/share/qtcreator/debugger/dumper.py b/share/qtcreator/debugger/dumper.py index 28c2c4c2e0d..07831324c8b 100644 --- a/share/qtcreator/debugger/dumper.py +++ b/share/qtcreator/debugger/dumper.py @@ -387,12 +387,27 @@ class DumperBase: self.isCli = False # Later set, or not set: - # cachedQtVersion self.stringCutOff = 10000 self.displayStringLimit = 100 + self.resetCaches() + + self.childrenPrefix = 'children=[' + self.childrenSuffix = '],' + + self.dumpermodules = [ + "qttypes", + "stdtypes", + "misctypes", + "boosttypes", + "creatortypes", + "personaltypes", + ] + + + def resetCaches(self): # This is a cache mapping from 'type name' to 'display alternatives'. - self.qqFormats = {} + self.qqFormats = { "QVariant (QVariantMap)" : mapForms() } # This is a cache of all known dumpers. self.qqDumpers = {} @@ -407,18 +422,6 @@ class DumperBase: # to not be QObject derived, it contains a 0 value. self.knownStaticMetaObjects = {} - self.childrenPrefix = 'children=[' - self.childrenSuffix = '],' - - self.dumpermodules = [ - "qttypes", - "stdtypes", - "misctypes", - "boosttypes", - "creatortypes", - "personaltypes", - ] - def putNewline(self): pass @@ -1674,10 +1677,8 @@ class DumperBase: pass def setupDumpers(self, _ = {}): - self.qqDumpers = {} - self.qqFormats = {} - self.qqEditable = {} self.typeCache = {} + self.resetCaches() for mod in self.dumpermodules: m = importlib.import_module(mod) diff --git a/share/qtcreator/debugger/qttypes.py b/share/qtcreator/debugger/qttypes.py index 4ebffc09981..90a256f4842 100644 --- a/share/qtcreator/debugger/qttypes.py +++ b/share/qtcreator/debugger/qttypes.py @@ -1031,6 +1031,13 @@ def qdump__QMultiMap(d, value): qdump__QMap(d, value) +def qform__QVariantMap(): + return mapForms() + +def qdump__QVariantMap(d, value): + qdump__QMap(d, value) + + def qdump__QMetaObjectPrivate(d, value): d.putEmptyValue() d.putNumChild(1)