diff --git a/src/util/private/dbuiltiniconengine.cpp b/src/util/private/dbuiltiniconengine.cpp index 9c8f5d4..8ec65ac 100644 --- a/src/util/private/dbuiltiniconengine.cpp +++ b/src/util/private/dbuiltiniconengine.cpp @@ -291,6 +291,26 @@ QString DBuiltinIconEngine::iconName() return m_iconName; } +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +QList DBuiltinIconEngine::availableSizes(QIcon::Mode mode, QIcon::State state) +{ + ensureLoaded(); + + QList sizes; + const int N = m_info.entries.size(); + sizes.reserve(N); + + // Gets all sizes from the DirectoryInfo entries + for (int i = 0; i < N; ++i) { + const auto& entry = m_info.entries.at(i); + int size = entry->dir.size; + sizes.append(QSize(size, size)); + } + + return sizes; +} +#endif + QThemeIconInfo DBuiltinIconEngine::loadIcon(const QString &iconName, uint key) { QThemeIconInfo info; diff --git a/src/util/private/dbuiltiniconengine_p.h b/src/util/private/dbuiltiniconengine_p.h index c4aafff..7e521b7 100644 --- a/src/util/private/dbuiltiniconengine_p.h +++ b/src/util/private/dbuiltiniconengine_p.h @@ -33,6 +33,7 @@ class Q_DECL_HIDDEN DBuiltinIconEngine : public QIconEngine #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) QString iconName() override; + QList availableSizes(QIcon::Mode mode = QIcon::Normal, QIcon::State state = QIcon::Off) override; #else QString iconName() const override; #endif diff --git a/src/util/private/dciiconengine.cpp b/src/util/private/dciiconengine.cpp index 06cb00d..9dfc525 100644 --- a/src/util/private/dciiconengine.cpp +++ b/src/util/private/dciiconengine.cpp @@ -158,6 +158,22 @@ const return m_iconName; } +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +QList DDciIconEngine::availableSizes(QIcon::Mode mode, QIcon::State state) +{ + ensureIconTheme(); + + const auto availableSizes = m_dciIcon.availableSizes(dciTheme(), DDciIcon::Normal); + QList sizes; + sizes.reserve(availableSizes.size()); + + for (int size : availableSizes) + sizes.append(QSize(size, size)); + + return sizes; +} +#endif + void DDciIconEngine::virtual_hook(int id, void *data) { ensureIconTheme(); diff --git a/src/util/private/dciiconengine_p.h b/src/util/private/dciiconengine_p.h index e4cb176..52d0c1d 100644 --- a/src/util/private/dciiconengine_p.h +++ b/src/util/private/dciiconengine_p.h @@ -30,6 +30,7 @@ class Q_DECL_HIDDEN DDciIconEngine : public QIconEngine #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) QString iconName() override; + QList availableSizes(QIcon::Mode mode = QIcon::Normal, QIcon::State state = QIcon::Off) override; #else QString iconName() const override; #endif