forked from qt-creator/qt-creator
some refactoring: make watchExpression/removeWatchExpression symmetric
wrt arguments
This commit is contained in:
@@ -62,24 +62,24 @@ BreakWindow::BreakWindow(QWidget *parent)
|
||||
this, SLOT(rowActivated(QModelIndex)));
|
||||
}
|
||||
|
||||
void BreakWindow::keyPressEvent(QKeyEvent *event)
|
||||
void BreakWindow::keyPressEvent(QKeyEvent *ev)
|
||||
{
|
||||
if (event->key() == Qt::Key_Delete)
|
||||
if (ev->key() == Qt::Key_Delete)
|
||||
deleteBreakpoint(currentIndex());
|
||||
QTreeView::keyPressEvent(event);
|
||||
QTreeView::keyPressEvent(ev);
|
||||
}
|
||||
|
||||
void BreakWindow::resizeEvent(QResizeEvent *event)
|
||||
void BreakWindow::resizeEvent(QResizeEvent *ev)
|
||||
{
|
||||
QHeaderView *hv = header();
|
||||
int totalSize = event->size().width() - 180;
|
||||
int totalSize = ev->size().width() - 180;
|
||||
hv->resizeSection(0, 60);
|
||||
hv->resizeSection(1, (totalSize * 30) / 100);
|
||||
hv->resizeSection(2, (totalSize * 30) / 100);
|
||||
hv->resizeSection(3, (totalSize * 30) / 100);
|
||||
hv->resizeSection(4, 70);
|
||||
hv->resizeSection(5, 50);
|
||||
QTreeView::resizeEvent(event);
|
||||
QTreeView::resizeEvent(ev);
|
||||
}
|
||||
|
||||
void BreakWindow::contextMenuEvent(QContextMenuEvent *ev)
|
||||
|
||||
@@ -731,9 +731,9 @@ void DebuggerManager::collapseChildren(const QModelIndex &idx)
|
||||
watchHandler()->collapseChildren(idx);
|
||||
}
|
||||
|
||||
void DebuggerManager::removeWatchExpression(const QString &iname)
|
||||
void DebuggerManager::removeWatchExpression(const QString &exp)
|
||||
{
|
||||
watchHandler()->removeWatchExpression(iname);
|
||||
watchHandler()->removeWatchExpression(exp);
|
||||
}
|
||||
|
||||
QVariant DebuggerManager::sessionValue(const QString &name)
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
#include <ctype.h>
|
||||
|
||||
// creates debug output regarding pending watch data results
|
||||
//#define DEBUG_PENDING 1
|
||||
#define DEBUG_PENDING 1
|
||||
// creates debug output for accesses to the itemmodel
|
||||
//#define DEBUG_MODEL 1
|
||||
|
||||
@@ -964,12 +964,19 @@ void WatchHandler::showEditValue(const WatchData &data)
|
||||
w->show();
|
||||
}
|
||||
|
||||
void WatchHandler::removeWatchExpression(const QString &iname)
|
||||
void WatchHandler::removeWatchExpression(const QString &exp)
|
||||
{
|
||||
MODEL_DEBUG("REMOVE WATCH: " << iname);
|
||||
WatchData data = takeData(iname);
|
||||
m_watchers.removeOne(data.iname);
|
||||
m_watchers.removeOne(exp);
|
||||
for (int i = m_completeSet.size(); --i >= 0;) {
|
||||
const WatchData & data = m_completeSet.at(i);
|
||||
if (data.iname.startsWith("watch.") && data.exp == exp) {
|
||||
m_completeSet.takeAt(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
saveWatchers();
|
||||
rebuildModel();
|
||||
emit watchModelUpdateRequested();
|
||||
}
|
||||
|
||||
|
||||
@@ -87,6 +87,17 @@ void WatchWindow::collapseNode(const QModelIndex &idx)
|
||||
emit requestCollapseChildren(idx);
|
||||
}
|
||||
|
||||
void WatchWindow::keyPressEvent(QKeyEvent *ev)
|
||||
{
|
||||
if (ev->key() == Qt::Key_Delete) {
|
||||
QModelIndex idx = currentIndex();
|
||||
QModelIndex idx1 = idx.sibling(idx.row(), 0);
|
||||
QString exp = model()->data(idx1).toString();
|
||||
emit requestRemoveWatchExpression(exp);
|
||||
}
|
||||
QTreeView::keyPressEvent(ev);
|
||||
}
|
||||
|
||||
void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
|
||||
{
|
||||
QMenu menu;
|
||||
@@ -103,7 +114,6 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
|
||||
QModelIndex idx = indexAt(ev->pos());
|
||||
QModelIndex mi0 = idx.sibling(idx.row(), 0);
|
||||
QString exp = model()->data(mi0).toString();
|
||||
QString iname = model()->data(mi0, INameRole).toString();
|
||||
QModelIndex mi1 = idx.sibling(idx.row(), 0);
|
||||
QString value = model()->data(mi1).toString();
|
||||
bool visual = false;
|
||||
@@ -134,7 +144,7 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
|
||||
if (m_type == LocalsType)
|
||||
emit requestWatchExpression(exp);
|
||||
else
|
||||
emit requestRemoveWatchExpression(iname);
|
||||
emit requestRemoveWatchExpression(exp);
|
||||
else if (act == act4)
|
||||
model()->setData(mi0, !visual, VisualRole);
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ public slots:
|
||||
|
||||
signals:
|
||||
void requestWatchExpression(const QString &exp);
|
||||
void requestRemoveWatchExpression(const QString &iname);
|
||||
void requestRemoveWatchExpression(const QString &exp);
|
||||
void requestAssignValue(const QString &exp, const QString &value);
|
||||
void requestExpandChildren(const QModelIndex &idx);
|
||||
void requestCollapseChildren(const QModelIndex &idx);
|
||||
@@ -74,6 +74,7 @@ private slots:
|
||||
void collapseNode(const QModelIndex &index);
|
||||
|
||||
private:
|
||||
void keyPressEvent(QKeyEvent *ev);
|
||||
void contextMenuEvent(QContextMenuEvent *ev);
|
||||
void editItem(const QModelIndex &idx);
|
||||
void reset(); /* reimpl */
|
||||
|
||||
Reference in New Issue
Block a user