From 1bf8ace20526fbc630fbf4d8faee49b41cd889f0 Mon Sep 17 00:00:00 2001 From: blacksun Date: Mon, 27 Nov 2017 19:43:02 +0000 Subject: [PATCH] Forget file from previous commit git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5118 bfdf4180-ca20-0410-9c96-a3a8aa849046 --- .../dynamicelementtextitem.cpp | 21 +++++++++++++++++++ .../qetgraphicsitem/dynamicelementtextitem.h | 3 +++ 2 files changed, 24 insertions(+) diff --git a/sources/qetgraphicsitem/dynamicelementtextitem.cpp b/sources/qetgraphicsitem/dynamicelementtextitem.cpp index 37223d10a..cd72831b2 100644 --- a/sources/qetgraphicsitem/dynamicelementtextitem.cpp +++ b/sources/qetgraphicsitem/dynamicelementtextitem.cpp @@ -23,6 +23,7 @@ #include "QPropertyUndoCommand/qpropertyundocommand.h" #include "terminal.h" #include "conductor.h" +#include "elementtextitemgroup.h" #include #include @@ -222,11 +223,26 @@ void DynamicElementTextItem::fromXml(const QDomElement &dom_elmt) /** * @brief DynamicElementTextItem::ParentElement * @return a pointer to the parent element. Note the pointer can be null. + * Note that the text can return a parent element, + * even if the text belong to a group of this same element. */ Element *DynamicElementTextItem::parentElement() const { return m_parent_element; } +/** + * @brief DynamicElementTextItem::parentGroup + * @return The group where this text belong, if this item + * is note in a group, return nullptr. + */ +ElementTextItemGroup *DynamicElementTextItem::parentGroup() const +{ + if(group()) + return dynamic_cast(group()); + else + return nullptr; +} + /** * @brief DynamicElementTextItem::elementUseForInfo * @return a pointer to the element we must use for the variable information. @@ -493,6 +509,11 @@ bool DynamicElementTextItem::frame() const return m_frame; } +QUuid DynamicElementTextItem::uuid() const +{ + return m_uuid; +} + /** * @brief DynamicElementTextItem::mousePressEvent * @param event diff --git a/sources/qetgraphicsitem/dynamicelementtextitem.h b/sources/qetgraphicsitem/dynamicelementtextitem.h index 8a46a3a24..8319ddfb7 100644 --- a/sources/qetgraphicsitem/dynamicelementtextitem.h +++ b/sources/qetgraphicsitem/dynamicelementtextitem.h @@ -24,6 +24,7 @@ class Element; class Conductor; +class ElementTextItemGroup; /** * @brief The DynamicElementTextItem class @@ -77,6 +78,7 @@ class DynamicElementTextItem : public DiagramTextItem void fromXml(const QDomElement &dom_elmt) override; Element *parentElement() const; + ElementTextItemGroup *parentGroup() const; Element *elementUseForInfo() const; void refreshLabelConnection(); @@ -93,6 +95,7 @@ class DynamicElementTextItem : public DiagramTextItem QString compositeText() const; void setFrame(const bool frame); bool frame() const; + QUuid uuid() const; protected: void mousePressEvent(QGraphicsSceneMouseEvent *event) override;