Context Menu



  • Hello, I try to use context menus, but I have a problem. I have reimplemented contextMenuEvent(QContextMenuEvent *event), which works when using the menu key on the keyboard, but which doesn't work well when using the right mouse button (the context menu disapears on release). The menu should persist on mouse release, how do I change that?



  • I just did this. Which platform you are trying ?

    @ this->setContextMenuPolicy(Qt::ActionsContextMenu);
    QAction *action = new QAction("pthinks",this);
    this->addAction(action);
    QAction *action1 = new QAction("Bangaluru",this);
    this->addAction(action1);@



  • [quote author="Dheerendra" date="1408193937"] Welcome to the forum. I just did this. Which platform are you trying ?

    @ this->setContextMenuPolicy(Qt::ActionsContextMenu);
    QAction *action = new QAction("pthinks",this);
    this->addAction(action);
    QAction *action1 = new QAction("Bangaluru",this);
    this->addAction(action1);@
    [/quote]



  • I am on Ubuntu 14.04. I want that the menu stays displayed when I release the right button. When I press the right button the menu is displayed, when I release the right button it disapears.


Log in to reply
 

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