Skip to content

Commit c8423a4

Browse files
committed
core: add searching custom file paths
core: remove filetype checking as qt will do this for us
1 parent a5431dd commit c8423a4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/core/iconimageprovider.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ IconImageProvider::requestPixmap(const QString& id, QSize* size, const QSize& re
1919
if (splitIdx != -1) {
2020
iconName = id.sliced(0, splitIdx);
2121
path = id.sliced(splitIdx + 6);
22-
qWarning() << "Searching custom icon paths is not yet supported. Icon path will be ignored for"
23-
<< id;
22+
path = QString("/%1/%2").arg(path, iconName.sliced(iconName.lastIndexOf('/') + 1));
2423
} else {
2524
splitIdx = id.indexOf("?fallback=");
2625
if (splitIdx != -1) {
@@ -32,7 +31,8 @@ IconImageProvider::requestPixmap(const QString& id, QSize* size, const QSize& re
3231
}
3332

3433
auto icon = QIcon::fromTheme(iconName);
35-
if (icon.isNull()) icon = QIcon::fromTheme(fallbackName);
34+
if (icon.isNull() && !fallbackName.isEmpty()) icon = QIcon::fromTheme(fallbackName);
35+
if (icon.isNull() && !path.isEmpty()) icon = QPixmap(path);
3636

3737
auto targetSize = requestedSize.isValid() ? requestedSize : QSize(100, 100);
3838
if (targetSize.width() == 0 || targetSize.height() == 0) targetSize = QSize(2, 2);

0 commit comments

Comments
 (0)