From fb44d0c411ae663ec1085f07248dce3e9067c742 Mon Sep 17 00:00:00 2001 From: r3yc0n1c Date: Tue, 19 Mar 2024 03:12:58 +0530 Subject: [PATCH] update: versioninfo copy fix code --- src/dialogs/VersionInfoDialog.cpp | 19 ++++++++----------- src/dialogs/VersionInfoDialog.h | 5 +---- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/src/dialogs/VersionInfoDialog.cpp b/src/dialogs/VersionInfoDialog.cpp index 24246683e..01a90b323 100644 --- a/src/dialogs/VersionInfoDialog.cpp +++ b/src/dialogs/VersionInfoDialog.cpp @@ -57,8 +57,6 @@ VersionInfoDialog::VersionInfoDialog(QWidget *parent) ui->rightTreeWidget->addAction(copyActionRightTreewidget); ui->rightTreeWidget->addAction(selAllActionRightTreewidget); - - contextMenu = new QMenu(this); } VersionInfoDialog::~VersionInfoDialog() {} @@ -68,21 +66,20 @@ void VersionInfoDialog::CopyTreeWidgetSelection(QTreeWidget *t) const int keyColumnIndex = 0, valueColumnIndex = 1; QString vinfo, row; - for (QTreeWidgetItem *x : t->selectedItems()) { - row = x->text(keyColumnIndex) + " = " + x->text(valueColumnIndex) + "\n"; - vinfo.append(row); + QTreeWidgetItemIterator it(t); + + while (*it) { + if ((*it)->isSelected()) { + row = (*it)->text(keyColumnIndex) + " = " + (*it)->text(valueColumnIndex) + "\n"; + vinfo.append(row); + } + it++; } QClipboard *clipboard = QApplication::clipboard(); clipboard->setText(vinfo.trimmed()); } -void VersionInfoDialog::contextMenuEvent(QContextMenuEvent *event) -{ - contextMenu->exec(event->globalPos()); - event->accept(); -} - void VersionInfoDialog::fillVersionInfo() { RzCoreLocked core(Core()); diff --git a/src/dialogs/VersionInfoDialog.h b/src/dialogs/VersionInfoDialog.h index b3cfffe5a..4490a480e 100644 --- a/src/dialogs/VersionInfoDialog.h +++ b/src/dialogs/VersionInfoDialog.h @@ -21,15 +21,12 @@ class VersionInfoDialog : public QDialog private slots: void CopyTreeWidgetSelection(QTreeWidget *t); -protected: - QMenu *contextMenu = nullptr; +protected: QAction *copyActionLeftTreewidget = nullptr; QAction *copyActionRightTreewidget = nullptr; QAction *selAllActionLeftTreewidget = nullptr; QAction *selAllActionRightTreewidget = nullptr; - void contextMenuEvent(QContextMenuEvent *event) override; - private: std::unique_ptr ui; CutterCore *core;