From 85aa0fd041fbaa258f089d86f227311e53f6206a Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Wed, 20 Dec 2017 16:03:42 +0300 Subject: Introduce QIcon::fallbackSearchPaths() ... that will be used if an icon can't be found in the current theme. The Icon Theme Specification https://standards.freedesktop.org/icon-theme-spec/latest/ar01s05.html states that unthemed icons must be searched in the base directories, i.e. /usr/share/icons, ... But in practice unthemed icons are installed into /usr/share/pixmaps and this dir is not used as a base dir for icon themes. So it's better to explicitly specify fallback dirs to avoid needless access to the filesystem. Also some KDE application install their own unthemed icons (into /usr/share//pics), that can't be found by QIconLoader. With this change it would be possible for them to specify dirs with unthemed icons and thus be displayed correctly in non-KDE environments. [ChangeLog][QtGui][QIcon] Added fallbackSearchPaths() that will be used to find icons missing in the current icon theme. Change-Id: I0dc55ba958b29356a3b0a2123d6b8faa24d4c91e Task-number: QTBUG-33123 Reviewed-by: Shawn Rutledge Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/gui/doc/snippets/code/src_gui_image_qicon.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/gui/doc/snippets') diff --git a/src/gui/doc/snippets/code/src_gui_image_qicon.cpp b/src/gui/doc/snippets/code/src_gui_image_qicon.cpp index f472494e4a..faad6574a7 100644 --- a/src/gui/doc/snippets/code/src_gui_image_qicon.cpp +++ b/src/gui/doc/snippets/code/src_gui_image_qicon.cpp @@ -79,3 +79,6 @@ void MyWidget::drawIcon(QPainter *painter, QPoint pos) QIcon undoicon = QIcon::fromTheme("edit-undo", QIcon(":/undo.png")); //! [4] +//! [5] + QIcon::setFallbackSearchPaths(QIcon::fallbackSearchPaths() << "my/search/path"); +//! [5] -- cgit v1.2.3