How to trigger QMenu on right click.



  • Hello all.
    I am creating QMenu object in the function of my class and I connect this object to one of my slots using

    connect(menu, SIGNAL(triggered(QAction*), SLOT(myslot(QAction*)));
    

    It works ok for left button click, but for right button click it doesn't emits triggered signal and the slot is not calling.
    can I do the same for both side button click without subclassing QMenu and reimplement of mouseEvent method?

    thank you.


  • Lifetime Qt Champion

    Hi,

    The menus example should contain the info you need.

    Hope it helps


  • Qt Champions 2017

    Hi
    Just as a note.
    No (dropdown) menus I have ever used can be triggered by right clicking. ( some offer properties this way)
    so can I ask why you need that?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.