Refactoring.
This commit is contained in:
parent
f952368fa1
commit
0a6c560382
|
@ -53,9 +53,11 @@
|
||||||
#include "../vtools/undocommands/undogroup.h"
|
#include "../vtools/undocommands/undogroup.h"
|
||||||
#include "../vformat/vpatternrecipe.h"
|
#include "../vformat/vpatternrecipe.h"
|
||||||
#include "../vlayout/dialogs/watermarkwindow.h"
|
#include "../vlayout/dialogs/watermarkwindow.h"
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||||
#include "../vmisc/backport/qoverload.h"
|
#include "../vmisc/backport/qoverload.h"
|
||||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||||
|
|
||||||
#include "../vlayout/vlayoutexporter.h"
|
#include "../vlayout/vlayoutexporter.h"
|
||||||
#include "../vwidgets/vgraphicssimpletextitem.h"
|
#include "../vwidgets/vgraphicssimpletextitem.h"
|
||||||
#include "../vlayout/dialogs/dialoglayoutscale.h"
|
#include "../vlayout/dialogs/dialoglayoutscale.h"
|
||||||
|
|
|
@ -266,12 +266,10 @@ qmusizetype ReadVal(const QString &formula, qreal &val, const QLocale &locale, c
|
||||||
val = d;
|
val = d;
|
||||||
return buf.size();
|
return buf.size();
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
val = 0;
|
val = 0;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
buf.append(c);
|
buf.append(c);
|
||||||
c = GetChar(formula, index);
|
c = GetChar(formula, index);
|
||||||
|
|
|
@ -153,14 +153,13 @@ static inline bool QmuFuzzyComparePossibleNulls(double p1, double p2)
|
||||||
{
|
{
|
||||||
return qFuzzyIsNull(p2);
|
return qFuzzyIsNull(p2);
|
||||||
}
|
}
|
||||||
else if(qFuzzyIsNull(p2))
|
|
||||||
|
if(qFuzzyIsNull(p2))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
return qFuzzyCompare(p1, p2);
|
return qFuzzyCompare(p1, p2);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QMUPARSERSHARED_EXPORT qmusizetype ReadVal(const QString &formula, qreal &val, const QLocale &locale,
|
QMUPARSERSHARED_EXPORT qmusizetype ReadVal(const QString &formula, qreal &val, const QLocale &locale,
|
||||||
|
|
|
@ -1477,13 +1477,13 @@ QMap<QString, qreal> VMeasurements::ReadCorrections(const QDomElement &mElement)
|
||||||
{
|
{
|
||||||
if (mElement.isNull())
|
if (mElement.isNull())
|
||||||
{
|
{
|
||||||
return QMap<QString, qreal>();
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
QDomElement correctionsTag = mElement.firstChildElement(TagCorrections);
|
QDomElement correctionsTag = mElement.firstChildElement(TagCorrections);
|
||||||
if (correctionsTag.isNull())
|
if (correctionsTag.isNull())
|
||||||
{
|
{
|
||||||
return QMap<QString, qreal>();
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
QMap<QString, qreal> corrections;
|
QMap<QString, qreal> corrections;
|
||||||
|
|
|
@ -368,10 +368,7 @@ VPointF VCubicBezierPath::FirstPoint() const
|
||||||
{
|
{
|
||||||
return ConstFirst(d->path);
|
return ConstFirst(d->path);
|
||||||
}
|
}
|
||||||
else
|
return {};
|
||||||
{
|
|
||||||
return VPointF();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -382,8 +379,6 @@ VPointF VCubicBezierPath::LastPoint() const
|
||||||
{
|
{
|
||||||
return d->path.at(SubSplOffset(count) + 3);// Take last point of the last real spline
|
return d->path.at(SubSplOffset(count) + 3);// Take last point of the last real spline
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
return {};
|
||||||
return VPointF();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,9 +40,7 @@ class VSplinePathData final : public QSharedData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
VSplinePathData()
|
VSplinePathData() = default;
|
||||||
: path(QVector<VSplinePoint>())
|
|
||||||
{}
|
|
||||||
|
|
||||||
VSplinePathData(const VSplinePathData &splPath)
|
VSplinePathData(const VSplinePathData &splPath)
|
||||||
: QSharedData(splPath),
|
: QSharedData(splPath),
|
||||||
|
@ -54,7 +52,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* @brief path list spline point.
|
* @brief path list spline point.
|
||||||
*/
|
*/
|
||||||
QVector<VSplinePoint> path;
|
QVector<VSplinePoint> path{};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_ASSIGN(VSplinePathData)
|
Q_DISABLE_ASSIGN(VSplinePathData)
|
||||||
|
|
|
@ -46,6 +46,7 @@
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||||
#include "../vmisc/diagnostic.h"
|
#include "../vmisc/diagnostic.h"
|
||||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||||
|
|
||||||
#include "../vmisc/vmath.h"
|
#include "../vmisc/vmath.h"
|
||||||
|
|
||||||
class QPaintDevice;
|
class QPaintDevice;
|
||||||
|
|
|
@ -829,10 +829,8 @@ vsizetype VPiecePath::Edge(quint32 p1, quint32 p2) const
|
||||||
{
|
{
|
||||||
return list.size() - 1;
|
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)
|
if (i < 0 || i > d->m_nodes.size()-1)
|
||||||
{
|
{
|
||||||
return QPointF();
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (d->m_nodes.size() > 1)
|
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()))
|
if (not nodes.isEmpty() && (nodeIndex < 0 || nodeIndex >= nodes.size()))
|
||||||
{
|
{
|
||||||
return QString();
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
|
|
|
@ -132,7 +132,7 @@ QModelIndex VPE::VPropertyModel::parent ( const QModelIndex & index ) const
|
||||||
{
|
{
|
||||||
if (!index.isValid())
|
if (!index.isValid())
|
||||||
{
|
{
|
||||||
return QModelIndex();
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
VProperty* childItem = getProperty(index);
|
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
|
//! 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)
|
if (!property || column > columnCount() || column < 0)
|
||||||
{
|
{
|
||||||
return QModelIndex();
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
VProperty* parentItem = property->getParent();
|
VProperty* parentItem = property->getParent();
|
||||||
|
|
|
@ -146,17 +146,17 @@ void DialogUnionDetails::ChoosedDetail(const quint32 &id, const SceneObject &typ
|
||||||
emit ToolTip(tr("Select a first point"));
|
emit ToolTip(tr("Select a first point"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
emit ToolTip(tr("Workpiece should have at least two points and three objects"));
|
emit ToolTip(tr("Workpiece should have at least two points and three objects"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (CheckObject(id, idDetail) == false)
|
if (not CheckObject(id, idDetail))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == SceneObject::Point)
|
if (type == SceneObject::Point)
|
||||||
{
|
{
|
||||||
if (numberP == 0)
|
if (numberP == 0)
|
||||||
|
@ -166,6 +166,7 @@ void DialogUnionDetails::ChoosedDetail(const quint32 &id, const SceneObject &typ
|
||||||
emit ToolTip(tr("Select a second point"));
|
emit ToolTip(tr("Select a second point"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (numberP == 1)
|
if (numberP == 1)
|
||||||
{
|
{
|
||||||
if (id == p1)
|
if (id == p1)
|
||||||
|
@ -173,6 +174,7 @@ void DialogUnionDetails::ChoosedDetail(const quint32 &id, const SceneObject &typ
|
||||||
emit ToolTip(tr("Select a unique point"));
|
emit ToolTip(tr("Select a unique point"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
VPiece d = data->GetPiece(idDetail);
|
VPiece d = data->GetPiece(idDetail);
|
||||||
if (d.GetPath().OnEdge(p1, id))
|
if (d.GetPath().OnEdge(p1, id))
|
||||||
{
|
{
|
||||||
|
|
|
@ -380,10 +380,8 @@ QSize FancyTabBar::sizeHint() const
|
||||||
{
|
{
|
||||||
return QSize(sh.width() * static_cast<int>(m_attachedTabs.count()), sh.height());
|
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());
|
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()));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -188,11 +188,9 @@ bool VPlainTextEdit::MatchRightParenthesis(QTextBlock currentBlock, int i, int n
|
||||||
CreateParenthesisSelection(docPos + static_cast<int>(info->position));
|
CreateParenthesisSelection(docPos + static_cast<int>(info->position));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
--numRightParentheses;
|
--numRightParentheses;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
currentBlock = currentBlock.previous();
|
currentBlock = currentBlock.previous();
|
||||||
if (currentBlock.isValid())
|
if (currentBlock.isValid())
|
||||||
|
|
Loading…
Reference in New Issue
Block a user