GCC warnings.

(grafted from 5853578c984bef1a0c33c5776334a726a57b1134)

--HG--
branch : release
This commit is contained in:
Roman Telezhynskyi 2016-06-28 09:36:50 +03:00
parent 412ea278fe
commit e1273d87f9
3 changed files with 21 additions and 2 deletions

View file

@ -602,4 +602,21 @@ QSharedPointer<QPrinter> DefaultPrinter(QPrinter::PrinterMode mode = QPrinter::S
QPixmap darkenPixmap(const QPixmap &pixmap) Q_REQUIRED_RESULT;
static inline bool VFuzzyComparePossibleNulls(double p1, double p2) Q_REQUIRED_RESULT;
static inline bool VFuzzyComparePossibleNulls(double p1, double p2)
{
if(qFuzzyIsNull(p1))
{
return qFuzzyIsNull(p2);
}
else if(qFuzzyIsNull(p2))
{
return false;
}
else
{
return qFuzzyCompare(p1, p2);
}
}
#endif // DEF_H

View file

@ -160,7 +160,8 @@ QPointF VToolLineIntersectAxis::FindPoint(const QLineF &axis, const QLineF &line
QLineF::IntersectType intersect = axis.intersect(line, &fPoint);
if (intersect == QLineF::UnboundedIntersection || intersect == QLineF::BoundedIntersection)
{
if(axis.angle() == line.angle() || qAbs(axis.angle() - line.angle()) == 180)
if(VFuzzyComparePossibleNulls(axis.angle(), line.angle())
|| VFuzzyComparePossibleNulls(qAbs(axis.angle() - line.angle()), 180))
{
return QPointF();
}

View file

@ -186,7 +186,8 @@ QPointF VToolTriangle::FindPoint(const QPointF &axisP1, const QPointF &axisP2, c
{
return QPointF();
}
if (axis.angle() == hypotenuse.angle() || qAbs(axis.angle() - hypotenuse.angle()) == 180)
if (VFuzzyComparePossibleNulls(axis.angle(), hypotenuse.angle())
|| VFuzzyComparePossibleNulls(qAbs(axis.angle() - hypotenuse.angle()), 180))
{
return QPointF();
}