SVG icon engine: do not add the SVG file on creation
When QIcon asks the SVG icon plugin to create an engine, do not call addFile on the newly created engine. Inside the plugin code, we lack the information about which mode and state the user requested. The code was hardcoding Normal / Off, but that's wrong in the general case (doesn't match what the user requested, possibly resulting in a data loss). (This sounds like a problem with the QIcon plugin API, where create() only takes the filename and not also the size, mode, state.) Instead, leave the engine empty; QIcon will detect it and call addFile for us, this time passing the right mode and state. Change-Id: If1d6c83339c79791f40ecc1832c1631de23d4856 Fixes: QTBUG-135483 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de> (cherry picked from commit 260b0a34ce7c7c2c418d501cfeb4dff214c3b706) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit 5088d0db5f1aa7219e5f0967ddc3ef35ecfc188c)
This commit is contained in:
committed by
Qt Cherry-pick Bot
parent
1d87cee9d4
commit
eeaba87228
@@ -25,11 +25,9 @@ public:
|
||||
QIconEngine *create(const QString &filename = QString()) override;
|
||||
};
|
||||
|
||||
QIconEngine *QSvgIconPlugin::create(const QString &file)
|
||||
QIconEngine *QSvgIconPlugin::create(const QString &)
|
||||
{
|
||||
QSvgIconEngine *engine = new QSvgIconEngine;
|
||||
if (!file.isNull())
|
||||
engine->addFile(file, QSize(), QIcon::Normal, QIcon::Off);
|
||||
return engine;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user