diff --git a/sources/ElementsCollection/elementslocation.cpp b/sources/ElementsCollection/elementslocation.cpp index c28f6d63c..5ec2ff02b 100644 --- a/sources/ElementsCollection/elementslocation.cpp +++ b/sources/ElementsCollection/elementslocation.cpp @@ -29,16 +29,18 @@ int ElementsLocation::MetaTypeId = qRegisterMetaType("ElementsLocation"); /** - * @brief ElementsLocation::ElementsLocation - * Constructor - */ + @brief ElementsLocation::ElementsLocation + Constructor +*/ ElementsLocation::ElementsLocation() {} /** - Constructeur - @param p Chemin de l'emplacement de l'element - @param pr Projet de l'emplacement de l'element + @brief ElementsLocation::ElementsLocation + @param path : + Chemin de l'emplacement de l'element + @param project : + Projet de l'emplacement de l'element */ ElementsLocation::ElementsLocation(const QString &path, QETProject *project) : m_project(project) @@ -63,15 +65,17 @@ ElementsLocation::ElementsLocation(const ElementsLocation &other) : {} /** - * @brief ElementsLocation::ElementLocation - * Constructor, build an ElementLocation from a QMimeData, the mime data format - * must be "application/x-qet-element-uri" or "application/x-qet-category-uri". - * This location can be null even if format is valid. - * @param data - */ + @brief ElementsLocation::ElementLocation + Constructor, build an ElementLocation from a QMimeData, + the mime data format must be "application/x-qet-element-uri" + or "application/x-qet-category-uri". + This location can be null even if format is valid. + @param data +*/ ElementsLocation::ElementsLocation(const QMimeData *data) { - if (data->hasFormat("application/x-qet-element-uri") || data->hasFormat("application/x-qet-category-uri")) + if (data->hasFormat("application/x-qet-element-uri") + || data->hasFormat("application/x-qet-category-uri")) setPath(data->text()); } @@ -87,9 +91,11 @@ ElementsLocation &ElementsLocation::operator=(const ElementsLocation &other) { } /** + @brief ElementsLocation::operator == Operateur de comparaison @param other Autre emplacement d'element a comparer - @return true si other et cet ElementsLocation sont identiques, false sinon + @return true si other et cet ElementsLocation sont identiques, + false sinon */ bool ElementsLocation::operator==(const ElementsLocation &other) const { return( @@ -99,9 +105,11 @@ bool ElementsLocation::operator==(const ElementsLocation &other) const { } /** + @brief ElementsLocation::operator != Operateur de comparaison @param other Autre emplacement d'element a comparer - @return true si other et cet ElementsLocation sont differents, false sinon + @return true si other et cet ElementsLocation sont differents, + false sinon */ bool ElementsLocation::operator!=(const ElementsLocation &other) const { return( @@ -111,11 +119,12 @@ bool ElementsLocation::operator!=(const ElementsLocation &other) const { } /** - * @brief ElementsLocation::baseName - * @return The base name of the element or directory. - * Unlike ElementsLocation::fileName , this method don't return the extension name. - * For exemple if this location represent an element they return myElement. - * @see fileName() + @brief ElementsLocation::baseName + @return The base name of the element or directory. + Unlike ElementsLocation::fileName, + this method don't return the extension name. + For exemple if this location represent an element they return myElement. + @see fileName() */ QString ElementsLocation::baseName() const { QRegExp regexp("^.*([^/]+)\\.elmt$"); @@ -126,13 +135,15 @@ QString ElementsLocation::baseName() const { } /** - * @brief ElementsLocation::collectionPath - * Return the path of the represented element relative to collection - * if @protocol is true the path is prepended by the collection type (common://, custom:// or embed://) - * else if false, only the collection path is returned without the collection type. - * @param protocol - * @return the path - */ + @brief ElementsLocation::collectionPath + Return the path of the represented element relative to collection + if protocol is true the path is prepended by + the collection type (common://, custom:// or embed://) + else if false, + only the collection path is returned without the collection type. + @param protocol + @return the path +*/ QString ElementsLocation::collectionPath(bool protocol) const { if (protocol) @@ -145,23 +156,27 @@ QString ElementsLocation::collectionPath(bool protocol) const } /** - * @brief ElementsLocation::projectCollectionPath - * @return The path is in form : project0+embed://dir/subdir/myElement.elmt - * If this item represent a file system thing, return a null QString; - */ + @brief ElementsLocation::projectCollectionPath + @return The path is in form : project0+embed://dir/subdir/myElement.elmt + If this item represent a file system thing, return a null QString; +*/ QString ElementsLocation::projectCollectionPath() const { if (isFileSystem()) return QString(); else - return QString("project" + QString::number(QETApp::projectId(m_project)) + "+" + collectionPath()); + return QString("project" + + QString::number(QETApp::projectId(m_project)) + + "+" + + collectionPath()); } /** - * @brief ElementsLocation::fileSystemPath - * @return The file system path of this element, (the separator is always '/' see QDir::toNativeSeparators()) - * If this element is embedded in a project return an empty string; - */ + @brief ElementsLocation::fileSystemPath + @return The file system path of this element, + (the separator is always '/' see QDir::toNativeSeparators()) + If this element is embedded in a project return an empty string; +*/ QString ElementsLocation::fileSystemPath() const { if (!m_project) @@ -171,20 +186,21 @@ QString ElementsLocation::fileSystemPath() const } /** - * @brief ElementsLocation::path - * @return The path of this location. - * OBSOLETE, use instead collectionPath(true) - */ + @brief ElementsLocation::path + @return The path of this location. + @deprecated use instead collectionPath(true) +*/ QString ElementsLocation::path() const { return(m_collection_path); } /** - * @brief ElementsLocation::setPath - * Set the path of this item. - * The path can be relative to a collection (start by common:// , custom:// or embed://) or not. - * @param path - */ + @brief ElementsLocation::setPath + Set the path of this item. + The path can be relative to a collection + (start by common:// , custom:// or embed://) or not. + @param path +*/ void ElementsLocation::setPath(const QString &path) { QString tmp_path = path; @@ -204,7 +220,7 @@ void ElementsLocation::setPath(const QString &path) } - //The path start with project, we get the project and the path from the string + //The path start with project, we get the project and the path from the string else if (tmp_path.startsWith("project")) { QRegExp rx("^project([0-9]+)\\+(embed:\\/\\/.*)$", Qt::CaseInsensitive); @@ -224,7 +240,8 @@ void ElementsLocation::setPath(const QString &path) } } - //The path is in file system, the given path is relative to common or custom collection + // The path is in file system, + // the given path is relative to common or custom collection else if (path.startsWith("common://") || path.startsWith("custom://")) { QString p; @@ -242,7 +259,7 @@ void ElementsLocation::setPath(const QString &path) m_file_system_path = p; m_collection_path = path; } - //In this case, the path is supposed to be relative to the file system. + //In this case, the path is supposed to be relative to the file system. else { QString path_ = path; @@ -282,11 +299,11 @@ void ElementsLocation::setPath(const QString &path) } /** - * @brief ElementsLocation::addToPath - * Add a string to the actual path of this location - * @param string - * @return True if the operation success - */ + @brief ElementsLocation::addToPath + Add a string to the actual path of this location + @param string + @return True if the operation success +*/ bool ElementsLocation::addToPath(const QString &string) { if (m_collection_path.endsWith(".elmt", Qt::CaseInsensitive)) @@ -308,6 +325,7 @@ bool ElementsLocation::addToPath(const QString &string) } /** + @brief ElementsLocation::parent @return the location of the parent category, or a copy of this location when it represents a root category. */ @@ -324,6 +342,7 @@ ElementsLocation ElementsLocation::parent() const { } /** + @brief ElementsLocation::project @return le projet de cet emplacement ou 0 si celui-ci n'est pas lie a un projet. */ @@ -332,7 +351,9 @@ QETProject *ElementsLocation::project() const { } /** - @param project le nouveau projet pointe par cet emplacement + @brief ElementsLocation::setProject + @param project : + le nouveau projet pointe par cet emplacement Indiquer 0 pour que cet emplacement ne soit plus lie a un projet. */ void ElementsLocation::setProject(QETProject *project) { @@ -340,6 +361,7 @@ void ElementsLocation::setProject(QETProject *project) { } /** + @brief ElementsLocation::isNull @return true si l'emplacement semble utilisable (chemin virtuel non vide). */ bool ElementsLocation::isNull() const { @@ -347,6 +369,7 @@ bool ElementsLocation::isNull() const { } /** + @brief ElementsLocation::toString @return Une chaine de caracteres representant l'emplacement */ QString ElementsLocation::toString() const { @@ -362,25 +385,25 @@ QString ElementsLocation::toString() const { } /** - * @brief ElementsLocation::isElement - * @return true if this location represent an element - */ + @brief ElementsLocation::isElement + @return true if this location represent an element +*/ bool ElementsLocation::isElement() const { return m_collection_path.endsWith(".elmt"); } /** - * @brief ElementsLocation::isDirectory - * @return true if this location represent a directory - */ + @brief ElementsLocation::isDirectory + @return true if this location represent a directory +*/ bool ElementsLocation::isDirectory() const { return (!isElement() && !m_collection_path.isEmpty()); } /** - * @brief ElementsLocation::isFileSystem - * @return - */ + @brief ElementsLocation::isFileSystem + @return true if +*/ bool ElementsLocation::isFileSystem() const { if (m_project) return false; @@ -389,27 +412,29 @@ bool ElementsLocation::isFileSystem() const } /** - * @brief ElementsLocation::isCommonCollection - * @return True if this location represent an item from the common collection - */ + @brief ElementsLocation::isCommonCollection + @return + True if this location represent an item from the common collection +*/ bool ElementsLocation::isCommonCollection() const { return fileSystemPath().startsWith(QETApp::commonElementsDirN()); } /** - * @brief ElementsLocation::isCustomCollection - * @return True if this location represent an item from the custom collection - */ + @brief ElementsLocation::isCustomCollection + @return + True if this location represent an item from the custom collection +*/ bool ElementsLocation::isCustomCollection() const { return fileSystemPath().startsWith(QETApp::customElementsDirN()); } /** - * @brief ElementsLocation::isProject - * @return True if this location represent an item from a project. - */ + @brief ElementsLocation::isProject + @return True if this location represent an item from a project. +*/ bool ElementsLocation::isProject() const { if (m_project && !m_collection_path.isEmpty()) @@ -419,9 +444,10 @@ bool ElementsLocation::isProject() const } /** - * @brief ElementsLocation::exist - * @return True if this location represent an existing directory or element. - */ + @brief ElementsLocation::exist + @return + True if this location represent an existing directory or element. +*/ bool ElementsLocation::exist() const { if (m_project) @@ -445,9 +471,9 @@ bool ElementsLocation::exist() const } /** - * @brief ElementsLocation::isWritable - * @return True if this element can be writable (can use set xml) - */ + @brief ElementsLocation::isWritable + @return True if this element can be writable (can use set xml) +*/ bool ElementsLocation::isWritable() const { if (m_project) @@ -463,10 +489,11 @@ bool ElementsLocation::isWritable() const } /** - * @brief ElementsLocation::projectCollection - * @return If this location represente a item in an embedded project collection, return this collection - * else return nullptr. - */ + @brief ElementsLocation::projectCollection + @return + If this location represente a item in an embedded project collection, + return this collection else return nullptr. +*/ XmlElementCollection *ElementsLocation::projectCollection() const { if (m_project) @@ -476,10 +503,10 @@ XmlElementCollection *ElementsLocation::projectCollection() const } /** - * @brief ElementsLocation::nameList - * @return the namelist of the represented element or directory. - * If namelist can't be set, return a empty namelist - */ + @brief ElementsLocation::nameList + @return the namelist of the represented element or directory. + If namelist can't be set, return a empty namelist +*/ NamesList ElementsLocation::nameList() { NamesList nl; @@ -514,10 +541,10 @@ NamesList ElementsLocation::nameList() } /** - * @brief ElementsLocation::xml - * @return The definition of this element or directory. - * The definition can be null. - */ + @brief ElementsLocation::xml + @return The definition of this element or directory. + The definition can be null. +*/ QDomElement ElementsLocation::xml() const { if (!m_project) @@ -546,15 +573,19 @@ QDomElement ElementsLocation::xml() const } /** - * @brief ElementsLocation::pugiXml - * @return the xml document of this element or directory - * The definition can be null - */ + @brief ElementsLocation::pugiXml + @return the xml document of this element or directory + The definition can be null +*/ pugi::xml_document ElementsLocation::pugiXml() const { - //Except for linux OS (because linux keep in cache the file), we keep in memory the xml - //to avoid multiple access to file. - //keep in memory the XML, consumes a little more RAM, for this reason we don't use it for linux to minimize the RAM footprint. + /* Except for linux OS (because linux keep in cache the file), + * we keep in memory the xml + * to avoid multiple access to file. + * keep in memory the XML, + * consumes a little more RAM, + * for this reason we don't use it for linux to minimize the RAM footprint. + */ #ifndef Q_OS_LINUX if (!m_string_stream.str().empty()) { @@ -579,7 +610,7 @@ pugi::xml_document ElementsLocation::pugiXml() const QString str = m_collection_path; if (isElement()) { - //Get the xml dom from Qt xml and copie to pugi xml + //Get the xml dom from Qt xml and copie to pugi xml QDomElement element = m_project->embeddedElementCollection()->element(str.remove("embed://")); QDomDocument qdoc; qdoc.appendChild(qdoc.importNode(element.firstChildElement("definition"), true)); @@ -604,13 +635,14 @@ pugi::xml_document ElementsLocation::pugiXml() const } /** - * @brief ElementsLocation::setXml - * Replace the current xml description by @xml_element; - * The document element of @xml_document must have tagname "definition" to be written - * This definition must be writable - * @param xml_element - * @return true if success - */ + @brief ElementsLocation::setXml + Replace the current xml description by xml_document; + The document element of xml_document must have + tagname "definition" to be written + This definition must be writable + @param xml_document + @return true if success +*/ bool ElementsLocation::setXml(const QDomDocument &xml_document) const { if (!isWritable()) @@ -666,10 +698,10 @@ bool ElementsLocation::setXml(const QDomDocument &xml_document) const } /** - * @brief ElementsLocation::uuid - * @return The uuid of the pointed element - * Uuid can be null - */ + @brief ElementsLocation::uuid + @return The uuid of the pointed element + Uuid can be null +*/ QUuid ElementsLocation::uuid() const { if (!isElement()) { @@ -685,16 +717,17 @@ QUuid ElementsLocation::uuid() const } /** - * @brief ElementLocation::icon - * @return The icon of the represented element. - * If icon can't be set, return a null QIcon - */ + @brief ElementLocation::icon + @return The icon of the represented element. + If icon can't be set, return a null QIcon +*/ QIcon ElementsLocation::icon() const { if (!m_project) { ElementsCollectionCache *cache = QETApp::collectionCache(); - ElementsLocation loc(*this); //Make a copy of this to keep this method const + // Make a copy of this to keep this method const + ElementsLocation loc(*this); if (cache->fetchElement(loc)) return QIcon(cache->pixmap()); } @@ -706,9 +739,9 @@ QIcon ElementsLocation::icon() const } /** - * @brief ElementLocation::name - * @return The name of the represented element in the current local - */ + @brief ElementLocation::name + @return The name of the represented element in the current local +*/ QString ElementsLocation::name() const { NamesList nl; @@ -717,13 +750,15 @@ QString ElementsLocation::name() const } /** - * @brief ElementLocation::fileName - * @return Return the file name of the represented item, whatever the storage system (file system, xml collection) - * with is file extension. - * For example if this location represent an element, they return myElement.elmt. - * For a directory return myDirectory. - * @see baseName - */ + @brief ElementLocation::fileName + @return Return the file name of the represented item, + whatever the storage system (file system, xml collection) + with is file extension. + For example if this location represent an element, + they return myElement.elmt. + For a directory return myDirectory. + @see baseName +*/ QString ElementsLocation::fileName() const { if (m_collection_path.isEmpty()) return QString(); @@ -734,10 +769,11 @@ QString ElementsLocation::fileName() const } /** - * @brief ElementsLocation::elementInformations - * @return the element information of the element represented by this location. - * If the location is a directory, the returned diagram context is empty - */ + @brief ElementsLocation::elementInformations + @return + the element information of the element represented by this location. + If the location is a directory, the returned diagram context is empty +*/ DiagramContext ElementsLocation::elementInformations() const { DiagramContext context; @@ -745,10 +781,18 @@ DiagramContext ElementsLocation::elementInformations() const return context; } - context.fromXml(pugiXml().document_element().child("elementInformations"), "elementInformation"); + context.fromXml(pugiXml().document_element().child( + "elementInformations"), + "elementInformation"); return context; } +/** + @brief operator << + @param debug + @param location + @return +*/ QDebug operator<< (QDebug debug, const ElementsLocation &location) { QDebugStateSaver saver(debug); @@ -762,7 +806,8 @@ QDebug operator<< (QDebug debug, const ElementsLocation &location) QString msg; msg += "ElementsLocation("; - msg += (location.isProject()? location.projectCollectionPath() : location.collectionPath(true)); + msg += (location.isProject()? location.projectCollectionPath() + : location.collectionPath(true)); msg += location.exist()? ", true" : ", false"; msg +=")"; diff --git a/sources/ElementsCollection/elementslocation.h b/sources/ElementsCollection/elementslocation.h index ab7a1128f..fee60fa43 100644 --- a/sources/ElementsCollection/elementslocation.h +++ b/sources/ElementsCollection/elementslocation.h @@ -32,6 +32,7 @@ class QETProject; class XmlElementCollection; /** + @brief The ElementsLocation class Cette classe represente la localisation, l'emplacement d'un element ou d'une categorie, voire d'une collection... dans une collection. Elle encapsule un chemin virtuel. @@ -40,7 +41,8 @@ class ElementsLocation { public: ElementsLocation(); - ElementsLocation(const QString &path, QETProject *project = nullptr); + ElementsLocation(const QString &path, + QETProject *project = nullptr); ElementsLocation(const ElementsLocation &); ElementsLocation(const QMimeData *data); virtual ~ElementsLocation(); diff --git a/sources/qetgraphicsitem/crossrefitem.cpp b/sources/qetgraphicsitem/crossrefitem.cpp index 56452cc94..68661d521 100644 --- a/sources/qetgraphicsitem/crossrefitem.cpp +++ b/sources/qetgraphicsitem/crossrefitem.cpp @@ -31,19 +31,19 @@ static int header = 5; static int cross_min_heigth = 33; /** - * @brief CrossRefItem::CrossRefItem - * @param elmt : element to display the cross ref - */ + @brief CrossRefItem::CrossRefItem + @param elmt : element to display the cross ref +*/ CrossRefItem::CrossRefItem(Element *elmt) : QGraphicsObject(elmt), m_element(elmt) {init();} /** - * @brief CrossRefItem::CrossRefItem - * @param elmt : element to display the cross ref - * @param text : If the Xref must be displayed under a text, the text. - */ + @brief CrossRefItem::CrossRefItem + @param elmt : element to display the cross ref + @param text : If the Xref must be displayed under a text, the text. +*/ CrossRefItem::CrossRefItem(Element *elmt, DynamicElementTextItem *text) : QGraphicsObject(text), m_element (elmt), @@ -51,10 +51,10 @@ CrossRefItem::CrossRefItem(Element *elmt, DynamicElementTextItem *text) : {init();} /** - * @brief CrossRefItem::CrossRefItem - * @param elmt : element to display the cross ref - * @param group : If the Xref must be displayed under a group, the group. - */ + @brief CrossRefItem::CrossRefItem + @param elmt : element to display the cross ref + @param group : If the Xref must be displayed under a group, the group. +*/ CrossRefItem::CrossRefItem(Element *elmt, ElementTextItemGroup *group) : QGraphicsObject(group), m_element(elmt), @@ -62,15 +62,15 @@ CrossRefItem::CrossRefItem(Element *elmt, ElementTextItemGroup *group) : {init();} /** - * @brief CrossRefItem::~CrossRefItem - * Default destructor - */ + @brief CrossRefItem::~CrossRefItem + Default destructor +*/ CrossRefItem::~CrossRefItem() {} /** - * @brief CrossRefItem::init - * init this Xref - */ + @brief CrossRefItem::init + init this Xref +*/ void CrossRefItem::init() { if(!m_element->diagram()) @@ -91,9 +91,9 @@ void CrossRefItem::init() } /** - * @brief CrossRefItem::setUpConnection - * Set up several connection to keep up to date the Xref - */ + @brief CrossRefItem::setUpConnection + Set up several connection to keep up to date the Xref +*/ void CrossRefItem::setUpConnection() { for(const QMetaObject::Connection& c : m_update_connection) @@ -123,47 +123,58 @@ void CrossRefItem::setUpConnection() } /** - * @brief CrossRefItem::boundingRect - * @return the bounding rect of this item - */ + @brief CrossRefItem::boundingRect + @return the bounding rect of this item +*/ QRectF CrossRefItem::boundingRect() const { return m_bounding_rect; } /** - * @brief CrossRefItem::shape - * @return the shape of this item - */ + @brief CrossRefItem::shape + @return the shape of this item +*/ QPainterPath CrossRefItem::shape() const{ return m_shape_path; } /** - * @brief CrossRefItem::elementPositionText - * @param elmt - * @return the string corresponding to the position of @elmt in the diagram. - * if @add_prefix is true, prefix (for power and delay contact) is added to the poistion text. - */ -QString CrossRefItem::elementPositionText(const Element *elmt, const bool &add_prefix) const + @brief CrossRefItem::elementPositionText + @param elmt + @param add_prefix + @return the string corresponding to the position of elmt in the diagram. + if add_prefix is true, + prefix (for power and delay contact) is added to the poistion text. +*/ +QString CrossRefItem::elementPositionText(const Element *elmt, + const bool &add_prefix) const { - XRefProperties xrp = m_element->diagram()->project()->defaultXRefProperties(m_element->kindInformations()["type"].toString()); + XRefProperties xrp = + m_element->diagram()->project()->defaultXRefProperties( + m_element->kindInformations()["type"].toString()); QString formula = xrp.masterLabel(); autonum::sequentialNumbers seq; - QString txt = autonum::AssignVariables::formulaToLabel(formula, seq, elmt->diagram(), elmt); + QString txt = autonum::AssignVariables::formulaToLabel( + formula, + seq, elmt->diagram(), + elmt); if (add_prefix) { - if (elmt->kindInformations()["type"].toString() == "power") txt.prepend(m_properties.prefix("power")); - else if (elmt->kindInformations()["type"].toString().contains("delay")) txt.prepend(m_properties.prefix("delay")); - else if (elmt->kindInformations()["state"].toString() == "SW") txt.prepend(m_properties.prefix("switch")); + if (elmt->kindInformations()["type"].toString() == "power") + txt.prepend(m_properties.prefix("power")); + else if (elmt->kindInformations()["type"].toString().contains("delay")) + txt.prepend(m_properties.prefix("delay")); + else if (elmt->kindInformations()["state"].toString() == "SW") + txt.prepend(m_properties.prefix("switch")); } return txt; } /** - * @brief CrossRefItem::updateProperties - * update the curent properties - */ + @brief CrossRefItem::updateProperties + update the curent properties +*/ void CrossRefItem::updateProperties() { XRefProperties xrp = m_element->diagram()->project()->defaultXRefProperties(m_element->kindInformations()["type"].toString()); @@ -183,9 +194,9 @@ void CrossRefItem::updateProperties() } /** - * @brief CrossRefItem::updateLabel - * Update the content of the item - */ + @brief CrossRefItem::updateLabel + Update the content of the item +*/ void CrossRefItem::updateLabel() { //init the shape and bounding rect @@ -218,22 +229,31 @@ void CrossRefItem::updateLabel() } /** - * @brief CrossRefItem::autoPos - * Calculate and set position automaticaly. - */ + @brief CrossRefItem::autoPos + Calculate and set position automaticaly. +*/ void CrossRefItem::autoPos() { - //We calcul the position according to the @snapTo of the xrefproperties + //We calcul the position according to the @snapTo of the xrefproperties if (m_properties.snapTo() == XRefProperties::Bottom) - centerToBottomDiagram(this, m_element, m_properties.offset() <= 40 ? 5 : m_properties.offset()); + centerToBottomDiagram(this, + m_element, + m_properties.offset() <= 40 + ? 5 + : m_properties.offset()); else centerToParentBottom(this); } +/** + @brief CrossRefItem::sceneEvent + @param event + @return +*/ bool CrossRefItem::sceneEvent(QEvent *event) { - //By default when a QGraphicsItem is a child of a QGraphicsItemGroup - //all events are forwarded to group. - //We override it, when this Xref is in a group + //By default when a QGraphicsItem is a child of a QGraphicsItemGroup + //all events are forwarded to group. + //We override it, when this Xref is in a group if(m_group) { switch (event->type()) @@ -259,22 +279,24 @@ bool CrossRefItem::sceneEvent(QEvent *event) } /** - * @brief CrossRefItem::paint - * Paint this item - * @param painter - * @param option - * @param widget - */ -void CrossRefItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { + @brief CrossRefItem::paint + Paint this item + @param painter + @param option + @param widget +*/ +void CrossRefItem::paint(QPainter *painter, + const QStyleOptionGraphicsItem *option, + QWidget *widget) { Q_UNUSED(option) Q_UNUSED(widget) m_drawing.play(painter); } /** - * @brief CrossRefItem::mouseDoubleClickEvent - * @param event - */ + @brief CrossRefItem::mouseDoubleClickEvent + @param event +*/ void CrossRefItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) { event->accept(); @@ -288,7 +310,8 @@ void CrossRefItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) m_hovered_contact->setSelected(true); //Zoom to the linked slave element - foreach(QGraphicsView *view, m_hovered_contact->diagram()->views()) + foreach(QGraphicsView *view, + m_hovered_contact->diagram()->views()) { QRectF fit = m_hovered_contact->sceneBoundingRect(); fit.adjust(-200, -200, 200, 200); @@ -297,12 +320,20 @@ void CrossRefItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) } } +/** + @brief CrossRefItem::hoverEnterEvent + @param event +*/ void CrossRefItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event) { m_hovered_contact = nullptr; QGraphicsObject::hoverEnterEvent(event); } +/** + @brief CrossRefItem::hoverMoveEvent + @param event +*/ void CrossRefItem::hoverMoveEvent(QGraphicsSceneHoverEvent *event) { QPointF pos = event->pos(); @@ -311,7 +342,7 @@ void CrossRefItem::hoverMoveEvent(QGraphicsSceneHoverEvent *event) { foreach(QRectF rect, m_hovered_contacts_map.values(m_hovered_contact)) { - //Mouse hover the same rect than previous hover event + //Mouse hover the same rect than previous hover event if (rect.contains(pos)) { QGraphicsObject::hoverMoveEvent(event); @@ -319,7 +350,7 @@ void CrossRefItem::hoverMoveEvent(QGraphicsSceneHoverEvent *event) } } - //At this point, mouse don't hover previous rect + //At this point, mouse don't hover previous rect m_hovered_contact = nullptr; foreach (Element *elmt, m_hovered_contacts_map.keys()) @@ -344,7 +375,7 @@ void CrossRefItem::hoverMoveEvent(QGraphicsSceneHoverEvent *event) { foreach(QRectF rect, m_hovered_contacts_map.values(elmt)) { - //Mouse hover a contact + //Mouse hover a contact if (rect.contains(pos)) { m_hovered_contact = elmt; @@ -357,6 +388,10 @@ void CrossRefItem::hoverMoveEvent(QGraphicsSceneHoverEvent *event) } } +/** + @brief CrossRefItem::hoverLeaveEvent + @param event +*/ void CrossRefItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) { m_hovered_contact = nullptr; @@ -364,6 +399,9 @@ void CrossRefItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) QGraphicsObject::hoverLeaveEvent(event); } +/** + @brief CrossRefItem::linkedChanged +*/ void CrossRefItem::linkedChanged() { for(const QMetaObject::Connection& c : m_slave_connection) @@ -376,17 +414,23 @@ void CrossRefItem::linkedChanged() for(Element *elmt : m_element->linkedElements()) { - m_slave_connection << connect(elmt, &Element::xChanged, this, &CrossRefItem::updateLabel); - m_slave_connection << connect(elmt, &Element::yChanged, this, &CrossRefItem::updateLabel); + m_slave_connection << connect(elmt, + &Element::xChanged, + this, + &CrossRefItem::updateLabel); + m_slave_connection << connect(elmt, + &Element::yChanged, + this, + &CrossRefItem::updateLabel); } updateLabel(); } /** - * @brief CrossRefItem::buildHeaderContact - * Draw the QPicture of m_hdr_no_ctc and m_hdr_nc_ctc - */ + @brief CrossRefItem::buildHeaderContact + Draw the QPicture of m_hdr_no_ctc and m_hdr_nc_ctc +*/ void CrossRefItem::buildHeaderContact() { if (!m_hdr_no_ctc.isNull() && !m_hdr_nc_ctc.isNull()) return; @@ -430,11 +474,13 @@ void CrossRefItem::buildHeaderContact() { } /** - * @brief CrossRefItem::setUpCrossBoundingRect - * Get the numbers of slaves elements linked to this parent element, - * for calculate the size of the cross bounding rect. - * The cross ref item is drawing according to the size of the cross bounding rect. - */ + @brief CrossRefItem::setUpCrossBoundingRect + Get the numbers of slaves elements linked to this parent element, + for calculate the size of the cross bounding rect. + The cross ref item is drawing according to the size of + the cross bounding rect. + @param painter +*/ void CrossRefItem::setUpCrossBoundingRect(QPainter &painter) { //No need to calcul if nothing is linked @@ -492,10 +538,10 @@ void CrossRefItem::setUpCrossBoundingRect(QPainter &painter) } /** - * @brief CrossRefItem::drawAsCross - * Draw this crossref with a cross - * @param painter, painter to use - */ + @brief CrossRefItem::drawAsCross + Draw this crossref with a cross + @param painter: painter to use +*/ void CrossRefItem::drawAsCross(QPainter &painter) { //calcul the size of the cross @@ -522,10 +568,10 @@ void CrossRefItem::drawAsCross(QPainter &painter) } /** - * @brief CrossRefItem::drawAsContacts - * Draw this crossref with symbolic contacts - * @param painter painter to use - */ + @brief CrossRefItem::drawAsContacts + Draw this crossref with symbolic contacts + @param painter painter to use +*/ void CrossRefItem::drawAsContacts(QPainter &painter) { if (m_element -> isFree()) @@ -567,13 +613,13 @@ void CrossRefItem::drawAsContacts(QPainter &painter) } /** - * @brief CrossRefItem::drawContact - * Draw one contact, the type of contact to draw is define in @flags. - * @param painter, painter to use - * @param flags, define how to draw the contact (see enul CONTACTS) - * @param elmt, the element to display text (the position of the contact) - * @return The bounding rect of the draw (contact + text) - */ + @brief CrossRefItem::drawContact + Draw one contact, the type of contact to draw is define in flags. + @param painter : painter to use + @param flags : define how to draw the contact (see enul CONTACTS) + @param elmt : the element to display text (the position of the contact) + @return The bounding rect of the draw (contact + text) +*/ QRectF CrossRefItem::drawContact(QPainter &painter, int flags, Element *elmt) { QString str = elementPositionText(elmt); @@ -735,8 +781,13 @@ QRectF CrossRefItem::drawContact(QPainter &painter, int flags, Element *elmt) } //Draw position text - QRectF text_rect = painter.boundingRect(QRectF(30, offset+5, 5, 10), Qt::AlignLeft | Qt::AlignVCenter, str); - painter.drawText(text_rect, Qt::AlignLeft | Qt::AlignVCenter, str); + QRectF text_rect = painter.boundingRect( + QRectF(30, offset+5, 5, 10), + Qt::AlignLeft | Qt::AlignVCenter, + str); + painter.drawText(text_rect, + Qt::AlignLeft | Qt::AlignVCenter, + str); bounding_rect = bounding_rect.united(text_rect); if (m_hovered_contacts_map.contains(elmt)) { @@ -754,10 +805,10 @@ QRectF CrossRefItem::drawContact(QPainter &painter, int flags, Element *elmt) } /** - * @brief CrossRefItem::fillCrossRef - * Fill the content of the cross ref - * @param painter painter to use. - */ + @brief CrossRefItem::fillCrossRef + Fill the content of the cross ref + @param painter painter to use. +*/ void CrossRefItem::fillCrossRef(QPainter &painter) { if (m_element->isFree()) return; @@ -773,7 +824,11 @@ void CrossRefItem::fillCrossRef(QPainter &painter) painter.setPen(pen); QString str = elementPositionText(elmt, true); - QRectF bounding = painter.boundingRect(QRectF(no_top_left, QSize(middle_cross, 1)), Qt::AlignLeft, str); + QRectF bounding = painter.boundingRect( + QRectF(no_top_left, + QSize(middle_cross, 1)), + Qt::AlignLeft, + str); painter.drawText(bounding, Qt::AlignLeft, str); if (m_hovered_contacts_map.contains(elmt)) @@ -793,11 +848,16 @@ void CrossRefItem::fillCrossRef(QPainter &painter) foreach(Element *elmt, NCElements()) { QPen pen = painter.pen(); - m_hovered_contact == elmt ? pen.setColor(Qt::blue) :pen.setColor(Qt::black); + m_hovered_contact == elmt ? pen.setColor(Qt::blue) + :pen.setColor(Qt::black); painter.setPen(pen); QString str = elementPositionText(elmt, true); - QRectF bounding = painter.boundingRect(QRectF(nc_top_left, QSize(middle_cross, 1)), Qt::AlignRight, str); + QRectF bounding = painter.boundingRect( + QRectF(nc_top_left, + QSize(middle_cross, 1)), + Qt::AlignRight, + str); painter.drawText(bounding, Qt::AlignRight, str); if (m_hovered_contacts_map.contains(elmt)) @@ -814,14 +874,18 @@ void CrossRefItem::fillCrossRef(QPainter &painter) } /** - * @brief CrossRefItem::AddExtraInfo - * Add the comment info of the parent item if needed. - * @param painter painter to use for draw the text - * @param type type of Info do be draw e.g. comment, location. - */ + @brief CrossRefItem::AddExtraInfo + Add the comment info of the parent item if needed. + @param painter painter to use for draw the text + @param type type of Info do be draw e.g. comment, location. +*/ void CrossRefItem::AddExtraInfo(QPainter &painter, const QString& type) { - QString text = autonum::AssignVariables::formulaToLabel(m_element -> elementInformations()[type].toString(), m_element->rSequenceStruct(), m_element->diagram(), m_element); + QString text = autonum::AssignVariables::formulaToLabel( + m_element->elementInformations()[type].toString(), + m_element->rSequenceStruct(), + m_element->diagram(), + m_element); bool must_show = m_element -> elementInformations().keyMustShow(type); if (!text.isEmpty() && must_show) @@ -831,38 +895,51 @@ void CrossRefItem::AddExtraInfo(QPainter &painter, const QString& type) QRectF r, text_bounding; qreal center = boundingRect().center().x(); - qreal width = boundingRect().width() > 70 ? boundingRect().width()/2 : 35; + qreal width = boundingRect().width() > 70 + ? boundingRect().width()/2 + : 35; - r = QRectF(QPointF(center - width, boundingRect().bottom()), - QPointF(center + width, boundingRect().bottom() + 1)); + r = QRectF(QPointF(center - width, + boundingRect().bottom()), + QPointF(center + width, + boundingRect().bottom() + 1)); - text_bounding = painter.boundingRect(r, Qt::TextWordWrap | Qt::AlignHCenter, text); - painter.drawText(text_bounding, Qt::TextWordWrap | Qt::AlignHCenter, text); + text_bounding = painter.boundingRect( + r, + Qt::TextWordWrap | Qt::AlignHCenter, + text); + painter.drawText(text_bounding, + Qt::TextWordWrap | Qt::AlignHCenter, + text); text_bounding.adjust(-1,0,1,0); //adjust only for better visual m_shape_path.addRect(text_bounding); prepareGeometryChange(); m_bounding_rect = m_bounding_rect.united(text_bounding); - if (type == "comment") painter.drawRoundedRect(text_bounding, 2, 2); + if (type == "comment") painter.drawRoundedRect(text_bounding, + 2, + 2); painter.restore(); } } /** - * @brief CrossRefItem::NOElements - * @return The linked elements of @m_element wich are open or switch contact. - * If linked element is a power contact, xref propertie is set to don't show power contact - * and this cross item must be drawed as cross, the element is not append in the list. - */ + @brief CrossRefItem::NOElements + @return The linked elements of m_element wich are open or switch contact. + If linked element is a power contact, + xref propertie is set to don't show power contact + and this cross item must be drawed as cross, + the element is not append in the list. +*/ QList CrossRefItem::NOElements() const { QList no_list; foreach (Element *elmt, m_element->linkedElements()) { - //We continue if element is a power contact and xref propertie - //is set to don't show power contact + //We continue if element is a power contact and xref propertie + //is set to don't show power contact if (m_properties.displayHas() == XRefProperties::Cross && !m_properties.showPowerContact() && elmt -> kindInformations()["type"].toString() == "power") @@ -880,19 +957,22 @@ QList CrossRefItem::NOElements() const } /** - * @brief CrossRefItem::NCElements - * @return The linked elements of @m_element wich are close or switch contact - * If linked element is a power contact, xref propertie is set to don't show power contact - * and this cross item must be drawed as cross, the element is not append in the list. - */ + @brief CrossRefItem::NCElements + @return The linked elements of m_element wich are close + or switch contact + If linked element is a power contact, + xref propertie is set to don't show power contact + and this cross item must be drawed as cross, + the element is not append in the list. +*/ QList CrossRefItem::NCElements() const { QList nc_list; foreach (Element *elmt, m_element->linkedElements()) { - //We continue if element is a power contact and xref propertie - //is set to don't show power contact + //We continue if element is a power contact and xref propertie + //is set to don't show power contact if (m_properties.displayHas() == XRefProperties::Cross && !m_properties.showPowerContact() && elmt -> kindInformations()["type"].toString() == "power") diff --git a/sources/qetgraphicsitem/crossrefitem.h b/sources/qetgraphicsitem/crossrefitem.h index 19efd7f29..fbbb8727c 100644 --- a/sources/qetgraphicsitem/crossrefitem.h +++ b/sources/qetgraphicsitem/crossrefitem.h @@ -29,16 +29,20 @@ class DynamicElementTextItem; class ElementTextItemGroup; /** - * @brief The CrossRefItem class - * This clas provide an item, for show the cross reference, like the contacts linked to a coil. - * The item setpos automaticaly when parent move. - * All slave displayed in cross ref will be updated when folio position change in the project. - * It's the responsability of the master element to informe displayed slave are moved, - * by calling the slot @updateLabel - * By default master element is the parent graphics item of this Xref, - * but if the Xref must be snap to the label of master, the label become the parent of this Xref. - * This behavior can be changed at anytime by calling setProperties. - */ + @brief The CrossRefItem class + This clas provide an item, for show the cross reference, + like the contacts linked to a coil. + The item setpos automaticaly when parent move. + All slave displayed in cross ref will be updated + when folio position change in the project. + It's the responsability of the master element + to informe displayed slave are moved, + by calling the slot updateLabel + By default master element is the parent graphics item of this Xref, + but if the Xref must be snap to the label of master, + the label become the parent of this Xref. + This behavior can be changed at anytime by calling setProperties. +*/ class CrossRefItem : public QGraphicsObject { Q_OBJECT @@ -46,8 +50,10 @@ class CrossRefItem : public QGraphicsObject //Methods public: explicit CrossRefItem(Element *elmt); - explicit CrossRefItem(Element *elmt, DynamicElementTextItem *text); - explicit CrossRefItem(Element *elmt, ElementTextItemGroup *group); + explicit CrossRefItem(Element *elmt, + DynamicElementTextItem *text); + explicit CrossRefItem(Element *elmt, + ElementTextItemGroup *group); ~CrossRefItem() override; private: void init(); @@ -57,55 +63,63 @@ class CrossRefItem : public QGraphicsObject enum { Type = UserType + 1009 }; int type() const override { return Type; } + /** + @brief The CONTACTS enum + */ enum CONTACTS { - NO = 1, - NC = 2, - NOC = 3, - SW = 4, - Power = 8, - DelayOn = 16, - DelayOff = 32, - DelayOnOff = 64, - Delay = 112 + NO = 1, + NC = 2, + NOC = 3, + SW = 4, + Power = 8, + DelayOn = 16, + DelayOff = 32, + DelayOnOff = 64, + Delay = 112 }; - QRectF boundingRect () const override; - QPainterPath shape () const override; - QString elementPositionText (const Element *elmt, const bool &add_prefix = false) const; + QRectF boundingRect() const override; + QPainterPath shape() const override; + QString elementPositionText( + const Element *elmt, + const bool &add_prefix = false) const; public slots: - void updateProperties (); - void updateLabel (); - void autoPos (); + void updateProperties(); + void updateLabel(); + void autoPos(); protected: bool sceneEvent(QEvent *event) override; - void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override; - void mouseDoubleClickEvent (QGraphicsSceneMouseEvent * event ) override; + void paint(QPainter *painter, + const QStyleOptionGraphicsItem *option, + QWidget *widget) override; + void mouseDoubleClickEvent ( + QGraphicsSceneMouseEvent * event ) override; void hoverEnterEvent(QGraphicsSceneHoverEvent *event) override; void hoverMoveEvent(QGraphicsSceneHoverEvent *event) override; void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) override; private: void linkedChanged(); - void buildHeaderContact (); - void setUpCrossBoundingRect (QPainter &painter); - void drawAsCross (QPainter &painter); - void drawAsContacts (QPainter &painter); - QRectF drawContact (QPainter &painter, int flags, Element *elmt); - void fillCrossRef (QPainter &painter); - void AddExtraInfo (QPainter &painter, const QString&); + void buildHeaderContact(); + void setUpCrossBoundingRect(QPainter &painter); + void drawAsCross(QPainter &painter); + void drawAsContacts(QPainter &painter); + QRectF drawContact(QPainter &painter, int flags, Element *elmt); + void fillCrossRef(QPainter &painter); + void AddExtraInfo(QPainter &painter, const QString&); QList NOElements() const; QList NCElements() const; //Attributes private: - Element *m_element; //element to display the cross reference - QRectF m_bounding_rect; - QPicture m_drawing, m_hdr_no_ctc, m_hdr_nc_ctc; - QPainterPath m_shape_path; + Element *m_element; //element to display the cross reference + QRectF m_bounding_rect; + QPicture m_drawing, m_hdr_no_ctc, m_hdr_nc_ctc; + QPainterPath m_shape_path; XRefProperties m_properties; - int m_drawed_contacts; + int m_drawed_contacts; QMultiMap m_hovered_contacts_map; Element *m_hovered_contact = nullptr; DynamicElementTextItem *m_text = nullptr; diff --git a/sources/undocommand/addelementtextcommand.cpp b/sources/undocommand/addelementtextcommand.cpp index ca6019e53..909243ed6 100644 --- a/sources/undocommand/addelementtextcommand.cpp +++ b/sources/undocommand/addelementtextcommand.cpp @@ -28,6 +28,12 @@ * AddElementTextCommand* * **********************/ +/** + @brief AddElementTextCommand::AddElementTextCommand + @param element + @param deti + @param parent +*/ AddElementTextCommand::AddElementTextCommand(Element *element, DynamicElementTextItem *deti, QUndoCommand *parent): @@ -38,6 +44,9 @@ AddElementTextCommand::AddElementTextCommand(Element *element, setText(QObject::tr("Ajouter un texte d'élément")); } +/** + @brief AddElementTextCommand::~AddElementTextCommand +*/ AddElementTextCommand::~AddElementTextCommand() { if(m_text->parentGroup()) @@ -47,6 +56,9 @@ AddElementTextCommand::~AddElementTextCommand() delete m_text; } +/** + @brief AddElementTextCommand::undo +*/ void AddElementTextCommand::undo() { m_element->removeDynamicTextItem(m_text); @@ -54,6 +66,9 @@ void AddElementTextCommand::undo() m_text->scene()->removeItem(m_text); } +/** + @brief AddElementTextCommand::redo +*/ void AddElementTextCommand::redo() { m_text->setParentItem(m_element); @@ -65,11 +80,11 @@ void AddElementTextCommand::redo() * AddTextsGroupCommand* * *********************/ /** - * @brief AddTextsGroupCommand::AddTextsGroupCommand - * @param element : the element to add a new group - * @param groupe_name : the name of the group - * @param parent : parent undo - */ + @brief AddTextsGroupCommand::AddTextsGroupCommand + @param element : the element to add a new group + @param groupe_name : the name of the group + @param parent : parent undo +*/ AddTextsGroupCommand::AddTextsGroupCommand(Element *element, QString groupe_name, QUndoCommand *parent) : @@ -81,11 +96,13 @@ AddTextsGroupCommand::AddTextsGroupCommand(Element *element, } /** - * @brief AddTextsGroupCommand::AddTextsGroupCommand - * @param element : The element to add a new group - * @param dom_element : the first time the group is created, we call the function fromXml of the group, and give @dom_element has argument. - * @param parent : parent undo - */ + @brief AddTextsGroupCommand::AddTextsGroupCommand + @param element : The element to add a new group + @param dom_element : the first time the group is created, + we call the function fromXml of the group, + and give @dom_element has argument. + @param parent : parent undo +*/ AddTextsGroupCommand::AddTextsGroupCommand(Element *element, const QDomElement& dom_element, QUndoCommand *parent) : @@ -97,11 +114,12 @@ AddTextsGroupCommand::AddTextsGroupCommand(Element *element, } /** - * @brief AddTextsGroupCommand::AddTextsGroupCommand - * @param element : The element to add a new group - * @param texts_list : a list of texts to add to the created group (texts must be child of element) - * @param parent : parent undo - */ + @brief AddTextsGroupCommand::AddTextsGroupCommand + @param element : The element to add a new group + @param texts_list : a list of texts to add to the created group + (texts must be child of element) + @param parent : parent undo +*/ AddTextsGroupCommand::AddTextsGroupCommand( Element *element, QString groupe_name, @@ -125,18 +143,24 @@ AddTextsGroupCommand::AddTextsGroupCommand( } /** - * @brief AddTextsGroupCommand::~AddTextsGroupCommand - * Destructor - */ + @brief AddTextsGroupCommand::~AddTextsGroupCommand + Destructor +*/ AddTextsGroupCommand::~AddTextsGroupCommand() {} +/** + @brief AddTextsGroupCommand::undo +*/ void AddTextsGroupCommand::undo() { if(m_element && m_group) m_element.data()->removeTextGroup(m_group); } +/** + @brief AddTextsGroupCommand::redo +*/ void AddTextsGroupCommand::redo() { if(!m_element) @@ -179,11 +203,11 @@ void AddTextsGroupCommand::redo() * RemoveTextsGroupCommand* * ************************/ /** - * @brief RemoveTextsGroupCommand::RemoveTextsGroupCommand - * @param element : The element where we remove a group - * @param group : the group to remove - * @param parent : the parent undo command - */ + @brief RemoveTextsGroupCommand::RemoveTextsGroupCommand + @param element : The element where we remove a group + @param group : the group to remove + @param parent : the parent undo command +*/ RemoveTextsGroupCommand::RemoveTextsGroupCommand(Element *element, ElementTextItemGroup *group, QUndoCommand *parent) : @@ -197,9 +221,15 @@ RemoveTextsGroupCommand::RemoveTextsGroupCommand(Element *element, m_text_list.append(deti); } +/** + @brief RemoveTextsGroupCommand::~RemoveTextsGroupCommand +*/ RemoveTextsGroupCommand::~RemoveTextsGroupCommand() {} - + +/** + @brief RemoveTextsGroupCommand::undo +*/ void RemoveTextsGroupCommand::undo() { if(m_element && m_group) @@ -214,6 +244,9 @@ void RemoveTextsGroupCommand::undo() } } +/** + @brief RemoveTextsGroupCommand::redo +*/ void RemoveTextsGroupCommand::redo() { if(m_element && m_group) @@ -233,11 +266,11 @@ void RemoveTextsGroupCommand::redo() * AddTextToGroupCommand* * **********************/ /** - * @brief AddTextToGroupCommand::AddTextToGroupCommand - * @param text - * @param group - * @param parent - */ + @brief AddTextToGroupCommand::AddTextToGroupCommand + @param text + @param group + @param parent +*/ AddTextToGroupCommand::AddTextToGroupCommand(DynamicElementTextItem *text, ElementTextItemGroup *group, QUndoCommand *parent) : @@ -250,9 +283,9 @@ AddTextToGroupCommand::AddTextToGroupCommand(DynamicElementTextItem *text, } /** - * @brief AddTextToGroupCommand::~AddTextToGroupCommand - * Destructor - */ + @brief AddTextToGroupCommand::~AddTextToGroupCommand + Destructor +*/ AddTextToGroupCommand::~AddTextToGroupCommand() { if(m_group && m_text && m_element) @@ -263,12 +296,18 @@ AddTextToGroupCommand::~AddTextToGroupCommand() } } +/** + @brief AddTextToGroupCommand::undo +*/ void AddTextToGroupCommand::undo() { if(m_element && m_group && m_text) m_element.data()->removeTextFromGroup(m_text, m_group); } +/** + @brief AddTextToGroupCommand::redo +*/ void AddTextToGroupCommand::redo() { if(m_element && m_group && m_text) @@ -286,11 +325,11 @@ void AddTextToGroupCommand::redo() * RemoveTextFromGroupCommand* * ***************************/ /** - * @brief RemoveTextFromGroupCommand::RemoveTextFromGroupCommand - * @param text : text to add to @group - * @param group - * @param parent : parent undo command - */ + @brief RemoveTextFromGroupCommand::RemoveTextFromGroupCommand + @param text : text to add to @group + @param group + @param parent : parent undo command +*/ RemoveTextFromGroupCommand::RemoveTextFromGroupCommand( DynamicElementTextItem *text, ElementTextItemGroup *group, @@ -304,9 +343,9 @@ RemoveTextFromGroupCommand::RemoveTextFromGroupCommand( } /** - * @brief RemoveTextFromGroupCommand::~RemoveTextFromGroupCommand - * Destructor - */ + @brief RemoveTextFromGroupCommand::~RemoveTextFromGroupCommand + Destructor +*/ RemoveTextFromGroupCommand::~RemoveTextFromGroupCommand() { if(m_group && m_text && m_element) @@ -317,12 +356,18 @@ RemoveTextFromGroupCommand::~RemoveTextFromGroupCommand() } } +/** + @brief RemoveTextFromGroupCommand::undo +*/ void RemoveTextFromGroupCommand::undo() { if(m_element && m_group && m_text) m_element.data()->addTextToGroup(m_text, m_group); } +/** + @brief RemoveTextFromGroupCommand::redo +*/ void RemoveTextFromGroupCommand::redo() { if(m_element && m_group && m_text) @@ -334,11 +379,11 @@ void RemoveTextFromGroupCommand::redo() * AlignmentTextsGroupCommand* * ***************************/ /** - * @brief AlignmentTextsGroupCommand::AlignmentTextsGroupCommand - * @param group : Group to change the alignment - * @param new_alignment : the new alignment of the group - * @param parent : the parent QUndoCommand of this undo - */ + @brief AlignmentTextsGroupCommand::AlignmentTextsGroupCommand + @param group : Group to change the alignment + @param new_alignment : the new alignment of the group + @param parent : the parent QUndoCommand of this undo +*/ AlignmentTextsGroupCommand::AlignmentTextsGroupCommand( ElementTextItemGroup *group, Qt::Alignment new_alignment, @@ -361,18 +406,18 @@ AlignmentTextsGroupCommand::AlignmentTextsGroupCommand( } /** - * @brief AlignmentTextsGroupCommand::~AlignmentTextsGroupCommand - * Destructor - */ + @brief AlignmentTextsGroupCommand::~AlignmentTextsGroupCommand + Destructor +*/ AlignmentTextsGroupCommand::~AlignmentTextsGroupCommand() {} /** - * @brief AlignmentTextsGroupCommand::mergeWith - * Try to merge this command with other command - * @param other - * @return true if was merged, else false - */ + @brief AlignmentTextsGroupCommand::mergeWith + Try to merge this command with other command + @param other + @return true if was merged, else false +*/ bool AlignmentTextsGroupCommand::mergeWith(const QUndoCommand *other) { if (id() != other->id() || other->childCount()) @@ -388,8 +433,8 @@ bool AlignmentTextsGroupCommand::mergeWith(const QUndoCommand *other) } /** - * @brief AlignmentTextsGroupCommand::undo - */ + @brief AlignmentTextsGroupCommand::undo +*/ void AlignmentTextsGroupCommand::undo() { if(m_group) @@ -409,8 +454,8 @@ void AlignmentTextsGroupCommand::undo() } /** - * @brief AlignmentTextsGroupCommand::redo - */ + @brief AlignmentTextsGroupCommand::redo +*/ void AlignmentTextsGroupCommand::redo() { if(m_group) diff --git a/sources/undocommand/addelementtextcommand.h b/sources/undocommand/addelementtextcommand.h index 019aaf79e..fc73f1d9b 100644 --- a/sources/undocommand/addelementtextcommand.h +++ b/sources/undocommand/addelementtextcommand.h @@ -27,9 +27,9 @@ class DynamicElementTextItem; class ElementTextItemGroup; /** - * @brief The AddElementTextCommand class - * Manage the adding of element text - */ + @brief The AddElementTextCommand class + Manage the adding of element text +*/ class AddElementTextCommand : public QUndoCommand { public: @@ -47,9 +47,9 @@ class AddElementTextCommand : public QUndoCommand }; /** - * @brief The AddTextsGroupCommand class - * Manage the adding of a texts group - */ + @brief The AddTextsGroupCommand class + Manage the adding of a texts group +*/ class AddTextsGroupCommand : public QUndoCommand { public: @@ -78,9 +78,9 @@ class AddTextsGroupCommand : public QUndoCommand }; /** - * @brief The RemoveTextsGroupCommand class - * Manage the removinf of a texts group - */ + @brief The RemoveTextsGroupCommand class + Manage the removinf of a texts group +*/ class RemoveTextsGroupCommand : public QUndoCommand { public: @@ -98,6 +98,9 @@ class RemoveTextsGroupCommand : public QUndoCommand QList> m_text_list; }; +/** + @brief The AddTextToGroupCommand class +*/ class AddTextToGroupCommand : public QUndoCommand { public: @@ -115,6 +118,9 @@ class AddTextToGroupCommand : public QUndoCommand QPointer m_element; }; +/** + @brief The RemoveTextFromGroupCommand class +*/ class RemoveTextFromGroupCommand : public QUndoCommand { public: @@ -132,6 +138,9 @@ class RemoveTextFromGroupCommand : public QUndoCommand QPointer m_element; }; +/** + @brief The AlignmentTextsGroupCommand class +*/ class AlignmentTextsGroupCommand : public QUndoCommand { public: