我需要删除一个特定的文件。 我已经尝试过这个:
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;
}
但是不幸的是dbFile仍然存在。我如何删除"dbFile"?