CloseEvent problem, how to close all the Wdigets witout spaming the user "Are you sure?"



  • @void MainWindow::closeEvent ( QCloseEvent * event )
    {
    event->ignore();
    if (QMessageBox::Yes == QMessageBox::question(this, "Close Confirmation?",
    "Are you sure you want to exit?",
    QMessageBox::Yes|QMessageBox::No))
    {
    event->accept();
    sendform->close();
    }
    }

    void SendForm::closeEvent ( QCloseEvent * event )
    {
    event->ignore();
    if (QMessageBox::Yes == QMessageBox::question(this, "Close Confirmation?",
    "Are you sure you want to exit?",
    QMessageBox::Yes|QMessageBox::No))
    {
    event->accept();
    }
    }

    @

    Hi, i have the closeEvent function to close and the second widget of my App, the problem is that the program Spamming the user with the QMessageBox. How can i find who is the sender to disable the Qmesagebox when a widget calls the close() function and not the User ?



  • Hi,
    Why not using a variable which stores a true/false value to say if you have to ask the user for the question again ?
    Sincerely



  • [quote author="archqt" date="1416763454"]Hi,
    Why not using a variable which stores a true/false value to say if you have to ask the user for the question again ?
    Sincerely[/quote]

    i am not sure if it's easy between two classes to make this without to use a QT way/function! how to recognise if the user or the Qwidget send the command ?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.