Commit 61c1c59f authored by Kai Koehne's avatar Kai Koehne

QmlDesigner: Store imports in a list, not a set

The order of imports does matter, therefore it should also be
represented as a list in the model.

Reviewed-by: Marco Bubke
parent cdbb7c6a
......@@ -96,7 +96,7 @@ public:
// Editing sub-components:
// Imports:
QSet<Import> imports() const;
QList<Import> imports() const;
void addImport(const Import &import);
void removeImport(const Import &import);
......
......@@ -122,13 +122,13 @@ void ModelPrivate::addImport(const Import &import)
if (m_imports.contains(import))
return;
m_imports.insert(import);
m_imports.append(import);
notifyImportAdded(import);
}
void ModelPrivate::removeImport(const Import &import)
{
if (!m_imports.remove(import))
if (!m_imports.removeOne(import))
return;
notifyImportRemoved(import);
......@@ -1004,7 +1004,7 @@ Model *Model::create(QString type, int major, int minor)
// return subModel;
//}
QSet<Import> Model::imports() const
QList<Import> Model::imports() const
{
return m_d->imports();
}
......
......@@ -154,7 +154,7 @@ public:
// Imports:
QSet<Import> imports() const { return m_imports; }
QList<Import> imports() const { return m_imports; }
void addImport(const Import &import);
void removeImport(const Import &import);
void notifyImportAdded(const Import &import) const;
......@@ -197,7 +197,7 @@ private:
Model *m_q;
MetaInfo m_metaInfo;
QSet<Import> m_imports;
QList<Import> m_imports;
QList<QWeakPointer<AbstractView> > m_viewList;
QList<InternalNodePointer> m_selectedNodeList;
QHash<QString,InternalNodePointer> m_idNodeHash;
......
......@@ -491,7 +491,7 @@ bool TextToModelMerger::isActive() const
void TextToModelMerger::setupImports(const Document::Ptr &doc,
DifferenceHandler &differenceHandler)
{
QSet<Import> existingImports = m_rewriterView->model()->imports();
QList<Import> existingImports = m_rewriterView->model()->imports();
for (UiImportList *iter = doc->qmlProgram()->imports; iter; iter = iter->next) {
UiImport *import = iter->import;
......@@ -510,13 +510,13 @@ void TextToModelMerger::setupImports(const Document::Ptr &doc,
const Import newImport = Import::createFileImport(strippedFileName,
version, as);
if (!existingImports.remove(newImport))
if (!existingImports.removeOne(newImport))
differenceHandler.modelMissesImport(newImport);
} else {
const Import newImport =
Import::createLibraryImport(flatten(import->importUri), as, version);
if (!existingImports.remove(newImport))
if (!existingImports.removeOne(newImport))
differenceHandler.modelMissesImport(newImport);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment