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