QNetworkDiskCache: Fix deprecation warning

access\qnetworkdiskcache.cpp: In member function 'virtual qint64 QNetworkDiskCache::expire()':
access\qnetworkdiskcache.cpp:540:44: warning: 'QDateTime QFileInfo::created() const' is deprecated: Use either birthTime() or metadataChangeTime() [-Wdeprecated-declarations]
             cacheItems.insert(info.created(), path);
                                            ^

Change-Id: I5705de5cb4b490ef2bd788fb94ceac0e5b6c0d05
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This commit is contained in:
Friedemann Kleint 2017-09-25 10:55:20 +02:00 committed by Timur Pocheptsov
parent 1e1de2b2e1
commit 278fa07045

View File

@ -537,7 +537,9 @@ qint64 QNetworkDiskCache::expire()
QFileInfo info = it.fileInfo();
QString fileName = info.fileName();
if (fileName.endsWith(CACHE_POSTFIX)) {
cacheItems.insert(info.created(), path);
const QDateTime birthTime = info.fileTime(QFile::FileBirthTime);
cacheItems.insert(birthTime.isValid() ? birthTime
: info.fileTime(QFile::FileMetadataChangeTime), path);
totalSize += info.size();
}
}