I have in my main window 2 triggers
1. from the menu that closed totaly the app
2. from he window X button that ignored and just hide the window.
I’m using this SIGNAL/SLOTS
how can I know from where is it being triggered?.
In the closeEvent:
connect(ui->actionQuit, SIGNAL(triggered()),this, SLOT(CloseWin()));
void MainWindow::CloseWin()
{
close();
}
// triggered from the ui->actionQuit amd from the X button
void MainWindow::closeEvent(QCloseEvent *event)
{
// how can i know from where its bean triggered?
hide();
event->ignore();
}
Two solutions are possible:
QAction) signal to a separate slot and callqApp->quit()theresender()method inside your slot to determine the object which sent the signalI would prefer first one.