forked from qt-creator/qt-creator
EffectMaker: Add the default image to UrlChooser combo for image values
Fixes: QDS-11221 Change-Id: Ib788c6950c9fc59fd87e199ab6c54bdd274cc8a2 Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io> Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io> Reviewed-by: Amr Elsayed <amr.elsayed@qt.io> Reviewed-by: Henning Gründl <henning.gruendl@qt.io>
This commit is contained in:
@@ -19,5 +19,19 @@ Row {
|
|||||||
actionIndicatorVisible: false
|
actionIndicatorVisible: false
|
||||||
|
|
||||||
onAbsoluteFilePathChanged: uniformValue = absoluteFilePath
|
onAbsoluteFilePathChanged: uniformValue = absoluteFilePath
|
||||||
|
|
||||||
|
function defaultAsString() {
|
||||||
|
let urlStr = uniformDefaultValue.toString()
|
||||||
|
urlStr = urlStr.replace(/^(file:\/{3})/, "")
|
||||||
|
|
||||||
|
// Prepend slash if there is no drive letter
|
||||||
|
if (urlStr.length > 1 && urlStr[1] !== ':')
|
||||||
|
urlStr = '/' + urlStr;
|
||||||
|
|
||||||
|
return urlStr
|
||||||
|
}
|
||||||
|
|
||||||
|
defaultItems: [uniformDefaultValue.split('/').pop()]
|
||||||
|
defaultPaths: [defaultAsString(uniformDefaultValue)]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -22,6 +22,10 @@ Row {
|
|||||||
// by QtQuick3D to add built-in primitives to the model.
|
// by QtQuick3D to add built-in primitives to the model.
|
||||||
property var defaultItems
|
property var defaultItems
|
||||||
|
|
||||||
|
// These paths will be used for default items if they are defined. Otherwise, default item
|
||||||
|
// itself is used as the path.
|
||||||
|
property var defaultPaths
|
||||||
|
|
||||||
// Current item
|
// Current item
|
||||||
property string absoluteFilePath: ""
|
property string absoluteFilePath: ""
|
||||||
|
|
||||||
@@ -422,8 +426,10 @@ Row {
|
|||||||
if (root.defaultItems !== undefined) {
|
if (root.defaultItems !== undefined) {
|
||||||
for (var i = 0; i < root.defaultItems.length; ++i) {
|
for (var i = 0; i < root.defaultItems.length; ++i) {
|
||||||
comboBox.listModel.append({
|
comboBox.listModel.append({
|
||||||
absoluteFilePath: "",
|
absoluteFilePath: root.defaultPaths ? root.defaultPaths[i]
|
||||||
relativeFilePath: root.defaultItems[i],
|
: "",
|
||||||
|
relativeFilePath: root.defaultPaths ? root.defaultPaths[i]
|
||||||
|
: root.defaultItems[i],
|
||||||
name: root.defaultItems[i],
|
name: root.defaultItems[i],
|
||||||
group: 0
|
group: 0
|
||||||
})
|
})
|
||||||
@@ -454,6 +460,7 @@ Row {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onDefaultItemsChanged: root.createModel()
|
onDefaultItemsChanged: root.createModel()
|
||||||
|
onDefaultPathsChanged: root.createModel()
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
root.createModel()
|
root.createModel()
|
||||||
|
@@ -25,6 +25,7 @@ class Uniform : public QObject
|
|||||||
Q_PROPERTY(QVariant uniformBackendValue READ backendValue NOTIFY uniformBackendValueChanged)
|
Q_PROPERTY(QVariant uniformBackendValue READ backendValue NOTIFY uniformBackendValueChanged)
|
||||||
Q_PROPERTY(QVariant uniformMinValue MEMBER m_minValue CONSTANT)
|
Q_PROPERTY(QVariant uniformMinValue MEMBER m_minValue CONSTANT)
|
||||||
Q_PROPERTY(QVariant uniformMaxValue MEMBER m_maxValue CONSTANT)
|
Q_PROPERTY(QVariant uniformMaxValue MEMBER m_maxValue CONSTANT)
|
||||||
|
Q_PROPERTY(QVariant uniformDefaultValue MEMBER m_defaultValue CONSTANT)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum class Type
|
enum class Type
|
||||||
|
@@ -158,6 +158,13 @@ QString FileResourcesModel::resolve(const QString &relative) const
|
|||||||
if (!QUrl::fromUserInput(relative, m_docPath.path()).isLocalFile())
|
if (!QUrl::fromUserInput(relative, m_docPath.path()).isLocalFile())
|
||||||
return relative;
|
return relative;
|
||||||
|
|
||||||
|
const QUrl relUrl(relative);
|
||||||
|
if (relUrl.isLocalFile()) {
|
||||||
|
QString localFile = relUrl.toLocalFile();
|
||||||
|
if (QDir::isAbsolutePath(localFile))
|
||||||
|
return localFile;
|
||||||
|
}
|
||||||
|
|
||||||
return QFileInfo(m_docPath, relative).absoluteFilePath();
|
return QFileInfo(m_docPath, relative).absoluteFilePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user