From d01297043e76589a88676bf52e66664631fda5c2 Mon Sep 17 00:00:00 2001 From: zhongyic00 Date: Thu, 18 Jul 2024 16:01:07 +0000 Subject: [PATCH] fix: playlist filter should consider plugins setAutoLoadFilterSuffix with formats dynammically got from QImageReader, fix https://github.com/BLumia/pineapple-pictures/issues/120 --- app/mainwindow.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/mainwindow.cpp b/app/mainwindow.cpp index bbe8a84..7a7326d 100644 --- a/app/mainwindow.cpp +++ b/app/mainwindow.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -56,11 +57,12 @@ MainWindow::MainWindow(QWidget *parent) this->setWindowIcon(QIcon(":/icons/app-icon.svg")); this->setMouseTracking(true); - m_pm->setAutoLoadFilterSuffix({ - "*.jpg", "*.jpeg", "*.jfif", - "*.png", "*.gif", "*.svg", "*.bmp", "*.webp", - "*.tif", "*.tiff" - }); + + QStringList formatFilters; + for (const QByteArray &item : QImageReader::supportedImageFormats()) { + formatFilters.append(QStringLiteral("*.") % QString::fromLocal8Bit(item)); + } + m_pm->setAutoLoadFilterSuffix(formatFilters); m_fadeOutAnimation = new QPropertyAnimation(this, "windowOpacity"); m_fadeOutAnimation->setDuration(300);