Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Qt- Delete file

Tags:

I need to remove one specific file. I have tried this:

msgBox.setButtonText(QMessageBox::Ok , tr("Ok"));
msgBox.setButtonText(QMessageBox::Cancel , tr("Cancel"));

int ret = msgBox.exec();

switch (ret)
{
    case QMessageBox::Ok:
    {
    #ifdef Q_OS_IOS
        QStringList paths = QStandardPaths::standardLocations(QStandardPaths::DataLocation);
        QString dbFile = paths.first().append("/log.dat");
    #else
        QString dbFile = "log.dat";
    #endif
        QSettings settings(CGlobalZone::m_companyName, CGlobalZone::m_softwareName);
        settings.clear();
        QDir dir;
        dir.remove(dbFile);

        break;

    case QMessageBox::Cancel:
        QTimer::singleShot(1500, this, SLOT(close()));
        break;
}


but unfortunately dbFile still exists. How I can remove "dbFile"?