summaryrefslogtreecommitdiff
path: root/src/plugins/debugger/watchwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/debugger/watchwindow.cpp')
-rw-r--r--src/plugins/debugger/watchwindow.cpp71
1 files changed, 36 insertions, 35 deletions
diff --git a/src/plugins/debugger/watchwindow.cpp b/src/plugins/debugger/watchwindow.cpp
index 0350bb03e4..7379c02915 100644
--- a/src/plugins/debugger/watchwindow.cpp
+++ b/src/plugins/debugger/watchwindow.cpp
@@ -83,7 +83,7 @@ static DebuggerEngine *currentEngine()
class WatchDelegate : public QItemDelegate
{
public:
- explicit WatchDelegate(WatchWindow *parent)
+ explicit WatchDelegate(WatchTreeView *parent)
: QItemDelegate(parent), m_watchWindow(parent)
{}
@@ -142,7 +142,7 @@ public:
}
private:
- WatchWindow *m_watchWindow;
+ WatchTreeView *m_watchWindow;
};
// Watch model query helpers.
@@ -199,10 +199,10 @@ static QString variableToolTip(const QString &name, const QString &type,
{
return offset ?
//: HTML tooltip of a variable in the memory editor
- WatchWindow::tr("<i>%1</i> %2 at #%3").
+ WatchTreeView::tr("<i>%1</i> %2 at #%3").
arg(type, name).arg(offset) :
//: HTML tooltip of a variable in the memory editor
- WatchWindow::tr("<i>%1</i> %2").arg(type, name);
+ WatchTreeView::tr("<i>%1</i> %2").arg(type, name);
}
static int memberVariableRecursion(const QAbstractItemModel *model,
@@ -318,7 +318,7 @@ static MemoryMarkupList
const quint64 offset = it.key() - address;
if (offset < size) {
ranges[offset] = ColorNumberToolTip(registerColorNumber,
- WatchWindow::tr("Register <i>%1</i>").arg(it.value()));
+ WatchTreeView::tr("Register <i>%1</i>").arg(it.value()));
} else {
break; // Sorted.
}
@@ -406,9 +406,9 @@ static void addVariableMemoryView(DebuggerEngine *engine, bool separateView,
const unsigned flags = separateView
? DebuggerEngine::MemoryView|DebuggerEngine::MemoryReadOnly : 0;
const QString title = deferencePointer
- ? WatchWindow::tr("Memory Referenced by Pointer \"%1\" (0x%2)")
+ ? WatchTreeView::tr("Memory Referenced by Pointer \"%1\" (0x%2)")
.arg(nameOf(m)).arg(address, 0, 16)
- : WatchWindow::tr("Memory at Variable \"%1\" (0x%2)")
+ : WatchTreeView::tr("Memory at Variable \"%1\" (0x%2)")
.arg(nameOf(m)).arg(address, 0, 16);
engine->openMemoryView(address, flags, markup, p, title, parent);
}
@@ -443,8 +443,8 @@ static void addStackLayoutMemoryView(DebuggerEngine *engine, bool separateView,
// Anything found and everything in a sensible range (static data in-between)?
if (end <= start || end - start > 100 * 1024) {
QMessageBox::information(parent,
- WatchWindow::tr("Cannot Display Stack Layout"),
- WatchWindow::tr("Could not determine a suitable address range."));
+ WatchTreeView::tr("Cannot Display Stack Layout"),
+ WatchTreeView::tr("Could not determine a suitable address range."));
return;
}
// Take a look at the register values. Extend the range a bit if suitable
@@ -468,7 +468,7 @@ static void addStackLayoutMemoryView(DebuggerEngine *engine, bool separateView,
const unsigned flags = separateView
? (DebuggerEngine::MemoryView|DebuggerEngine::MemoryReadOnly) : 0;
const QString title =
- WatchWindow::tr("Memory Layout of Local Variables at 0x%1").arg(start, 0, 16);
+ WatchTreeView::tr("Memory Layout of Local Variables at 0x%1").arg(start, 0, 16);
engine->openMemoryView(start, flags, markup, p, title, parent);
}
@@ -478,8 +478,8 @@ static void addStackLayoutMemoryView(DebuggerEngine *engine, bool separateView,
//
/////////////////////////////////////////////////////////////////////
-WatchWindow::WatchWindow(Type type, QWidget *parent)
- : BaseWindow(parent),
+WatchTreeView::WatchTreeView(Type type, QWidget *parent)
+ : BaseTreeView(parent),
m_type(type)
{
setObjectName(QLatin1String("WatchWindow"));
@@ -499,17 +499,17 @@ WatchWindow::WatchWindow(Type type, QWidget *parent)
SLOT(collapseNode(QModelIndex)));
}
-void WatchWindow::expandNode(const QModelIndex &idx)
+void WatchTreeView::expandNode(const QModelIndex &idx)
{
setModelData(LocalsExpandedRole, true, idx);
}
-void WatchWindow::collapseNode(const QModelIndex &idx)
+void WatchTreeView::collapseNode(const QModelIndex &idx)
{
setModelData(LocalsExpandedRole, false, idx);
}
-void WatchWindow::keyPressEvent(QKeyEvent *ev)
+void WatchTreeView::keyPressEvent(QKeyEvent *ev)
{
if (ev->key() == Qt::Key_Delete && m_type == WatchersType) {
QModelIndexList indices = selectionModel()->selectedRows();
@@ -533,7 +533,7 @@ void WatchWindow::keyPressEvent(QKeyEvent *ev)
QTreeView::keyPressEvent(ev);
}
-void WatchWindow::dragEnterEvent(QDragEnterEvent *ev)
+void WatchTreeView::dragEnterEvent(QDragEnterEvent *ev)
{
//QTreeView::dragEnterEvent(ev);
if (ev->mimeData()->hasText()) {
@@ -542,7 +542,7 @@ void WatchWindow::dragEnterEvent(QDragEnterEvent *ev)
}
}
-void WatchWindow::dragMoveEvent(QDragMoveEvent *ev)
+void WatchTreeView::dragMoveEvent(QDragMoveEvent *ev)
{
//QTreeView::dragMoveEvent(ev);
if (ev->mimeData()->hasText()) {
@@ -551,7 +551,7 @@ void WatchWindow::dragMoveEvent(QDragMoveEvent *ev)
}
}
-void WatchWindow::dropEvent(QDropEvent *ev)
+void WatchTreeView::dropEvent(QDropEvent *ev)
{
if (ev->mimeData()->hasText()) {
watchExpression(ev->mimeData()->text());
@@ -562,7 +562,7 @@ void WatchWindow::dropEvent(QDropEvent *ev)
//QTreeView::dropEvent(ev);
}
-void WatchWindow::mouseDoubleClickEvent(QMouseEvent *ev)
+void WatchTreeView::mouseDoubleClickEvent(QMouseEvent *ev)
{
const QModelIndex idx = indexAt(ev->pos());
if (!idx.isValid()) {
@@ -577,24 +577,24 @@ void WatchWindow::mouseDoubleClickEvent(QMouseEvent *ev)
static QString addWatchActionText(QString exp)
{
if (exp.isEmpty())
- return WatchWindow::tr("Evaluate Expression");
+ return WatchTreeView::tr("Evaluate Expression");
if (exp.size() > 30) {
exp.truncate(30);
exp.append(QLatin1String("..."));
}
- return WatchWindow::tr("Evaluate Expression \"%1\"").arg(exp);
+ return WatchTreeView::tr("Evaluate Expression \"%1\"").arg(exp);
}
// Text for add watch action with truncated expression.
static QString removeWatchActionText(QString exp)
{
if (exp.isEmpty())
- return WatchWindow::tr("Remove Evaluated Expression");
+ return WatchTreeView::tr("Remove Evaluated Expression");
if (exp.size() > 30) {
exp.truncate(30);
exp.append(QLatin1String("..."));
}
- return WatchWindow::tr("Remove Evaluated Expression \"%1\"").arg(exp);
+ return WatchTreeView::tr("Remove Evaluated Expression \"%1\"").arg(exp);
}
static void copyToClipboard(const QString &clipboardText)
@@ -606,7 +606,7 @@ static void copyToClipboard(const QString &clipboardText)
clipboard->setText(clipboardText, QClipboard::Clipboard);
}
-void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
+void WatchTreeView::contextMenuEvent(QContextMenuEvent *ev)
{
DebuggerEngine *engine = currentEngine();
WatchHandler *handler = engine->watchHandler();
@@ -970,7 +970,7 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
}
}
-bool WatchWindow::event(QEvent *ev)
+bool WatchTreeView::event(QEvent *ev)
{
if (m_grabbing && ev->type() == QEvent::MouseButtonPress) {
QMouseEvent *mev = static_cast<QMouseEvent *>(ev);
@@ -981,14 +981,14 @@ bool WatchWindow::event(QEvent *ev)
return QTreeView::event(ev);
}
-void WatchWindow::editItem(const QModelIndex &idx)
+void WatchTreeView::editItem(const QModelIndex &idx)
{
Q_UNUSED(idx) // FIXME
}
-void WatchWindow::setModel(QAbstractItemModel *model)
+void WatchTreeView::setModel(QAbstractItemModel *model)
{
- BaseWindow::setModel(model);
+ BaseTreeView::setModel(model);
setRootIsDecorated(true);
if (header()) {
header()->setDefaultAlignment(Qt::AlignLeft);
@@ -999,12 +999,12 @@ void WatchWindow::setModel(QAbstractItemModel *model)
connect(model, SIGNAL(layoutChanged()), SLOT(resetHelper()));
}
-void WatchWindow::resetHelper()
+void WatchTreeView::resetHelper()
{
resetHelper(model()->index(0, 0));
}
-void WatchWindow::resetHelper(const QModelIndex &idx)
+void WatchTreeView::resetHelper(const QModelIndex &idx)
{
if (idx.data(LocalsExpandedRole).toBool()) {
//qDebug() << "EXPANDING " << model()->data(idx, INameRole);
@@ -1022,24 +1022,24 @@ void WatchWindow::resetHelper(const QModelIndex &idx)
}
}
-void WatchWindow::watchExpression(const QString &exp)
+void WatchTreeView::watchExpression(const QString &exp)
{
currentEngine()->watchHandler()->watchExpression(exp);
}
-void WatchWindow::removeWatchExpression(const QString &exp)
+void WatchTreeView::removeWatchExpression(const QString &exp)
{
currentEngine()->watchHandler()->removeWatchExpression(exp);
}
-void WatchWindow::setModelData
+void WatchTreeView::setModelData
(int role, const QVariant &value, const QModelIndex &index)
{
QTC_ASSERT(model(), return);
model()->setData(index, value, role);
}
-void WatchWindow::setWatchpointAtAddress(quint64 address, unsigned size)
+void WatchTreeView::setWatchpointAtAddress(quint64 address, unsigned size)
{
BreakpointParameters data(WatchpointAtAddress);
data.address = address;
@@ -1053,7 +1053,7 @@ void WatchWindow::setWatchpointAtAddress(quint64 address, unsigned size)
breakHandler()->appendBreakpoint(data);
}
-void WatchWindow::setWatchpointAtExpression(const QString &exp)
+void WatchTreeView::setWatchpointAtExpression(const QString &exp)
{
BreakpointParameters data(WatchpointAtExpression);
data.expression = exp;
@@ -1066,6 +1066,7 @@ void WatchWindow::setWatchpointAtExpression(const QString &exp)
breakHandler()->appendBreakpoint(data);
}
+
} // namespace Internal
} // namespace Debugger