QmlDesigner: Cleanup the templates for DataStore

- Fix the bug which disables the live preview
- The singleton of the DataStore is defined once
- Also modifies the template file formats of the DataStore files

Fixes: QDS-11430
Change-Id: I67e0f64355dccdc32c031bb4dc0fb8edf3fdf64a
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
This commit is contained in:
Ali Kianian
2023-11-29 13:34:35 +02:00
parent fa376883f0
commit 37cca63593
15 changed files with 36 additions and 72 deletions

View File

@@ -384,19 +384,19 @@
"target": "%{ProjectDirectory}/imports/%{ImportModuleName}/designer/plugin.metainfo" "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/designer/plugin.metainfo"
}, },
{ {
"source": "../shared-plugin/name/JsonData.qml", "source": "../shared-plugin/name/JsonData.qml.tpl",
"target": "%{ProjectDirectory}/imports/%{ImportModuleName}/JsonData.qml" "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/JsonData.qml"
}, },
{ {
"source": "../shared-plugin/name/DataStore.qml", "source": "../shared-plugin/name/DataStore.qml.tpl",
"target": "%{ProjectDirectory}/imports/%{ImportModuleName}/DataStore.qml" "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/DataStore.qml"
}, },
{ {
"source": "../shared-plugin/name/models.json", "source": "../shared-plugin/name/models.json.tpl",
"target": "%{ProjectDirectory}/imports/%{ImportModuleName}/models.json" "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/models.json"
}, },
{ {
"source": "../shared-plugin/name/data.json", "source": "../shared-plugin/name/data.json.tpl",
"target": "%{ProjectDirectory}/imports/%{ImportModuleName}/data.json" "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/data.json"
} }
] ]

View File

@@ -397,19 +397,19 @@
"target": "%{ProjectDirectory}/imports/%{ImportModuleName}/designer/plugin.metainfo" "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/designer/plugin.metainfo"
}, },
{ {
"source": "../shared-plugin/name/JsonData.qml", "source": "../shared-plugin/name/JsonData.qml.tpl",
"target": "%{ProjectDirectory}/imports/%{ImportModuleName}/JsonData.qml" "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/JsonData.qml"
}, },
{ {
"source": "../shared-plugin/name/DataStore.qml", "source": "../shared-plugin/name/DataStore.qml.tpl",
"target": "%{ProjectDirectory}/imports/%{ImportModuleName}/DataStore.qml" "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/DataStore.qml"
}, },
{ {
"source": "../shared-plugin/name/models.json", "source": "../shared-plugin/name/models.json.tpl",
"target": "%{ProjectDirectory}/imports/%{ImportModuleName}/models.json" "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/models.json"
}, },
{ {
"source": "../shared-plugin/name/data.json", "source": "../shared-plugin/name/data.json.tpl",
"target": "%{ProjectDirectory}/imports/%{ImportModuleName}/data.json" "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/data.json"
} }
] ]

View File

@@ -384,19 +384,19 @@
"target": "%{ProjectDirectory}/imports/%{ImportModuleName}/designer/plugin.metainfo" "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/designer/plugin.metainfo"
}, },
{ {
"source": "../shared-plugin/name/JsonData.qml", "source": "../shared-plugin/name/JsonData.qml.tpl",
"target": "%{ProjectDirectory}/imports/%{ImportModuleName}/JsonData.qml" "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/JsonData.qml"
}, },
{ {
"source": "../shared-plugin/name/DataStore.qml", "source": "../shared-plugin/name/DataStore.qml.tpl",
"target": "%{ProjectDirectory}/imports/%{ImportModuleName}/DataStore.qml" "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/DataStore.qml"
}, },
{ {
"source": "../shared-plugin/name/models.json", "source": "../shared-plugin/name/models.json.tpl",
"target": "%{ProjectDirectory}/imports/%{ImportModuleName}/models.json" "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/models.json"
}, },
{ {
"source": "../shared-plugin/name/data.json", "source": "../shared-plugin/name/data.json.tpl",
"target": "%{ProjectDirectory}/imports/%{ImportModuleName}/data.json" "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/data.json"
} }
] ]

View File

@@ -343,19 +343,19 @@
"target": "%{ProjectDirectory}/imports/%{ImportModuleName}/designer/plugin.metainfo" "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/designer/plugin.metainfo"
}, },
{ {
"source": "../shared-plugin/name/JsonData.qml", "source": "../shared-plugin/name/JsonData.qml.tpl",
"target": "%{ProjectDirectory}/imports/%{ImportModuleName}/JsonData.qml" "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/JsonData.qml"
}, },
{ {
"source": "../shared-plugin/name/DataStore.qml", "source": "../shared-plugin/name/DataStore.qml.tpl",
"target": "%{ProjectDirectory}/imports/%{ImportModuleName}/DataStore.qml" "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/DataStore.qml"
}, },
{ {
"source": "../shared-plugin/name/models.json", "source": "../shared-plugin/name/models.json.tpl",
"target": "%{ProjectDirectory}/imports/%{ImportModuleName}/models.json" "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/models.json"
}, },
{ {
"source": "../shared-plugin/name/data.json", "source": "../shared-plugin/name/data.json.tpl",
"target": "%{ProjectDirectory}/imports/%{ImportModuleName}/data.json" "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/data.json"
} }
] ]

View File

@@ -345,19 +345,19 @@
"target": "%{ProjectDirectory}/imports/%{ImportModuleName}/designer/plugin.metainfo" "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/designer/plugin.metainfo"
}, },
{ {
"source": "../shared-plugin/name/JsonData.qml", "source": "../shared-plugin/name/JsonData.qml.tpl",
"target": "%{ProjectDirectory}/imports/%{ImportModuleName}/JsonData.qml" "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/JsonData.qml"
}, },
{ {
"source": "../shared-plugin/name/DataStore.qml", "source": "../shared-plugin/name/DataStore.qml.tpl",
"target": "%{ProjectDirectory}/imports/%{ImportModuleName}/DataStore.qml" "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/DataStore.qml"
}, },
{ {
"source": "../shared-plugin/name/models.json", "source": "../shared-plugin/name/models.json.tpl",
"target": "%{ProjectDirectory}/imports/%{ImportModuleName}/models.json" "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/models.json"
}, },
{ {
"source": "../shared-plugin/name/data.json", "source": "../shared-plugin/name/data.json.tpl",
"target": "%{ProjectDirectory}/imports/%{ImportModuleName}/data.json" "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/data.json"
} }
] ]

View File

@@ -345,19 +345,19 @@
"target": "%{ProjectDirectory}/imports/%{ImportModuleName}/designer/plugin.metainfo" "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/designer/plugin.metainfo"
}, },
{ {
"source": "../shared-plugin/name/JsonData.qml", "source": "../shared-plugin/name/JsonData.qml.tpl",
"target": "%{ProjectDirectory}/imports/%{ImportModuleName}/JsonData.qml" "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/JsonData.qml"
}, },
{ {
"source": "../shared-plugin/name/DataStore.qml", "source": "../shared-plugin/name/DataStore.qml.tpl",
"target": "%{ProjectDirectory}/imports/%{ImportModuleName}/DataStore.qml" "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/DataStore.qml"
}, },
{ {
"source": "../shared-plugin/name/models.json", "source": "../shared-plugin/name/models.json.tpl",
"target": "%{ProjectDirectory}/imports/%{ImportModuleName}/models.json" "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/models.json"
}, },
{ {
"source": "../shared-plugin/name/data.json", "source": "../shared-plugin/name/data.json.tpl",
"target": "%{ProjectDirectory}/imports/%{ImportModuleName}/data.json" "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/data.json"
} }
] ]

View File

@@ -1,15 +0,0 @@
pragma Singleton
import QtQuick 6.5
import QtQuick.Studio.Utils 1.0
JsonListModel {
id: models
source: Qt.resolvedUrl("models.json")
property ChildListModel exampleModel: ChildListModel {
modelName: "exampleModel"
}
property JsonData backend: JsonData {}
}

View File

@@ -2,11 +2,16 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
pragma Singleton pragma Singleton
import QtQuick.Studio.Utils import QtQuick 6.5
import QtQuick.Studio.Utils 1.0
JsonListModel { JsonListModel {
property alias allModels: models
id: models id: models
source: Qt.resolvedUrl("models.json")
source: Qt.resolvedUrl("DataStore.json") property ChildListModel book: ChildListModel {
modelName: "book"
}
property JsonData backend: JsonData {}
} }

View File

@@ -4,4 +4,3 @@ singleton Constants 1.0 Constants.qml
EventListSimulator 1.0 EventListSimulator.qml EventListSimulator 1.0 EventListSimulator.qml
EventListModel 1.0 EventListModel.qml EventListModel 1.0 EventListModel.qml
DirectoryFontLoader 1.0 DirectoryFontLoader.qml DirectoryFontLoader 1.0 DirectoryFontLoader.qml
singleton DataStore 1.0 DataStore.qml

View File

@@ -1,24 +0,0 @@
{
"exampleModel": [
{
"name": "Christen Anderson",
"number": "+3455641"
},
{
"name": "Armanda Cox",
"number": "+21155641"
},
{
"name": "Ken Garza",
"number": "+3288642"
},
{
"name": "Rodney Hamilton",
"number": "+3558848"
},
{
"name": "Andrew Battles",
"number": "+42488649"
}
]
}

View File

@@ -3,4 +3,3 @@ singleton DataStore 1.0 DataStore.qml
EventListModel 1.0 EventListModel.qml EventListModel 1.0 EventListModel.qml
EventListSimulator 1.0 EventListSimulator.qml EventListSimulator 1.0 EventListSimulator.qml
DirectoryFontLoader 1.0 DirectoryFontLoader.qml DirectoryFontLoader 1.0 DirectoryFontLoader.qml
singleton DataStore 1.0 DataStore.qml

View File

@@ -263,19 +263,19 @@
"condition": "%{QdsProjectStyle}" "condition": "%{QdsProjectStyle}"
}, },
{ {
"source": "../shared-plugin/name/JsonData.qml", "source": "../shared-plugin/name/JsonData.qml.tpl",
"target": "%{ProjectDirectory}/imports/%{ImportModuleName}/JsonData.qml" "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/JsonData.qml"
}, },
{ {
"source": "../shared-plugin/name/DataStore.qml", "source": "../shared-plugin/name/DataStore.qml.tpl",
"target": "%{ProjectDirectory}/imports/%{ImportModuleName}/DataStore.qml" "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/DataStore.qml"
}, },
{ {
"source": "../shared-plugin/name/models.json", "source": "../shared-plugin/name/models.json.tpl",
"target": "%{ProjectDirectory}/imports/%{ImportModuleName}/models.json" "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/models.json"
}, },
{ {
"source": "../shared-plugin/name/data.json", "source": "../shared-plugin/name/data.json.tpl",
"target": "%{ProjectDirectory}/imports/%{ImportModuleName}/data.json" "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/data.json"
} }
] ]