Hello,
I have QMainWindow and i created a QMenuBar added QMenu in it with actions that are connected with some slots but when i run appliacation and want to use some options from menu the slot is not called, i dont know where is a problem.
Here is main window constructor
ui(new Ui::Window)
{
setCentralWidget(ui->centralWidget);
ui->setupUi(this);
ui->render = new Render();
ui
->menuAnimacja
= new QMenu;
createAnimationActions();
ui->menuAnimacja->addAction( ui->actionStart );
ui->menuAnimacja->addAction( ui->actionStop );
ui->menuBar->addMenu( ui->menuAnimacja );
}
Window::Window(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::Window)
{
ui->centralWidget = new QWidget;
setCentralWidget(ui->centralWidget);
ui->setupUi(this);
ui->render = new Render();
ui->menuBar = new QMenuBar;
ui->menuAnimacja = new QMenu;
createAnimationActions();
ui->menuAnimacja->addAction( ui->actionStart );
ui->menuAnimacja->addAction( ui->actionStop );
ui->menuBar->addMenu( ui->menuAnimacja );
}
To copy to clipboard, switch view to plain text mode
and here i am creating actions
void Window::createAnimationActions()
{
ui
->actionStart
= new QAction(this);
connect(ui->actionStart, SIGNAL(triggered()), this, SLOT(startAnimation()));
ui
->actionStop
= new QAction(this);
connect(ui->actionStop, SIGNAL(triggered()), this, SLOT(stopAnimation()));
}
void Window::createAnimationActions()
{
ui->actionStart = new QAction(this);
connect(ui->actionStart, SIGNAL(triggered()), this, SLOT(startAnimation()));
ui->actionStop = new QAction(this);
connect(ui->actionStop, SIGNAL(triggered()), this, SLOT(stopAnimation()));
}
To copy to clipboard, switch view to plain text mode
Bookmarks