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);
|
||||
}
|
||||
|
||||
void CollectionSourceModel::removeSource(const ModelNode &node)
|
||||
void CollectionSourceModel::reset()
|
||||
{
|
||||
int nodePlace = m_sourceIndexHash.value(node.internalId(), -1);
|
||||
if (nodePlace < 0)
|
||||
return;
|
||||
beginResetModel();
|
||||
m_collectionSources.clear();
|
||||
m_sourceIndexHash.clear();
|
||||
m_collectionList.clear();
|
||||
m_previousSelectedList.clear();
|
||||
setSelectedCollectionName({});
|
||||
|
||||
removeRow(nodePlace);
|
||||
updateEmpty();
|
||||
endResetModel();
|
||||
updateSelectedSource();
|
||||
}
|
||||
|
||||
int CollectionSourceModel::sourceIndex(const ModelNode &node) const
|
||||
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
virtual QHash<int, QByteArray> roleNames() const override;
|
||||
|
||||
void setSource(const ModelNode &source);
|
||||
void removeSource(const ModelNode &node);
|
||||
void reset();
|
||||
int sourceIndex(const ModelNode &node) const;
|
||||
void addSource(const ModelNode &node);
|
||||
void selectSource(const ModelNode &node);
|
||||
|
||||
@@ -144,6 +144,7 @@ void CollectionView::modelAboutToBeDetached([[maybe_unused]] Model *model)
|
||||
m_dataStoreTypeFound = false;
|
||||
disconnect(m_documentUpdateConnection);
|
||||
QTC_ASSERT(m_delayedTasks.isEmpty(), m_delayedTasks.clear());
|
||||
m_widget->sourceModel()->reset();
|
||||
}
|
||||
|
||||
void CollectionView::nodeRemoved(const ModelNode &removedNode,
|
||||
@@ -319,8 +320,8 @@ void CollectionView::resetDataStoreNode()
|
||||
if (!dataStore || m_widget->sourceModel()->sourceIndex(dataStore) > -1)
|
||||
return;
|
||||
|
||||
bool dataStoreSingletonFound = false;
|
||||
if (m_libraryInfoIsUpdated && rewriterView() && rewriterView()->isAttached()) {
|
||||
bool dataStoreSingletonFound = m_dataStoreTypeFound;
|
||||
if (!dataStoreSingletonFound && rewriterView() && rewriterView()->isAttached()) {
|
||||
const QList<QmlTypeData> types = rewriterView()->getQMLTypes();
|
||||
for (const QmlTypeData &cppTypeData : types) {
|
||||
if (cppTypeData.isSingleton && cppTypeData.typeName == "DataStore") {
|
||||
|
||||
Reference in New Issue
Block a user