[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 22:41:07
[Download RAW message or body]

On Wednesday 13 February 2002 22:18, Scott Wheeler wrote:
> On Wednesday 13 February 2002 12:50 pm, David Faure wrote:
> 
> > 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?
> 
> The only thing that I found (I greped my entire KDE dir structure) that uses 
> this is in kanimwidget.cpp:
> ===
>   if (parent()->inherits( "KToolBar" ))
>     d->size = ((KToolBar*)parent())->iconSize();
>   if (!d->size)
>      d->size = KGlobal::iconLoader()->currentSize(KIcon::MainToolbar);
> ===
> As you can see, it has a workaround for this in it that wouldn't be needed 
> with the suggested fix.  

Actually it should remain, just in case this isn't used in a KToolBar.
Better have a fallback in this unlikely case.

> I understand what you're saying about the internals of KToolBar.  I'm still 
> pretty new at hacking on the libs that I'm learning as I go.  Aside from 
> staying consistent with other implementations it didn't seem very 
> straightforward.

Isn't it ?
Suggested patch, posted here for review:

Index: ktoolbar.cpp
===================================================================
RCS file: /home/kde/kdelibs/kdeui/ktoolbar.cpp,v
retrieving revision 1.306
diff -u -p -r1.306 ktoolbar.cpp
--- ktoolbar.cpp        2002/02/09 00:01:24     1.306
+++ ktoolbar.cpp        2002/02/13 22:39:24
@@ -926,6 +926,8 @@ void KToolBar::setIconSize(int size, boo

 int KToolBar::iconSize() const
 {
+    if ( !d->m_iconSize ) // default value?
+        return KGlobal::iconLoader()->currentSize(KIcon::MainToolbar);
     return d->m_iconSize;
 }

-- 
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