Reputation:
how can I setup icons for my Qt application ? Do I have to provide 16px,32px icons and so on ? Or will Qt automagically resize them to fit current requirements ?
Upvotes: 4
Views: 5861
Reputation: 78528
Edit: It seems you're talking about the window icon of the top-level window.
Window icons can be set using QWidget::setWindowIcon()
, and the default icon for new windows can be set using QApplication::setWindowIcon()
. If your source image is of high enough resolution, Qt should automatically resize this icon for you to suit all occations.
This is described in the Qt documentation, including info about how to set the embedded icon of a .exe file or OS X application.
Upvotes: 1
Reputation: 2528
Remember that You can store multiple images in *.ico file.
There is a nice free tool to build ico files
http://icofx.ro
Upvotes: 1
Reputation: 2504
You mean the application-icon, which is shown from windows for the executable, in taskbar and on alt+tab?
Create an yourprojekt.rc
and point to your icon:
IDI_ICON1 ICON DISCARDABLE "./youricon.ico"
In the projektfile advice qmake to use the resourcefile:
RC_FILE = YourProjekt.rc
For the youricon.ico
I recommend to include the the icon in 16px, 24px, 32px, 48px and 256px. Afaik are these the sizes used by windows for small symbols (16px) to extra large symbols (256px).
If you don't have an image of an particular size in your ico, windows will resize another one to that size - but upsizing or downsizung 32px to/from 256px does not look so nice in most cases.
Upvotes: 2
Reputation: 43110
Qt can and will resize the icons.
Include a resource file to your project and use the resource editor to add icons.
Upvotes: 0