QmlDesigner: Avoid some unneeded QFileInfo constructions

Change-Id: I0289c3187f07e26d05a7ca591cc8b12b767c3502
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Eike Ziller
2017-10-19 08:34:06 +02:00
parent c7c0bbf511
commit f2ef88aada
2 changed files with 3 additions and 2 deletions

View File

@@ -693,7 +693,7 @@ static inline QString fixComponentPathForIncompatibleQt(const QString &component
//plugin directories might contain the version number //plugin directories might contain the version number
fixedPath.chop(4); fixedPath.chop(4);
fixedPath += QLatin1Char('/') + QFileInfo(componentPath).fileName(); fixedPath += QLatin1Char('/') + QFileInfo(componentPath).fileName();
if (QFileInfo(fixedPath).exists()) if (QFileInfo::exists(fixedPath))
return fixedPath; return fixedPath;
} }
} }

View File

@@ -194,7 +194,8 @@ void PropertyEditorView::changeValue(const QString &name)
if (qmlObjectNode.modelNode().metaInfo().propertyTypeName(propertyName) == "QUrl" if (qmlObjectNode.modelNode().metaInfo().propertyTypeName(propertyName) == "QUrl"
|| qmlObjectNode.modelNode().metaInfo().propertyTypeName(propertyName) == "url") { //turn absolute local file paths into relative paths || qmlObjectNode.modelNode().metaInfo().propertyTypeName(propertyName) == "url") { //turn absolute local file paths into relative paths
QString filePath = castedValue.toUrl().toString(); QString filePath = castedValue.toUrl().toString();
if (QFileInfo(filePath).exists() && QFileInfo(filePath).isAbsolute()) { QFileInfo fi(filePath);
if (fi.exists() && fi.isAbsolute()) {
QDir fileDir(QFileInfo(model()->fileUrl().toLocalFile()).absolutePath()); QDir fileDir(QFileInfo(model()->fileUrl().toLocalFile()).absolutePath());
castedValue = QUrl(fileDir.relativeFilePath(filePath)); castedValue = QUrl(fileDir.relativeFilePath(filePath));
} }