diff options
-rw-r--r-- | qt-ui/profile/divetooltipitem.cpp | 36 | ||||
-rw-r--r-- | qt-ui/profile/divetooltipitem.h | 2 |
2 files changed, 19 insertions, 19 deletions
diff --git a/qt-ui/profile/divetooltipitem.cpp b/qt-ui/profile/divetooltipitem.cpp index 7f7627309..dbef866c5 100644 --- a/qt-ui/profile/divetooltipitem.cpp +++ b/qt-ui/profile/divetooltipitem.cpp @@ -19,7 +19,7 @@ #include "display.h" #endif -void ToolTipItem::addToolTip(const QString &toolTip, const QIcon &icon, const QPixmap *pixmap) +void ToolTipItem::addToolTip(const QString &toolTip, const QIcon &icon, const QPixmap& pixmap) { const IconMetrics& iconMetrics = defaultIconMetrics(); @@ -32,8 +32,8 @@ void ToolTipItem::addToolTip(const QString &toolTip, const QIcon &icon, const QP iconItem = new QGraphicsPixmapItem(icon.pixmap(iconMetrics.sz_small, iconMetrics.sz_small), this); iconItem->setPos(iconMetrics.spacing, yValue); } else { - if (pixmap && !pixmap->isNull()) { - pixmapItem = new QGraphicsPixmapItem(*pixmap, this); + if (!pixmap.isNull()) { + pixmapItem = new QGraphicsPixmapItem(pixmap, this); pixmapItem->setPos(iconMetrics.spacing, yValue); } } @@ -232,8 +232,8 @@ void ToolTipItem::refresh(const QPointF &pos) { int i; struct plot_data *entry; - static QPixmap *tissues = new QPixmap(16,60); - static QPainter *painter = new QPainter(tissues); + static QPixmap tissues(16,60); + static QPainter painter(&tissues); int time = timeAxis->valueAt(pos); if (time == lastTime) return; @@ -244,21 +244,21 @@ void ToolTipItem::refresh(const QPointF &pos) entry = get_plot_details_new(&pInfo, time, &mb); if (entry) { - tissues->fill(); - painter->setPen(QColor(0, 0, 0, 0)); - painter->setBrush(QColor(LIMENADE1)); - painter->drawRect(0, 10 + (100 - AMB_PERCENTAGE) / 2, 16, AMB_PERCENTAGE / 2); - painter->setBrush(QColor(SPRINGWOOD1)); - painter->drawRect(0, 10, 16, (100 - AMB_PERCENTAGE) / 2); - painter->setBrush(QColor("Red")); - painter->drawRect(0,0,16,10); - painter->setPen(QColor(0, 0, 0, 255)); - 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, + tissues.fill(); + painter.setPen(QColor(0, 0, 0, 0)); + painter.setBrush(QColor(LIMENADE1)); + painter.drawRect(0, 10 + (100 - AMB_PERCENTAGE) / 2, 16, AMB_PERCENTAGE / 2); + painter.setBrush(QColor(SPRINGWOOD1)); + painter.drawRect(0, 10, 16, (100 - AMB_PERCENTAGE) / 2); + painter.setBrush(QColor(Qt::red)); + painter.drawRect(0,0,16,10); + painter.setPen(QColor(0, 0, 0, 255)); + 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->setPen(QColor(0, 0, 0, 127)); + painter.setPen(QColor(0, 0, 0, 127)); for (i=0; i<16; i++) { - painter->drawLine(i, 60, i, 60 - entry->percentages[i] / 2); + painter.drawLine(i, 60, i, 60 - entry->percentages[i] / 2); } addToolTip(QString::fromUtf8(mb.buffer, mb.len),QIcon(), tissues); } diff --git a/qt-ui/profile/divetooltipitem.h b/qt-ui/profile/divetooltipitem.h index 51e8eccd1..bb3ad84d3 100644 --- a/qt-ui/profile/divetooltipitem.h +++ b/qt-ui/profile/divetooltipitem.h @@ -34,7 +34,7 @@ public: void collapse(); void expand(); void clear(); - void addToolTip(const QString &toolTip, const QIcon &icon = QIcon(), const QPixmap *pixmap = NULL); + void addToolTip(const QString &toolTip, const QIcon &icon = QIcon(), const QPixmap &pixmap = QPixmap()); void refresh(const QPointF &pos); bool isExpanded() const; void persistPos(); |