[kde-guidelines] Possible guidelines for buttons with menus

Aurélien Gâteau agateau at kde.org
Mon Aug 5 08:37:28 UTC 2013


Le vendredi 2 août 2013 15:30:52 David Edmundson a écrit :
> On Fri, Aug 2, 2013 at 3:08 PM, Aurélien Gâteau <agateau at kde.org> wrote:
> > Hi,
> > 
> > As you may know, I am contributing to the KDE Frameworks project, which
> > aims
> > at splitting the existing Qt4-based kdelibs into separate, finer-grained,
> > Qt5-
> > based components. Another objective of this project is to get some of the
> > features KDE developers added to Qt widgets back into Qt itself.
> > 
> > One of those features was "delayed menus" for buttons. When used on a
> > button,
> > then a short click on the button triggers a default action, while holding
> > the
> > mouse pressed on the button shows a menu with more actions. Qt provides
> > this
> > feature for toolbar buttons but not for regular buttons (QPushButton).
> > 
> > in kdelibs, KPushButton extends QPushButton and add this delayed menu
> > feature,
> > so the original task was to implement the same in QPushButton, so that we
> > could get rid of KPushButton. After a bit of research, we found out this
> > feature was very seldom used and we felt it was surprising: buttons with
> > delayed menus look like menu-buttons (buttons where a short click always
> > show
> > a menu) but behave differently.
> > 
> > Here is an example of such a button: Kate session dialog. To get this
> > dialog
> > to show, open the config dialog, go to  Application > Sessions, and select
> > the "Manually choose a session" radio button. Now restart Kate, the dialog
> > should appear. It looks like this:
> > 
> > http://6g6.eu/sih0-kate-session-dialog-1.png
> > 
> > Clicking the "New Session" button creates a new session. When you hold
> > down
> > the mouse button on it, you get this menu:
> > 
> > http://6g6.eu/sih0-kate-session-dialog-2.png
> > 
> > The KDE Frameworks project maintains a porting document which suggest
> > developers alternatives for features which are going away. What should we
> > suggest to developers using this feature? A generic solution would be
> > recommending the use of a plain menu button, but I am not sure if it is
> > always
> > practical since it means the default action will require two clicks
> > instead of
> > one.
> 
> I like the usage of "split button dropdowns" as seen here
> http://getbootstrap.com/components/. It's quite clear, click on the left
> you get the button, click on the right you'd get the menu.

That is a better alternative than delayed menus indeed. The only drawback I 
find is the click target is small, but that is acceptable I think.

I would also make it so that there is a clear vertical line between the button 
text and the down arrow, to ensure it looks different from a menu-only button. 
(bootstrap only shows the split on mouse over, which is not enough IMO)

> On a technical level it'd be harder to get that into Qt, but it's something
> we could make that could go into KWidgetAddons just fine.

Agreed, so the plan could be:
1. Create a "SplittedMenuButton" (or any better name) in KWidgetAddons
2. Suggest users of the "delayed menu button" feature to use 
SplittedMenuButton instead

Thinking a bit more about it, this SplittedMenuButton brings to memory a 
button feature I have been willing to have for a long time: segmented buttons 
(bootstrap calls them "Button Groups" http://getbootstrap.com/components/#btn-groups-single)

When you think about it, a SplittedMenuButton can be seen as two segmented 
buttons, one with the button text in it, executing the default action, one 
with the down arrow, showing the menu. Maybe we can get those in Qt.

Having segmented buttons in Qt would be great because then widget styles can 
be aware of those buttons and render the straight vertical borders 
appropriately (instead of faking them after-the-fact in a custom widget, like 
I do in Gwenview statusbar buttons)

Heiko and Thomas: Do you think segmented buttons would be a good addition to 
our recommended controls?

Aurélien


More information about the kde-guidelines mailing list