"Buttons have icons", round N+1
Thomas Lübking
thomas.luebking at gmail.com
Sun Dec 13 16:14:17 UTC 2015
On Sonntag, 13. Dezember 2015 16:20:19 CEST, René J.V. wrote:
> There has been some discussion around one of my RRs concerning
> how to respect KDE's ShowIconsOnPushButtons and Qt's
> SH_DialogButtonBox_ButtonsHaveIcons style hint.
>
> The ultimate way would be in the style that does the actual
> drawing, but that is probably not the one with the smallest
> overhead.
I object the overhead concern. The global solution is easily applied by the style (the icon isn't loaded from disk or rendered until you/the style requires a pixmap from painting - until then there's just a string that hints which icon to use)
> The dialog in question is a KMessageBox with a few KStandardGuiItems.
> In a comparable situation, Qt's own code simply doesn't add the
> standard icons to the buttons being created, when
> SH_DialogButtonBox_ButtonsHaveIcons is false.
>
> KMessageBox isn't a QDialogButtonBox
No, but it uses one - the problem is the same as in the kdelibs4support code of KDialogButtonBox - the assignment of the KGuiItem which ignores SH_DialogButtonBox_ButtonsHaveIcons in all the *Internal functions of KMessageBox. Needs a similar fix (to respect the hint)
So this is as well orthogonal to the general Pushbutton icon/ShowIconsOnPushButtons question (but simply a bug that needs to be fixed)
It might seem reasonable to query the parent widget of the button in KGuiItem to catch a variety of occasions at once (though this doesn't guarantee anything, parent and style would have to be tracked to make this "perfect" or QPushButton would check its parent widget on painting and conditionally omit the icon when it's a buttonbox and the style doesn't want icons there)
Cheers,
Thomas
More information about the Kde-frameworks-devel
mailing list