[Qt-interest] using designer to add menu to toolbar

Duane Hebert spoo at flarn.com
Mon Nov 23 18:23:48 CET 2009


"Andreas Pakulat" <apaku at gmx.de> wrote in message news:20091123165614.GA18124 at neo.apaku.dnsalias.org...
> On 23.11.09 10:03:42, Duane Hebert wrote:
>> >Just try it.I think what I said and what you need are exactly the same one.Actualy I do not think we can add a QMenu to
>> > >toolbar,but only menuAction.Of course we can not see them until run-time because you create them when the app runs ,not >when 
>> > >you
>> >design them.
>>
>> Try what?  I must be missing something here.  In order to add an action the way that you say, I must create an action in designer
>> and then I can drag it to the toolbar.  I know that.  But my question was how to add a Qmenu to the toolbar in the same way.  I
>> don't see how to do that.
>
> The answer is that you can't. Designer simply doesn't allow to do much with
> actions at all. So you'll have to write code for that yourself.
>
> And you're not really adding a QMenu, you'd add an action that has a menu
> and that menu again has actions. If you try how submenu-editing works in
> designer you'll quickly notice that designer hides any non-leaf actions in
> the action editor.

Thanks Andreas, that's what I thought.  What I ended up doing is adding an action in designer and in code,
replacing that action with the menuAction that I want.  This way, the developers that are handling the images
and things can change the look of this and I can take care of my functionality and transfer the icon, size, text etc.

FWIW, it doesn't seem to me like a bad idea to add this functionality in some way. 




More information about the Qt-interest-old mailing list