• i have a widget
    how can i add a menu (open "item1/item2" if RightClicked it) a simple way

    plz dont link to Qt documentation. just show me a simple exemple.

  • you have to call setContextMenuPolicy(Qt::CustomContextMenu) on your widget and connect an own slot to the widgets customContextMenuRequested-signal. In this slot create an instance of QMenu with your desired Items as instances of QAction and call exec() on the menu...

    And you probably can't avoid reading some documentation (which contains several examples with menus, like "this":http://qt-project.org/doc/qt-4.8/mainwindows-menus.html one)

Log in to reply

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