Why does KPushButton have a delayedMenu?
Stephen Kelly
steveire at gmail.com
Fri Apr 6 14:20:05 BST 2012
Kevin Krammer wrote:
> On Friday, 2012-04-06, Stephen Kelly wrote:
>> Eike Hein wrote:
>> > On 04/06/2012 01:08 PM, Richard Moore wrote:
>> >> It's for things like a browser's back button where a click moves you
>> >> back, wheras press and hold shows a menu of the recent history.
>> >
>> > Another use is in Konsole (and Yakuake) where click-and-hold on
>> > the "New Tab" button opens a popup menu allowing the choice of
>> > which profile to use.
>>
>> Ah, I see. I thought it was some internalized workaround for some bug or
>> other, but that looks like something that could be added to Qt.
>
> QToolButton has that, see QToolButton::ToolButtonPopupMode
> My guess for it not being in QAbstractButton is that it doesn't make sense
> for QCheckBox and QRadioButton.
Interesting. So should KPushButtons which wish to use the delayed popup
stuff be changed to QToolButtons, or should we try to get the feature from
QToolButton to QAbstractButton. I don't think it would be too unusual to
have parts of an interface which not all subclasses make use of. Or maybe
the menu popup stuff can be refactored into an internal class used by both
QToolButton and QPushButton, and add the feature and API to QPushButton that
way.
Either way, it would need to be done in a BC way in Qt 5.1. Any volunteers?
Also, any arguments supporting getting it into Qt? Can someone tell me where
I would see it used outside of a toolbar (Where a QToolButton should be used
instead)?
Also, I'm a bit confused by the docs for this stuff:
/**
* Sets a delayed popup menu
* for consistency, since menu() isn't virtual
*/
void setDelayedMenu(QMenu *delayed_menu);
/**
* returns a delayed popup menu
* since menu() isn't virtual
*/
QMenu *delayedMenu();
What does the delayed menu stuff have to do with menu() not being virtual?
Would it be easier if it was virtual? Should we try to make it virtual (any
volunteers?)?
> Always thought QToolButton should be a "mode" of QPushButton instead of a
> separate class :)
Maybe... I guess it would be possible in theory to get its features into
QPushButton and deprecate QToolButton, but again, someone would have to
justify and implement that.
Thanks,
Steve.
More information about the kde-core-devel
mailing list