Skip to content
Snippets Groups Projects
Commit 2a907003 authored by hjk's avatar hjk
Browse files

debugger: insert action to create new watch item in locals&watchers context menu

parent 27cb595b
No related branches found
No related tags found
No related merge requests found
...@@ -339,6 +339,7 @@ DebuggerSettings *theDebuggerSettings() ...@@ -339,6 +339,7 @@ DebuggerSettings *theDebuggerSettings()
item = new DebuggerAction(instance); item = new DebuggerAction(instance);
instance->insertItem(WatchExpressionInWindow, item); instance->insertItem(WatchExpressionInWindow, item);
item->setTextPattern(QObject::tr("Watch expression \"%1\" in separate window")); item->setTextPattern(QObject::tr("Watch expression \"%1\" in separate window"));
//item->setCheckable(true);
item = new DebuggerAction(instance); item = new DebuggerAction(instance);
instance->insertItem(AssignValue, item); instance->insertItem(AssignValue, item);
......
...@@ -499,9 +499,6 @@ QVariant WatchHandler::data(const QModelIndex &idx, int role) const ...@@ -499,9 +499,6 @@ QVariant WatchHandler::data(const QModelIndex &idx, int role) const
case INameRole: case INameRole:
return data.iname; return data.iname;
case VisualRole:
return m_displayedINames.contains(data.iname);
case ExpandedRole: case ExpandedRole:
//qDebug() << " FETCHING: " << data.iname //qDebug() << " FETCHING: " << data.iname
// << m_expandedINames.contains(data.iname) // << m_expandedINames.contains(data.iname)
......
...@@ -132,7 +132,7 @@ public: ...@@ -132,7 +132,7 @@ public:
bool changed; bool changed;
}; };
enum { INameRole = Qt::UserRole, ExpressionRole, VisualRole, ExpandedRole }; enum { INameRole = Qt::UserRole, ExpressionRole, ExpandedRole };
class WatchHandler : public QAbstractItemModel class WatchHandler : public QAbstractItemModel
......
...@@ -54,7 +54,7 @@ using namespace Debugger::Internal; ...@@ -54,7 +54,7 @@ using namespace Debugger::Internal;
// //
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
enum { INameRole = Qt::UserRole, ExpressionRole, VisualRole, ExpandedRole }; enum { INameRole = Qt::UserRole, ExpressionRole, ExpandedRole };
class WatchDelegate : public QItemDelegate class WatchDelegate : public QItemDelegate
{ {
...@@ -158,8 +158,6 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev) ...@@ -158,8 +158,6 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
QAction *act2 = new QAction("Always adjust column widths to contents", &menu); QAction *act2 = new QAction("Always adjust column widths to contents", &menu);
act2->setCheckable(true); act2->setCheckable(true);
act2->setChecked(m_alwaysResizeColumnsToContents); act2->setChecked(m_alwaysResizeColumnsToContents);
//QAction *act3 = 0;
QAction *act4 = 0;
menu.addAction(act1); menu.addAction(act1);
menu.addAction(act2); menu.addAction(act2);
...@@ -169,20 +167,16 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev) ...@@ -169,20 +167,16 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
QString exp = model()->data(mi0).toString(); QString exp = model()->data(mi0).toString();
QModelIndex mi1 = idx.sibling(idx.row(), 0); QModelIndex mi1 = idx.sibling(idx.row(), 0);
QString value = model()->data(mi1).toString(); QString value = model()->data(mi1).toString();
bool visual = false;
menu.addSeparator(); menu.addSeparator();
int type = (m_type == LocalsType) ? WatchExpression : RemoveWatchExpression; int type = (m_type == LocalsType) ? WatchExpression : RemoveWatchExpression;
menu.addAction(theDebuggerAction(type)->updatedAction(exp)); menu.addAction(theDebuggerAction(type)->updatedAction(exp));
visual = model()->data(mi0, VisualRole).toBool(); //QAction *act4 = theDebuggerAction(WatchExpressionInWindow);
//act4 = theDebuggerAction(WatchExpressionInWindow)->action();
//act4->setCheckable(true);
//act4->setChecked(visual);
//menu.addAction(act4); //menu.addAction(act4);
//act3 = new QAction(tr("Add to watch window..."), &menu); QAction *act3 = new QAction(tr("Insert new watch item"), &menu);
//menu.addAction(act3); menu.addAction(act3);
menu.addSeparator(); menu.addSeparator();
menu.addAction(theDebuggerAction(RecheckDumpers)); menu.addAction(theDebuggerAction(RecheckDumpers));
...@@ -196,10 +190,8 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev) ...@@ -196,10 +190,8 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
resizeColumnsToContents(); resizeColumnsToContents();
else if (act == act2) else if (act == act2)
setAlwaysResizeColumnsToContents(!m_alwaysResizeColumnsToContents); setAlwaysResizeColumnsToContents(!m_alwaysResizeColumnsToContents);
else if (act == act4) else if (act == act3)
model()->setData(mi0, !visual, VisualRole); theDebuggerAction(WatchExpression)->trigger("<Edit>");
else if (act == act4)
model()->setData(mi0, !visual, VisualRole);
} }
void WatchWindow::resizeColumnsToContents() void WatchWindow::resizeColumnsToContents()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment