Cppcheck warnings.
--HG-- branch : feature
This commit is contained in:
parent
9a51b165ac
commit
a7987422ae
|
@ -38,7 +38,7 @@ public:
|
|||
/**
|
||||
* @brief VGraphicsFillItem Constructor
|
||||
*/
|
||||
VGraphicsFillItem(QGraphicsItem *parent = nullptr);
|
||||
explicit VGraphicsFillItem(QGraphicsItem *parent = nullptr);
|
||||
/**
|
||||
* @brief ~VGraphicsFillItem Destructor
|
||||
*/
|
||||
|
|
|
@ -34,6 +34,39 @@
|
|||
#include <QDataStream>
|
||||
#include <QtNumeric>
|
||||
|
||||
namespace
|
||||
{
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
qreal EvalFormula(const VContainer *data, QString formula)
|
||||
{
|
||||
if (formula.isEmpty())
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
// Replace line return character with spaces for calc if exist
|
||||
formula.replace("\n", " ");
|
||||
QScopedPointer<Calculator> cal(new Calculator());
|
||||
const qreal result = cal->EvalFormula(data->PlainVariables(), formula);
|
||||
|
||||
if (qIsInf(result) || qIsNaN(result))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
catch (qmu::QmuParserError &e)
|
||||
{
|
||||
Q_UNUSED(e)
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VPieceNode::VPieceNode()
|
||||
: d(new VPieceNodeData)
|
||||
|
@ -182,36 +215,6 @@ void VPieceNode::SetAngleType(PieceNodeAngle type)
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
qreal VPieceNode::EvalFormula(const VContainer *data, QString formula) const
|
||||
{
|
||||
if (formula.isEmpty())
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
// Replace line return character with spaces for calc if exist
|
||||
formula.replace("\n", " ");
|
||||
QScopedPointer<Calculator> cal(new Calculator());
|
||||
const qreal result = cal->EvalFormula(data->PlainVariables(), formula);
|
||||
|
||||
if (qIsInf(result) || qIsNaN(result))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
catch (qmu::QmuParserError &e)
|
||||
{
|
||||
Q_UNUSED(e)
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Friend functions
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QDataStream& operator<<(QDataStream& out, const VPieceNode& p)
|
||||
|
|
|
@ -76,8 +76,6 @@ public:
|
|||
void SetAngleType(PieceNodeAngle type);
|
||||
private:
|
||||
QSharedDataPointer<VPieceNodeData> d;
|
||||
|
||||
qreal EvalFormula(const VContainer *data, QString formula) const;
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(VPieceNode)
|
||||
|
|
Loading…
Reference in New Issue
Block a user