From 91e81879a5a28145a2b79d8c9172e1ea3c3580bc Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Wed, 15 Apr 2020 22:35:24 +0200 Subject: media: put photo-view in row-selection mode It makes no sense to have the view in item-selection mode, since each picture represents a row. Thus we can remove a few lines of code. Signed-off-by: Berthold Stoeger --- desktop-widgets/tab-widgets/TabDivePhotos.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/desktop-widgets/tab-widgets/TabDivePhotos.cpp b/desktop-widgets/tab-widgets/TabDivePhotos.cpp index 921511de4..dab5d2c67 100644 --- a/desktop-widgets/tab-widgets/TabDivePhotos.cpp +++ b/desktop-widgets/tab-widgets/TabDivePhotos.cpp @@ -26,6 +26,7 @@ TabDivePhotos::TabDivePhotos(QWidget *parent) ui->setupUi(this); ui->photosView->setModel(divePictureModel); ui->photosView->setSelectionMode(QAbstractItemView::ExtendedSelection); + ui->photosView->setSelectionBehavior(QAbstractItemView::SelectRows); ui->photosView->setResizeMode(QListView::Adjust); connect(ui->photosView, &DivePictureWidget::photoDoubleClicked, @@ -70,8 +71,6 @@ QVector TabDivePhotos::getSelectedFilenames() const if (!ui->photosView->selectionModel()->hasSelection()) return selectedPhotos; QModelIndexList indices = ui->photosView->selectionModel()->selectedRows(); - if (indices.count() == 0) - indices = ui->photosView->selectionModel()->selectedIndexes(); selectedPhotos.reserve(indices.count()); for (const auto &photo: indices) { if (photo.isValid()) { @@ -115,8 +114,6 @@ void TabDivePhotos::saveSubtitles() if (!ui->photosView->selectionModel()->hasSelection()) return; QModelIndexList indices = ui->photosView->selectionModel()->selectedRows(); - if (indices.count() == 0) - indices = ui->photosView->selectionModel()->selectedIndexes(); selectedPhotos.reserve(indices.count()); for (const auto &photo: indices) { if (photo.isValid()) { -- cgit v1.2.3-70-g09d2