EffectComposer: Open effectComposerNodes/images by default in UrlChooser

Task-number: QDS-11464
Change-Id: I96bb7e359bd41637f0b1906a523c8a5de190981d
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
Shrief Gabr
2024-03-07 11:43:13 +02:00
parent d786001fa1
commit 836c0a11e4
6 changed files with 14 additions and 4 deletions

View File

@@ -13,6 +13,7 @@ Row {
HelperWidgets.UrlChooser {
backendValue: uniformBackendValue
resourcesPath: EffectComposerBackend.rootView.imagesPath()
actionIndicatorVisible: false
comboBox.width: Math.min(parent.width - 70, 300)

View File

@@ -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)

View File

@@ -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};

View File

@@ -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;

View File

@@ -114,9 +114,9 @@ QList<FileResourcesItem> 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;

View File

@@ -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;