summaryrefslogtreecommitdiffstats
path: root/src/gui/platform/unix
diff options
context:
space:
mode:
authorVolker Hilsheimer <[email protected]>2024-06-17 13:57:25 +0200
committerVolker Hilsheimer <[email protected]>2024-06-17 19:25:42 +0200
commite10308769592222b97153956feeb9531863bef35 (patch)
tree666a8be2e277c5761154b0fc00fd8f348768f4bd /src/gui/platform/unix
parent0e9c0c0847bd09c8a2b5166a2bafc103db0d3abc (diff)
QFileSystemModel: only use theme icons if a theme is set
The old code checked themes first, and only went through the platform's file-based icon resolving code if the theme didn't provide an icon. With the added support for theme icons on macOS and Windows, this broke standard file icons on macOS and Windows: the icon theme provides the font-based icons, but they are significantly different from what users expect a folder, drive, or generic file icon to look like in a file explorer-like UI. To fix this, we cannot simply turn the priorities around, as we get a standard, default file icon for any file that doesn't have a specific icon configured. The behavior needs to be different on each platform: on Linux desktop we respect the icon theme, on other platforms we prefer the file-type based icon. Add a theme hint that tells the icon provider which one to prefer. Implemented in on Linux desktop to return true, otherwise returns false. Adapt the logic in QAbstractFileIconProvider accordingly. Pick-to: 6.8 6.7 Fixes: QTBUG-124829 Change-Id: I9ff3f543c000aec8238bdf36b18be5c7a2349098 Reviewed-by: Tor Arne Vestbø <[email protected]>
Diffstat (limited to 'src/gui/platform/unix')
-rw-r--r--src/gui/platform/unix/qgenericunixthemes.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/gui/platform/unix/qgenericunixthemes.cpp b/src/gui/platform/unix/qgenericunixthemes.cpp
index 8a7f7cd6f7a..90971ba94cd 100644
--- a/src/gui/platform/unix/qgenericunixthemes.cpp
+++ b/src/gui/platform/unix/qgenericunixthemes.cpp
@@ -503,6 +503,8 @@ QVariant QGenericUnixTheme::themeHint(ThemeHint hint) const
return QVariant(mouseCursorTheme());
case QPlatformTheme::MouseCursorSize:
return QVariant(mouseCursorSize());
+ case QPlatformTheme::PreferFileIconFromTheme:
+ return true;
default:
break;
}
@@ -1108,6 +1110,8 @@ QVariant QKdeTheme::themeHint(QPlatformTheme::ThemeHint hint) const
return QVariant(mouseCursorTheme());
case QPlatformTheme::MouseCursorSize:
return QVariant(mouseCursorSize());
+ case QPlatformTheme::PreferFileIconFromTheme:
+ return true;
default:
break;
}
@@ -1385,6 +1389,8 @@ QVariant QGnomeTheme::themeHint(QPlatformTheme::ThemeHint hint) const
return QVariant(mouseCursorTheme());
case QPlatformTheme::MouseCursorSize:
return QVariant(mouseCursorSize());
+ case QPlatformTheme::PreferFileIconFromTheme:
+ return true;
default:
break;
}