summaryrefslogtreecommitdiff
path: root/share/qtcreator/qmldesigner/itemLibraryQmlSources
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@qt.io>2023-01-12 17:53:10 +0200
committerMiikka Heikkinen <miikka.heikkinen@qt.io>2023-01-13 11:24:58 +0000
commitf2b6b669a3ae18a54612e20b72e993c54d48f2e7 (patch)
tree29680f76bd47183fed8aeb7c350b46c0c5ad51cf /share/qtcreator/qmldesigner/itemLibraryQmlSources
parent4aea4ea693b2964d60a10c81df13f91274008875 (diff)
downloadqt-creator-f2b6b669a3ae18a54612e20b72e993c54d48f2e7.tar.gz
QmlDesigner: Disable add texture/light probe if no valid material lib
Both material library node exists and QtQuick3D imported must be true for these menu items to be enabled. Since this information is only needed in context menu, update the flag only when context menu is shown. Fixes: QDS-8524 Change-Id: I66221bf953b3b542cf7827b46e8c307a9b33acba Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Diffstat (limited to 'share/qtcreator/qmldesigner/itemLibraryQmlSources')
-rw-r--r--share/qtcreator/qmldesigner/itemLibraryQmlSources/AssetsContextMenu.qml8
1 files changed, 8 insertions, 0 deletions
diff --git a/share/qtcreator/qmldesigner/itemLibraryQmlSources/AssetsContextMenu.qml b/share/qtcreator/qmldesigner/itemLibraryQmlSources/AssetsContextMenu.qml
index 3337be90ef..4e537bb624 100644
--- a/share/qtcreator/qmldesigner/itemLibraryQmlSources/AssetsContextMenu.qml
+++ b/share/qtcreator/qmldesigner/itemLibraryQmlSources/AssetsContextMenu.qml
@@ -25,6 +25,8 @@ StudioControls.Menu {
function openContextMenuForRoot(rootModelIndex, dirPath, dirName, onFolderCreated)
{
+ rootView.updateHasMaterialLibrary()
+
root.__onFolderCreated = onFolderCreated
root.__fileIndex = ""
root.__dirPath = dirPath
@@ -37,6 +39,8 @@ StudioControls.Menu {
function openContextMenuForDir(dirModelIndex, dirPath, dirName, allExpandedState,
onFolderCreated, onFolderRenamed)
{
+ rootView.updateHasMaterialLibrary()
+
root.__onFolderCreated = onFolderCreated
root.__onFolderRenamed = onFolderRenamed
root.__dirPath = dirPath
@@ -58,6 +62,8 @@ StudioControls.Menu {
addTexturesItem.text = qsTr("Add Texture")
}
+ rootView.updateHasMaterialLibrary()
+
root.__onFolderCreated = onFolderCreated
root.__selectedAssetPathsList = selectedAssetPathsList
root.__fileIndex = fileIndex
@@ -91,6 +97,7 @@ StudioControls.Menu {
StudioControls.MenuItem {
id: addTexturesItem
text: qsTr("Add Texture")
+ enabled: rootView.hasMaterialLibrary
visible: root.__fileIndex && assetsModel.allFilePathsAreImages(root.__selectedAssetPathsList)
height: addTexturesItem.visible ? addTexturesItem.implicitHeight : 0
onTriggered: rootView.addTextures(root.__selectedAssetPathsList)
@@ -99,6 +106,7 @@ StudioControls.Menu {
StudioControls.MenuItem {
id: addLightProbes
text: qsTr("Add Light Probe")
+ enabled: rootView.hasMaterialLibrary
visible: root.__fileIndex && root.__selectedAssetPathsList.length === 1
&& assetsModel.allFilePathsAreImages(root.__selectedAssetPathsList)
height: addLightProbes.visible ? addLightProbes.implicitHeight : 0