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 <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2020-04-15 22:35:24 +02:00 committed by Dirk Hohndel
parent bd960ea088
commit 91e81879a5

View file

@ -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<QString> 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()) {