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

Alex Malyushytskyy alexmalvtk at gmail.com
Wed Aug 21 01:16:07 CEST 2013


You can add any widget (QToolButton is a widget ) to toolbar with QAction **
addWidget <qtoolbar.html#addWidget>* ( QWidget * *widget* )


On Tue, Aug 20, 2013 at 11:03 AM, Etienne Sandré-Chardonnal <
etienne.sandre at m4x.org> wrote:

> 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...)
>
> Thanks,
>
> Etienne
>
>
>
>
> 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
>>
>
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130820/d96cb684/attachment.html>


More information about the Interest mailing list