Hello,
Seems trivial problem, but do not understand why this happens?
Simple program crashes on " menuBar()->addMenu(file_menu_); "
Any suggestion?
{
Q_OBJECT
}
PhotoWarperWindow::PhotoWarperWindow(void)
{
setCentralWidget(widget);
layout->setMargin(5);
widget->setLayout(layout);
//CreateActions();
CreateMenus();
setWindowTitle
(QString::fromUtf8("Menus"));
setMinimumSize(160, 160);
resize(480, 320);
}
void PhotoWarperWindow::CreateMenus()
{
file_menu_
= new QMenu(menuBar
());
menuBar()->addMenu(file_menu_); <- PROGRAM CRASH HERE
}
int main(int argc, char* argv[])
{
PhotoWarperWindow window;
window.show();
return app.exec();
}
class PhotoWarperWindow : public QMainWindow
{
Q_OBJECT
}
PhotoWarperWindow::PhotoWarperWindow(void)
{
QWidget *widget = new QWidget;
setCentralWidget(widget);
QVBoxLayout *layout = new QVBoxLayout;
layout->setMargin(5);
widget->setLayout(layout);
//CreateActions();
CreateMenus();
setWindowTitle(QString::fromUtf8("Menus"));
setMinimumSize(160, 160);
resize(480, 320);
}
void PhotoWarperWindow::CreateMenus()
{
QMenuBar *mb = menuBar();
file_menu_ = new QMenu(menuBar());
menuBar()->addMenu(file_menu_); <- PROGRAM CRASH HERE
}
int main(int argc, char* argv[])
{
QApplication app(argc, argv);
PhotoWarperWindow window;
window.show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks