Debugger[CDB]: Enable tooltips for class members of 'this'.

Look if 'this.x' exists if 'x' cannot be found as a local variable.
Enable filtering by nested names in tooltip treeview ('this.x').
This commit is contained in:
Friedemann Kleint
2011-03-29 12:29:10 +02:00
parent 34030efbc4
commit 77999ce204
3 changed files with 58 additions and 14 deletions

View File

@@ -528,17 +528,25 @@ bool CdbEngine::setToolTipExpression(const QPoint &mousePos,
int line;
int column;
DebuggerToolTipContext context = contextIn;
const QString exp = cppExpressionAt(editor, context.position, &line, &column, &context.function);
QString exp = cppExpressionAt(editor, context.position, &line, &column, &context.function);
// Are we in the current stack frame
if (context.function.isEmpty() || exp.isEmpty() || context.function != stackHandler()->currentFrame().function)
return false;
// No numerical or any other expressions [yet]
if (!(exp.at(0).isLetter() || exp.at(0) == QLatin1Char('_')))
return false;
const QByteArray iname = QByteArray(localsPrefixC) + exp.toAscii();
const QModelIndex index = watchHandler()->itemIndex(iname);
if (!index.isValid())
return false;
// Can this be found as a local variable?
const QByteArray localsPrefix(localsPrefixC);
QByteArray iname = localsPrefix + exp.toAscii();
QModelIndex index = watchHandler()->itemIndex(iname);
if (!index.isValid()) {
// Nope, try a 'local.this.m_foo'.
exp.prepend(QLatin1String("this."));
iname.insert(localsPrefix.size(), "this.");
index = watchHandler()->itemIndex(iname);
if (!index.isValid())
return false;
}
DebuggerTreeViewToolTipWidget *tw = new DebuggerTreeViewToolTipWidget;
tw->setContext(context);
tw->setDebuggerModel(LocalsWatch);