[Interest] Default action for a QMenu added to a QToolBar

Etienne Sandré-Chardonnal etienne.sandre at m4x.org
Tue Aug 20 20:03:48 CEST 2013

Thanks Christoph,

Is there any way to do this with a QToolBar? I cannot add a QToolButton to
the toolbar (unless I missed something), as you add the menu directly using
addAction (qMenu->menuAction()), and the QToolBar seems to miss this setting

On the other hand, QToolBar is quite useful for me (auto display of a popup
button if the toolbar is not large enough for all buttons, etc...)



2013/8/20 Christoph Feck <christoph at maxiom.de>

> On Tuesday 20 August 2013 19:27:03 Etienne Sandré-Chardonnal wrote:
> > Dear all,
> >
> > I inserted a QMenu to a QToolBar. This displays the menu icon,
> > together with a drop-down arrow for opening the menu.
> >
> > Clicking the menu icon in the toolbar does nothing, as the menu
> > action is connected to nothing.
> > Is it possible to either:
> >  - Set the default child action that will be triggered when the
> > main menu icon is clicked (setDefaultAction doesn't do the job)
> >  - Popup the menu when the main menu icon is clicked (as when
> > clicking the dropdown arrow)
> >
> > Thanks,
> >
> > Etienne
> http://qt-project.org/doc/qt-4.8/qtoolbutton.html#ToolButtonPopupMode-enum
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130820/f74f2a08/attachment.html>

More information about the Interest mailing list