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,28 +170,32 @@ Item {
leftPadding: 10 leftPadding: 10
visible: infoText.text === "" && !searchBox.isEmpty() && categoryNoMatch visible: infoText.text === "" && !searchBox.isEmpty() && categoryNoMatch
} }
}
}
Text { Text {
id: infoText id: infoText
text: {
if (!ContentLibraryBackend.rootView.isQt6Project) text: {
qsTr("<b>Content Library</b> is not supported in Qt5 projects.") let categoryName = (categoryTitle === "3D") ? categoryTitle + " assets"
else if (!ContentLibraryBackend.rootView.hasQuick3DImport) : categoryTitle.toLowerCase()
qsTr("To use <b>Content Library</b>, first add the QtQuick3D module in the <b>Components</b> view.")
else if (!ContentLibraryBackend.rootView.hasMaterialLibrary) if (!ContentLibraryBackend.rootView.isQt6Project)
qsTr("<b>Content Library</b> is disabled inside a non-visual component.") qsTr("<b>Content Library</b> is not supported in Qt5 projects.")
else if (ContentLibraryBackend.userModel.isEmpty) else if (!ContentLibraryBackend.rootView.hasQuick3DImport && categoryTitle !== "Textures")
qsTr("There are no user assets in the <b>Content Library</b>.") qsTr("To use " + categoryName + ", first add the QtQuick3D module in the <b>Components</b> view.")
else else if (!ContentLibraryBackend.rootView.hasMaterialLibrary)
"" qsTr("<b>Content Library</b> is disabled inside a non-visual component.")
else if (categoryEmpty)
qsTr("There are no "+ categoryName + " in the <b>User Assets</b>.")
else
""
}
color: StudioTheme.Values.themeTextColor
font.pixelSize: StudioTheme.Values.baseFontSize
topPadding: 10
leftPadding: 10
visible: infoText.text !== ""
}
} }
color: StudioTheme.Values.themeTextColor
font.pixelSize: StudioTheme.Values.baseFontSize
topPadding: 10
leftPadding: 10
visible: infoText.text !== ""
} }
} }
} }