summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Bubke <marco.bubke@digia.com>2013-08-14 14:36:21 +0200
committerMarco Bubke <marco.bubke@digia.com>2013-08-14 15:15:35 +0200
commitc9938fef824bbe30a62004b8318f77301f080dec (patch)
tree23b24db29714f2805571737ab9eb391d8e075eb6
parent737838c3bfc469f951e9fa3a7b9cd539388b1512 (diff)
downloadqt-creator-c9938fef824bbe30a62004b8318f77301f080dec.tar.gz
QmlDesigner: Add isSameModule to Import
Change-Id: I5d06ad83adcd48b311d9c270ffcc5d1cf85e3afa Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
-rw-r--r--src/plugins/qmldesigner/designercore/include/import.h1
-rw-r--r--src/plugins/qmldesigner/designercore/model/import.cpp8
2 files changed, 9 insertions, 0 deletions
diff --git a/src/plugins/qmldesigner/designercore/include/import.h b/src/plugins/qmldesigner/designercore/include/import.h
index 1e2d8ba9c7..b49846f2a5 100644
--- a/src/plugins/qmldesigner/designercore/include/import.h
+++ b/src/plugins/qmldesigner/designercore/include/import.h
@@ -62,6 +62,7 @@ public:
QString toImportString() const;
bool operator==(const Import &other) const;
+ bool isSameModule(const Import &other) const;
private:
Import(const QString &url, const QString &file, const QString &version, const QString &alias, const QStringList &importPaths);
diff --git a/src/plugins/qmldesigner/designercore/model/import.cpp b/src/plugins/qmldesigner/designercore/model/import.cpp
index 250d007098..b2a46ea264 100644
--- a/src/plugins/qmldesigner/designercore/model/import.cpp
+++ b/src/plugins/qmldesigner/designercore/model/import.cpp
@@ -95,6 +95,14 @@ bool Import::operator==(const Import &other) const
return url() == other.url() && file() == other.file() && version() == other.version() && alias() == other.alias();
}
+bool Import::isSameModule(const Import &other) const
+{
+ if (isLibraryImport())
+ return url() == other.url();
+ else
+ return file() == other.file();
+}
+
uint qHash(const Import &import)
{
return ::qHash(import.url()) ^ ::qHash(import.file()) ^ ::qHash(import.version()) ^ ::qHash(import.alias());