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

List:       kde-core-devel
Subject:    Re: KToolBar::iconSize()
From:       David Faure <david () mandrakesoft ! com>
Date:       2002-02-13 17:50:04
[Download RAW message or body]

On Wednesday 13 February 2002 17:43, Scott Wheeler wrote:
> KToolBar::iconSize() currently returns 0 when it's set to "default".  This 
> seems wrong, but it may be intentional.  It's currently inserted into the 
> popup menu so that it will return 0 (ktoolbar.cpp, I think line 1892 -- I 
> added some kdDebug()s).
> 
> It seems like it should be set to "[MainToolbarIcons] -> Size" in kdeglobals.  
> There are a few ways around this problem, first, I could simply override it 
> in my app, but that seems ugly.  I'm not really sure there's a good reason to 
> have a "default", so it could just be removed.  The last option (that I can 
> think of) is to read it from the configuration and set it to what seems like 
> the right value.  

The reason the toolbar stores 0 into m_iconSize is so that it remembers
it's set to the default size, i.e. the user didn't change it, so if the global
default size for toolbars is changed (IIRC there is such a config option),
it will update accordingly. That's why it's so common to store "0 for default",
e.g. iconviews do the same (at least Konqueror's).

> Unfortunately, that also leaves the default size at zero if you have a 
> <app>ui.rc it's not set there and I don't think you can set it there.  A 
> 
> /opt/kde3/share/apps> cls ; grep -ri Size * | grep 'ui.rc'
> 
> didn't show anything useful.  

Of course. It's not recommended to hardcode toolbar sizes in the application
 ... but the framework allows it, just in case ;)

> All of this may be the intended behavior, but it seems strange.  If it's a 
> bug, I've patched my code (just for testing) and can send it in (after 
> removing some debugging stuff).  If this is the intended behavior, it might 
> be nice if it said so in the documentation.  For me trying to develop an app 
> (and using the icon size to determine the size of other widgets in the 
> toolbar) this is rather confusing.  Since it returns an integer, and not 
> something like "KIcon::SizeLarge" it seems like it should return the size no 
> matter what.

The value of m_iconSize has to remain IMHO.
The API, though, could be fixed, so that it returns the actual size, i.e.
iconSize() would query KIconTheme::currentSize (IIRC) to get the correct
size. However one would need to check if any KDE app uses iconSize() 
currently, to see if it relies on it being 0 if default - could you check that?

-- 
David FAURE, david@mandrakesoft.com, faure@kde.org
http://people.mandrakesoft.com/~david, http://www.konqueror.org
KDE 3.0: Konquering the Desktops

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

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