Commit a59f45c5 authored by hjk's avatar hjk
Browse files

debugger: try to improve tooltip handling

Still far from usable.
parent ed843bf5
...@@ -114,9 +114,9 @@ static const char winPythonVersionC[] = "python2.5"; ...@@ -114,9 +114,9 @@ static const char winPythonVersionC[] = "python2.5";
#define CB(callback) &GdbEngine::callback, STRINGIFY(callback) #define CB(callback) &GdbEngine::callback, STRINGIFY(callback)
QByteArray GdbEngine::tooltipIName() QByteArray GdbEngine::tooltipIName(const QString &exp)
{ {
return "tooltip.x"; return "tooltip." + exp.toLatin1().toHex();
} }
static bool stateAcceptsGdbCommands(DebuggerState state) static bool stateAcceptsGdbCommands(DebuggerState state)
...@@ -3222,7 +3222,7 @@ QPoint GdbEngine::m_toolTipPos; ...@@ -3222,7 +3222,7 @@ QPoint GdbEngine::m_toolTipPos;
bool GdbEngine::showToolTip() bool GdbEngine::showToolTip()
{ {
QByteArray iname = tooltipIName(); QByteArray iname = tooltipIName(m_toolTipExpression);
if (!theDebuggerBoolSetting(UseToolTipsInMainEditor)) { if (!theDebuggerBoolSetting(UseToolTipsInMainEditor)) {
watchHandler()->removeData(iname); watchHandler()->removeData(iname);
...@@ -3257,8 +3257,10 @@ void GdbEngine::setToolTipExpression(const QPoint &mousePos, ...@@ -3257,8 +3257,10 @@ void GdbEngine::setToolTipExpression(const QPoint &mousePos,
m_toolTipPos = mousePos; m_toolTipPos = mousePos;
int line, column; int line, column;
QString exp = cppExpressionAt(editor, cursorPos, &line, &column); QString exp = cppExpressionAt(editor, cursorPos, &line, &column);
if (exp == m_toolTipExpression) if (!exp.isEmpty() && exp == m_toolTipExpression) {
showToolTip();
return; return;
}
m_toolTipExpression = exp; m_toolTipExpression = exp;
...@@ -3326,7 +3328,7 @@ void GdbEngine::setToolTipExpression(const QPoint &mousePos, ...@@ -3326,7 +3328,7 @@ void GdbEngine::setToolTipExpression(const QPoint &mousePos,
WatchData toolTip; WatchData toolTip;
toolTip.exp = exp.toLatin1(); toolTip.exp = exp.toLatin1();
toolTip.name = exp; toolTip.name = exp;
toolTip.iname = tooltipIName(); toolTip.iname = tooltipIName(exp);
watchHandler()->removeData(toolTip.iname); watchHandler()->removeData(toolTip.iname);
watchHandler()->insertData(toolTip); watchHandler()->insertData(toolTip);
} }
......
...@@ -525,7 +525,7 @@ private: ////////// View & Data Stuff ////////// ...@@ -525,7 +525,7 @@ private: ////////// View & Data Stuff //////////
static QString m_toolTipExpression; static QString m_toolTipExpression;
static QPoint m_toolTipPos; static QPoint m_toolTipPos;
static QByteArray tooltipIName(); static QByteArray tooltipIName(const QString &exp);
// HACK: // HACK:
StackFrame m_targetFrame; StackFrame m_targetFrame;
......
...@@ -60,8 +60,11 @@ void GdbEngine::updateLocalsPython(const QByteArray &varList) ...@@ -60,8 +60,11 @@ void GdbEngine::updateLocalsPython(const QByteArray &varList)
expanded += "formats:" + handler->individualFormatRequests(); expanded += "formats:" + handler->individualFormatRequests();
QByteArray watchers; QByteArray watchers;
if (!m_toolTipExpression.isEmpty()) if (!m_toolTipExpression.isEmpty()) {
watchers += m_toolTipExpression.toLatin1() + '#' + tooltipIName(); watchers += m_toolTipExpression.toLatin1();
watchers += '#';
watchers += tooltipIName(m_toolTipExpression);
}
QHash<QByteArray, int> watcherNames = handler->watcherNames(); QHash<QByteArray, int> watcherNames = handler->watcherNames();
QHashIterator<QByteArray, int> it(watcherNames); QHashIterator<QByteArray, int> it(watcherNames);
......
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