summaryrefslogtreecommitdiffstats
path: root/profile-widget
diff options
context:
space:
mode:
Diffstat (limited to 'profile-widget')
-rw-r--r--profile-widget/divecartesianaxis.cpp4
-rw-r--r--profile-widget/diveprofileitem.cpp2
-rw-r--r--profile-widget/divetextitem.cpp2
-rw-r--r--profile-widget/divetooltipitem.cpp10
-rw-r--r--profile-widget/profilewidget2.cpp14
-rw-r--r--profile-widget/ruleritem.cpp2
6 files changed, 17 insertions, 17 deletions
diff --git a/profile-widget/divecartesianaxis.cpp b/profile-widget/divecartesianaxis.cpp
index 4270d4b89..df27f90d4 100644
--- a/profile-widget/divecartesianaxis.cpp
+++ b/profile-widget/divecartesianaxis.cpp
@@ -369,7 +369,7 @@ QString DepthAxis::textForValue(double value)
{
if (value == 0)
return QString();
- return get_depth_string(value, false, false);
+ return get_depth_string(lrint(value), false, false);
}
QColor DepthAxis::colorForValue(double value)
@@ -409,7 +409,7 @@ QColor TimeAxis::colorForValue(double value)
QString TimeAxis::textForValue(double value)
{
- int nr = value / 60;
+ int nr = lrint(value) / 60;
if (maximum() < 600)
return QString("%1:%2").arg(nr).arg((int)value % 60, 2, 10, QChar('0'));
return QString::number(nr);
diff --git a/profile-widget/diveprofileitem.cpp b/profile-widget/diveprofileitem.cpp
index 7caa8ce39..ad3bb151e 100644
--- a/profile-widget/diveprofileitem.cpp
+++ b/profile-widget/diveprofileitem.cpp
@@ -667,7 +667,7 @@ void DiveMeanDepthItem::createTextItem() {
texts.clear();
int decimals;
const char *unitText;
- double d = get_depth_units(lastRunningSum, &decimals, &unitText);
+ double d = get_depth_units(lrint(lastRunningSum), &decimals, &unitText);
DiveTextItem *text = new DiveTextItem(this);
text->setAlignment(Qt::AlignRight | Qt::AlignTop);
text->setBrush(getColor(TEMP_TEXT));
diff --git a/profile-widget/divetextitem.cpp b/profile-widget/divetextitem.cpp
index 21a72624d..c64f231c2 100644
--- a/profile-widget/divetextitem.cpp
+++ b/profile-widget/divetextitem.cpp
@@ -88,7 +88,7 @@ void DiveTextItem::updateText()
if ((size = fnt.pixelSize()) > 0) {
// set in pixels - so the scale factor may not make a difference if it's too close to 1
size *= scale * printScale;
- fnt.setPixelSize(size);
+ fnt.setPixelSize(lrint(size));
} else {
size = fnt.pointSizeF();
size *= scale * printScale;
diff --git a/profile-widget/divetooltipitem.cpp b/profile-widget/divetooltipitem.cpp
index 4b422fe81..36b1a9b91 100644
--- a/profile-widget/divetooltipitem.cpp
+++ b/profile-widget/divetooltipitem.cpp
@@ -108,7 +108,7 @@ void ToolTipItem::expand()
width = title->boundingRect().width() + sp2;
// clip the height
if (entryToolTip.first) {
- const int minH = entryToolTip.first->y() + entryToolTip.first->pixmap().height() + sp2;
+ const int minH = lrint(entryToolTip.first->y() + entryToolTip.first->pixmap().height() + sp2);
if (height < minH)
height = minH;
} else if (height < iconMetrics.sz_small) {
@@ -245,7 +245,7 @@ void ToolTipItem::refresh(const QPointF &pos)
return;
refreshTime.start();
- int time = timeAxis->valueAt(pos);
+ int time = lrint(timeAxis->valueAt(pos));
if (time == lastTime)
return;
@@ -269,9 +269,9 @@ void ToolTipItem::refresh(const QPointF &pos)
painter.setPen(QColor(0, 0, 0, 255));
if (decoMode() == BUEHLMANN)
- painter.drawLine(0, 60 - entry->gfline / 2, 16, 60 - entry->gfline / 2);
- painter.drawLine(0, 60 - AMB_PERCENTAGE * (entry->pressures.n2 + entry->pressures.he) / entry->ambpressure / 2,
- 16, 60 - AMB_PERCENTAGE * (entry->pressures.n2 + entry->pressures.he) / entry->ambpressure /2);
+ painter.drawLine(0, lrint(60 - entry->gfline / 2), 16, lrint(60 - entry->gfline / 2));
+ painter.drawLine(0, lrint(60 - AMB_PERCENTAGE * (entry->pressures.n2 + entry->pressures.he) / entry->ambpressure / 2),
+ 16, lrint(60 - AMB_PERCENTAGE * (entry->pressures.n2 + entry->pressures.he) / entry->ambpressure /2));
painter.setPen(QColor(0, 0, 0, 127));
for (int i=0; i<16; i++) {
painter.drawLine(i, 60, i, 60 - entry->percentages[i] / 2);
diff --git a/profile-widget/profilewidget2.cpp b/profile-widget/profilewidget2.cpp
index 5a48e3a5f..fe8dd9fe3 100644
--- a/profile-widget/profilewidget2.cpp
+++ b/profile-widget/profilewidget2.cpp
@@ -975,8 +975,8 @@ void ProfileWidget2::scrollViewTo(const QPoint &pos)
QScrollBar *hs = horizontalScrollBar();
const qreal yRat = (qreal)pos.y() / viewport()->height();
const qreal xRat = (qreal)pos.x() / viewport()->width();
- vs->setValue(yRat * vs->maximum());
- hs->setValue(xRat * hs->maximum());
+ vs->setValue(lrint(yRat * vs->maximum()));
+ hs->setValue(lrint(xRat * hs->maximum()));
}
void ProfileWidget2::mouseMoveEvent(QMouseEvent *event)
@@ -1312,7 +1312,7 @@ bool ProfileWidget2::isAddOrPlanner()
struct plot_data *ProfileWidget2::getEntryFromPos(QPointF pos)
{
// find the time stamp corresponding to the mouse position
- int seconds = timeAxis->valueAt(pos);
+ int seconds = lrint(timeAxis->valueAt(pos));
struct plot_data *entry = NULL;
for (int i = 0; i < plotInfo.nr; i++) {
@@ -1540,7 +1540,7 @@ void ProfileWidget2::addBookmark()
{
QAction *action = qobject_cast<QAction *>(sender());
QPointF scenePos = mapToScene(mapFromGlobal(action->data().toPoint()));
- add_event(current_dc, timeAxis->valueAt(scenePos), SAMPLE_EVENT_BOOKMARK, 0, 0, "bookmark");
+ add_event(current_dc, lrint(timeAxis->valueAt(scenePos)), SAMPLE_EVENT_BOOKMARK, 0, 0, "bookmark");
invalidate_dive_cache(current_dive);
mark_divelist_changed(true);
replot();
@@ -1550,7 +1550,7 @@ void ProfileWidget2::addSetpointChange()
{
QAction *action = qobject_cast<QAction *>(sender());
QPointF scenePos = mapToScene(mapFromGlobal(action->data().toPoint()));
- SetpointDialog::instance()->setpointData(current_dc, timeAxis->valueAt(scenePos));
+ SetpointDialog::instance()->setpointData(current_dc, lrint(timeAxis->valueAt(scenePos)));
SetpointDialog::instance()->show();
}
@@ -1783,7 +1783,7 @@ void ProfileWidget2::recreatePlannedDive()
DiveHandler *activeHandler = qobject_cast<DiveHandler *>(sender());
DivePlannerPointsModel *plannerModel = DivePlannerPointsModel::instance();
int index = fixHandlerIndex(activeHandler);
- int mintime = 0, maxtime = (timeAxis->maximum() + 10) * 60;
+ int mintime = 0, maxtime = lrint((timeAxis->maximum() + 10) * 60);
if (index > 0)
mintime = plannerModel->at(index - 1).time;
if (index < plannerModel->size() - 1)
@@ -1992,7 +1992,7 @@ void ProfileWidget2::dropEvent(QDropEvent *event)
FOR_EACH_PICTURE(current_dive) {
if (QString(picture->filename) == filename) {
- picture->offset.seconds = timeAxis->valueAt(mappedPos);
+ picture->offset.seconds = lrint(timeAxis->valueAt(mappedPos));
mark_divelist_changed(true);
break;
}
diff --git a/profile-widget/ruleritem.cpp b/profile-widget/ruleritem.cpp
index c5712de54..dc2c308e3 100644
--- a/profile-widget/ruleritem.cpp
+++ b/profile-widget/ruleritem.cpp
@@ -127,7 +127,7 @@ void RulerItem2::recalculate()
const qreal diff = begin.x() + textItem->boundingRect().width();
// clamp so that the text doesn't go out of the screen to the right
if (diff > view->width()) {
- begin.setX(begin.x() - (diff - view->width()));
+ begin.setX(lrint(begin.x() - (diff - view->width())));
tgtX = mapFromScene(view->mapToScene(begin)).x();
}
// always show the text bellow the lowest of the start and end points