Commit 0ae56956 authored by Friedemann Kleint's avatar Friedemann Kleint Committed by hjk

Try to watch local variable in watchwindow-DND, too.

Fix codepath overlooked in
6886e485 by introducing
a WatchHandler::watchVariable().

Task-number: QTCREATORBUG-8120
Change-Id: Ibab2619754e0006f3c81810a6bfdf758261c169e
Reviewed-by: default avatarhjk <qthjk@ovi.com>
parent 1f9e226e
......@@ -1167,12 +1167,7 @@ public slots:
exp = fixCppExpression(exp);
if (exp.isEmpty())
return;
const QString name = exp;
// Prefer to watch an existing local variable by its expression (address) if it can be found.
WatchHandler *watchHandler = currentEngine()->watchHandler();
if (const WatchData *localVariable = watchHandler->findCppLocalVariable(exp))
exp = QLatin1String(localVariable->exp);
watchHandler->watchExpression(exp, name);
currentEngine()->watchHandler()->watchVariable(exp);
}
void handleExecExit()
......
......@@ -1586,6 +1586,18 @@ void WatchHandler::watchExpression(const QString &exp, const QString &name)
updateWatchersWindow();
}
// Watch something obtained from the editor.
// Prefer to watch an existing local variable by its expression
// (address) if it can be found. Default to watchExpression().
void WatchHandler::watchVariable(const QString &exp)
{
if (const WatchData *localVariable = findCppLocalVariable(exp)) {
watchExpression(QLatin1String(localVariable->exp), exp);
} else {
watchExpression(exp);
}
}
static void swapEndian(char *d, int nchar)
{
QTC_ASSERT(nchar % 4 == 0, return);
......
......@@ -77,6 +77,7 @@ public:
void cleanup();
void watchExpression(const QString &exp, const QString &name = QString());
void watchVariable(const QString &exp);
Q_SLOT void clearWatches();
void updateWatchers(); // Called after locals are fetched
......
......@@ -553,7 +553,7 @@ void WatchTreeView::dropEvent(QDropEvent *ev)
QString data = ev->mimeData()->text();
foreach (const QChar c, data)
exp.append(c.isPrint() ? c : QChar(QLatin1Char(' ')));
watchExpression(exp);
currentEngine()->watchHandler()->watchVariable(exp);
//ev->acceptProposedAction();
ev->setDropAction(Qt::CopyAction);
ev->accept();
......
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