Ya, QWidget::contextMenuEvent is a better option.
You will also need to show the menu using QMenu::exec.

Also be careful about the actions being created on stack.