How to make a running text file in qt creator? Code below is not working : I want a running text file meaning when I close the program the file will still be there and if I add to the text file then the text from before the addition will still be there.

This is how I would do what I want to do in c++:  
 
    ofstream fout("filename.txt", ios::app)  
 
Here is how I am trying to do this in QT creator:  

    void addToDatabase::on_pushButton_clicked() {
        QString make = ui->lineEdit->text();
        QString model = ui->lineEdit_2->text();
        QString price = ui->lineEdit_3->text();
        QString miles = ui->lineEdit_4->text();

        QFile myDatabase(myDatabasePath);
        if (myDatabase.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append)) {
            QTextStream out(&myDatabase);
            out << make << "    " << model << "    " << price << "    " << miles << endl;
            myDatabase.flush();
            myDatabase.close();
        }
        this->close();
    }  
In summary, I want the database file to not get overwritten when I add a new QString to it. I've noticed that when I try to read my QFile it doesn't work either. I think this is because the declaration of myDatabase on line 7 is overwriting the old database.txt file at that path.  
Any help would be very much appreciated. Thank you!
