Commit 5d645bfd authored by hjk's avatar hjk

debugger: fix display of QObject properties

parent 42b39023
...@@ -1357,6 +1357,13 @@ class Dumper: ...@@ -1357,6 +1357,13 @@ class Dumper:
nsStrippedType = self.stripNamespaceFromType(typedefStrippedType)\ nsStrippedType = self.stripNamespaceFromType(typedefStrippedType)\
.replace("::", "__") .replace("::", "__")
# Is this derived from QObject?
try:
item.value['staticMetaObject']
hasMetaObject = True
except:
hasMetaObject = False
#warn(" STRIPPED: %s" % nsStrippedType) #warn(" STRIPPED: %s" % nsStrippedType)
#warn(" DUMPERS: %s" % (nsStrippedType in qqDumpers)) #warn(" DUMPERS: %s" % (nsStrippedType in qqDumpers))
...@@ -1369,11 +1376,14 @@ class Dumper: ...@@ -1369,11 +1376,14 @@ class Dumper:
elif self.useFancy \ elif self.useFancy \
and ((format is None) or (format >= 1)) \ and ((format is None) or (format >= 1)) \
and (nsStrippedType in qqDumpers): and ((nsStrippedType in qqDumpers) or hasMetaObject):
#warn("IS DUMPABLE: %s " % type) #warn("IS DUMPABLE: %s " % type)
#self.putAddress(value.address) #self.putAddress(value.address)
self.putType(item.value.type) self.putType(item.value.type)
qqDumpers[nsStrippedType](self, item) if hasMetaObject:
qdump__QObject(self, item)
else:
qqDumpers[nsStrippedType](self, item)
#warn(" RESULT: %s " % self.output) #warn(" RESULT: %s " % self.output)
elif typedefStrippedType.code == gdb.TYPE_CODE_ENUM: elif typedefStrippedType.code == gdb.TYPE_CODE_ENUM:
......
...@@ -588,9 +588,6 @@ def extractCString(table, offset): ...@@ -588,9 +588,6 @@ def extractCString(table, offset):
return result return result
def qdump__QWidget(d, item):
qdump__QObject(d, item)
def qdump__QObject(d, item): def qdump__QObject(d, item):
#warn("OBJECT: %s " % item.value) #warn("OBJECT: %s " % item.value)
staticMetaObject = item.value["staticMetaObject"] staticMetaObject = item.value["staticMetaObject"]
...@@ -628,6 +625,7 @@ def qdump__QObject(d, item): ...@@ -628,6 +625,7 @@ def qdump__QObject(d, item):
d.putNumChild(4) d.putNumChild(4)
if d.isExpanded(item): if d.isExpanded(item):
with Children(d): with Children(d):
d.putFields(item)
# Parent and children. # Parent and children.
d.putItem(Item(d_ptr["parent"], item.iname, "parent", "parent")) d.putItem(Item(d_ptr["parent"], item.iname, "parent", "parent"))
d.putItem(Item(d_ptr["children"], item.iname, "children", "children")) d.putItem(Item(d_ptr["children"], item.iname, "children", "children"))
...@@ -651,9 +649,8 @@ def qdump__QObject(d, item): ...@@ -651,9 +649,8 @@ def qdump__QObject(d, item):
namesArray = names["d"]["array"] namesArray = names["d"]["array"]
dynamicPropertyCount = namesEnd - namesBegin dynamicPropertyCount = namesEnd - namesBegin
#staticPropertyCount = metaData[6] #staticPropertyCount = call(mo, "propertyCount()")
# FIXME: Replace with plain memory accesses. staticPropertyCount = metaData[6]
staticPropertyCount = call(mo, "propertyCount()")
#warn("PROPERTY COUNT: %s" % staticPropertyCount) #warn("PROPERTY COUNT: %s" % staticPropertyCount)
propertyCount = staticPropertyCount + dynamicPropertyCount propertyCount = staticPropertyCount + dynamicPropertyCount
......
...@@ -761,13 +761,18 @@ public: ...@@ -761,13 +761,18 @@ public:
int i = 0; int i = 0;
} }
Q_PROPERTY(QString myProp READ myProp WRITE setMyProp) Q_PROPERTY(QString myProp1 READ myProp1 WRITE setMyProp1)
QString myProp() const { return m_myProp; } QString myProp1() const { return m_myProp1; }
Q_SLOT void setMyProp(const QString &mt) { m_myProp = mt; } Q_SLOT void setMyProp1(const QString &mt) { m_myProp1 = mt; }
Q_PROPERTY(QString myProp2 READ myProp2 WRITE setMyProp2)
QString myProp2() const { return m_myProp2; }
Q_SLOT void setMyProp2(const QString &mt) { m_myProp2 = mt; }
public: public:
Ui *m_ui; Ui *m_ui;
QString m_myProp; QString m_myProp1;
QString m_myProp2;
}; };
} // namespace Bar } // namespace Bar
...@@ -778,8 +783,10 @@ void testQObject(int &argc, char *argv[]) ...@@ -778,8 +783,10 @@ void testQObject(int &argc, char *argv[])
QApplication app(argc, argv); QApplication app(argc, argv);
#if 1 #if 1
Names::Bar::TestObject test; Names::Bar::TestObject test;
test.setMyProp("HELLO"); test.setMyProp1("HELLO");
QString s = test.myProp(); test.setMyProp2("WORLD");
QString s = test.myProp1();
s += test.myProp2();
int i = 1; int i = 1;
#endif #endif
......
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