From f976fea4183979220903f46a3a86d9c28b9da37e Mon Sep 17 00:00:00 2001 From: Gary Wang Date: Sun, 29 Jun 2025 16:24:06 +0800 Subject: [PATCH] fix: shouldn't loop when navigate gallery via shortcuts Related: https://github.com/BLumia/pineapple-pictures/issues/153 --- app/mainwindow.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/mainwindow.cpp b/app/mainwindow.cpp index 1b8109f..ee32cb4 100644 --- a/app/mainwindow.cpp +++ b/app/mainwindow.cpp @@ -255,6 +255,9 @@ void MainWindow::clearGallery() void MainWindow::galleryPrev() { + const bool loopGallery = Settings::instance()->loopGallery(); + if (!loopGallery && m_pm->isFirstIndex()) return; + QModelIndex index = m_pm->previousIndex(); if (index.isValid()) { m_pm->setCurrentIndex(index); @@ -264,6 +267,9 @@ void MainWindow::galleryPrev() void MainWindow::galleryNext() { + const bool loopGallery = Settings::instance()->loopGallery(); + if (!loopGallery && m_pm->isLastIndex()) return; + QModelIndex index = m_pm->nextIndex(); if (index.isValid()) { m_pm->setCurrentIndex(index);