Icon is not showing up in Qt Main Window

萝らか妹 提交于 2019-12-19 11:16:37

问题


My Qt application contains a Main Window. I added resource into project and added an icon to the resource. From the main window source file I used the following line to load the icon to the main window.

this->setWindowIcon(QIcon("://img/Icon.ico"));

When I run the application from Qt creator, it shows the icon in the mainwindow BUT when I run the exe from the executable path directly(copied all Qt dependency dlls into that folder) it is not showing the icon in the main window.

Not sure what I am missing.


回答1:


Put qico.dll in the imageformats directore near executable.

MyAppDir\YourApp.exe
MyAppDir\imageformats\qico.dll

On future, every format except of png should have dll. For example qgif.dll and so on.



来源:https://stackoverflow.com/questions/25679623/icon-is-not-showing-up-in-qt-main-window

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!