From fa35f30dfa9f08bb4d9e49d887cd3d42885f418c Mon Sep 17 00:00:00 2001 From: Levent Kaya Date: Mon, 23 Mar 2026 11:29:46 +0300 Subject: [PATCH] Feat: add copy value only option on logger and tracker --- src/SeerVariableLoggerBrowserWidget.cpp | 11 ++++++++--- src/SeerVariableTrackerBrowserWidget.cpp | 11 ++++++++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/SeerVariableLoggerBrowserWidget.cpp b/src/SeerVariableLoggerBrowserWidget.cpp index a78c0e8..0a7ecdc 100644 --- a/src/SeerVariableLoggerBrowserWidget.cpp +++ b/src/SeerVariableLoggerBrowserWidget.cpp @@ -342,6 +342,7 @@ void SeerVariableLoggerBrowserWidget::handleContextMenu (const QPoint& pos) { QAction* deleteAllAction = menu.addAction("Delete all"); QAction* copyAction = menu.addAction("Copy selected"); + QAction* copyValueOnlyAction = menu.addAction("Copy selected value"); QAction* copyAllAction = menu.addAction("Copy all"); QString actionText; @@ -399,12 +400,12 @@ void SeerVariableLoggerBrowserWidget::handleContextMenu (const QPoint& pos) { handleDeleteAllToolButton(); } - if (action == copyAction || action == copyAllAction) { + if (action == copyAction || action == copyAllAction || action == copyValueOnlyAction) { // Get selected tree items. QList items; // Get list of 'select' items. - if (action == copyAction) { + if (action == copyAction || action == copyValueOnlyAction) { items = variablesTreeWidget->selectedItems(); } @@ -427,8 +428,12 @@ void SeerVariableLoggerBrowserWidget::handleContextMenu (const QPoint& pos) { if (i != 0) { text += '\n'; } + if (action != copyValueOnlyAction) { + text += items[i]->text(1) + ":" + items[i]->text(2); + } else { + text += items[i]->text(2); + } - text += items[i]->text(1) + ":" + items[i]->text(2); } clipboard->setText(text, QClipboard::Clipboard); diff --git a/src/SeerVariableTrackerBrowserWidget.cpp b/src/SeerVariableTrackerBrowserWidget.cpp index 940e5b4..0e32335 100644 --- a/src/SeerVariableTrackerBrowserWidget.cpp +++ b/src/SeerVariableTrackerBrowserWidget.cpp @@ -590,6 +590,7 @@ void SeerVariableTrackerBrowserWidget::handleContextMenu (const QPoint& pos) { QAction* deleteAllAction = menu.addAction("Delete all"); QAction* copyAction = menu.addAction("Copy selected"); + QAction* copyValueOnlyAction = menu.addAction("Copy selected value"); QAction* copyAllAction = menu.addAction("Copy all"); QString actionText; @@ -646,12 +647,12 @@ void SeerVariableTrackerBrowserWidget::handleContextMenu (const QPoint& pos) { handleDeleteAllToolButton(); } - if (action == copyAction || action == copyAllAction) { + if (action == copyAction || action == copyAllAction || action == copyValueOnlyAction) { // Get selected tree items. QList items; // Get list of 'select' items. - if (action == copyAction) { + if (action == copyAction || copyValueOnlyAction) { items = variablesTreeWidget->selectedItems(); } @@ -675,7 +676,11 @@ void SeerVariableTrackerBrowserWidget::handleContextMenu (const QPoint& pos) { text += '\n'; } - text += items[i]->text(0) + ":" + items[i]->text(1); + if (action != copyValueOnlyAction) { + text += items[i]->text(0) + ":" + items[i]->text(1); + } else { + text += items[i]->text(1); + } } clipboard->setText(text, QClipboard::Clipboard);