From 17bf4cd98084ff882bdddb1bd55a9ee52613b4bd Mon Sep 17 00:00:00 2001 From: Eirik Aavitsland Date: Mon, 1 Jul 2024 10:34:36 +0200 Subject: [PATCH] Doc: Add basic info about icon engines to QIcon Some of the function doc refers to icon engines, but the concept was never properly introduced. Also explains why order of adding icon files matter. Task-number: QTBUG-125772 Pick-to: 6.8 Change-Id: I342d3d90e3cb58f0c12b205a226aaf78b2136dac Reviewed-by: Christian Ehrlicher --- src/gui/image/qicon.cpp | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp index bccb543a77c..8ad7cc28b88 100644 --- a/src/gui/image/qicon.cpp +++ b/src/gui/image/qicon.cpp @@ -625,11 +625,26 @@ QFactoryLoader *qt_iconEngineFactoryLoader() Icons from an application-provided theme take precedence over the native icon library. - In addition, it is possible to provide custom \l {QIconEngine} - {icon engines}. This allows applications to customize every aspect - of generated icons. With QIconEnginePlugin it is possible to register - different icon engines for different file suffixes, making it possible - for third parties to provide additional icon engines to those included + \section1 Icon Engines + + Internally, QIcon instantiates an \l {QIconEngine} {icon engine} + backend to handle and render the icon images. The type of icon + engine is determined by the first file or pixmap or theme added to a + QIcon object. Additional files or pixmaps will then be handled by + the same engine. + + Icon engines differ in the way they handle and render icons. The + default pixmap-based engine only deals with fixed images, while the + QtSvg module provides an icon engine that can re-render the provided + vector graphics files at the requested size for better quality. The + theme icon engines will typically only provide images from native + platform icon library, and ignore any added files or pixmaps. + + In addition, it is possible to provide custom icon engines. This + allows applications to customize every aspect of generated + icons. With QIconEnginePlugin it is possible to register different + icon engines for different file suffixes, making it possible for + third parties to provide additional icon engines to those included with Qt. \section1 Making Classes that Use QIcon