[qet] [1487] The *Location classes can now be used with QVariant, QHash and signals/slots. |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/qet Archives
]
Revision: 1487
Author: xavier
Date: 2012-02-05 20:24:42 +0100 (Sun, 05 Feb 2012)
Log Message:
-----------
The *Location classes can now be used with QVariant, QHash and signals/slots.
Modified Paths:
--------------
branches/0.3/sources/elementslocation.cpp
branches/0.3/sources/elementslocation.h
branches/0.3/sources/titleblock/templatelocation.cpp
branches/0.3/sources/titleblock/templatelocation.h
Modified: branches/0.3/sources/elementslocation.cpp
===================================================================
--- branches/0.3/sources/elementslocation.cpp 2012-02-05 18:56:02 UTC (rev 1486)
+++ branches/0.3/sources/elementslocation.cpp 2012-02-05 19:24:42 UTC (rev 1487)
@@ -18,6 +18,9 @@
#include "elementslocation.h"
#include "qetapp.h"
+// make this class usable with QVariant
+int ElementsLocation::MetaTypeId = qRegisterMetaType<ElementsLocation>("ElementsLocation");
+
/**
Constructeur par defaut
*/
@@ -205,3 +208,11 @@
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()));
+}
Modified: branches/0.3/sources/elementslocation.h
===================================================================
--- branches/0.3/sources/elementslocation.h 2012-02-05 18:56:02 UTC (rev 1486)
+++ branches/0.3/sources/elementslocation.h 2012-02-05 19:24:42 UTC (rev 1487)
@@ -17,6 +17,7 @@
*/
#ifndef ELEMENTS_LOCATION_H
#define ELEMENTS_LOCATION_H
+#include <QtCore>
#include <QString>
class QETProject;
/**
@@ -52,5 +53,10 @@
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
Modified: branches/0.3/sources/titleblock/templatelocation.cpp
===================================================================
--- branches/0.3/sources/titleblock/templatelocation.cpp 2012-02-05 18:56:02 UTC (rev 1486)
+++ branches/0.3/sources/titleblock/templatelocation.cpp 2012-02-05 19:24:42 UTC (rev 1487)
@@ -20,7 +20,7 @@
#include "qetapp.h"
// make this class usable with QVariant
-int t = qRegisterMetaType<TitleBlockTemplateLocation>("TitleBlockTemplateLocation");
+int TitleBlockTemplateLocation::MetaTypeId = qRegisterMetaType<TitleBlockTemplateLocation>("TitleBlockTemplateLocation");
/**
Constructor
@@ -162,3 +162,10 @@
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()));
+}
Modified: branches/0.3/sources/titleblock/templatelocation.h
===================================================================
--- branches/0.3/sources/titleblock/templatelocation.h 2012-02-05 18:56:02 UTC (rev 1486)
+++ branches/0.3/sources/titleblock/templatelocation.h 2012-02-05 19:24:42 UTC (rev 1487)
@@ -60,4 +60,6 @@
public:
static int MetaTypeId; ///< Id of the corresponding Qt meta type
};
+Q_DECLARE_METATYPE(TitleBlockTemplateLocation)
+uint qHash(const TitleBlockTemplateLocation &);
#endif