aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/debugger/watchhandler.cpp
diff options
context:
space:
mode:
authorhjk <[email protected]>2010-06-25 09:07:14 +0200
committerhjk <[email protected]>2010-06-25 09:16:55 +0200
commiteb75f40a9883b437f1e1ce722a769a450a905d39 (patch)
tree2395c735a3ddb1539e5b7a457885711a99ebd0f9 /src/plugins/debugger/watchhandler.cpp
parent21843d6326e107acf21d7a7649b7d226d4a3761a (diff)
debugger: allow per item selection of display method in Locals&Watchers
Diffstat (limited to 'src/plugins/debugger/watchhandler.cpp')
-rw-r--r--src/plugins/debugger/watchhandler.cpp30
1 files changed, 20 insertions, 10 deletions
diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp
index 92b71279f61..ddf6f9e0238 100644
--- a/src/plugins/debugger/watchhandler.cpp
+++ b/src/plugins/debugger/watchhandler.cpp
@@ -613,7 +613,8 @@ QVariant WatchModel::data(const QModelIndex &idx, int role) const
return QVariant(QLatin1Char('*') + item->parent->name);
return data.name;
case 1: {
- int format = m_handler->m_individualFormats.value(data.addr, -1);
+ int format =
+ m_handler->m_individualFormats.value(data.iname, -1);
if (format == -1)
format = m_handler->m_typeFormats.value(data.type, -1);
return truncateValue(formattedValue(data, format));
@@ -650,26 +651,30 @@ QVariant WatchModel::data(const QModelIndex &idx, int role) const
case LocalsExpandedRole:
return m_handler->m_expandedINames.contains(data.iname);
- case LocalsTypeFormatListRole:
- if (!data.typeFormats.isEmpty())
- return data.typeFormats.split(',');
+ case LocalsTypeFormatListRole: {
if (isIntType(data.type))
return QStringList() << tr("decimal") << tr("hexadecimal")
<< tr("binary") << tr("octal");
if (data.type.endsWith(QLatin1Char('*')))
return QStringList()
- << tr("Bald pointer")
+ << tr("Raw pointer")
<< tr("Latin1 string")
<< tr("UTF8 string")
<< tr("UTF16 string")
<< tr("UCS4 string");
- break;
+ // Hack: Compensate for namespaces.
+ QString type = data.type;
+ int pos = type.indexOf("::Q");
+ if (pos >= 0 && type.count(':') == 2)
+ type = type.mid(pos + 2);
+ return m_handler->m_reportedTypeFormats.value(type);
+ }
case LocalsTypeFormatRole:
return m_handler->m_typeFormats.value(data.type, -1);
case LocalsIndividualFormatRole:
- return m_handler->m_individualFormats.value(data.addr, -1);
+ return m_handler->m_individualFormats.value(data.iname, -1);
case LocalsRawValueRole:
return data.value;
@@ -772,9 +777,9 @@ bool WatchModel::setData(const QModelIndex &index, const QVariant &value, int ro
case LocalsIndividualFormatRole: {
const int format = value.toInt();
if (format == -1) {
- m_handler->m_individualFormats.remove(data.addr);
+ m_handler->m_individualFormats.remove(data.iname);
} else {
- m_handler->m_individualFormats[data.addr] = format;
+ m_handler->m_individualFormats[data.iname] = format;
}
engine()->updateWatchData(data);
break;
@@ -1503,7 +1508,7 @@ int WatchHandler::format(const QByteArray &iname) const
{
int result = -1;
if (const WatchData *item = findItem(iname)) {
- int result = m_individualFormats.value(iname, -1);
+ int result = m_individualFormats.value(item->iname, -1);
if (result == -1)
result = m_typeFormats.value(item->type, -1);
}
@@ -1561,5 +1566,10 @@ QByteArray WatchHandler::individualFormatRequests() const
return ba;
}
+void WatchHandler::addTypeFormats(const QString &type, const QStringList &formats)
+{
+ m_reportedTypeFormats.insert(type, formats);
+}
+
} // namespace Internal
} // namespace Debugger