forked from qt-creator/qt-creator
QmlDesigner: Fix 'add to selected' gone from conent lib materials
Fixes: QDS-13125 Change-Id: I58737e8138579ed15166cefdfad05b11269a80da Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
This commit is contained in:
@@ -25,7 +25,9 @@ StudioControls.Menu {
|
|||||||
{
|
{
|
||||||
root.targetItem = item
|
root.targetItem = item
|
||||||
|
|
||||||
let isMaterial = item && root.targetItem.bundleId === "UserMaterials"
|
let isMaterial = item && (root.targetItem.bundleId === "UserMaterials"
|
||||||
|
|| root.targetItem.bundleId === "MaterialBundle"
|
||||||
|
|| root.targetItem.bundleId === "Materials")
|
||||||
applyToSelectedReplace.visible = isMaterial
|
applyToSelectedReplace.visible = isMaterial
|
||||||
applyToSelectedAdd.visible = isMaterial
|
applyToSelectedAdd.visible = isMaterial
|
||||||
|
|
||||||
|
@@ -10,8 +10,10 @@ ContentLibraryMaterial::ContentLibraryMaterial(QObject *parent,
|
|||||||
const QString &qml,
|
const QString &qml,
|
||||||
const TypeName &type,
|
const TypeName &type,
|
||||||
const QUrl &icon,
|
const QUrl &icon,
|
||||||
const QStringList &files)
|
const QStringList &files,
|
||||||
|
const QString &bundleId)
|
||||||
: QObject(parent), m_name(name), m_qml(qml), m_type(type), m_icon(icon), m_files(files)
|
: QObject(parent), m_name(name), m_qml(qml), m_type(type), m_icon(icon), m_files(files)
|
||||||
|
, m_bundleId(bundleId)
|
||||||
{
|
{
|
||||||
m_allFiles = m_files;
|
m_allFiles = m_files;
|
||||||
m_allFiles.push_back(m_qml);
|
m_allFiles.push_back(m_qml);
|
||||||
@@ -78,4 +80,9 @@ QStringList ContentLibraryMaterial::allFiles() const
|
|||||||
return m_allFiles;
|
return m_allFiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString ContentLibraryMaterial::bundleId() const
|
||||||
|
{
|
||||||
|
return m_bundleId;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace QmlDesigner
|
} // namespace QmlDesigner
|
||||||
|
@@ -19,7 +19,7 @@ class ContentLibraryMaterial : public QObject
|
|||||||
Q_PROPERTY(bool bundleMaterialVisible MEMBER m_visible NOTIFY materialVisibleChanged)
|
Q_PROPERTY(bool bundleMaterialVisible MEMBER m_visible NOTIFY materialVisibleChanged)
|
||||||
Q_PROPERTY(bool bundleItemImported READ imported WRITE setImported NOTIFY materialImportedChanged)
|
Q_PROPERTY(bool bundleItemImported READ imported WRITE setImported NOTIFY materialImportedChanged)
|
||||||
Q_PROPERTY(QStringList bundleMaterialFiles READ allFiles CONSTANT)
|
Q_PROPERTY(QStringList bundleMaterialFiles READ allFiles CONSTANT)
|
||||||
Q_PROPERTY(QString itemType MEMBER m_itemType CONSTANT)
|
Q_PROPERTY(QString bundleId READ bundleId CONSTANT)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ContentLibraryMaterial(QObject *parent,
|
ContentLibraryMaterial(QObject *parent,
|
||||||
@@ -27,7 +27,8 @@ public:
|
|||||||
const QString &qml,
|
const QString &qml,
|
||||||
const TypeName &type,
|
const TypeName &type,
|
||||||
const QUrl &icon,
|
const QUrl &icon,
|
||||||
const QStringList &files);
|
const QStringList &files,
|
||||||
|
const QString &bundleId);
|
||||||
|
|
||||||
bool filter(const QString &searchText);
|
bool filter(const QString &searchText);
|
||||||
|
|
||||||
@@ -42,6 +43,8 @@ public:
|
|||||||
bool imported() const;
|
bool imported() const;
|
||||||
QStringList allFiles() const;
|
QStringList allFiles() const;
|
||||||
|
|
||||||
|
QString bundleId() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void materialVisibleChanged();
|
void materialVisibleChanged();
|
||||||
void materialImportedChanged();
|
void materialImportedChanged();
|
||||||
@@ -57,7 +60,7 @@ private:
|
|||||||
bool m_imported = false;
|
bool m_imported = false;
|
||||||
|
|
||||||
QStringList m_allFiles;
|
QStringList m_allFiles;
|
||||||
const QString m_itemType = "material";
|
const QString m_bundleId;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace QmlDesigner
|
} // namespace QmlDesigner
|
||||||
|
@@ -266,7 +266,8 @@ void ContentLibraryMaterialsModel::loadMaterialBundle()
|
|||||||
QString qml = matObj.value("qml").toString();
|
QString qml = matObj.value("qml").toString();
|
||||||
TypeName type = QLatin1String("%1.%2").arg(bundleType, qml.chopped(4)).toLatin1(); // chopped(4): remove .qml
|
TypeName type = QLatin1String("%1.%2").arg(bundleType, qml.chopped(4)).toLatin1(); // chopped(4): remove .qml
|
||||||
|
|
||||||
auto bundleMat = new ContentLibraryMaterial(category, matName, qml, type, icon, files);
|
auto bundleMat = new ContentLibraryMaterial(category, matName, qml, type, icon, files,
|
||||||
|
m_bundleId);
|
||||||
|
|
||||||
category->addBundleMaterial(bundleMat);
|
category->addBundleMaterial(bundleMat);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user