KIconButton sizes

David Faure faure at
Mon Feb 4 15:02:59 GMT 2008

On Saturday 02 February 2008, Lukas Appelhans wrote:
> Hi!
> The attached Patch adds the functionality to KIconButton-class to only set the 
> Icon-Size for Dialog or Button. 
> For example: We in KGet need a Size of 16x16 for the Button, which looks 
> pretty bad in the Dialog...
> Any objections or comments?
I don't understand, buttonIconSize/setButtonIconSize is already available as iconSize/setIconSize(QSize)
(inherited from QPushButton), and setDialogIconSize is already available as setIconSize(int) (which also
calls QPushButton::setIconSize(QSize)).
Ah! So the real problem is that KIconButton's setIconSize method clashes with QPushButton's setIconSize
since they have different meanings. Damn we should have renamed it for 4.0.

So... you want a dialog that shows large icons, but a button that shows a 16x16 icon?

In that case a solution is to call button->setIconSize(QSize(16,16)) *after* calling button->setIconSize(int) if you call it at all.
To make this more obvious we could have a setButtonIconSize indeed, but:
* in a way that makes it work also if setIconSize(int) is called afterwards
* and I don't see a need for setDialogIconSize... we end up with too many redundant setters.

David Faure, faure at, sponsored by Trolltech to work on KDE,
Konqueror (, and KOffice (

More information about the kde-core-devel mailing list