forked from qt-creator/qt-creator
QmlDesigner: Fix the bug for reading the dataStore of the projects
Fixes: QDS-12047 Change-Id: I6144b78985ed761b5446f71731fd0c220658c259 Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
@@ -214,13 +214,18 @@ void CollectionSourceModel::setSource(const ModelNode &source)
|
|||||||
updateSelectedSource(true);
|
updateSelectedSource(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CollectionSourceModel::removeSource(const ModelNode &node)
|
void CollectionSourceModel::reset()
|
||||||
{
|
{
|
||||||
int nodePlace = m_sourceIndexHash.value(node.internalId(), -1);
|
beginResetModel();
|
||||||
if (nodePlace < 0)
|
m_collectionSources.clear();
|
||||||
return;
|
m_sourceIndexHash.clear();
|
||||||
|
m_collectionList.clear();
|
||||||
|
m_previousSelectedList.clear();
|
||||||
|
setSelectedCollectionName({});
|
||||||
|
|
||||||
removeRow(nodePlace);
|
updateEmpty();
|
||||||
|
endResetModel();
|
||||||
|
updateSelectedSource();
|
||||||
}
|
}
|
||||||
|
|
||||||
int CollectionSourceModel::sourceIndex(const ModelNode &node) const
|
int CollectionSourceModel::sourceIndex(const ModelNode &node) const
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public:
|
|||||||
virtual QHash<int, QByteArray> roleNames() const override;
|
virtual QHash<int, QByteArray> roleNames() const override;
|
||||||
|
|
||||||
void setSource(const ModelNode &source);
|
void setSource(const ModelNode &source);
|
||||||
void removeSource(const ModelNode &node);
|
void reset();
|
||||||
int sourceIndex(const ModelNode &node) const;
|
int sourceIndex(const ModelNode &node) const;
|
||||||
void addSource(const ModelNode &node);
|
void addSource(const ModelNode &node);
|
||||||
void selectSource(const ModelNode &node);
|
void selectSource(const ModelNode &node);
|
||||||
|
|||||||
@@ -144,6 +144,7 @@ void CollectionView::modelAboutToBeDetached([[maybe_unused]] Model *model)
|
|||||||
m_dataStoreTypeFound = false;
|
m_dataStoreTypeFound = false;
|
||||||
disconnect(m_documentUpdateConnection);
|
disconnect(m_documentUpdateConnection);
|
||||||
QTC_ASSERT(m_delayedTasks.isEmpty(), m_delayedTasks.clear());
|
QTC_ASSERT(m_delayedTasks.isEmpty(), m_delayedTasks.clear());
|
||||||
|
m_widget->sourceModel()->reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CollectionView::nodeRemoved(const ModelNode &removedNode,
|
void CollectionView::nodeRemoved(const ModelNode &removedNode,
|
||||||
@@ -319,8 +320,8 @@ void CollectionView::resetDataStoreNode()
|
|||||||
if (!dataStore || m_widget->sourceModel()->sourceIndex(dataStore) > -1)
|
if (!dataStore || m_widget->sourceModel()->sourceIndex(dataStore) > -1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool dataStoreSingletonFound = false;
|
bool dataStoreSingletonFound = m_dataStoreTypeFound;
|
||||||
if (m_libraryInfoIsUpdated && rewriterView() && rewriterView()->isAttached()) {
|
if (!dataStoreSingletonFound && rewriterView() && rewriterView()->isAttached()) {
|
||||||
const QList<QmlTypeData> types = rewriterView()->getQMLTypes();
|
const QList<QmlTypeData> types = rewriterView()->getQMLTypes();
|
||||||
for (const QmlTypeData &cppTypeData : types) {
|
for (const QmlTypeData &cppTypeData : types) {
|
||||||
if (cppTypeData.isSingleton && cppTypeData.typeName == "DataStore") {
|
if (cppTypeData.isSingleton && cppTypeData.typeName == "DataStore") {
|
||||||
|
|||||||
Reference in New Issue
Block a user