No need to check that a file exists if we know it's modified date

This commit is contained in:
Aleix Pol 2021-06-28 16:55:19 +02:00
parent c3e0ba8ff5
commit cd4ab21dd8
1 changed files with 4 additions and 3 deletions

View File

@ -457,9 +457,10 @@ bool SvgPrivate::setImagePath(const QString &imagePath)
#endif
}
QFileInfo info(path);
const QFileInfo info(path);
const QDateTime lastModifiedDate = info.lastModified();
lastModified = info.lastModified().toSecsSinceEpoch();
lastModified = lastModifiedDate.toSecsSinceEpoch();
SvgRectsCache::instance()->loadImageFromCache(path, lastModified);
@ -468,7 +469,7 @@ bool SvgPrivate::setImagePath(const QString &imagePath)
// also images with absolute path needs to have a natural size initialized,
// even if looks a bit weird using Theme to store non-themed stuff
if ((themed && !path.isEmpty() && QFileInfo::exists(path)) || QFileInfo::exists(actualPath)) {
if ((themed && !path.isEmpty() && lastModifiedDate.isValid()) || QFileInfo::exists(actualPath)) {
naturalSize = SvgRectsCache::instance()->naturalSize(path, scaleFactor);
if (naturalSize.isEmpty()) {
createRenderer();