how to set main app icon in Qt?

how to set main app icon in Qt?

Post by frog » Wed, 22 Jan 2003 09:12:55



Newbie Qt programmer can't figure out how to set application's main icon, it
defaults to 'X'.  Please point me to an example, or docs which explain
this.  (I'm handcoding my app, not using Designer.)

Thanks.
-Frank Brown
http://www.inwa.net/~frog/

 
 
 

how to set main app icon in Qt?

Post by Kevin Kramme » Thu, 23 Jan 2003 00:45:45



> Newbie Qt programmer can't figure out how to set application's main
> icon, it
> defaults to 'X'.  Please point me to an example, or docs which explain
> this.  (I'm handcoding my app, not using Designer.)

call the setIcon method of the main widget.

Cheers,
Kevin

--

Student at Graz University of Technology
http://www.sbox.tu-graz.ac.at/home/v/voyager

 
 
 

how to set main app icon in Qt?

Post by Hugo Vanwoerko » Fri, 24 Jan 2003 08:27:28


Am Tue, 21 Jan 2003 um 09:45 GMT schrieb


>> Newbie Qt programmer can't figure out how to set application's main
>> icon, it
>> defaults to 'X'.  Please point me to an example, or docs which explain
>> this.  (I'm handcoding my app, not using Designer.)

> call the setIcon method of the main widget.

But it depends upon the window manager whether it shows. I use setIcon and it shows
on Qt-3.1.1-Embedded (of course) and on any QT version on KDE2/3 but not on Fvwm.
When I told Fvwm about it they said: "Look at Kcalc, it shows!" And sure enough
Kcalc shows the icon, mine does not. So I looked at iconloader.h in KDE and that
is a mess to follow. So I'd be curious if you use setIcon whether it shows
the icon and with what windowmgr.
Hugo.
 
 
 

how to set main app icon in Qt?

Post by frog » Sun, 26 Jan 2003 06:36:44



> Am Tue, 21 Jan 2003 um 09:45 GMT schrieb

> But it depends upon the window manager whether it shows...
> ... So I'd be curious if
> you use setIcon whether it shows the icon and with what windowmgr.
> Hugo.

I'm using KDE 3.0.3 so this won't tell you anything you didn't already know.  
However I am having a hard time getting the icon to display.  Passing the
xpm filename to setIcon doesn't seem to work.  Am wondering if icon size
matters?  I'm using a 32 x 32 bit format.

code (in main widget constructor):

setIcon(QPixmap("/home/fgb/c/fgo2/fgoIcon.xpm"));

-Frank
http://www.inwa.net/~frog/

 
 
 

how to set main app icon in Qt?

Post by frog » Sun, 26 Jan 2003 08:31:53



> However I am having a hard time getting the icon to display...

> setIcon(QPixmap("/home/fgb/c/fgo2/fgoIcon.xpm"));

OK I got it.. changed filespec to contents of filespec and it works.
-Frank
http://www.inwa.net/~frog/