From f2ef88aadae9e295c079dff242430755f20199e7 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Thu, 19 Oct 2017 08:34:06 +0200 Subject: [PATCH] QmlDesigner: Avoid some unneeded QFileInfo constructions Change-Id: I0289c3187f07e26d05a7ca591cc8b12b767c3502 Reviewed-by: Thomas Hartmann --- .../qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp | 2 +- .../components/propertyeditor/propertyeditorview.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp index 102e3851d04..1dc4716649c 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp @@ -693,7 +693,7 @@ static inline QString fixComponentPathForIncompatibleQt(const QString &component //plugin directories might contain the version number fixedPath.chop(4); fixedPath += QLatin1Char('/') + QFileInfo(componentPath).fileName(); - if (QFileInfo(fixedPath).exists()) + if (QFileInfo::exists(fixedPath)) return fixedPath; } } diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp index a38a6b93aff..4cad2d08cc0 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp @@ -194,7 +194,8 @@ void PropertyEditorView::changeValue(const QString &name) if (qmlObjectNode.modelNode().metaInfo().propertyTypeName(propertyName) == "QUrl" || qmlObjectNode.modelNode().metaInfo().propertyTypeName(propertyName) == "url") { //turn absolute local file paths into relative paths 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()); castedValue = QUrl(fileDir.relativeFilePath(filePath)); }