From a915ef5a0d902b4a8d220bb9c4a37eb1aa33ed1d Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Wed, 17 Nov 2021 16:19:00 +0200 Subject: [PATCH] Code style. --- src/app/valentina/xml/vpattern.cpp | 9 ++++----- src/libs/ifc/xml/vabstractpattern.cpp | 19 ++++++++----------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/src/app/valentina/xml/vpattern.cpp b/src/app/valentina/xml/vpattern.cpp index 2d043d69d..2c299651d 100644 --- a/src/app/valentina/xml/vpattern.cpp +++ b/src/app/valentina/xml/vpattern.cpp @@ -749,14 +749,14 @@ VNodeDetail VPattern::ParseDetailNode(const QDomElement &domElement) const */ void VPattern::ParseDrawElement(const QDomNode &node, const Document &parse) { - QStringList tags = QStringList() << TagCalculation << TagModeling << TagDetails << TagGroups; + QStringList tags{TagCalculation, TagModeling, TagDetails, TagGroups}; QDomNode domNode = node.firstChild(); - while (domNode.isNull() == false) + while (not domNode.isNull()) { if (domNode.isElement()) { const QDomElement domElement = domNode.toElement(); - if (domElement.isNull() == false) + if (not domElement.isNull()) { switch (tags.indexOf(domElement.tagName())) { @@ -778,8 +778,7 @@ void VPattern::ParseDrawElement(const QDomNode &node, const Document &parse) ParseGroups(domElement); break; default: - VException e(tr("Wrong tag name '%1'.").arg(domElement.tagName())); - throw e; + throw VException(tr("Wrong tag name '%1'.").arg(domElement.tagName())); } } } diff --git a/src/libs/ifc/xml/vabstractpattern.cpp b/src/libs/ifc/xml/vabstractpattern.cpp index 6b9bd2592..2b6f700a6 100644 --- a/src/libs/ifc/xml/vabstractpattern.cpp +++ b/src/libs/ifc/xml/vabstractpattern.cpp @@ -416,12 +416,12 @@ void VAbstractPattern::ParseGroups(const QDomElement &domElement) QMap itemVisibility; QDomNode domNode = domElement.firstChild(); - while (domNode.isNull() == false) + while (not domNode.isNull()) { if (domNode.isElement()) { const QDomElement domElement = domNode.toElement(); - if (domElement.isNull() == false) + if (not domElement.isNull()) { if (domElement.tagName() == TagGroup) { @@ -2257,8 +2257,8 @@ bool VAbstractPattern::GroupHasItem(const QDomElement &groupDomElement, quint32 const QDomElement item = itemNode.toElement(); if (item.isNull() == false) { - quint32 toolIdIterate= GetParametrUInt(item, AttrTool, QChar('0')); - quint32 objectIdIterate= GetParametrUInt(item, AttrObject, QString::number(toolIdIterate)); + quint32 toolIdIterate = GetParametrUInt(item, AttrTool, QChar('0')); + quint32 objectIdIterate = GetParametrUInt(item, AttrObject, QString::number(toolIdIterate)); if(toolIdIterate == toolId && objectIdIterate == objectId) { @@ -2351,7 +2351,7 @@ QDomElement VAbstractPattern::AddItemToGroup(quint32 toolId, quint32 objectId, q { QDomElement group = elementById(groupId, TagGroup); - if (group.isNull() == false) + if (not group.isNull()) { if(objectId == 0) { @@ -2380,11 +2380,8 @@ QDomElement VAbstractPattern::AddItemToGroup(quint32 toolId, quint32 objectId, q return item; } - else - { - qDebug() << "The group of id " << groupId << " doesn't exist"; - } + qDebug() << "The group of id " << groupId << " doesn't exist"; return QDomElement(); } @@ -2400,7 +2397,7 @@ QDomElement VAbstractPattern::RemoveItemFromGroup(quint32 toolId, quint32 object { QDomElement group = elementById(groupId, TagGroup); - if (group.isNull() == false) + if (not group.isNull()) { if(objectId == 0) { @@ -2413,7 +2410,7 @@ QDomElement VAbstractPattern::RemoveItemFromGroup(quint32 toolId, quint32 object if (itemNode.isElement()) { const QDomElement item = itemNode.toElement(); - if (item.isNull() == false) + if (not item.isNull()) { quint32 toolIdIterate= GetParametrUInt(item, AttrTool, QChar('0')); quint32 objectIdIterate= GetParametrUInt(item, AttrObject, QString::number(toolIdIterate));