mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-21 22:16:38 +00:00
Allow adding a watch for any text selection
This commit is contained in:
@@ -1559,6 +1559,20 @@ void ShaderViewer::debug_contextMenu(const QPoint &pos)
|
||||
contextMenu.addAction(&runForwardCursor);
|
||||
contextMenu.addSeparator();
|
||||
|
||||
QAction watchExpr(tr("Add Watch Expression"), this);
|
||||
watchExpr.setEnabled(!edit->selectionEmpty());
|
||||
|
||||
QObject::connect(&watchExpr, &QAction::triggered, [this, edit] {
|
||||
QString expr =
|
||||
QString::fromUtf8(edit->get_text_range(edit->selectionStart(), edit->selectionEnd()));
|
||||
|
||||
for(QString e : expr.split(QLatin1Char(' ')))
|
||||
AddWatch(e);
|
||||
});
|
||||
|
||||
contextMenu.addAction(&watchExpr);
|
||||
contextMenu.addSeparator();
|
||||
|
||||
QAction copyText(tr("Copy"), this);
|
||||
QAction selectAll(tr("Select All"), this);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user