Refactoring.

This commit is contained in:
Roman Telezhynskyi 2023-02-09 15:48:28 +02:00
parent f952368fa1
commit 0a6c560382
12 changed files with 38 additions and 51 deletions

View File

@ -53,9 +53,11 @@
#include "../vtools/undocommands/undogroup.h"
#include "../vformat/vpatternrecipe.h"
#include "../vlayout/dialogs/watermarkwindow.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
#include "../vmisc/backport/qoverload.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
#include "../vlayout/vlayoutexporter.h"
#include "../vwidgets/vgraphicssimpletextitem.h"
#include "../vlayout/dialogs/dialoglayoutscale.h"

View File

@ -266,11 +266,9 @@ qmusizetype ReadVal(const QString &formula, qreal &val, const QLocale &locale, c
val = d;
return buf.size();
}
else
{
val = 0;
return -1;
}
val = 0;
return -1;
}
buf.append(c);

View File

@ -153,14 +153,13 @@ static inline bool QmuFuzzyComparePossibleNulls(double p1, double p2)
{
return qFuzzyIsNull(p2);
}
else if(qFuzzyIsNull(p2))
if(qFuzzyIsNull(p2))
{
return false;
}
else
{
return qFuzzyCompare(p1, p2);
}
return qFuzzyCompare(p1, p2);
}
QMUPARSERSHARED_EXPORT qmusizetype ReadVal(const QString &formula, qreal &val, const QLocale &locale,

View File

@ -1477,13 +1477,13 @@ QMap<QString, qreal> VMeasurements::ReadCorrections(const QDomElement &mElement)
{
if (mElement.isNull())
{
return QMap<QString, qreal>();
return {};
}
QDomElement correctionsTag = mElement.firstChildElement(TagCorrections);
if (correctionsTag.isNull())
{
return QMap<QString, qreal>();
return {};
}
QMap<QString, qreal> corrections;

View File

@ -368,10 +368,7 @@ VPointF VCubicBezierPath::FirstPoint() const
{
return ConstFirst(d->path);
}
else
{
return VPointF();
}
return {};
}
//---------------------------------------------------------------------------------------------------------------------
@ -382,8 +379,6 @@ VPointF VCubicBezierPath::LastPoint() const
{
return d->path.at(SubSplOffset(count) + 3);// Take last point of the last real spline
}
else
{
return VPointF();
}
return {};
}

View File

@ -40,9 +40,7 @@ class VSplinePathData final : public QSharedData
{
public:
VSplinePathData()
: path(QVector<VSplinePoint>())
{}
VSplinePathData() = default;
VSplinePathData(const VSplinePathData &splPath)
: QSharedData(splPath),
@ -54,7 +52,7 @@ public:
/**
* @brief path list spline point.
*/
QVector<VSplinePoint> path;
QVector<VSplinePoint> path{};
private:
Q_DISABLE_ASSIGN(VSplinePathData)

View File

@ -46,6 +46,7 @@
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/vmath.h"
class QPaintDevice;

View File

@ -829,10 +829,8 @@ vsizetype VPiecePath::Edge(quint32 p1, quint32 p2) const
{
return list.size() - 1;
}
else
{
return min;
}
return min;
}
//---------------------------------------------------------------------------------------------------------------------
@ -915,7 +913,7 @@ QPointF VPiecePath::NodePreviousPoint(const VContainer *data, int i) const
{
if (i < 0 || i > d->m_nodes.size()-1)
{
return QPointF();
return {};
}
if (d->m_nodes.size() > 1)
@ -1249,7 +1247,7 @@ QString VPiecePath::NodeName(const QVector<VPieceNode> &nodes, vsizetype nodeInd
{
if (not nodes.isEmpty() && (nodeIndex < 0 || nodeIndex >= nodes.size()))
{
return QString();
return {};
}
try

View File

@ -132,7 +132,7 @@ QModelIndex VPE::VPropertyModel::parent ( const QModelIndex & index ) const
{
if (!index.isValid())
{
return QModelIndex();
return {};
}
VProperty* childItem = getProperty(index);
@ -153,7 +153,7 @@ QModelIndex VPE::VPropertyModel::parent ( const QModelIndex & index ) const
}
}
return QModelIndex();
return {};
}
//! Returns the item flags for the given index
@ -282,7 +282,7 @@ QModelIndex VPE::VPropertyModel::getIndexFromProperty(VProperty* property, int c
{
if (!property || column > columnCount() || column < 0)
{
return QModelIndex();
return {};
}
VProperty* parentItem = property->getParent();

View File

@ -146,17 +146,17 @@ void DialogUnionDetails::ChoosedDetail(const quint32 &id, const SceneObject &typ
emit ToolTip(tr("Select a first point"));
return;
}
else
{
emit ToolTip(tr("Workpiece should have at least two points and three objects"));
return;
}
emit ToolTip(tr("Workpiece should have at least two points and three objects"));
return;
}
}
if (CheckObject(id, idDetail) == false)
if (not CheckObject(id, idDetail))
{
return;
}
if (type == SceneObject::Point)
{
if (numberP == 0)
@ -166,6 +166,7 @@ void DialogUnionDetails::ChoosedDetail(const quint32 &id, const SceneObject &typ
emit ToolTip(tr("Select a second point"));
return;
}
if (numberP == 1)
{
if (id == p1)
@ -173,6 +174,7 @@ void DialogUnionDetails::ChoosedDetail(const quint32 &id, const SceneObject &typ
emit ToolTip(tr("Select a unique point"));
return;
}
VPiece d = data->GetPiece(idDetail);
if (d.GetPath().OnEdge(p1, id))
{

View File

@ -380,10 +380,8 @@ QSize FancyTabBar::sizeHint() const
{
return QSize(sh.width() * static_cast<int>(m_attachedTabs.count()), sh.height());
}
else
{
return QSize(sh.width(), sh.height() * static_cast<int>(m_attachedTabs.count()));
}
return QSize(sh.width(), sh.height() * static_cast<int>(m_attachedTabs.count()));
}
//---------------------------------------------------------------------------------------------------------------------
@ -396,10 +394,8 @@ QSize FancyTabBar::minimumSizeHint() const
{
return QSize(sh.width() * static_cast<int>(m_attachedTabs.count()), sh.height());
}
else
{
return QSize(sh.width(), sh.height() * static_cast<int>(m_attachedTabs.count()));
}
return QSize(sh.width(), sh.height() * static_cast<int>(m_attachedTabs.count()));
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -188,10 +188,8 @@ bool VPlainTextEdit::MatchRightParenthesis(QTextBlock currentBlock, int i, int n
CreateParenthesisSelection(docPos + static_cast<int>(info->position));
return true;
}
else
{
--numRightParentheses;
}
--numRightParentheses;
}
currentBlock = currentBlock.previous();