Skip to content

Commit

Permalink
update: versioninfo copy fix code
Browse files Browse the repository at this point in the history
  • Loading branch information
r3yc0n1c committed Mar 18, 2024
1 parent 84fac11 commit 7fb3965
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
19 changes: 8 additions & 11 deletions src/dialogs/VersionInfoDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ VersionInfoDialog::VersionInfoDialog(QWidget *parent)

ui->rightTreeWidget->addAction(copyActionRightTreewidget);
ui->rightTreeWidget->addAction(selAllActionRightTreewidget);

contextMenu = new QMenu(this);
}

VersionInfoDialog::~VersionInfoDialog() {}
Expand All @@ -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());
Expand Down
2 changes: 0 additions & 2 deletions src/dialogs/VersionInfoDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ private slots:
QAction *selAllActionLeftTreewidget = nullptr;
QAction *selAllActionRightTreewidget = nullptr;

void contextMenuEvent(QContextMenuEvent *event) override;

private:
std::unique_ptr<Ui::VersionInfoDialog> ui;
CutterCore *core;
Expand Down

0 comments on commit 7fb3965

Please sign in to comment.