From 0b6cbe0f79d7707297211850963323eb77d21c20 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Wed, 14 May 2014 22:27:26 -0300 Subject: Code Cleanup: use qMin instad of if( min ) setMin else setMax. silly code cleanup. Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- qt-ui/profile/diveprofileitem.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'qt-ui/profile') diff --git a/qt-ui/profile/diveprofileitem.cpp b/qt-ui/profile/diveprofileitem.cpp index 6f4c2a599..58c4a868b 100644 --- a/qt-ui/profile/diveprofileitem.cpp +++ b/qt-ui/profile/diveprofileitem.cpp @@ -156,10 +156,8 @@ void DiveProfileItem::modelDataChanged(const QModelIndex &topLeft, const QModelI if (!entry->in_deco) { /* not in deco implies this is a safety stop, no ceiling */ p.append(QPointF(hAxis->posAtValue(entry->sec), vAxis->posAtValue(0))); - } else if (entry->stopdepth < entry->depth) { - p.append(QPointF(hAxis->posAtValue(entry->sec), vAxis->posAtValue(entry->stopdepth))); - } else { - p.append(QPointF(hAxis->posAtValue(entry->sec), vAxis->posAtValue(entry->depth))); + } else{ + p.append(QPointF(hAxis->posAtValue(entry->sec), vAxis->posAtValue(qMin(entry->stopdepth, entry->depth)))); } } setPolygon(p); @@ -562,11 +560,7 @@ void DiveReportedCeiling::modelDataChanged(const QModelIndex &topLeft, const QMo plot_data *entry = dataModel->data().entry; for (int i = 0, count = dataModel->rowCount(); i < count; i++, entry++) { if (entry->in_deco && entry->stopdepth) { - if (entry->stopdepth < entry->depth) { - p.append(QPointF(hAxis->posAtValue(entry->sec), vAxis->posAtValue(entry->stopdepth))); - } else { - p.append(QPointF(hAxis->posAtValue(entry->sec), vAxis->posAtValue(entry->depth))); - } + p.append(QPointF(hAxis->posAtValue(entry->sec), vAxis->posAtValue(qMin(entry->stopdepth, entry->depth)))); } else { p.append(QPointF(hAxis->posAtValue(entry->sec), vAxis->posAtValue(0))); } -- cgit v1.2.3-70-g09d2