2016-05-22 11:54:27 +02:00
|
|
|
#include <QPaintEngine>
|
|
|
|
#include <QPaintDevice>
|
2016-05-12 09:03:05 +02:00
|
|
|
#include "infoitem.h"
|
|
|
|
#include "trackinfo.h"
|
|
|
|
|
2016-05-22 11:54:27 +02:00
|
|
|
|
2016-05-12 09:03:05 +02:00
|
|
|
TrackInfo::TrackInfo(QObject *parent) : QGraphicsScene(parent)
|
|
|
|
{
|
|
|
|
_info = new InfoItem();
|
|
|
|
addItem(_info);
|
|
|
|
}
|
|
|
|
|
|
|
|
void TrackInfo::insert(const QString &key, const QString &value)
|
|
|
|
{
|
|
|
|
_info->insert(key, value);
|
|
|
|
}
|
|
|
|
|
2017-08-31 16:28:37 +02:00
|
|
|
void TrackInfo::plot(QPainter *painter, const QRectF &target, qreal scale)
|
2016-05-12 09:03:05 +02:00
|
|
|
{
|
2017-08-31 16:28:37 +02:00
|
|
|
QSizeF canvas = QSizeF(target.width() / scale, target.height() / scale);
|
2016-05-22 11:54:27 +02:00
|
|
|
QSizeF diff = QSizeF(qAbs(canvas.width() - sceneRect().width()),
|
|
|
|
qAbs(canvas.height() - sceneRect().height()));
|
|
|
|
QRectF adj = sceneRect().adjusted(0, -diff.height()/2, diff.width(),
|
|
|
|
diff.height()/2);
|
|
|
|
|
|
|
|
render(painter, target, adj);
|
2016-05-12 09:03:05 +02:00
|
|
|
}
|
2016-05-21 16:10:24 +02:00
|
|
|
|
2016-05-22 15:47:23 +02:00
|
|
|
bool TrackInfo::isEmpty() const
|
2016-05-21 16:10:24 +02:00
|
|
|
{
|
|
|
|
return _info->isEmpty();
|
|
|
|
}
|
2016-05-22 15:47:23 +02:00
|
|
|
|
|
|
|
QSizeF TrackInfo::contentSize() const
|
|
|
|
{
|
|
|
|
return sceneRect().size();
|
|
|
|
}
|