mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 20:33:24 +00:00
Use our macro for FP comparisons
I think that catches all the ones we missed (thanks clang -Wfloat-equal). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
2bd2df0349
commit
6ea6a4305c
3 changed files with 8 additions and 8 deletions
|
@ -246,7 +246,7 @@ void DivePlannerGraphics::keyLeftAction()
|
|||
double xpos = timeLine->posAtValue((dp.time - 60) / 60);
|
||||
bool nextStep = false;
|
||||
Q_FOREACH(DiveHandler *h, handles) {
|
||||
if (h->pos().x() == xpos) {
|
||||
if (IS_FP_SAME(h->pos().x(), xpos)) {
|
||||
nextStep = true;
|
||||
break;
|
||||
}
|
||||
|
@ -274,7 +274,7 @@ void DivePlannerGraphics::keyRightAction()
|
|||
double xpos = timeLine->posAtValue((dp.time + 60) / 60);
|
||||
bool nextStep = false;
|
||||
Q_FOREACH(DiveHandler *h, handles) {
|
||||
if (h->pos().x() == xpos) {
|
||||
if (IS_FP_SAME(h->pos().x(), xpos)) {
|
||||
nextStep = true;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ double DiveCartesianAxis::tickSize() const
|
|||
|
||||
void DiveCartesianAxis::setMaximum(double maximum)
|
||||
{
|
||||
if (max == maximum)
|
||||
if (IS_FP_SAME(max, maximum))
|
||||
return;
|
||||
max = maximum;
|
||||
emit maxChanged();
|
||||
|
@ -50,7 +50,7 @@ void DiveCartesianAxis::setMaximum(double maximum)
|
|||
|
||||
void DiveCartesianAxis::setMinimum(double minimum)
|
||||
{
|
||||
if (min == minimum)
|
||||
if (IS_FP_SAME(min, minimum))
|
||||
return;
|
||||
min = minimum;
|
||||
}
|
||||
|
@ -348,7 +348,7 @@ QLineF DiveCartesianPlane::horizontalLine() const
|
|||
|
||||
void DiveCartesianPlane::setHorizontalLine(QLineF line)
|
||||
{
|
||||
if ( horizontalSize == line.length())
|
||||
if (IS_FP_SAME(horizontalSize, line.length()))
|
||||
return;
|
||||
horizontalSize = line.length();
|
||||
setup();
|
||||
|
@ -356,7 +356,7 @@ void DiveCartesianPlane::setHorizontalLine(QLineF line)
|
|||
|
||||
void DiveCartesianPlane::setVerticalLine(QLineF line)
|
||||
{
|
||||
if (verticalSize == line.length())
|
||||
if (IS_FP_SAME(verticalSize, line.length()))
|
||||
return;
|
||||
verticalSize = line.length();
|
||||
setup();
|
||||
|
@ -439,7 +439,7 @@ void PartialGasPressureAxis::preferencesChanged()
|
|||
max = model->po2Max();
|
||||
|
||||
qreal pp = floor(max * 10.0) / 10.0 + 0.2;
|
||||
if (maximum() == pp)
|
||||
if (IS_FP_SAME(maximum(), pp))
|
||||
return;
|
||||
|
||||
setMaximum(pp);
|
||||
|
|
|
@ -571,7 +571,7 @@ void ProfileGraphicsView::plot_pp_text()
|
|||
QGraphicsLineItem *item = new QGraphicsLineItem(SCALEGC(0, m), SCALEGC(hpos, m));
|
||||
QPen pen(defaultPen);
|
||||
pen.setColor(c);
|
||||
if ( QString::number(m).toDouble() != QString::number(m).toInt()) {
|
||||
if ( IS_FP_SAME(QString::number(m).toDouble(), QString::number(m).toInt())) {
|
||||
pen.setStyle(Qt::DashLine);
|
||||
pen.setWidthF(1.2);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue