//////////////////////////////////////////////////////////////////////////////
+struct ModelIndex { int r; int c; void *p; void *m; };
+
+static void qDumpQAbstractItem(QDumper &d)
+{
+ ModelIndex mm;
+ mm.r = mm.c = 0;
+ mm.p = mm.m = 0;
+ sscanf(d.templateParameters[0], "%d,%d,%p,%p", &mm.r, &mm.c, &mm.p, &mm.m);
+ const QModelIndex &mi(*reinterpret_cast<QModelIndex *>(&mm));
+ const QAbstractItemModel *m = mi.model();
+ const int rowCount = m->rowCount(mi);
+ if (rowCount < 0)
+ return;
+ const int columnCount = m->columnCount(mi);
+ if (columnCount < 0)
+ return;
+ P(d, "type", NS"QAbstractItem");
+ P(d, "addr", "$" << mm.r << "," << mm.c << "," << mm.p << "," << mm.m);
+ //P(d, "value", "(" << rowCount << "," << columnCount << ")");
+ P(d, "value", m->data(mi, Qt::DisplayRole).toString());
+ P(d, "valueencoded", "2");
+ P(d, "numchild", "1");
+ if (d.dumpChildren) {
+ d << ",children=[";
+ for (int row = 0; row < rowCount; ++row) {
+ for (int column = 0; column < columnCount; ++column) {
+ QModelIndex child = m->index(row, column, mi);
+ d.beginHash();
+ P(d, "name", "[" << row << "," << column << "]");
+ //P(d, "numchild", (m->hasChildren(child) ? "1" : "0"));
+ P(d, "numchild", "1");
+ P(d, "addr", "$" << child.row() << "," << child.column() << ","
+ << child.internalPointer() << "," << child.model());
+ P(d, "type", NS"QAbstractItem");
+ P(d, "value", m->data(mi, Qt::DisplayRole).toString());
+ P(d, "valueencoded", "2");
+ d.endHash();
+ }
+ }
+ d.beginHash();
+ P(d, "name", "DisplayRole");
+ P(d, "numchild", 0);
+ P(d, "value", m->data(mi, Qt::DisplayRole).toString());
+ P(d, "valueencoded", 2);
+ P(d, "type", NS"QString");
+ d.endHash();
+ d << "]";
+ }
+ d.disarm();
+}
+
+static void qDumpQAbstractItemModel(QDumper &d)
+{
+ const QAbstractItemModel &m = *reinterpret_cast<const QAbstractItemModel *>(d.data);
+
+ const int rowCount = m.rowCount();
+ if (rowCount < 0)
+ return;
+ const int columnCount = m.columnCount();
+ if (columnCount < 0)
+ return;
+
+ P(d, "type", NS"QAbstractItemModel");
+ P(d, "value", "(" << rowCount << "," << columnCount << ")");
+ P(d, "numchild", "1");
+ if (d.dumpChildren) {
+ d << ",children=[";
+ d.beginHash();
+ P(d, "numchild", "1");
+ P(d, "name", NS"QObject");
+ P(d, "addr", d.data);
+ P(d, "value", m.objectName());
+ P(d, "valueencoded", "2");
+ P(d, "type", NS"QObject");
+ P(d, "displayedtype", m.metaObject()->className());
+ d.endHash();
+ for (int row = 0; row < rowCount; ++row) {
+ for (int column = 0; column < columnCount; ++column) {
+ QModelIndex mi = m.index(row, column);
+ d.beginHash();
+ P(d, "name", "[" << row << "," << column << "]");
+ P(d, "value", m.data(mi, Qt::DisplayRole).toString());
+ P(d, "valueencoded", "2");
+ //P(d, "numchild", (m.hasChildren(mi) ? "1" : "0"));
+ P(d, "numchild", "1");
+ P(d, "addr", "$" << mi.row() << "," << mi.column() << ","
+ << mi.internalPointer() << "," << mi.model());
+ P(d, "type", NS"QAbstractItem");
+ d.endHash();
+ }
+ }
+ d << "]";
+ }
+ d.disarm();
+}
+
static void qDumpQByteArray(QDumper &d)
{
const QByteArray &ba = *reinterpret_cast<const QByteArray *>(d.data);
if (d.dumpChildren) {
d << ",children=[";
d.beginHash();
- P(d, "name", "key");
+ P(d, "name", "data");
P(d, "type", NS "QImageData");
P(d, "addr", d.data);
d.endHash();
d.setupTemplateParameters();
P(d, "iname", d.iname);
- P(d, "addr", d.data);
+ if (d.data)
+ P(d, "addr", d.data);
#ifdef QT_NO_QDATASTREAM
if (d.protocolVersion == 3) {
if (isEqual(type, "map"))
qDumpStdMap(d);
break;
+ case 'A':
+ if (isEqual(type, "QAbstractItemModel"))
+ qDumpQAbstractItemModel(d);
+ else if (isEqual(type, "QAbstractItem"))
+ qDumpQAbstractItem(d);
+ break;
case 'B':
if (isEqual(type, "QByteArray"))
qDumpQByteArray(d);
// They are mentioned here nevertheless. For types that are not listed
// here, dumpers won't be used.
d << "dumpers=["
+ "\""NS"QAbstractItem\","
+ "\""NS"QAbstractItemModel\","
"\""NS"QByteArray\","
"\""NS"QDateTime\","
"\""NS"QDir\","
d.iname = inbuffer; while (*inbuffer) ++inbuffer; ++inbuffer;
d.exp = inbuffer; while (*inbuffer) ++inbuffer; ++inbuffer;
d.innertype = inbuffer; while (*inbuffer) ++inbuffer; ++inbuffer;
- d.iname = inbuffer; while (*inbuffer) ++inbuffer; ++inbuffer;
handleProtocolVersion2and3(d);
}
if (s.startsWith(QLatin1String("std::")))
return stdType(s.mid(5));
// Strip namespace
+ // FIXME: that's not a good idea as it makes all namespaces equal.
const int namespaceIndex = s.lastIndexOf(QLatin1String("::"));
if (namespaceIndex == -1) {
// None ... check for std..
if (sType != UnknownType)
return sType;
} else {
- s.remove(namespaceIndex + 2);
+ s = s.mid(namespaceIndex + 2);
}
if (s == QLatin1String("QObject"))
return QObjectType;
return QObjectSignalType;
if (s == QLatin1String("QVector"))
return QVectorType;
+ if (s == QLatin1String("QAbstractItem"))
+ return QAbstractItemType;
if (s == QLatin1String("QMap"))
return QMapType;
if (s == QLatin1String("QMultiMap"))
bool QtDumperHelper::needsExpressionSyntax(Type t)
{
switch (t) {
+ case QAbstractItemType:
case QObjectSlotType:
case QObjectSignalType:
case QMapType:
break;
}
if (name == QLatin1String("std::wstring")) {
+ // FIXME: check space between > > below?
m_sizeCache.insert(QLatin1String("std::basic_string<unsigned short,std::char_traits<unsignedshort>,std::allocator<unsignedshort> >"), size);
break;
}
const Type st = simpleType(typeName);
if (st != UnknownType) {
td.isTemplate = false;
- td.type =st;
+ td.type = st;
return td;
}
// Try template
if (outertype == m_qtNamespace + QLatin1String("QWidget"))
outertype = m_qtNamespace + QLatin1String("QObject");
+ QString inner = td.inner;
+
extraArgs.clear();
if (!inners.empty()) {
// in rare cases we need more or less:
switch (td.type) {
+ case QAbstractItemType:
+ inner = data.addr.mid(1);
+ break;
case QObjectType:
case QWidgetType:
if (debugger == GdbDebugger) {
inBuffer->append('\0');
inBuffer->append(data.exp.toUtf8());
inBuffer->append('\0');
- inBuffer->append(td.inner.toUtf8());
- inBuffer->append('\0');
- inBuffer->append(data.iname.toUtf8());
+ inBuffer->append(inner.toUtf8());
inBuffer->append('\0');
if (debug)