diff --git a/share/qtcreator/qmldesigner/effectComposerQmlSources/ValueImage.qml b/share/qtcreator/qmldesigner/effectComposerQmlSources/ValueImage.qml index 3bdab3a0a0e..bed9dfdce0c 100644 --- a/share/qtcreator/qmldesigner/effectComposerQmlSources/ValueImage.qml +++ b/share/qtcreator/qmldesigner/effectComposerQmlSources/ValueImage.qml @@ -13,6 +13,7 @@ Row { HelperWidgets.UrlChooser { backendValue: uniformBackendValue + resourcesPath: EffectComposerBackend.rootView.imagesPath() actionIndicatorVisible: false comboBox.width: Math.min(parent.width - 70, 300) diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/UrlChooser.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/UrlChooser.qml index 5d65bb09fc4..c73e736ef42 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/UrlChooser.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/UrlChooser.qml @@ -28,6 +28,9 @@ Row { // Current item property string absoluteFilePath: "" + // If this property is set, this path will be opened instead of the default path + property string resourcesPath + property alias comboBox: comboBox property alias spacer: spacer property alias actionIndicatorVisible: comboBox.actionIndicatorVisible @@ -525,7 +528,7 @@ Row { icon: StudioTheme.Constants.addFile iconColor: root.textColor onClicked: { - fileModel.openFileDialog() + fileModel.openFileDialog(resourcesPath) if (fileModel.fileName !== "") { root.backendValue.value = fileModel.fileName root.absoluteFilePath = fileModel.resolve(root.backendValue.value) diff --git a/src/plugins/effectcomposer/effectcomposerwidget.cpp b/src/plugins/effectcomposer/effectcomposerwidget.cpp index 3ae6e7b62f8..dd1d5e926d2 100644 --- a/src/plugins/effectcomposer/effectcomposerwidget.cpp +++ b/src/plugins/effectcomposer/effectcomposerwidget.cpp @@ -197,6 +197,11 @@ QString EffectComposerWidget::uniformDefaultImage(const QString &nodeName, const return m_effectComposerNodesModel->defaultImagesForNode(nodeName).value(uniformName); } +QString EffectComposerWidget::imagesPath() const +{ + return Core::ICore::resourcePath("qmldesigner/effectComposerNodes/images").toString(); +} + QSize EffectComposerWidget::sizeHint() const { return {420, 420}; diff --git a/src/plugins/effectcomposer/effectcomposerwidget.h b/src/plugins/effectcomposer/effectcomposerwidget.h index fb4c818f4f2..aa9cb750d8e 100644 --- a/src/plugins/effectcomposer/effectcomposerwidget.h +++ b/src/plugins/effectcomposer/effectcomposerwidget.h @@ -52,6 +52,7 @@ public: Q_INVOKABLE QPoint globalPos(const QPoint &point) const; Q_INVOKABLE QString uniformDefaultImage(const QString &nodeName, const QString &uniformName) const; + Q_INVOKABLE QString imagesPath() const; QSize sizeHint() const override; diff --git a/src/plugins/qmldesigner/components/propertyeditor/fileresourcesmodel.cpp b/src/plugins/qmldesigner/components/propertyeditor/fileresourcesmodel.cpp index 3c419a3e82d..2942ca86c76 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/fileresourcesmodel.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/fileresourcesmodel.cpp @@ -114,9 +114,9 @@ QList FileResourcesModel::model() const return m_model; } -void FileResourcesModel::openFileDialog() +void FileResourcesModel::openFileDialog(const QString &customPath) { - QString resourcePath = m_path.toLocalFile(); + QString resourcePath = customPath.isEmpty() ? m_path.toLocalFile() : customPath; bool resourcePathChanged = m_lastResourcePath != resourcePath; m_lastResourcePath = resourcePath; diff --git a/src/plugins/qmldesigner/components/propertyeditor/fileresourcesmodel.h b/src/plugins/qmldesigner/components/propertyeditor/fileresourcesmodel.h index 4bca3f531ac..d382424c8ac 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/fileresourcesmodel.h +++ b/src/plugins/qmldesigner/components/propertyeditor/fileresourcesmodel.h @@ -69,7 +69,7 @@ public: void refreshModel(); - Q_INVOKABLE void openFileDialog(); + Q_INVOKABLE void openFileDialog(const QString &customPath = {}); Q_INVOKABLE QString resolve(const QString &relative) const; Q_INVOKABLE bool isLocal(const QString &path) const;