[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: kde-app and diabled icons
From:       Antonio Larrosa =?iso-8859-1?q?Jim=E9nez?= <larrosa () kde ! org>
Date:       2001-06-30 22:04:08
[Download RAW message or body]

El Sáb 30 Jun 2001 23:28, Martijn Klingens escribió:
> On Saturday 30 June 2001 22:56, Thomas Satzinger wrote:
> > On Saturday 30 June 2001 21:41, Martijn Klingens wrote:
> >
> > i do the following
> > KGlobal::instance()->iconLoader()->loadIcon( "name_of_icon_file",
> > KIcon::NoGroup, KIcon::Small )
> >

That's wrong ... and long :)

> > i have the icon in $kde_dir/share/icons
> >
> > i have read somewhere, that kde takes care to apply the visual effect
> > for different situations(enabled/disbaled)but somehow it doesn´t work
> > here for me
> >

it doesn't ? have you tried to change the configuration for icon effects 
on KControl ?

> > i think i did oversee something very aesy
>
> Well.. I returns a QPixmap and AFAIK you need a QIconSet to have a set
> of different icons depending on the state. But I'm not sure what method
> is recommended there.
>
> I personally always use the global functions from kiconloader.h:
>
> QIconSet *is = SmallIcon( "name-of_icon_file" );
>

That's wrong too, it'll use the same icon for every state.

The extremely correct way is to use the XMLGUI framework to create the 
menu, and using just the icon name in the KAction constructors so that
the icons are loaded and the effects are applied internally without you 
having to care about anything.

The not-so-nice way (but also correct) is to use
SmallIconSet ("name-of-icon"); if you're going to use that iconset in a 
menubar and BarIconSet("name-of-icon"); if it's going to be used in a tool 
bar.

Note that you shouldn't use the name of the _file_ because you shouldn't
use extensions (nor the path to the file). 


> But I'm not at all sure that is the best way. It seems to work though.
>

No, it doesn't work. Just ask Torsten :-)
It will show _really_ugly_ icons if you use it in a system which is 
carefully configured . For example, in a system that is configured to use 
a black&white effect for all the normal icons, your app will show your 
color icons on a completely b&w desktop.

Greetings,

--
Antonio Larrosa Jimenez
KDE Core developer  - larrosa@kde.org
SuSE Labs developer - larrosa@suse.de
http://perso.wanadoo.es/antlarr
KDE - The development framework of the future, today.

>> Visit http://master.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic