forked from qt-creator/qt-creator
QmlDesigner: Add helper function to Import
Change-Id: I51401d17ad61326a610ed92c87c6e41f7a137fdf Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -60,6 +60,9 @@ public:
|
|||||||
bool operator==(const Import &other) const;
|
bool operator==(const Import &other) const;
|
||||||
bool isSameModule(const Import &other) const;
|
bool isSameModule(const Import &other) const;
|
||||||
|
|
||||||
|
int majorVersion() const;
|
||||||
|
static int majorFromVersion(const QString &version);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Import(const QString &url, const QString &file, const QString &version, const QString &alias, const QStringList &importPaths);
|
Import(const QString &url, const QString &file, const QString &version, const QString &alias, const QStringList &importPaths);
|
||||||
|
|
||||||
|
@@ -97,6 +97,18 @@ bool Import::isSameModule(const Import &other) const
|
|||||||
return file() == other.file();
|
return file() == other.file();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Import::majorVersion() const
|
||||||
|
{
|
||||||
|
return majorFromVersion(m_version);
|
||||||
|
}
|
||||||
|
|
||||||
|
int Import::majorFromVersion(const QString &version)
|
||||||
|
{
|
||||||
|
if (version.isEmpty())
|
||||||
|
return -1;
|
||||||
|
return version.split('.').first().toInt();
|
||||||
|
}
|
||||||
|
|
||||||
uint qHash(const Import &import)
|
uint qHash(const Import &import)
|
||||||
{
|
{
|
||||||
return ::qHash(import.url()) ^ ::qHash(import.file()) ^ ::qHash(import.version()) ^ ::qHash(import.alias());
|
return ::qHash(import.url()) ^ ::qHash(import.file()) ^ ::qHash(import.version()) ^ ::qHash(import.alias());
|
||||||
|
Reference in New Issue
Block a user