Qt-interest Archive, December 2006
Displaying Application Icon in Windows
Message 1 in thread
I'm having trouble displaying my application icon to work on Windows.
My application has one QMainWindow and a central widget set. I tried
calling setWindowIcon on both the main window and central widget, but
the icon will not show up in the top left corner of the application
window or in the task bar. Funny enough, the icon correctly shows up in
the little alt+tab icon box when I switch between programs. I know my
icon file can validly load and display - what's going on with QT? I
also tried the the suggestions in the trolltech documentation about
setting an icon: http://doc.trolltech.com/4.2/appicon.html. But these
suggestions had already been auto-generated in the appropriate files.
Any suggestions would be appreciated. Thanks,
Chris
--
[ signature omitted ]
Message 2 in thread
Quick checklist:
- your icon must be an ICO-format bitmap file -- not another file format renamed
- create a 16x16 pixel version as well as 32x32 or whatever else: in Visual Studio select Current Image Types... in the Image menu
- put the ICO file in code directory
- create an RC (text) file in code directory with the following: IDI_ICON1 ICON DISCARDABLE "myIcon.ico"
- add the following to your .pro file: RC_FILE = myIcon.rc
- run qmake
- rebuild
Don't use setWindowIcon unless you want a window icon different from the application icon.
I don't think ICO is an acceptable image format for setWindowIcon(...): you need a PNG or JPEG or whatever.
Sam Dutton
SAM DUTTON
SENIOR SITE DEVELOPER
200 GRAY'S INN ROAD
LONDON
WC1X 8XZ
UNITED KINGDOM
T +44 (0)20 7430 4496
F
E SAM.DUTTON@xxxxxxxxx
WWW.ITN.CO.UK
________________________________
From: Chris Portka [mailto:cportka@xxxxxxxxxxxxxxx]
Sent: Wed 20/12/2006 21:24
To: qt-interest@xxxxxxxxxxxxx
Subject: Displaying Application Icon in Windows
I'm having trouble displaying my application icon to work on Windows.
My application has one QMainWindow and a central widget set. I tried
calling setWindowIcon on both the main window and central widget, but
the icon will not show up in the top left corner of the application
window or in the task bar. Funny enough, the icon correctly shows up in
the little alt+tab icon box when I switch between programs. I know my
icon file can validly load and display - what's going on with QT? I
also tried the the suggestions in the trolltech documentation about
setting an icon: http://doc.trolltech.com/4.2/appicon.html <http://doc.trolltech.com/4.2/appicon.html> . But these
suggestions had already been auto-generated in the appropriate files.
Any suggestions would be appreciated. Thanks,
Chris
--
[ signature omitted ]

Message 3 in thread
Dutton, Sam wrote:
> Quick checklist:
>
> - your icon must be an ICO-format bitmap file -- not another file format
> renamed
> - create a 16x16 pixel version as well as 32x32 or whatever else: in
> Visual Studio select Current Image Types... in the Image menu
> - put the ICO file in code directory
> - create an RC (text) file in code directory with the following:
> IDI_ICON1 ICON DISCARDABLE "myIcon.ico"
> - add the following to your .pro file: RC_FILE = myIcon.rc
> - run qmake
> - rebuild
>
> Don't use setWindowIcon unless you want a window icon different from the
> application icon.
>
> I don't think ICO is an acceptable image format for setWindowIcon(...):
> you need a PNG or JPEG or whatever.
>
> Sam Dutton
>
>
> Please Note:
>
>
>
> Any views or opinions are solely those of the author and do not necessarily represent
> those of Independent Television News Limited unless specifically stated.
> This email and any files attached are confidential and intended solely for the use of the individual
> or entity to which they are addressed.
> If you have received this email in error, please notify postmaster@xxxxxxxxx
>
> Please note that to ensure regulatory compliance and for the protection of our clients and business,
> we may monitor and read messages sent to and from our systems.
>
> Thank You.
>
>
>
> **
> **
> **
> *SAM DUTTON
> * *SENIOR SITE DEVELOPER
> *
> 200 GRAY'S INN ROAD
> LONDON
> WC1X 8XZ
> UNITED KINGDOM
> T +44 (0)20 7430 4496
> F
> E SAM.DUTTON@xxxxxxxxx
> WWW.ITN.CO.UK <http://WWW.ITN.CO.UK>
>
> ------------------------------------------------------------------------
>
>
>
> *From:* Chris Portka [mailto:cportka@xxxxxxxxxxxxxxx]
> *Sent:* Wed 20/12/2006 21:24
> *To:* qt-interest@xxxxxxxxxxxxx
> *Subject:* Displaying Application Icon in Windows
>
> I'm having trouble displaying my application icon to work on Windows.
> My application has one QMainWindow and a central widget set. I tried
> calling setWindowIcon on both the main window and central widget, but
> the icon will not show up in the top left corner of the application
> window or in the task bar. Funny enough, the icon correctly shows up in
> the little alt+tab icon box when I switch between programs. I know my
> icon file can validly load and display - what's going on with QT? I
> also tried the the suggestions in the trolltech documentation about
> setting an icon: http://doc.trolltech.com/4.2/appicon.html. But these
> suggestions had already been auto-generated in the appropriate files.
> Any suggestions would be appreciated. Thanks,
> Chris
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
Thanks for your help. The problem was I had generated a 32x32pixel icon
but not a 16x16 pixel icon.
Chris
--
[ signature omitted ]
Message 4 in thread
Hi,
>> I don't think ICO is an acceptable image format for
>> setWindowIcon(...): you need a PNG or JPEG or whatever.
Indeed, unless using this Qt Solution:
http://www.trolltech.com/products/qt/addon/solutions/catalog/4/Utilities/qticoimageformat/
> Thanks for your help. The problem was I had generated a 32x32pixel icon
> but not a 16x16 pixel icon.
Not surprising, since this is not documented:
http://doc.trolltech.com/4.2/appicon.html
I'll notify our documentation team.
--
[ signature omitted ]
Message 5 in thread
Dimitri schrieb:
>> Thanks for your help. The problem was I had generated a 32x32pixel
>> icon but not a 16x16 pixel icon.
>
> Not surprising, since this is not documented:
> http://doc.trolltech.com/4.2/appicon.html
> I'll notify our documentation team.
AFAI can tell a Windows .ico is habitually implied to contain a 16x16
icon, and the 32x32 is considered optional; that's a leftover from the
Win 3.x times. However, won't hurt to document that. Does Vista now
support other formats for app icons at last, or are we still stuck in
that awkward "don't change anything" downward compatibility trap?
Martin
P. S. If you think this could have been a rant you may be right.
--
[ signature omitted ]