Version: 3.0.2 (using KDE KDE 3.2.1) (i.e.) If you have expanded a complex structure down five or six levels, it would be really nice to be able to click on an element down at the sixth level and drag it to the Add Watch box at the bottom of the pane and have it filled in with the fully qualified name (a->b->c.e.f.g or whatever). It would also be nice to be able to do this from the source window. It would also (wish 3 here ;) be nice to be able to drag to the GDB text entry window. This is mostly simple copy/paste behavior so it should be _too_ hard to implement.
What would you say about just adding "Watch this" item to the popup menu?
SVN commit 450556 by vprus: Add "Remember value" and "Watch variable" items to the variable window popup menu. BUG: 78566 M +32 -3 variablewidget.cpp --- branches/KDE/3.5/kdevelop/languages/cpp/debugger/variablewidget.cpp #450555:450556 @@ -258,12 +258,25 @@ { KPopupMenu popup(this); popup.insertTitle(item->text(VarNameCol)); + int idRemember = -2; int idRemove = -2; - int idReevaluate = -2; + int idReevaluate = -2; + int idWatch = -2; + QListViewItem* root = findRoot(item); + + if (root != recentExpressions_) + { + idRemember = popup.insertItem( + SmallIcon("pencil"), i18n("Remember value")); + } + if (dynamic_cast<WatchRoot*>(root)) { idRemove = popup.insertItem( SmallIcon("editdelete"), i18n("Remove Watch Variable") ); + } else if (root != recentExpressions_) { + idWatch = popup.insertItem( + i18n("Watch variable")); } if (root == recentExpressions_) { idReevaluate = popup.insertItem( @@ -278,9 +291,25 @@ SmallIcon("editcopy"), i18n("Copy to Clipboard") ); int res = popup.exec(QCursor::pos()); - if (res == idRemove) + if (res == idRemember) + { + if (VarItem *item = dynamic_cast<VarItem*>(currentItem())) + { + ((VariableWidget*)parent())-> + slotEvaluateExpression(item->gdbExpression()); + } + } + else if (res == idWatch) + { + if (VarItem *item = dynamic_cast<VarItem*>(currentItem())) + { + ((VariableWidget*)parent())-> + slotAddWatchVariable(item->gdbExpression()); + } + } + else if (res == idRemove) delete item; - if (res == idToggleRadix) + else if (res == idToggleRadix) emit toggleRadix(item); else if (res == idCopyToClipboard) {