[Qt-interest] QAction.

Shabd Swarup V shabd at cadence.com
Thu Feb 19 04:19:59 CET 2009


Thanks a lot, Luc. That worked quite well.

Regards,
Shabd

-----Original Message-----
From: qt-interest-bounces at trolltech.com [mailto:qt-interest-bounces at trolltech.com] On Behalf Of Luc Devallonné
Sent: Wednesday, February 18, 2009 7:02 PM
To: qt-interest at trolltech.com
Subject: Re: [Qt-interest] QAction.

The widgets associated with an action are accessible through
associatedWidgets() ... then you need to iterate over the result and
cast them in order to define their exact type, if your action is
within a toolbar, you will find first a QToolButton, and then you
should call parentWidget on it.

Hope this helps

Luc

On Wed, Feb 18, 2009 at 2:10 PM, Shabd Swarup V <shabd at cadence.com> wrote:
> Thanks Alex, but parentWidget() actually returns the MainWindow instead of the MenuBar/ToolBar.
>
> Regards,
> Shabd
>
> -----Original Message-----
> From: qt-interest-bounces at trolltech.com [mailto:qt-interest-bounces at trolltech.com] On Behalf Of Alexandre Beraud
> Sent: Wednesday, February 18, 2009 6:25 PM
> To: qt-interest at trolltech.com
> Subject: Re: [Qt-interest] QAction.
>
> Hi,
>
> You can try to make a qobject_cast on the parentWidget() and check
> whether it is null or not.
>
> Regards,
>
> Alex
>
>
>
> Shabd Swarup V a écrit :
>>
>> Hi,
>>
>>
>>
>> If I have access to a *QAction* object, is there a way to find out
>> whether that action is part of a MenuBar, ToolBar or a PopUpMenu etc.
>>
>> Please let me know.
>>
>>
>>
>> Thanks in advance.
>>
>>
>>
>> Regards,
>>
>> Shabd
>>
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Qt-interest mailing list
>> Qt-interest at trolltech.com
>> http://lists.trolltech.com/mailman/listinfo/qt-interest
>>
>
>
> --
> BERAUD Alexandre
> Ingénieur Développement
>
> Infflux - Informatique & Flux
> Tel: 01 49 57 92 00 - Fax : 01 49 57 92 01
> Mail: aberaud at infflux.com
> Visitez notre site :  www.infflux.com
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>

_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest




More information about the Qt-interest-old mailing list