diff options
author | Chris Xiong <chirs241097@gmail.com> | 2022-10-03 16:12:36 -0400 |
---|---|---|
committer | Chris Xiong <chirs241097@gmail.com> | 2022-10-03 16:12:36 -0400 |
commit | 16f80ce1cc1dd8f5046d87a6f517ffbe4cc12abd (patch) | |
tree | fac8ebbef90d235493cc56d6dba3fa3750ade47f | |
parent | 8948ac99c542f4114bd353cd9440b89c5874069a (diff) | |
download | deduper-16f80ce1cc1dd8f5046d87a6f517ffbe4cc12abd.tar.xz |
Use existing code for click handling.
-rw-r--r-- | qdeduper/mingui.cpp | 14 |
1 files 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<Qt::CheckState>(); - 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<Qt::CheckState>(); - 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); |