Code example:
auto fileMenu = std::make_unique<QMenu>(this->menuBar()->addMenu("First"));
fileMenu->addAction("AFirst");
auto x = this->menuBar()->addMenu("Second");
x->addAction("ASecond");
Results:
I have 2 menus in menubar, but in first menu - for some reason, there are NO actions. Second menu correctly has action.
I have tried different approaches, like, class-member pointers, and so on, but this is shortest possible example - QAction is missing, if QMenu is unique_ptr. Can anyone explain this for me? Parent window is QMainWindow, just in case.
System info: Win8.1 x64, Compiler is VS2013, Qt 5.4 x32.
QMenu
in aunique_ptr
; it is already managed by the menu bar. – CarltonaddMenu
in the documentation, the one that returns aQAction
. – Carlton