summaryrefslogtreecommitdiffstats
path: root/qt-ui/profile/divetooltipitem.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qt-ui/profile/divetooltipitem.cpp')
-rw-r--r--qt-ui/profile/divetooltipitem.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/qt-ui/profile/divetooltipitem.cpp b/qt-ui/profile/divetooltipitem.cpp
index fb8729679..0f7191474 100644
--- a/qt-ui/profile/divetooltipitem.cpp
+++ b/qt-ui/profile/divetooltipitem.cpp
@@ -1,6 +1,8 @@
#include "divetooltipitem.h"
#include "divecartesianaxis.h"
#include "profile.h"
+#include "dive.h"
+#include "membuffer.h"
#include <QPropertyAnimation>
#include <QGraphicsSceneMouseEvent>
#include <QPen>
@@ -39,9 +41,11 @@ void ToolTipItem::refresh(struct graphics_context *gc, QPointF pos)
{
clear();
int time = (pos.x() * gc->maxtime) / gc->maxx;
- char buffer[500];
- get_plot_details(gc, time, buffer, 500);
- addToolTip(QString(buffer));
+ struct membuffer mb = { 0 };
+
+ get_plot_details(gc, time, &mb);
+ addToolTip(QString::fromUtf8(mb.buffer, mb.len));
+ free_buffer(&mb);
QList<QGraphicsItem*> items = scene()->items(pos, Qt::IntersectsItemShape, Qt::DescendingOrder, transform());
Q_FOREACH(QGraphicsItem *item, items) {
@@ -229,9 +233,11 @@ void ToolTipItem::refresh(const QPointF& pos)
{
clear();
int time = timeAxis->valueAt( pos );
- char buffer[500];
- get_plot_details_new(&pInfo, time, buffer, 500);
- addToolTip(QString(buffer));
+ struct membuffer mb = { 0 };
+
+ get_plot_details_new(&pInfo, time, &mb);
+ addToolTip(QString::fromUtf8(mb.buffer, mb.len));
+ free_buffer(&mb);
QList<QGraphicsItem*> items = scene()->items(pos, Qt::IntersectsItemShape, Qt::DescendingOrder, transform());
Q_FOREACH(QGraphicsItem *item, items) {