4 #include "gearratiographitem.h"
7 GearRatioGraphItem::GearRatioGraphItem(const Graph
&graph
, GraphType type
,
8 int width
, const QColor
&color
, QGraphicsItem
*parent
)
9 : GraphItem(graph
, type
, width
, color
, Qt::SolidLine
, parent
)
11 for (int i
= 0; i
< graph
.size(); i
++) {
12 const GraphSegment
&segment
= graph
.at(i
);
13 for (int j
= 1; j
< segment
.size(); j
++) {
14 qreal dx
= segment
.at(j
).s() - segment
.at(j
-1).s();
15 _map
.insert(segment
.at(j
).y(), _map
.value(segment
.at(j
).y()) + dx
);
19 qreal key
= NAN
, val
= NAN
;
20 for (QMap
<qreal
, qreal
>::const_iterator it
= _map
.constBegin();
21 it
!= _map
.constEnd(); ++it
) {
22 if (std::isnan(val
) || it
.value() > val
) {
30 ToolTip
GearRatioGraphItem::info() const
33 QLocale
l(QLocale::system());
35 tt
.insert(tr("Minimum"), l
.toString(min(), 'f', 2));
36 tt
.insert(tr("Maximum"), l
.toString(max(), 'f', 2));
37 tt
.insert(tr("Most used"), l
.toString(top(), 'f', 2));