View Single Post
M Ali
Junior Member
Join Date: Dec 2021
Old 12-28-2021 , 04:43   Re: New menu memory leakage
Reply With Quote #4

void MainWindow::createMenu()
{
//Create menus
QAction *quit = new QAction("&Quit", this);
QMenu *file = menuBar()->addMenu("&File");
file->addAction(quit);
connect(quit, &QAction::triggered,
[=]() {
QApplication::quit();
});

//Creating instances of ticker and timer here
//Done so that the connection between ticker and timer is possible
ticker = new Ticker(this);
timer = new Timer(this);
connect(timer, &Timer::timeout, ticker, &Ticker::playSound);
}
M Ali is offline