Qt4 how to add 16px / 32px / ... icons for my application?

How to customize icons for my Qt application? Should I provide 16px, 32px etc icons? Or Qt will automatically resize them according to current requirements?

+4
source share
4 answers

Edit: It seems you are talking about the window icon of a 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 has a sufficiently high resolution, Qt should automatically resize this icon for all cases.

This is described in the Qt documentation including information on how to install the built-in icon of an .exe file or OS X application.

+1
source

Do you mean the application icon, which is displayed from the windows for the executable file, in the taskbar and on the alt + tab?

Create yourprojekt.rc and point to the icon:

  IDI_ICON1 ICON DISCARDABLE "./youricon.ico" 

In the projektfile qmake tip, use a resource file:

  RC_FILE = YourProjekt.rc 

For youricon.ico I recommend turning on the icon in 16px, 24px, 32px, 48px and 256px. Afaik are the sizes used by windows for small characters (16 pixels) for extra large characters (256 pixels).

If you do not have an image of a certain size in your ico, the windows will resize the other to that size - but increasing or decreasing 32px to / from 256px in most cases does not look so pretty.

+2
source

Remember that you can store multiple images in a * .ico file.

There is a good free tool for creating ico files

http://icofx.ro

+1
source

Qt can and will resize the icons.

Include a resource file in your project and use the resource editor to add icons.

0
source

Source: https://habr.com/ru/post/1344096/


All Articles