Solved QGuiApplication window icon
-
I'm trying to change my application icon, i did :
QGuiApplication::setWindowIcon(QIcon(":/GUI/img/Radiation.png"));
but icon is not changing.
I also tryed the solution posted by @J-Hilk
https://forum.qt.io/topic/92233/qml-qwidget-window-iconsclass QuickWindow : public QQuickWindow { .... //mains.cpp qmlRegisterType<QuickWindow>("QuickWindow",1,0, "QuickWindow"); ... //main.qml QuickWindow { ... windowIcon: "GUI/img/Radiation.png"
but i still have the default icon.
Does anyone know hos to fix this ?
Qt 5.11 Mingw
Win 7 x64Googled : it looks like there is a probleme with w7.
One solution in Srackoverflow is : https://stackoverflow.com/questions/19587359/qapplicationsetwindowicon-works-on-windows-xp-but-does-not-work-on-windows-7
-
lcreate directory imageformats in application dir,
-
copy qico.dll in it. // Where is this dll ?
Thx in advance
-
-
@J.Hilk hi, thanks for reply
finnaly deleting the buildfolder and using setWindowIcon() worked
QGuiApplication::setWindowIcon(QIcon(":/GUI/img/Radiation.png"));
thx
-
@LeLev
Hi,let us check some points to remove the most common errors :)
- Radiation.png is part of your QtRessource file?
- Did you add Radiation.png later to your ressource file
-
- If yes, make sure you run qmake again, or delete the buildfolder, so that the image is compiled into your binary correctly.
- Did you include QIcon
#include <QIcon>
in your main.cpp ? - the qml ressource path should also start with
:/GUI
in your example it starts withGUI
, typo?
-
@J.Hilk hi, thanks for reply
finnaly deleting the buildfolder and using setWindowIcon() worked
QGuiApplication::setWindowIcon(QIcon(":/GUI/img/Radiation.png"));
thx