[Qt-interest] QMenu vertical separator feature

Andre Somers andre at familiesomers.nl
Tue Nov 23 18:52:40 CET 2010


Op 22-11-2010 23:13, Patrick Sebastian Zimmermann schreef:
> This is my first post to this mailing list, so: Hello everyone.
>
> I try to extend the QMenu to allow for a vertical separator, that will allow to put menu entries in several columns in a controlled fashion.
> I found no way of implementing this via composition or inheritance. Thus I tried to do it by changing QMenu itself.
> In addition to the QMenu class the QAction class needs to be adapted to distinguish between a horizontal (the current one) and
> vertical separator. This is quite an intrusive change, since QAction is used in some other places too where this differentiation makes no sense.
> Now the question:
> Would such a change have any chance of getting upstream?
First of all: I only speak for myself. I am not connected to Nokia or 
any other influential organization or project that might have leverage 
or decision power concerning Qt.

My take on your last question is "probably not". I base that on several 
things. First of all: I doubt the changes you'll have to make are 
binairy compatible, though perhaps that is possible. Second: the widget 
part of Qt doesn't really have the focus of the Qt devs it used to have. 
QML is the thing at the moment, so most effort is spend there. Third, 
because I doubt such a menu would pass UI usability guidelines. AFAIK, 
there is no comparable widget available at the platforms Qt runs on.

 From a technical point of view, I think that you may be better off 
creating your own menu-like widget instead of trying to adapt Qt's. Of 
course you can use Qt's version for inspiration and a base for the code, 
but I doubt it would be worth adapting QMenu and QAction. Would it not 
be easier to simply create a new method in your Menu2D class that allows 
you to add QActions to a specific column?

Anyway: these are just some thoughts. Perhaps the Trolls think it is a 
great idea.

André



More information about the Qt-interest-old mailing list