PDA

View Full Version : setWindowIcon function



Peppy
24th October 2009, 20:03
I tried function "setWindowIcon()" but it doesn't show any icon, I tried add to resources but it doesn't work too...:eek:...Where is the problem?

wysota
25th October 2009, 08:57
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.

schnitzel
26th October 2009, 02:37
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.

nikhilqt
26th October 2009, 12:50
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.;)

Peppy
6th November 2009, 19:05
It wll works when I open the Windows Explorer ?

wysota
9th November 2009, 09:46
It wll works when I open the Windows Explorer ?

Is it a question or a statement?