Swanand
Swanand

Reputation: 4115

QGuiApplication Exit Dialog box

We have a QGuiApplication and a pretty standard mainfunction and then application starts in QML file.

int main(int argc, char *argv[])
{
    QGuiApplication app(argc, argv);
    // Some Processing...

   // Start the Application
    return a.exec();
}

I want to implement "Exit Dialog Box" i.e. When user clicks on "X", I want to show a Dialog box "Do you want to exit? Yes No ".

Is there any signal which I should wait for? AboutToQuit()is too late! and CloseEvent()is for QWidget.

I am using Qt5.3

Upvotes: 1

Views: 942

Answers (1)

Simon Warta
Simon Warta

Reputation: 11408

There is onClosing for QML windows. A root ApplicationWindow is a Window as well.

Note that the onClosing slot is not properly recognized by Qt Creator but it works.

Upvotes: 3

Related Questions