You are not logged in.

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Wednesday, May 26th 2010, 5:02pm

application icon

Hello,


how can I set an icon for my application ?
I'm guessing this is os specific, though I'm not sure.
If so, I want to do this for windows, linux and mac at least.

Thanks.

2

Wednesday, May 26th 2010, 8:29pm

Examine some "advanced" project. Like QtCreator.
The application .pro file is

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
include(../../qtcreator.pri)
include(../shared/qtsingleapplication/qtsingleapplication.pri)

TEMPLATE = app
TARGET = $$IDE_APP_TARGET
DESTDIR = $$IDE_APP_PATH

SOURCES += main.cpp

include(../rpath.pri)

win32 {
    CONFIG(debug, debug|release):LIBS *= -lExtensionSystemd -lAggregationd
    else:LIBS *= -lExtensionSystem -lAggregation

    RC_FILE = qtcreator.rc
    target.path = /bin
    INSTALLS += target
} else:macx {
    CONFIG(debug, debug|release):LIBS *= -lExtensionSystem_debug -lAggregation_debug
    else:LIBS *= -lExtensionSystem -lAggregation
    LIBS += -framework CoreFoundation
    ICON = qtcreator.icns
    QMAKE_INFO_PLIST = Info.plist
    FILETYPES.files = profile.icns prifile.icns
    FILETYPES.path = Contents/Resources
    QMAKE_BUNDLE_DATA += FILETYPES
} else {
    LIBS *= -lExtensionSystem -lAggregation

    target.path  = /bin
    INSTALLS    += target
}

OTHER_FILES += qtcreator.rc Info.plist

qtcreator.rc file

Source code

1
 IDI_ICON1               ICON    DISCARDABLE     "qtcreator.ico"

qtcreator.icns is binary file containing mac icons. Mac format.

afaik in linux an executable does not have any icons. Maybe a shortcut. Well, google.
Fighting fire with fire.
Three can keep a secret if two of them are dead.

3

Wednesday, May 26th 2010, 9:08pm

Well the term 'icon' might be confusing indeed.
afaikThere are actually 2 different icons :
one is the executable icon (which doesn't exist in linux, I think)
the other one (the one I was talking about) is the one that is displayed next to its name in the bar title, and the one that is displayed in the taskbar next to its name as well in the bottom of the screen.
How can I set this icon ?

I have a IDE (eclipse). If I change the .pro manually, won't eclipse overwrite my changes when I rebuild my project ?

Junior

Professional

  • "Junior" is male

Posts: 1,622

Location: San Antonio, TX USA

Occupation: Senior Secure Systems Engineer

  • Send private message

4

Wednesday, May 26th 2010, 9:30pm

QApplicationwindow icon setting.