[Qt-interest] Menu and SubMenu Actions

Raja Rokkam rokkamraja at gmail.com
Tue Jul 20 15:32:13 CEST 2010


Finally, got it working. Below is the solution:

Whenever an action is defined, I set an objectName to it and overwritten the
mouseReleaseEvent as below:

  void mouseReleaseEvent(QMouseEvent *event)
    {
       if (activeAction()) {
           activeAction()->trigger();
           event->accept();
        } else {
            QMenu::mouseReleaseEvent(event);
        }
    }


Thanks!!

On Tue, Jul 20, 2010 at 6:46 PM, Pedro Henrique Linhares <
pedrolmota at gmail.com> wrote:

> I also think you cannot achieve this behavior maybe you should try it by
> other means. Using another subMenu item to activate the actions or something
> like that.
>
> regards,
>
> Pedro Henrique.
>
>
> On Tue, Jul 20, 2010 at 9:47 AM, Andre Somers <andre at familiesomers.nl>wrote:
>
>> Op 20-7-2010 9:00, Raja Rokkam schreef:
>> > Hi All,
>> >
>> >           I have a simple issue:
>> >
>> > Menu1 -> Item1
>> >                Item2
>> >                Item3
>> >
>> >
>> > When I click on either of items, I will disable all the 3 entries, but
>> > enable the MENU1 entry changing its text.
>> >
>> > Now, in the above case if use clicks on MENU1 entry, it should show me
>> > the disabled entries when Hovered and call a SLOT when clicked on it
>> >
>> > Right now, its just showing me the disabled list of entries and when
>> > clicked it is moving on to 1st disabled entry.
>> >
>> >
>> AFAIK, what you want is not possible with the standard menus in Qt. The
>> behaviour is non-standard and will not be expected by your users. A menu
>> item that represents a submenu can not itself be an action, AFAIK.
>>
>> André
>> _______________________________________________
>> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100720/e3c2326e/attachment.html 


More information about the Qt-interest-old mailing list