summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/plugins/debugger/cdb/cdbengine.cpp25
-rw-r--r--src/plugins/debugger/cdb/cdbengine.h2
-rw-r--r--src/plugins/debugger/debuggerengine.cpp3
-rw-r--r--src/plugins/debugger/debuggerengine.h2
-rw-r--r--src/plugins/debugger/debuggerplugin.cpp39
-rw-r--r--src/plugins/debugger/debuggertooltipmanager.cpp130
-rw-r--r--src/plugins/debugger/debuggertooltipmanager.h8
-rw-r--r--src/plugins/debugger/gdb/gdbengine.cpp19
-rw-r--r--src/plugins/debugger/gdb/gdbengine.h2
-rw-r--r--src/plugins/debugger/pdb/pdbengine.cpp17
-rw-r--r--src/plugins/debugger/pdb/pdbengine.h2
-rw-r--r--src/plugins/debugger/qml/qmlcppengine.cpp4
-rw-r--r--src/plugins/debugger/qml/qmlcppengine.h2
-rw-r--r--src/plugins/debugger/qml/qmlengine.cpp3
-rw-r--r--src/plugins/debugger/qml/qmlengine.h2
-rw-r--r--src/plugins/debugger/script/scriptengine.cpp17
-rw-r--r--src/plugins/debugger/script/scriptengine.h2
-rw-r--r--src/plugins/debugger/tcf/tcfengine.cpp3
-rw-r--r--src/plugins/debugger/tcf/tcfengine.h2
-rw-r--r--src/plugins/debugger/watchutils.cpp10
-rw-r--r--src/plugins/debugger/watchutils.h1
21 files changed, 180 insertions, 115 deletions
diff --git a/src/plugins/debugger/cdb/cdbengine.cpp b/src/plugins/debugger/cdb/cdbengine.cpp
index 0bae54ae03..8677a5e293 100644
--- a/src/plugins/debugger/cdb/cdbengine.cpp
+++ b/src/plugins/debugger/cdb/cdbengine.cpp
@@ -471,7 +471,7 @@ void CdbEngine::syncOperateByInstruction(bool operateByInstruction)
postCommand(m_operateByInstruction ? QByteArray("l-s") : QByteArray("l+s"), 0);
}
-void CdbEngine::setToolTipExpression(const QPoint &mousePos,
+bool CdbEngine::setToolTipExpression(const QPoint &mousePos,
TextEditor::ITextEditor *editor,
const DebuggerToolTipContext &contextIn)
{
@@ -479,7 +479,7 @@ void CdbEngine::setToolTipExpression(const QPoint &mousePos,
qDebug() << Q_FUNC_INFO;
// Need a stopped debuggee and a cpp file in a valid frame
if (state() != InferiorStopOk || !isCppEditor(editor) || stackHandler()->currentIndex() < 0)
- return;
+ return false;
// Determine expression and function
int line;
int column;
@@ -487,20 +487,21 @@ void CdbEngine::setToolTipExpression(const QPoint &mousePos,
const 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;
+ return false;
// No numerical or any other expressions [yet]
if (!(exp.at(0).isLetter() || exp.at(0) == QLatin1Char('_')))
- return;
+ return false;
const QByteArray iname = QByteArray(localsPrefixC) + exp.toAscii();
const QModelIndex index = watchHandler()->itemIndex(iname);
- if (index.isValid()) {
- DebuggerTreeViewToolTipWidget *tw = new DebuggerTreeViewToolTipWidget;
- tw->setContext(context);
- tw->setDebuggerModel(LocalsWatch);
- tw->setExpression(exp);
- tw->acquireEngine(this);
- DebuggerToolTipManager::instance()->add(mousePos, tw);
- }
+ if (!index.isValid())
+ return false;
+ DebuggerTreeViewToolTipWidget *tw = new DebuggerTreeViewToolTipWidget;
+ tw->setContext(context);
+ tw->setDebuggerModel(LocalsWatch);
+ tw->setExpression(exp);
+ tw->acquireEngine(this);
+ DebuggerToolTipManager::instance()->add(mousePos, tw);
+ return true;
}
// Determine full path to the CDB extension library.
diff --git a/src/plugins/debugger/cdb/cdbengine.h b/src/plugins/debugger/cdb/cdbengine.h
index 5fa6f8bfb0..263da86a1e 100644
--- a/src/plugins/debugger/cdb/cdbengine.h
+++ b/src/plugins/debugger/cdb/cdbengine.h
@@ -85,7 +85,7 @@ public:
virtual ~CdbEngine();
// Factory function that returns 0 if the debug engine library cannot be found.
- virtual void setToolTipExpression(const QPoint &mousePos, TextEditor::ITextEditor *editor,
+ virtual bool setToolTipExpression(const QPoint &mousePos, TextEditor::ITextEditor *editor,
const DebuggerToolTipContext &ctx);
virtual void setupEngine();
virtual void setupInferior();
diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp
index 50986b415c..7b82b9a4a7 100644
--- a/src/plugins/debugger/debuggerengine.cpp
+++ b/src/plugins/debugger/debuggerengine.cpp
@@ -1239,9 +1239,10 @@ DebuggerRunControl *DebuggerEngine::runControl() const
return d->runControl();
}
-void DebuggerEngine::setToolTipExpression
+bool DebuggerEngine::setToolTipExpression
(const QPoint &, TextEditor::ITextEditor *, const DebuggerToolTipContext &)
{
+ return false;
}
void DebuggerEngine::updateWatchData(const WatchData &, const WatchUpdateFlags &)
diff --git a/src/plugins/debugger/debuggerengine.h b/src/plugins/debugger/debuggerengine.h
index 8cab885da9..63d4d46347 100644
--- a/src/plugins/debugger/debuggerengine.h
+++ b/src/plugins/debugger/debuggerengine.h
@@ -137,7 +137,7 @@ public:
const DebuggerStartParameters &startParameters() const;
DebuggerStartParameters &startParameters();
- virtual void setToolTipExpression(const QPoint & mousePos,
+ virtual bool setToolTipExpression(const QPoint & mousePos,
TextEditor::ITextEditor *editor, const Internal::DebuggerToolTipContext &);
virtual void updateWatchData(const Internal::WatchData &data,
diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp
index 62ccadd109..1eb85fce72 100644
--- a/src/plugins/debugger/debuggerplugin.cpp
+++ b/src/plugins/debugger/debuggerplugin.cpp
@@ -721,16 +721,6 @@ bool DebuggingHelperOptionPage::matches(const QString &s) const
//
///////////////////////////////////////////////////////////////////////
-static bool isDebuggable(IEditor *editor)
-{
- // Only blacklist Qml. Whitelisting would fail on C++ code in files
- // with strange names, more harm would be done this way.
- // IFile *file = editor->file();
- // return !(file && file->mimeType() == "application/x-qml");
- // Nowadays, even Qml is debuggable.
- return editor;
-}
-
class ContextData
{
public:
@@ -871,8 +861,6 @@ public slots:
void updateBreakMenuItem(Core::IEditor *editor);
void setBusyCursor(bool busy);
void requestMark(TextEditor::ITextEditor *editor, int lineNumber);
- void showToolTip(TextEditor::ITextEditor *editor,
- const QPoint &pnt, int pos, bool *handled);
void requestContextMenu(TextEditor::ITextEditor *editor,
int lineNumber, QMenu *menu);
@@ -1776,7 +1764,7 @@ void DebuggerPluginPrivate::runScheduled()
void DebuggerPluginPrivate::editorOpened(IEditor *editor)
{
- if (!isDebuggable(editor))
+ if (!isEditorDebuggable(editor))
return;
ITextEditor *textEditor = qobject_cast<ITextEditor *>(editor);
if (!textEditor)
@@ -1784,9 +1772,6 @@ void DebuggerPluginPrivate::editorOpened(IEditor *editor)
connect(textEditor,
SIGNAL(markRequested(TextEditor::ITextEditor*,int)),
SLOT(requestMark(TextEditor::ITextEditor*,int)));
- connect(editor,
- SIGNAL(tooltipOverrideRequested(TextEditor::ITextEditor*,QPoint,int,bool*)),
- SLOT(showToolTip(TextEditor::ITextEditor*,QPoint,int,bool*)));
connect(textEditor,
SIGNAL(markContextMenuRequested(TextEditor::ITextEditor*,int,QMenu*)),
SLOT(requestContextMenu(TextEditor::ITextEditor*,int,QMenu*)));
@@ -1801,7 +1786,7 @@ void DebuggerPluginPrivate::updateBreakMenuItem(Core::IEditor *editor)
void DebuggerPluginPrivate::requestContextMenu(ITextEditor *editor,
int lineNumber, QMenu *menu)
{
- if (!isDebuggable(editor))
+ if (!isEditorDebuggable(editor))
return;
ContextData args;
@@ -1947,26 +1932,6 @@ void DebuggerPluginPrivate::requestMark(ITextEditor *editor, int lineNumber)
}
}
-void DebuggerPluginPrivate::showToolTip(ITextEditor *editor,
- const QPoint &point, int pos, bool *handled)
-{
- if (!isDebuggable(editor))
- return;
- if (!boolSetting(UseToolTipsInMainEditor))
- return;
- if (!currentEngine())
- return;
- if (!currentEngine()->canDisplayTooltip())
- return;
- QTC_ASSERT(handled, return);
-
- const DebuggerToolTipContext context = DebuggerToolTipContext::fromEditor(editor, pos);
- if (context.isValid()) {
- *handled = true;
- currentEngine()->setToolTipExpression(point, editor, context);
- }
-}
-
DebuggerRunControl *DebuggerPluginPrivate::createDebugger
(const DebuggerStartParameters &sp, RunConfiguration *rc)
{
diff --git a/src/plugins/debugger/debuggertooltipmanager.cpp b/src/plugins/debugger/debuggertooltipmanager.cpp
index 738ab14667..c1282f9ab2 100644
--- a/src/plugins/debugger/debuggertooltipmanager.cpp
+++ b/src/plugins/debugger/debuggertooltipmanager.cpp
@@ -34,7 +34,9 @@
#include "debuggertooltipmanager.h"
#include "watchutils.h"
#include "debuggerengine.h"
+#include "debuggeractions.h"
#include "watchhandler.h"
+#include "watchutils.h"
#include "stackhandler.h"
#include "debuggercore.h"
@@ -43,6 +45,7 @@
#include <coreplugin/imode.h>
#include <coreplugin/editormanager/editormanager.h>
#include <texteditor/itexteditor.h>
+#include <texteditor/tooltip/tooltip.h>
#include <utils/qtcassert.h>
@@ -128,28 +131,46 @@ static inline void debugMode(const QAbstractItemModel *model)
nospace << '#' << r << ' ' << model->data(model->index(r, 0)).toString() << '\n';
}
-static inline QPlainTextEdit *plainTextEditor(Core::IEditor *ie, QString *fileName = 0)
+namespace Debugger {
+namespace Internal {
+
+// A convenience struct to pass around all tooltip-relevant editor members
+// (TextEditor, Widget, File, etc), constructing from a Core::IEditor.
+struct DebuggerToolTipEditor
+{
+ explicit DebuggerToolTipEditor(Core::IEditor *ie = 0);
+ inline bool isValid() const { return textEditor != 0 && plainTextEdit != 0 && file != 0; }
+ inline operator bool() const { return isValid(); }
+ QString fileName() const { return file ? file->fileName() : QString(); }
+
+ static DebuggerToolTipEditor currentToolTipEditor();
+
+ TextEditor::ITextEditor *textEditor;
+ QPlainTextEdit *plainTextEdit;
+ Core::IFile *file;
+};
+
+DebuggerToolTipEditor::DebuggerToolTipEditor(Core::IEditor *ie) :
+ textEditor(0), plainTextEdit(0), file(0)
{
- if (const Core::IFile *file = ie->file())
- if (qobject_cast<TextEditor::ITextEditor *>(ie))
+ if (ie && ie->file() && isEditorDebuggable(ie)) {
+ if (TextEditor::ITextEditor *te = qobject_cast<TextEditor::ITextEditor *>(ie)) {
if (QPlainTextEdit *pe = qobject_cast<QPlainTextEdit *>(ie->widget())) {
- if (fileName)
- *fileName = file->fileName();
- return pe;
+ textEditor = te;
+ plainTextEdit = pe;
+ file = ie->file();
}
- return 0;
+ }
+ }
}
-static inline QPlainTextEdit *currentPlainTextEditor(QString *fileName = 0)
+DebuggerToolTipEditor DebuggerToolTipEditor::currentToolTipEditor()
{
if (Core::IEditor *ie = Core::EditorManager::instance()->currentEditor())
- return plainTextEditor(ie, fileName);
- return 0;
+ return DebuggerToolTipEditor(ie);
+ return DebuggerToolTipEditor();
}
-namespace Debugger {
-namespace Internal {
-
/* Helper for building a QStandardItemModel of a tree form (see TreeModelVisitor).
* The recursion/building is based on the scheme: \code
<row><item1><item2>
@@ -1005,7 +1026,8 @@ QString DebuggerTreeViewToolTipWidget::clipboardContents() const
DebuggerToolTipManager *DebuggerToolTipManager::m_instance = 0;
DebuggerToolTipManager::DebuggerToolTipManager(QObject *parent) :
- QObject(parent), m_debugModeActive(false)
+ QObject(parent), m_debugModeActive(false),
+ m_lastToolTipPos(-1), m_lastToolTipEditor(0)
{
DebuggerToolTipManager::m_instance = this;
}
@@ -1152,21 +1174,21 @@ void DebuggerToolTipManager::slotUpdateVisibleToolTips()
return;
}
- QString fileName;
- QPlainTextEdit *plainTextEdit = currentPlainTextEditor(&fileName);
+ DebuggerToolTipEditor toolTipEditor = DebuggerToolTipEditor::currentToolTipEditor();
if (debugToolTips)
- qDebug() << "DebuggerToolTipManager::slotUpdateVisibleToolTips() " << fileName << sender();
+ qDebug() << "DebuggerToolTipManager::slotUpdateVisibleToolTips() " << sender();
- if (fileName.isEmpty() || !plainTextEdit) {
+ if (!toolTipEditor.isValid() || toolTipEditor.fileName().isEmpty()) {
hide();
return;
}
// Reposition and show all tooltips of that file.
+ const QString fileName = toolTipEditor.fileName();
foreach (const QPointer<AbstractDebuggerToolTipWidget> &tw, m_tooltips) {
if (tw->fileName() == fileName) {
- tw->positionShow(plainTextEdit);
+ tw->positionShow(toolTipEditor.plainTextEdit);
} else {
tw->hide();
}
@@ -1250,9 +1272,12 @@ bool DebuggerToolTipManager::debug()
void DebuggerToolTipManager::slotEditorOpened(Core::IEditor *e)
{
// Move tooltip along when scrolled.
- if (QPlainTextEdit *plainTextEdit = plainTextEditor(e)) {
- connect(plainTextEdit->verticalScrollBar(), SIGNAL(valueChanged(int)),
+ if (DebuggerToolTipEditor toolTipEditor = DebuggerToolTipEditor(e)) {
+ connect(toolTipEditor.plainTextEdit->verticalScrollBar(), SIGNAL(valueChanged(int)),
this, SLOT(slotUpdateVisibleToolTips()));
+ connect(toolTipEditor.textEditor,
+ SIGNAL(tooltipOverrideRequested(TextEditor::ITextEditor*,QPoint,int,bool*)),
+ SLOT(slotTooltipOverrideRequested(TextEditor::ITextEditor*,QPoint,int,bool*)));
}
}
@@ -1288,16 +1313,65 @@ void DebuggerToolTipManager::leavingDebugMode()
if (m_debugModeActive) {
m_debugModeActive = false;
hide();
- QWidget *topLevel = Core::ICore::instance()->mainWindow()->topLevelWidget();
- topLevel->removeEventFilter(this);
- Core::EditorManager *em = Core::EditorManager::instance();
- foreach (Core::IEditor *e, em->openedEditors())
- if (QPlainTextEdit *plainTextEdit = plainTextEditor(e))
- plainTextEdit->verticalScrollBar()->disconnect(this);
- em->disconnect(this);
+ if (QWidget *topLevel = Core::ICore::instance()->mainWindow()->topLevelWidget())
+ topLevel->removeEventFilter(this);
+ if (Core::EditorManager *em = Core::EditorManager::instance()) {
+ foreach (Core::IEditor *e, em->openedEditors()) {
+ if (DebuggerToolTipEditor toolTipEditor = DebuggerToolTipEditor(e)) {
+ toolTipEditor.plainTextEdit->verticalScrollBar()->disconnect(this);
+ toolTipEditor.textEditor->disconnect(this);
+ }
+ }
+ em->disconnect(this);
+ }
+ m_lastToolTipEditor = 0;
+ m_lastToolTipPos = -1;
}
}
+void DebuggerToolTipManager::slotTooltipOverrideRequested(TextEditor::ITextEditor *editor,
+ const QPoint &point,
+ int pos, bool *handled)
+{
+ QTC_ASSERT(handled, return);
+ if (debugToolTips)
+ qDebug() << ">slotTooltipOverrideRequested() " << editor << point << pos << *handled;
+
+ DebuggerEngine *currentEngine = 0;
+ do {
+ if (*handled || (m_lastToolTipEditor == editor && pos == m_lastToolTipPos))
+ break; // Avoid flicker.
+
+ DebuggerCore *core = debuggerCore();
+ if (!isEditorDebuggable(editor) || !core->boolSetting(UseToolTipsInMainEditor))
+ break;
+
+ currentEngine = core->currentEngine();
+ if (!currentEngine || !currentEngine->canDisplayTooltip())
+ break;
+
+ const DebuggerToolTipContext context = DebuggerToolTipContext::fromEditor(editor, pos);
+ if (context.isValid() && currentEngine->setToolTipExpression(point, editor, context)) {
+ if (TextEditor::ToolTip::instance()->isVisible())
+ TextEditor::ToolTip::instance()->hide();
+ *handled = true;
+ m_lastToolTipEditor = editor;
+ m_lastToolTipPos = pos;
+ }
+
+ } while (false);
+
+ // Other tooltip, close all in case mouse never entered the tooltip
+ // and no leave was triggered.
+ if (!*handled) {
+ m_lastToolTipEditor = 0;
+ m_lastToolTipPos = -1;
+ closeUnpinnedToolTips();
+ }
+ if (debugToolTips)
+ qDebug() << "<slotTooltipOverrideRequested() " << currentEngine << *handled;
+}
+
QStringList DebuggerToolTipManager::treeWidgetExpressions(const QString &fileName,
const QString &engineType,
const QString &function) const
diff --git a/src/plugins/debugger/debuggertooltipmanager.h b/src/plugins/debugger/debuggertooltipmanager.h
index f17ee5ad9c..0f21a1b9e5 100644
--- a/src/plugins/debugger/debuggertooltipmanager.h
+++ b/src/plugins/debugger/debuggertooltipmanager.h
@@ -62,6 +62,10 @@ class IEditor;
class IMode;
}
+namespace TextEditor {
+class ITextEditor;
+}
+
namespace Debugger {
class DebuggerEngine;
@@ -266,6 +270,8 @@ private slots:
void slotDebuggerStateChanged(Debugger::DebuggerState);
void slotStackFrameCompleted();
void slotEditorOpened(Core::IEditor *);
+ void slotTooltipOverrideRequested(TextEditor::ITextEditor *editor, const QPoint &point,
+ int pos, bool *handled);
private:
typedef QList<QPointer<AbstractDebuggerToolTipWidget> > DebuggerToolTipWidgetList;
@@ -280,6 +286,8 @@ private:
DebuggerToolTipWidgetList m_tooltips;
bool m_debugModeActive;
+ int m_lastToolTipPos;
+ Core::IEditor *m_lastToolTipEditor;
};
} // namespace Internal
diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp
index 1ce7af51b7..b95ecb5e2b 100644
--- a/src/plugins/debugger/gdb/gdbengine.cpp
+++ b/src/plugins/debugger/gdb/gdbengine.cpp
@@ -3419,13 +3419,13 @@ void GdbEngine::clearToolTip()
m_toolTipContext.reset();
}
-void GdbEngine::setToolTipExpression(const QPoint &mousePos,
+bool GdbEngine::setToolTipExpression(const QPoint &mousePos,
TextEditor::ITextEditor *editor, const DebuggerToolTipContext &contextIn)
{
if (state() != InferiorStopOk || !isCppEditor(editor)) {
//qDebug() << "SUPPRESSING DEBUGGER TOOLTIP, INFERIOR NOT STOPPED "
// " OR NOT A CPPEDITOR";
- return;
+ return false;
}
DebuggerToolTipContext context = contextIn;
@@ -3434,7 +3434,7 @@ void GdbEngine::setToolTipExpression(const QPoint &mousePos,
if (DebuggerToolTipManager::debug())
qDebug() << "GdbEngine::setToolTipExpression1 " << exp << context;
if (exp.isEmpty())
- return;
+ return false;
// Extract the first identifier, everything else is considered
// too dangerous.
@@ -3455,10 +3455,10 @@ void GdbEngine::setToolTipExpression(const QPoint &mousePos,
exp = exp.mid(pos1, pos2 - pos1);
if (exp.isEmpty() || exp.startsWith(_c('#')) || !hasLetterOrNumber(exp) || isKeyWord(exp))
- return;
+ return false;
if (exp.startsWith(_c('"')) && exp.endsWith(_c('"')))
- return;
+ return false;
if (exp.startsWith(__("++")) || exp.startsWith(__("--")))
exp = exp.mid(2);
@@ -3467,14 +3467,14 @@ void GdbEngine::setToolTipExpression(const QPoint &mousePos,
exp = exp.mid(2);
if (exp.startsWith(_c('<')) || exp.startsWith(_c('[')))
- return;
+ return false;
if (hasSideEffects(exp) || exp.isEmpty())
- return;
+ return false;
if (!m_toolTipContext.isNull() && m_toolTipContext->expression == exp) {
showToolTip();
- return;
+ return true;
}
m_toolTipContext.reset(new GdbToolTipContext(context));
@@ -3485,7 +3485,7 @@ void GdbEngine::setToolTipExpression(const QPoint &mousePos,
if (isSynchronous()) {
updateLocals(QVariant());
- return;
+ return true;
}
WatchData toolTip;
@@ -3494,6 +3494,7 @@ void GdbEngine::setToolTipExpression(const QPoint &mousePos,
toolTip.iname = tooltipIName(exp);
watchHandler()->removeData(toolTip.iname);
watchHandler()->insertData(toolTip);
+ return true;
}
diff --git a/src/plugins/debugger/gdb/gdbengine.h b/src/plugins/debugger/gdb/gdbengine.h
index 440a70eace..3f5936df0d 100644
--- a/src/plugins/debugger/gdb/gdbengine.h
+++ b/src/plugins/debugger/gdb/gdbengine.h
@@ -476,7 +476,7 @@ private: ////////// View & Data Stuff //////////
//
// Watch specific stuff
//
- virtual void setToolTipExpression(const QPoint &mousePos,
+ virtual bool setToolTipExpression(const QPoint &mousePos,
TextEditor::ITextEditor *editor, const DebuggerToolTipContext &);
virtual void assignValueInDebugger(const WatchData *data,
const QString &expr, const QVariant &value);
diff --git a/src/plugins/debugger/pdb/pdbengine.cpp b/src/plugins/debugger/pdb/pdbengine.cpp
index a0547b7383..46c8a5eed7 100644
--- a/src/plugins/debugger/pdb/pdbengine.cpp
+++ b/src/plugins/debugger/pdb/pdbengine.cpp
@@ -456,7 +456,7 @@ static WatchData m_toolTip;
static QPoint m_toolTipPos;
static QHash<QString, WatchData> m_toolTipCache;
-void PdbEngine::setToolTipExpression(const QPoint &mousePos,
+bool PdbEngine::setToolTipExpression(const QPoint &mousePos,
TextEditor::ITextEditor *editor, const DebuggerToolTipContext &ctx)
{
Q_UNUSED(mousePos)
@@ -464,13 +464,13 @@ void PdbEngine::setToolTipExpression(const QPoint &mousePos,
if (state() != InferiorStopOk) {
//SDEBUG("SUPPRESSING DEBUGGER TOOLTIP, INFERIOR NOT STOPPED");
- return;
+ return false;
}
// Check mime type and get expression (borrowing some C++ - functions)
const QString javaPythonMimeType =
QLatin1String("application/javascript");
if (!editor->file() || editor->file()->mimeType() != javaPythonMimeType)
- return;
+ return false;
int line;
int column;
@@ -488,17 +488,17 @@ void PdbEngine::setToolTipExpression(const QPoint &mousePos,
QToolTip::hideText();
if (exp.isEmpty() || exp.startsWith(QLatin1Char('#'))) {
QToolTip::hideText();
- return;
+ return false;
}
if (!hasLetterOrNumber(exp)) {
QToolTip::showText(m_toolTipPos, tr("'%1' contains no identifier").arg(exp));
- return;
+ return true;
}
if (exp.startsWith(QLatin1Char('"')) && exp.endsWith(QLatin1Char('"'))) {
QToolTip::showText(m_toolTipPos, tr("String literal %1").arg(exp));
- return;
+ return true;
}
if (exp.startsWith(QLatin1String("++")) || exp.startsWith(QLatin1String("--")))
@@ -508,13 +508,13 @@ void PdbEngine::setToolTipExpression(const QPoint &mousePos,
exp.remove(0, 2);
if (exp.startsWith(QLatin1Char('<')) || exp.startsWith(QLatin1Char('[')))
- return;
+ return false;
if (hasSideEffects(exp)) {
QToolTip::showText(m_toolTipPos,
tr("Cowardly refusing to evaluate expression '%1' "
"with potential side effects").arg(exp));
- return;
+ return true;
}
#if 0
@@ -528,6 +528,7 @@ void PdbEngine::setToolTipExpression(const QPoint &mousePos,
m_toolTip.iname = tooltipIName;
insertData(m_toolTip);
#endif
+ return false;
}
diff --git a/src/plugins/debugger/pdb/pdbengine.h b/src/plugins/debugger/pdb/pdbengine.h
index 8da4377e42..fcff5d32e0 100644
--- a/src/plugins/debugger/pdb/pdbengine.h
+++ b/src/plugins/debugger/pdb/pdbengine.h
@@ -79,7 +79,7 @@ private:
void shutdownInferior();
void shutdownEngine();
- void setToolTipExpression(const QPoint &mousePos,
+ bool setToolTipExpression(const QPoint &mousePos,
TextEditor::ITextEditor *editor, const DebuggerToolTipContext &);
void continueInferior();
diff --git a/src/plugins/debugger/qml/qmlcppengine.cpp b/src/plugins/debugger/qml/qmlcppengine.cpp
index 2060955d30..afd2e63a78 100644
--- a/src/plugins/debugger/qml/qmlcppengine.cpp
+++ b/src/plugins/debugger/qml/qmlcppengine.cpp
@@ -139,10 +139,10 @@ QmlCppEngine::~QmlCppEngine()
delete d->m_cppEngine;
}
-void QmlCppEngine::setToolTipExpression(const QPoint & mousePos,
+bool QmlCppEngine::setToolTipExpression(const QPoint & mousePos,
TextEditor::ITextEditor *editor, const DebuggerToolTipContext &ctx)
{
- d->m_activeEngine->setToolTipExpression(mousePos, editor, ctx);
+ return d->m_activeEngine->setToolTipExpression(mousePos, editor, ctx);
}
void QmlCppEngine::updateWatchData(const WatchData &data,
diff --git a/src/plugins/debugger/qml/qmlcppengine.h b/src/plugins/debugger/qml/qmlcppengine.h
index f0cf10e6fb..72d81fc9b6 100644
--- a/src/plugins/debugger/qml/qmlcppengine.h
+++ b/src/plugins/debugger/qml/qmlcppengine.h
@@ -18,7 +18,7 @@ public:
explicit QmlCppEngine(const DebuggerStartParameters &sp);
~QmlCppEngine();
- void setToolTipExpression(const QPoint &mousePos,
+ bool setToolTipExpression(const QPoint &mousePos,
TextEditor::ITextEditor * editor, const DebuggerToolTipContext &);
void updateWatchData(const WatchData &data,
const WatchUpdateFlags &flags);
diff --git a/src/plugins/debugger/qml/qmlengine.cpp b/src/plugins/debugger/qml/qmlengine.cpp
index 11e1ef48d1..5faf4b1f44 100644
--- a/src/plugins/debugger/qml/qmlengine.cpp
+++ b/src/plugins/debugger/qml/qmlengine.cpp
@@ -571,12 +571,13 @@ void QmlEngine::requestModuleSymbols(const QString &moduleName)
//
//////////////////////////////////////////////////////////////////////
-void QmlEngine::setToolTipExpression(const QPoint &mousePos,
+bool QmlEngine::setToolTipExpression(const QPoint &mousePos,
TextEditor::ITextEditor *editor, const DebuggerToolTipContext &ctx)
{
// This is processed by QML inspector, which has dependencies to
// the qml js editor. Makes life easier.
emit tooltipRequested(mousePos, editor, ctx.position);
+ return true;
}
//////////////////////////////////////////////////////////////////////
diff --git a/src/plugins/debugger/qml/qmlengine.h b/src/plugins/debugger/qml/qmlengine.h
index 533fb4e3e8..055594cd91 100644
--- a/src/plugins/debugger/qml/qmlengine.h
+++ b/src/plugins/debugger/qml/qmlengine.h
@@ -80,7 +80,7 @@ private:
void shutdownInferior();
void shutdownEngine();
- void setToolTipExpression(const QPoint &mousePos,
+ bool setToolTipExpression(const QPoint &mousePos,
TextEditor::ITextEditor *editor, const DebuggerToolTipContext &);
void continueInferior();
diff --git a/src/plugins/debugger/script/scriptengine.cpp b/src/plugins/debugger/script/scriptengine.cpp
index 6b6a1e33d6..888514092a 100644
--- a/src/plugins/debugger/script/scriptengine.cpp
+++ b/src/plugins/debugger/script/scriptengine.cpp
@@ -512,7 +512,7 @@ static WatchData m_toolTip;
static QPoint m_toolTipPos;
static QHash<QString, WatchData> m_toolTipCache;
-void ScriptEngine::setToolTipExpression(const QPoint &mousePos,
+bool ScriptEngine::setToolTipExpression(const QPoint &mousePos,
TextEditor::ITextEditor *editor, const DebuggerToolTipContext &ctx)
{
Q_UNUSED(mousePos)
@@ -520,13 +520,13 @@ void ScriptEngine::setToolTipExpression(const QPoint &mousePos,
if (state() != InferiorStopOk) {
//SDEBUG("SUPPRESSING DEBUGGER TOOLTIP, INFERIOR NOT STOPPED");
- return;
+ return false;
}
// Check mime type and get expression (borrowing some C++ - functions)
const QString javaScriptMimeType =
QLatin1String("application/javascript");
if (!editor->file() || editor->file()->mimeType() != javaScriptMimeType)
- return;
+ return false;
int line;
int column;
@@ -544,17 +544,17 @@ void ScriptEngine::setToolTipExpression(const QPoint &mousePos,
QToolTip::hideText();
if (exp.isEmpty() || exp.startsWith(QLatin1Char('#'))) {
QToolTip::hideText();
- return;
+ return false;
}
if (!hasLetterOrNumber(exp)) {
QToolTip::showText(m_toolTipPos, tr("'%1' contains no identifier").arg(exp));
- return;
+ return false;
}
if (exp.startsWith(QLatin1Char('"')) && exp.endsWith(QLatin1Char('"'))) {
QToolTip::showText(m_toolTipPos, tr("String literal %1").arg(exp));
- return;
+ return false;
}
if (exp.startsWith(QLatin1String("++")) || exp.startsWith(QLatin1String("--")))
@@ -564,13 +564,13 @@ void ScriptEngine::setToolTipExpression(const QPoint &mousePos,
exp.remove(0, 2);
if (exp.startsWith(QLatin1Char('<')) || exp.startsWith(QLatin1Char('[')))
- return;
+ return false;
if (hasSideEffects(exp)) {
QToolTip::showText(m_toolTipPos,
tr("Cowardly refusing to evaluate expression '%1' "
"with potential side effects").arg(exp));
- return;
+ return false;
}
#if 0
@@ -584,6 +584,7 @@ void ScriptEngine::setToolTipExpression(const QPoint &mousePos,
m_toolTip.iname = tooltipIName;
insertData(m_toolTip);
#endif
+ return false;
}
diff --git a/src/plugins/debugger/script/scriptengine.h b/src/plugins/debugger/script/scriptengine.h
index b34ae49b58..8136c9a23b 100644
--- a/src/plugins/debugger/script/scriptengine.h
+++ b/src/plugins/debugger/script/scriptengine.h
@@ -73,7 +73,7 @@ private:
void executeStepI();
void executeNextI();
- void setToolTipExpression(const QPoint &mousePos,
+ bool setToolTipExpression(const QPoint &mousePos,
TextEditor::ITextEditor *editor, const DebuggerToolTipContext &);
void setupEngine();
void setupInferior();
diff --git a/src/plugins/debugger/tcf/tcfengine.cpp b/src/plugins/debugger/tcf/tcfengine.cpp
index a06910f6c1..b63aa6e3c2 100644
--- a/src/plugins/debugger/tcf/tcfengine.cpp
+++ b/src/plugins/debugger/tcf/tcfengine.cpp
@@ -535,10 +535,11 @@ static WatchData m_toolTip;
static QPoint m_toolTipPos;
static QHash<QString, WatchData> m_toolTipCache;
-void TcfEngine::setToolTipExpression(const QPoint &mousePos, TextEditor::ITextEditor *editor, const DebuggerToolTipContext &)
+bool TcfEngine::setToolTipExpression(const QPoint &mousePos, TextEditor::ITextEditor *editor, const DebuggerToolTipContext &)
{
Q_UNUSED(mousePos)
Q_UNUSED(editor)
+ return false;
}
//////////////////////////////////////////////////////////////////////
diff --git a/src/plugins/debugger/tcf/tcfengine.h b/src/plugins/debugger/tcf/tcfengine.h
index d3ade0a2e7..56b3fbb151 100644
--- a/src/plugins/debugger/tcf/tcfengine.h
+++ b/src/plugins/debugger/tcf/tcfengine.h
@@ -82,7 +82,7 @@ private:
void shutdownInferior();
void shutdownEngine();
- void setToolTipExpression(const QPoint &mousePos,
+ bool setToolTipExpression(const QPoint &mousePos,
TextEditor::ITextEditor *editor, const DebuggerToolTipContext &);
void continueInferior();
diff --git a/src/plugins/debugger/watchutils.cpp b/src/plugins/debugger/watchutils.cpp
index 730955ae57..9d10cb372e 100644
--- a/src/plugins/debugger/watchutils.cpp
+++ b/src/plugins/debugger/watchutils.cpp
@@ -148,6 +148,16 @@ QDebug operator<<(QDebug d, const Scope &scope)
namespace Debugger {
namespace Internal {
+bool isEditorDebuggable(Core::IEditor *editor)
+{
+ // Only blacklist Qml. Whitelisting would fail on C++ code in files
+ // with strange names, more harm would be done this way.
+ // IFile *file = editor->file();
+ // return !(file && file->mimeType() == "application/x-qml");
+ // Nowadays, even Qml is debuggable.
+ return editor;
+}
+
QByteArray dotEscape(QByteArray str)
{
str.replace(' ', '.');
diff --git a/src/plugins/debugger/watchutils.h b/src/plugins/debugger/watchutils.h
index 11a3a412fc..5985158a22 100644
--- a/src/plugins/debugger/watchutils.h
+++ b/src/plugins/debugger/watchutils.h
@@ -60,6 +60,7 @@ namespace Internal {
class WatchData;
class GdbMi;
+bool isEditorDebuggable(Core::IEditor *editor);
QByteArray dotEscape(QByteArray str);
QString currentTime();
bool isSkippableFunction(const QString &funcName, const QString &fileName);