fix: shouldn't loop when navigate gallery via shortcuts

Related: https://github.com/BLumia/pineapple-pictures/issues/153
This commit is contained in:
2025-06-29 16:24:06 +08:00
parent 2846e4907b
commit f976fea418

View File

@ -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);