debugger: add widget watchers by mouse click in the debugged application.

The option is hidden in the context menu.
Currently the application must be stopped.
This commit is contained in:
hjk
2009-07-01 12:49:41 +02:00
parent ac8e371486
commit 013437cfab
11 changed files with 124 additions and 102 deletions

View File

@@ -114,6 +114,8 @@ public:
WatchWindow::WatchWindow(Type type, QWidget *parent)
: QTreeView(parent), m_alwaysResizeColumnsToContents(true), m_type(type)
{
m_grabbing = false;
QAction *act = theDebuggerAction(UseAlternatingRowColors);
setWindowTitle(tr("Locals and Watchers"));
setAlternatingRowColors(act->isChecked());
@@ -219,6 +221,8 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
QAction *act3 = new QAction(tr("Insert new watch item"), &menu);
menu.addAction(act3);
QAction *act4 = new QAction(tr("Select widget to watch"), &menu);
menu.addAction(act4);
menu.addSeparator();
menu.addAction(theDebuggerAction(RecheckDebuggingHelpers));
@@ -233,7 +237,12 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
else if (act == act2)
setAlwaysResizeColumnsToContents(!m_alwaysResizeColumnsToContents);
else if (act == act3)
theDebuggerAction(WatchExpression)->trigger(WatchHandler::watcherEditPlaceHolder());
theDebuggerAction(WatchExpression)
->trigger(WatchHandler::watcherEditPlaceHolder());
else if (act == act4) {
grabMouse(Qt::CrossCursor);
m_grabbing = true;
}
}
void WatchWindow::resizeColumnsToContents()
@@ -253,6 +262,17 @@ void WatchWindow::setAlwaysResizeColumnsToContents(bool on)
header()->setResizeMode(1, mode);
}
bool WatchWindow::event(QEvent *ev)
{
if (m_grabbing && ev->type() == QEvent::MouseButtonPress) {
QMouseEvent *mev = static_cast<QMouseEvent *>(ev);
m_grabbing = false;
releaseMouse();
theDebuggerAction(WatchPoint)->trigger(mapToGlobal(mev->pos()));
}
return QTreeView::event(ev);
}
void WatchWindow::editItem(const QModelIndex &idx)
{
Q_UNUSED(idx); // FIXME