profile: use C++ string functions to format plot data

This may appear a bit ominous, as it doesn't generate a string,
but a vector of strings (one for each line). However, that is
in preparation for the QtQuickification of the profile, where
the text-items take such a list.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-03-10 23:11:23 +01:00 committed by bstoeger
parent 422f693f5b
commit ae299d5e66
4 changed files with 149 additions and 158 deletions

View file

@ -93,7 +93,6 @@ void RulerItem2::settingsChanged(bool value)
void RulerItem2::recalculate()
{
char buffer[500];
QPointF tmp;
QFont font;
QFontMetrics fm(font);
@ -112,8 +111,13 @@ void RulerItem2::recalculate()
}
QLineF line(startPoint, endPoint);
setLine(line);
compare_samples(dive, pInfo, source->idx, dest->idx, buffer, 500, 1);
text = QString(buffer);
QString text;
for (const std::string &s: compare_samples(dive, pInfo, source->idx, dest->idx, 1)) {
if (!text.isEmpty())
text += '\n';
text += QString::fromStdString(s);
}
// draw text
QGraphicsView *view = scene()->views().first();