From effc5abdd828443251699241df205de363cc2a05 Mon Sep 17 00:00:00 2001 From: hjk <qtc-committer@nokia.com> Date: Tue, 29 Jun 2010 10:58:09 +0200 Subject: [PATCH] debugger: don't try to compute tooltip if it's not shown --- src/plugins/debugger/gdb/gdbengine.cpp | 16 +++++---- src/plugins/debugger/gdb/gdbengine.h | 2 +- src/plugins/debugger/gdb/pythongdbengine.cpp | 3 +- tests/manual/gdbdebugger/simple/app.cpp | 34 ++++++++++++++++---- 4 files changed, 39 insertions(+), 16 deletions(-) diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index 8b9fede4085..f18dce585ec 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -114,11 +114,8 @@ static const char winPythonVersionC[] = "python2.5"; #define CB(callback) &GdbEngine::callback, STRINGIFY(callback) -QByteArray GdbEngine::tooltipINameForExpression(const QByteArray &exp) +QByteArray GdbEngine::tooltipIName() { - // FIXME: 'exp' can contain illegal characters - //return "tooltip." + exp; - Q_UNUSED(exp) return "tooltip.x"; } @@ -3204,10 +3201,17 @@ QPoint GdbEngine::m_toolTipPos; bool GdbEngine::showToolTip() { + QByteArray iname = tooltipIName(); + + if (!theDebuggerBoolSetting(UseToolTipsInMainEditor)) { + watchHandler()->removeData(iname); + return true; + } + WatchModel *model = watchHandler()->model(TooltipsWatch); - QByteArray iname = tooltipINameForExpression(m_toolTipExpression.toLatin1()); WatchItem *item = model->findItem(iname, model->rootItem()); if (!item) { + watchHandler()->removeData(iname); hideDebuggerToolTip(); return false; } @@ -3301,7 +3305,7 @@ void GdbEngine::setToolTipExpression(const QPoint &mousePos, WatchData toolTip; toolTip.exp = exp.toLatin1(); toolTip.name = exp; - toolTip.iname = tooltipINameForExpression(toolTip.exp); + toolTip.iname = tooltipIName(); watchHandler()->removeData(toolTip.iname); watchHandler()->insertData(toolTip); } diff --git a/src/plugins/debugger/gdb/gdbengine.h b/src/plugins/debugger/gdb/gdbengine.h index 3787b8202e1..c703573f51f 100644 --- a/src/plugins/debugger/gdb/gdbengine.h +++ b/src/plugins/debugger/gdb/gdbengine.h @@ -520,7 +520,7 @@ private: ////////// View & Data Stuff ////////// static QString m_toolTipExpression; static QPoint m_toolTipPos; - static QByteArray tooltipINameForExpression(const QByteArray &exp); + static QByteArray tooltipIName(); }; } // namespace Internal diff --git a/src/plugins/debugger/gdb/pythongdbengine.cpp b/src/plugins/debugger/gdb/pythongdbengine.cpp index a2d45dd178e..b4bf14664e0 100644 --- a/src/plugins/debugger/gdb/pythongdbengine.cpp +++ b/src/plugins/debugger/gdb/pythongdbengine.cpp @@ -61,8 +61,7 @@ void GdbEngine::updateLocalsPython(const QByteArray &varList) QByteArray watchers; if (!m_toolTipExpression.isEmpty()) - watchers += m_toolTipExpression.toLatin1() - + '#' + tooltipINameForExpression(m_toolTipExpression.toLatin1()); + watchers += m_toolTipExpression.toLatin1() + '#' + tooltipIName(); QHash<QByteArray, int> watcherNames = handler->watcherNames(); QHashIterator<QByteArray, int> it(watcherNames); diff --git a/tests/manual/gdbdebugger/simple/app.cpp b/tests/manual/gdbdebugger/simple/app.cpp index 8a4f93a5f6e..6eb30b48bd1 100644 --- a/tests/manual/gdbdebugger/simple/app.cpp +++ b/tests/manual/gdbdebugger/simple/app.cpp @@ -187,13 +187,20 @@ private: QHash<QObject *, Map::iterator> h; }; -class X : virtual public Foo +class X : public Foo { public: X() { } }; +class XX : virtual public Foo +{ +public: + XX() { + } +}; + class Y : virtual public Foo { public: @@ -201,13 +208,24 @@ public: } }; +class D : public X, public Y +{ + int diamond; +}; + void testArray() { - X xxx; +#if 1 + X x; + XX xx; + D diamond; + Foo *f = &xx; + Foo ff; double d[3][3]; for (int i = 0; i != 3; ++i) for (int j = 0; j != 3; ++j) d[i][j] = i + j; +#endif char c[20]; c[0] = 'a'; @@ -215,11 +233,12 @@ void testArray() c[2] = 'c'; c[3] = 'd'; - QString x[20]; - x[0] = "a"; - x[1] = "b"; - x[2] = "c"; - x[3] = "d"; +#if 1 + QString s[20]; + s[0] = "a"; + s[1] = "b"; + s[2] = "c"; + s[3] = "d"; Foo foo[10]; //for (int i = 0; i != sizeof(foo)/sizeof(foo[0]); ++i) { @@ -227,6 +246,7 @@ void testArray() foo[i].a = i; foo[i].doit(); } +#endif } #ifndef Q_CC_RVCT -- GitLab