From 622916db0441fefc2bf1576829409d0cb3038471 Mon Sep 17 00:00:00 2001 From: Albert S Date: Fri, 15 Apr 2022 21:05:00 +0200 Subject: [PATCH] gui: Implement 'Delete' button in Indexer tab --- gui/mainwindow.cpp | 6 ++++++ gui/mainwindow.ui | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 33116fd..7c1ae3a 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -114,6 +114,12 @@ void MainWindow::connectSignals() }); connect(this->indexer, &Indexer::finished, this, &MainWindow::finishIndexing); + + connect(ui->lstPaths->selectionModel(), &QItemSelectionModel::selectionChanged, this, + [&](const QItemSelection &selected, const QItemSelection &deselected) + { ui->btnDeletePath->setEnabled(this->ui->lstPaths->selectedItems().count() > 0); }); + + connect(ui->btnDeletePath, &QPushButton::clicked, this, [&] { qDeleteAll(ui->lstPaths->selectedItems()); }); } void MainWindow::spinPreviewPageValueChanged(int val) diff --git a/gui/mainwindow.ui b/gui/mainwindow.ui index 100df00..766d3c2 100644 --- a/gui/mainwindow.ui +++ b/gui/mainwindow.ui @@ -190,7 +190,10 @@ - + + + false + Delete