App closes before uploading data to database, Qt

  c++, qt

So I have made a basic app that allows users to enter in data and then upon pressing submit the data is submitted to a firebase and the app closes. However for some reason the app is closing without submitting the data to the firebase.

The code for the submit button is as follows:

void checkinapp::on_pushButton_clicked()

post() and exit() are defined as follows:

void post()
        m_networkManager = new QNetworkAccessManager ( this );
        QVariantMap newUser;
        newUser[ "Stress" ] = QString::number(stressed);
        newUser[ "Sleep" ] = QString::number(tired);
        newUser[ "Hungry" ] = QString::number(hungry);
        newUser[ "Happy" ] = QString::number(happy);
        newUser[ "Grade" ] = QString::number(grade);
        newUser[ "Date" ] = "1/10/21";
        newUser[ "Gender" ] = QString::number(gender);
        newUser[ "Aid" ] = QString::number(help);
        QJsonDocument jsonDoc = QJsonDocument::fromVariant( newUser );
        QNetworkRequest newUserRequest(Url( "url/User.json"));
        newUserRequest.setHeader( QNetworkRequest::ContentTypeHeader, QString( "application/json" ));
        m_networkManager->post( newUserRequest, jsonDoc.toJson() );
        submitted = true;

void exit()


When I comment out checkinapp::exit() the app submits to the database but doesn’t close. however when it’s not commented out it closes the app without uploading to the database.

Source: Windows Questions C++