From 156867a380245a22f78bf28374be184e71b954f0 Mon Sep 17 00:00:00 2001 From: xavier Date: Wed, 18 Jan 2012 19:53:27 +0000 Subject: [PATCH] Minor improvements in the TitleBlockTemplateLocation class. git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/branches/0.3@1469 bfdf4180-ca20-0410-9c96-a3a8aa849046 --- sources/titleblock/templatelocation.cpp | 12 ++++++++++++ sources/titleblock/templatelocation.h | 5 +++++ 2 files changed, 17 insertions(+) diff --git a/sources/titleblock/templatelocation.cpp b/sources/titleblock/templatelocation.cpp index 0ba42e192..cfd4657db 100644 --- a/sources/titleblock/templatelocation.cpp +++ b/sources/titleblock/templatelocation.cpp @@ -19,6 +19,9 @@ #include "templatescollection.h" #include "qetapp.h" +// make this class usable with QVariant +int t = qRegisterMetaType("TitleBlockTemplateLocation"); + /** Constructor @param collection Parent collection of the title block template @@ -124,6 +127,15 @@ QString TitleBlockTemplateLocation::protocol() const { return("unknown"); } +/** + This is a convenience method equivalent to + parentCollection() -> getTemplateXmlDescription +*/ +QDomElement TitleBlockTemplateLocation::getTemplateXmlDescription() const { + if (!collection_ || name_.isEmpty()) return(QDomElement()); + return(collection_ -> getTemplateXmlDescription(name_)); +} + /** This is a convenience method equivalent to parentCollection() -> getTemplate(...). diff --git a/sources/titleblock/templatelocation.h b/sources/titleblock/templatelocation.h index d878b7bbd..58bd43227 100644 --- a/sources/titleblock/templatelocation.h +++ b/sources/titleblock/templatelocation.h @@ -18,6 +18,7 @@ #ifndef TITLEBLOCK_SLASH_TEMPLATE_LOCATION_H #define TITLEBLOCK_SLASH_TEMPLATE_LOCATION_H #include +#include class QETProject; class TitleBlockTemplate; class TitleBlockTemplatesCollection; @@ -46,11 +47,15 @@ class TitleBlockTemplateLocation { QString toString() const; QETProject *parentProject() const; QString protocol() const; + QDomElement getTemplateXmlDescription() const; TitleBlockTemplate *getTemplate() const; // attributes private: TitleBlockTemplatesCollection *collection_; ///< Collection the template belongs to QString name_; ///< Name of the template + + public: + static int MetaTypeId; ///< Id of the corresponding Qt meta type }; #endif