diff options
Diffstat (limited to 'share/qtcreator/qmldesigner/contentLibraryQmlSource/ContentLibraryMaterialsView.qml')
-rw-r--r-- | share/qtcreator/qmldesigner/contentLibraryQmlSource/ContentLibraryMaterialsView.qml | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/share/qtcreator/qmldesigner/contentLibraryQmlSource/ContentLibraryMaterialsView.qml b/share/qtcreator/qmldesigner/contentLibraryQmlSource/ContentLibraryMaterialsView.qml index c21baf4c580..9a0e33b8e5e 100644 --- a/share/qtcreator/qmldesigner/contentLibraryQmlSource/ContentLibraryMaterialsView.qml +++ b/share/qtcreator/qmldesigner/contentLibraryQmlSource/ContentLibraryMaterialsView.qml @@ -27,8 +27,6 @@ HelperWidgets.ScrollView { root.count = c } - property var currMaterialItem: null - property var rootItem: null property var materialsModel: ContentLibraryBackend.materialsModel required property var searchBox @@ -51,17 +49,19 @@ HelperWidgets.ScrollView { ContentLibraryMaterialContextMenu { id: ctxMenu - hasModelSelection: materialsModel.hasModelSelection - importerRunning: materialsModel.importerRunning + hasModelSelection: root.materialsModel.hasModelSelection + importerRunning: root.materialsModel.importerRunning - onUnimport: (bundleMat) => root.unimport(bundleMat) - onAddToProject: (bundleMat) => materialsModel.addToProject(bundleMat) + onApplyToSelected: (add) => root.materialsModel.applyToSelected(ctxMenu.targetMaterial, add) + + onUnimport: root.unimport(ctxMenu.targetMaterial) + onAddToProject: root.materialsModel.addToProject(ctxMenu.targetMaterial) } Repeater { id: categoryRepeater - model: materialsModel + model: root.materialsModel delegate: HelperWidgets.Section { id: section @@ -73,7 +73,7 @@ HelperWidgets.ScrollView { bottomPadding: StudioTheme.Values.sectionPadding caption: bundleCategoryName - visible: bundleCategoryVisible && !materialsModel.isEmpty + visible: bundleCategoryVisible && !root.materialsModel.isEmpty expanded: bundleCategoryExpanded expandOnClick: false category: "ContentLib_Mat" @@ -103,7 +103,10 @@ HelperWidgets.ScrollView { width: root.cellWidth height: root.cellHeight + importerRunning: root.materialsModel.importerRunning + onShowContextMenu: ctxMenu.popupMenu(modelData) + onAddToProject: root.materialsModel.addToProject(modelData) } onCountChanged: root.assignMaxCount() @@ -115,13 +118,13 @@ HelperWidgets.ScrollView { Text { id: infoText text: { - if (!materialsModel.matBundleExists) + if (!root.materialsModel.matBundleExists) qsTr("No materials available. Make sure you have internet connection.") else if (!ContentLibraryBackend.rootView.isQt6Project) qsTr("<b>Content Library</b> materials are not supported in Qt5 projects.") else if (!ContentLibraryBackend.rootView.hasQuick3DImport) qsTr("To use <b>Content Library</b>, first add the QtQuick3D module in the <b>Components</b> view.") - else if (!materialsModel.hasRequiredQuick3DImport) + else if (!root.materialsModel.hasRequiredQuick3DImport) qsTr("To use <b>Content Library</b>, version 6.3 or later of the QtQuick3D module is required.") else if (!ContentLibraryBackend.rootView.hasMaterialLibrary) qsTr("<b>Content Library</b> is disabled inside a non-visual component.") @@ -134,7 +137,7 @@ HelperWidgets.ScrollView { font.pixelSize: StudioTheme.Values.baseFontSize topPadding: 10 leftPadding: 10 - visible: materialsModel.isEmpty + visible: root.materialsModel.isEmpty } } } |