From 16f80ce1cc1dd8f5046d87a6f517ffbe4cc12abd Mon Sep 17 00:00:00 2001 From: Chris Xiong Date: Mon, 3 Oct 2022 16:12:36 -0400 Subject: Use existing code for click handling. --- qdeduper/mingui.cpp | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/qdeduper/mingui.cpp b/qdeduper/mingui.cpp index dd5bc22..807acc6 100644 --- a/qdeduper/mingui.cpp +++ b/qdeduper/mingui.cpp @@ -208,20 +208,10 @@ DeduperMainWindow::DeduperMainWindow() apply_prefs(); QObject::connect(lv, &QListView::clicked, [this](const QModelIndex &i) { - auto cs = i.data(Qt::ItemDataRole::CheckStateRole).value(); - if (cs == Qt::CheckState::Checked) - cs = Qt::CheckState::Unchecked; - else cs = Qt::CheckState::Checked; - this->im->setData(i, cs, Qt::ItemDataRole::CheckStateRole); - this->marked_update(); + if (i.isValid()) this->mark_toggle(i.row()); }); QObject::connect(lv, &QListView::doubleClicked, [this](const QModelIndex &i) { - auto cs = i.data(Qt::ItemDataRole::CheckStateRole).value(); - if (cs == Qt::CheckState::Checked) - cs = Qt::CheckState::Unchecked; - else cs = Qt::CheckState::Checked; - this->im->setData(i, cs, Qt::ItemDataRole::CheckStateRole); - this->marked_update(); + if (i.isValid()) this->mark_toggle(i.row()); open_image(i.row()); }); l->addWidget(lv); -- cgit v1.2.3