From f006cfb233f03c85f32530ec287d3608764d2666 Mon Sep 17 00:00:00 2001 From: Ali Kianian Date: Thu, 11 Apr 2024 12:59:18 +0300 Subject: QmlDesigner: Warn the user if the project is not imported When the project is not importd in the design document, DataStore cannot be found by the project manager. User should add it to make the Model Editor work. So we will warn the user in the Model Editor view. Task-number: QDS-12119 Change-Id: I313e5553e8b0a0ef3b97c50d61db80c0a8d382f8 Reviewed-by: Qt CI Patch Build Bot Reviewed-by: Thomas Hartmann --- .../CollectionDetailsView.qml | 30 +++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'share/qtcreator') diff --git a/share/qtcreator/qmldesigner/collectionEditorQmlSource/CollectionDetailsView.qml b/share/qtcreator/qmldesigner/collectionEditorQmlSource/CollectionDetailsView.qml index e3f1a58959..e40a3c9457 100644 --- a/share/qtcreator/qmldesigner/collectionEditorQmlSource/CollectionDetailsView.qml +++ b/share/qtcreator/qmldesigner/collectionEditorQmlSource/CollectionDetailsView.qml @@ -498,10 +498,38 @@ Rectangle { } } + ColumnLayout { + id: importsProblem + + visible: !topRow.visible && rootView.dataStoreExists && !rootView.projectImportExists + width: parent.width + anchors.verticalCenter: parent.verticalCenter + clip: true + + Text { + text: qsTr("Import the project to your design document to make the Model Editor enabled.") + Layout.alignment: Qt.AlignCenter + Layout.maximumWidth: parent.width + leftPadding: StudioTheme.Values.collectionItemTextPadding + rightPadding: StudioTheme.Values.collectionItemTextPadding + color: StudioTheme.Values.themeTextColor + font.pixelSize: StudioTheme.Values.mediumFontSize + wrapMode: Text.Wrap + } + + HelperWidgets.Button { + text: qsTr("Enable DataStore (This will add the required import)") + Layout.alignment: Qt.AlignCenter + onClicked: rootView.addProjectImport() + leftPadding: StudioTheme.Values.collectionItemTextPadding + rightPadding: StudioTheme.Values.collectionItemTextPadding + } + } + Text { anchors.centerIn: parent text: qsTr("There are no models in this project.\nAdd or import a model.") - visible: !topRow.visible + visible: !topRow.visible && !importsProblem.visible color: StudioTheme.Values.themeTextColor font.pixelSize: StudioTheme.Values.mediumFontSize } -- cgit v1.2.3