diff --git a/sources/elementslocation.cpp b/sources/elementslocation.cpp index b5ca41432..45353bf64 100644 --- a/sources/elementslocation.cpp +++ b/sources/elementslocation.cpp @@ -18,6 +18,9 @@ #include "elementslocation.h" #include "qetapp.h" +// make this class usable with QVariant +int ElementsLocation::MetaTypeId = qRegisterMetaType("ElementsLocation"); + /** Constructeur par defaut */ @@ -205,3 +208,11 @@ ElementsLocation ElementsLocation::locationFromString(const QString &string) { location.fromString(string); return(location); } + +/** + @param location A standard element location + @return a hash identifying this location +*/ +uint qHash(const ElementsLocation &location) { + return(qHash(location.toString())); +} diff --git a/sources/elementslocation.h b/sources/elementslocation.h index 99117b87b..4c0508fe9 100644 --- a/sources/elementslocation.h +++ b/sources/elementslocation.h @@ -17,6 +17,7 @@ */ #ifndef ELEMENTS_LOCATION_H #define ELEMENTS_LOCATION_H +#include #include class QETProject; /** @@ -52,5 +53,10 @@ class ElementsLocation { private: QString path_; QETProject *project_; + + public: + static int MetaTypeId; ///< Id of the corresponding Qt meta type }; +Q_DECLARE_METATYPE(ElementsLocation) +uint qHash(const ElementsLocation &); #endif diff --git a/sources/titleblock/templatelocation.cpp b/sources/titleblock/templatelocation.cpp index 04fc41034..348019313 100644 --- a/sources/titleblock/templatelocation.cpp +++ b/sources/titleblock/templatelocation.cpp @@ -20,7 +20,7 @@ #include "qetapp.h" // make this class usable with QVariant -int t = qRegisterMetaType("TitleBlockTemplateLocation"); +int TitleBlockTemplateLocation::MetaTypeId = qRegisterMetaType("TitleBlockTemplateLocation"); /** Constructor @@ -162,3 +162,10 @@ bool TitleBlockTemplateLocation::operator==(const TitleBlockTemplateLocation &lo return(location.collection_ == collection_ && location.name_ == name_); } +/** + @param location A standard title block template location + @return a hash identifying this location +*/ +uint qHash(const TitleBlockTemplateLocation &location) { + return(qHash(location.toString())); +} diff --git a/sources/titleblock/templatelocation.h b/sources/titleblock/templatelocation.h index 952678395..3bb4b2194 100644 --- a/sources/titleblock/templatelocation.h +++ b/sources/titleblock/templatelocation.h @@ -60,4 +60,6 @@ class TitleBlockTemplateLocation { public: static int MetaTypeId; ///< Id of the corresponding Qt meta type }; +Q_DECLARE_METATYPE(TitleBlockTemplateLocation) +uint qHash(const TitleBlockTemplateLocation &); #endif