diff options
-rw-r--r-- | src/plugins/iconengines/svgiconengine/qsvgiconengine.cpp | 12 | ||||
-rw-r--r-- | tests/auto/qicon_svg/qicon_svg.pro | 2 |
2 files changed, 8 insertions, 6 deletions
diff --git a/src/plugins/iconengines/svgiconengine/qsvgiconengine.cpp b/src/plugins/iconengines/svgiconengine/qsvgiconengine.cpp index 902e59d..6d84df1 100644 --- a/src/plugins/iconengines/svgiconengine/qsvgiconengine.cpp +++ b/src/plugins/iconengines/svgiconengine/qsvgiconengine.cpp @@ -180,11 +180,13 @@ QPixmap QSvgIconEngine::pixmap(const QSize &size, QIcon::Mode mode, renderer.render(&p); p.end(); pm = QPixmap::fromImage(img); - QStyleOption opt(0); - opt.palette = QApplication::palette(); - QPixmap generated = QApplication::style()->generatedIconPixmap(mode, pm, &opt); - if (!generated.isNull()) - pm = generated; + if (qobject_cast<QApplication *>(QCoreApplication::instance())) { + QStyleOption opt(0); + opt.palette = QGuiApplication::palette(); + QPixmap generated = QApplication::style()->generatedIconPixmap(mode, pm, &opt); + if (!generated.isNull()) + pm = generated; + } if (!pm.isNull()) QPixmapCache::insert(pmckey, pm); diff --git a/tests/auto/qicon_svg/qicon_svg.pro b/tests/auto/qicon_svg/qicon_svg.pro index 3d61851..87e26be 100644 --- a/tests/auto/qicon_svg/qicon_svg.pro +++ b/tests/auto/qicon_svg/qicon_svg.pro @@ -1,7 +1,7 @@ CONFIG += testcase TARGET = tst_qicon_svg -QT += widgets testlib gui-private +QT += testlib gui-private SOURCES += tst_qicon_svg.cpp RESOURCES = tst_qicon_svg.qrc |