Tracking bug: QIcon::availableSizes() returns an empty list for SVG icons #1362

Open
opened 2026-02-20 21:00:21 -05:00 by deekerman · 0 comments
Owner

Originally created by @mkrautz on GitHub (Mar 18, 2018).

From #qt-labs on freenode:

14:45:58 <mkrautz> does anyone know whether an SVG-backed QIcon should return an empty availableSizes() list? I can't figure out if that's supposed to be the case
14:46:21 <mkrautz> ref: https://github.com/qt/qtbase/blob/a37dd93defd91b79fb6730d0ff0515a66a0d3972/src/gui/image/qiconengine.cpp#L160-L161 ... "[...] Engines that work in terms of a scalable, vectorial format normally return an empty list."
14:46:22 <qt_gerrit> ref: [qtbase]  from  -
14:46:51 <mkrautz> I'm investigating an issue where a few places in Qt and KF5 expect a QIcon to return a non-empty availableSizes(), and the fact that it's empty is causing things to break
14:47:26 <mkrautz> the problems are basically these two bugs:
14:47:27 <mkrautz> https://bugreports.qt.io/browse/QTBUG-53550
14:47:28 <qt_gerrit> mkrautz: QSystemTrayIcon of type svg not rendering in OpenSUSE Leap 42.1 - https://bugreports.qt.io/browse/QTBUG-53550 (Reported)
14:47:31 <mkrautz> https://bugreports.qt.io/browse/QTBUG-63187
14:47:31 <qt_gerrit> mkrautz: QIcon::fromTheme, fails on SVG with 'path + filename + extension' - https://bugreports.qt.io/browse/QTBUG-63187 (Reported)
14:48:40 <mkrautz> QTBUG-53550 is due to KStatusNotifierItem creating pixmaps from a QIcon using availableSizes()... however, since it's empty, no icon will be shown:
14:48:40 <mkrautz> https://github.com/KDE/knotifications/blob/v5.38.0/src/kstatusnotifieritem.cpp#L1129-L1142
14:48:41 <qt_gerrit> mkrautz: QSystemTrayIcon of type svg not rendering in OpenSUSE Leap 42.1 - https://bugreports.qt.io/browse/QTBUG-53550 (Reported)
14:50:59 <mkrautz> and as mentioned in QTBUG-63187, QIcon::fromTheme() also seemingly doesn't expect empty availableSizes() for valid icons? https://github.com/qt/qtbase/blob/a37dd93defd91b79fb6730d0ff0515a66a0d3972/src/gui/image/qicon.cpp#L1291
14:51:00 <qt_gerrit> mkrautz: QIcon::fromTheme, fails on SVG with 'path + filename + extension' - https://bugreports.qt.io/browse/QTBUG-63187 (Reported)
14:51:00 <qt_gerrit> mkrautz: [qtbase]  from  -
14:53:03 <mkrautz> the public docs for QIcon don't mention the snippet about availableSizes() being allowed to return an empty list for vector-based icons anywhere either...
Originally created by @mkrautz on GitHub (Mar 18, 2018). From #qt-labs on freenode: 14:45:58 <mkrautz> does anyone know whether an SVG-backed QIcon should return an empty availableSizes() list? I can't figure out if that's supposed to be the case 14:46:21 <mkrautz> ref: https://github.com/qt/qtbase/blob/a37dd93defd91b79fb6730d0ff0515a66a0d3972/src/gui/image/qiconengine.cpp#L160-L161 ... "[...] Engines that work in terms of a scalable, vectorial format normally return an empty list." 14:46:22 <qt_gerrit> ref: [qtbase] from - 14:46:51 <mkrautz> I'm investigating an issue where a few places in Qt and KF5 expect a QIcon to return a non-empty availableSizes(), and the fact that it's empty is causing things to break 14:47:26 <mkrautz> the problems are basically these two bugs: 14:47:27 <mkrautz> https://bugreports.qt.io/browse/QTBUG-53550 14:47:28 <qt_gerrit> mkrautz: QSystemTrayIcon of type svg not rendering in OpenSUSE Leap 42.1 - https://bugreports.qt.io/browse/QTBUG-53550 (Reported) 14:47:31 <mkrautz> https://bugreports.qt.io/browse/QTBUG-63187 14:47:31 <qt_gerrit> mkrautz: QIcon::fromTheme, fails on SVG with 'path + filename + extension' - https://bugreports.qt.io/browse/QTBUG-63187 (Reported) 14:48:40 <mkrautz> QTBUG-53550 is due to KStatusNotifierItem creating pixmaps from a QIcon using availableSizes()... however, since it's empty, no icon will be shown: 14:48:40 <mkrautz> https://github.com/KDE/knotifications/blob/v5.38.0/src/kstatusnotifieritem.cpp#L1129-L1142 14:48:41 <qt_gerrit> mkrautz: QSystemTrayIcon of type svg not rendering in OpenSUSE Leap 42.1 - https://bugreports.qt.io/browse/QTBUG-53550 (Reported) 14:50:59 <mkrautz> and as mentioned in QTBUG-63187, QIcon::fromTheme() also seemingly doesn't expect empty availableSizes() for valid icons? https://github.com/qt/qtbase/blob/a37dd93defd91b79fb6730d0ff0515a66a0d3972/src/gui/image/qicon.cpp#L1291 14:51:00 <qt_gerrit> mkrautz: QIcon::fromTheme, fails on SVG with 'path + filename + extension' - https://bugreports.qt.io/browse/QTBUG-63187 (Reported) 14:51:00 <qt_gerrit> mkrautz: [qtbase] from - 14:53:03 <mkrautz> the public docs for QIcon don't mention the snippet about availableSizes() being allowed to return an empty list for vector-based icons anywhere either...
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/mumble-mumble-voip#1362
No description provided.