1 #include <QPaintEngine>
2 #include <QPaintDevice>
8 TrackInfo::TrackInfo(QObject
*parent
) : QGraphicsScene(parent
)
10 _info
= new InfoItem();
14 void TrackInfo::insert(const QString
&key
, const QString
&value
)
16 _info
->insert(key
, value
);
19 void TrackInfo::plot(QPainter
*painter
, const QRectF
&target
)
21 qreal ratio
= painter
->paintEngine()->paintDevice()->logicalDpiX()
23 QSizeF canvas
= QSizeF(target
.width() / ratio
, target
.height() / ratio
);
24 QSizeF diff
= QSizeF(qAbs(canvas
.width() - sceneRect().width()),
25 qAbs(canvas
.height() - sceneRect().height()));
26 QRectF adj
= sceneRect().adjusted(0, -diff
.height()/2, diff
.width(),
29 render(painter
, target
, adj
);
32 bool TrackInfo::isEmpty() const
34 return _info
->isEmpty();
37 QSizeF
TrackInfo::contentSize() const
39 return sceneRect().size();