I created a menu inside my mainwindow:
MainWindow
::MainWindow(QWidget *parent
) : ui(new Ui::MainWindow)
{
ui->setupUi(this);
Menu *settingsMenu = new Menu(this);
// settingsMenu->show();
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
Menu *settingsMenu = new Menu(this);
// settingsMenu->show();
To copy to clipboard, switch view to plain text mode
it works fine. But now I decided to create a menu class and add the menu creation code in that class.
the menu class I created also inherits QMainWindow. When I create an instance of it in the MainWindow constructor, it doesn't show anything.
of course if I call the show() method it will create it in a separate window.
How can I merge the menu class to the main window?
ui(new Ui::MainWindow)
{
ui->setupUi(this);
createActions();
createMenus();
}
Menu::Menu(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
createActions();
createMenus();
}
To copy to clipboard, switch view to plain text mode
Bookmarks