QmlDesigner: Guarantee textures are always visible in User Assets

Also shows all three sections permanently, with separate warning messages inside of them if needed.

Fixes: QDS-12825
Change-Id: Id13546d134a6b77326ed091ab7df0ed880d9f197
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
Shrief Gabr
2024-12-27 00:13:22 +02:00
parent e185f9d49a
commit ce2604b11b

View File

@@ -104,7 +104,6 @@ Item {
bottomPadding: StudioTheme.Values.sectionPadding bottomPadding: StudioTheme.Values.sectionPadding
caption: categoryTitle caption: categoryTitle
visible: !categoryEmpty && infoText.text === ""
category: "ContentLib_User" category: "ContentLib_User"
function expandSection() { function expandSection() {
@@ -132,6 +131,7 @@ Item {
ContentLibraryItem { ContentLibraryItem {
width: root.cellWidth width: root.cellWidth
height: root.cellHeight height: root.cellHeight
visible: !infoText.visible
onShowContextMenu: ctxMenuItem.popupMenu(modelData) onShowContextMenu: ctxMenuItem.popupMenu(modelData)
onAddToProject: ContentLibraryBackend.userModel.addToProject(modelData) onAddToProject: ContentLibraryBackend.userModel.addToProject(modelData)
@@ -151,6 +151,7 @@ Item {
delegate: ContentLibraryItem { delegate: ContentLibraryItem {
width: root.cellWidth width: root.cellWidth
height: root.cellHeight height: root.cellHeight
visible: !infoText.visible
onShowContextMenu: ctxMenuItem.popupMenu(modelData) onShowContextMenu: ctxMenuItem.popupMenu(modelData)
onAddToProject: ContentLibraryBackend.userModel.addToProject(modelData) onAddToProject: ContentLibraryBackend.userModel.addToProject(modelData)
@@ -169,20 +170,22 @@ Item {
leftPadding: 10 leftPadding: 10
visible: infoText.text === "" && !searchBox.isEmpty() && categoryNoMatch visible: infoText.text === "" && !searchBox.isEmpty() && categoryNoMatch
} }
}
}
Text { Text {
id: infoText id: infoText
text: { text: {
let categoryName = (categoryTitle === "3D") ? categoryTitle + " assets"
: categoryTitle.toLowerCase()
if (!ContentLibraryBackend.rootView.isQt6Project) if (!ContentLibraryBackend.rootView.isQt6Project)
qsTr("<b>Content Library</b> is not supported in Qt5 projects.") qsTr("<b>Content Library</b> is not supported in Qt5 projects.")
else if (!ContentLibraryBackend.rootView.hasQuick3DImport) else if (!ContentLibraryBackend.rootView.hasQuick3DImport && categoryTitle !== "Textures")
qsTr("To use <b>Content Library</b>, first add the QtQuick3D module in the <b>Components</b> view.") qsTr("To use " + categoryName + ", first add the QtQuick3D module in the <b>Components</b> view.")
else if (!ContentLibraryBackend.rootView.hasMaterialLibrary) else if (!ContentLibraryBackend.rootView.hasMaterialLibrary)
qsTr("<b>Content Library</b> is disabled inside a non-visual component.") qsTr("<b>Content Library</b> is disabled inside a non-visual component.")
else if (ContentLibraryBackend.userModel.isEmpty) else if (categoryEmpty)
qsTr("There are no user assets in the <b>Content Library</b>.") qsTr("There are no "+ categoryName + " in the <b>User Assets</b>.")
else else
"" ""
} }
@@ -195,3 +198,5 @@ Item {
} }
} }
} }
}
}