I tried function "setWindowIcon()" but it doesn't show any icon, I tried add to resources but it doesn't work too......Where is the problem?
I tried function "setWindowIcon()" but it doesn't show any icon, I tried add to resources but it doesn't work too......Where is the problem?
Showing some code would help but there are two things worth mentioning first:
1. It only works for top-level windows
2. If you use a relative path to an image, your app might not be able to find it during runtime.
I only know how to do this from Qt Creator and I assume you mean the window's icon, not the application icon:
1)create a file app.qrc
2)add this file to your project
3)add prefix if you like, i.e. images but then you better create the appropriate subdirectory
4)add your .ico file in the qrc dialog
5)go to your main window ui and select the main window's windowIcon property
6)select the little drop down arrow
7)select 'choose resource'
8)select your icon
I think that's it.
One thing i want to mention. If the file is in one format and you try to change by changing the extension manually, sometimes it does not work i.e., it wont display at all.
ex: from *.bmp to *.png: It wont work.![]()
It wll works when I open the Windows Explorer ?
Bookmarks