setMenu() doesn't set a context menu. If you want a context menu, you have three choices - either reimplement the contextMenuEvent() method of the button or catch the customContextMenuRequested() signal or add actions to the button and set the context menu policy accordingly (each of the solutions needs its own setting of that policy).