18 #ifndef SCALEBARITEM_H
19 #define SCALEBARITEM_H
21 #include <QGraphicsItem>
22 #include <QTextDocument>
33 enum {Type = UserType + ScaleBar
50 ScaleBarItem(
double x0 = 0,
double y0 = 0,
unsigned color = 0,
51 QGraphicsItem* parent = 0,
double length = 1,
52 const QString& text =
"",
bool visible =
true,
53 bool vertical =
false,
double relSize = 1);
65 ScaleBarItem(
const KConfigGroup* plo,
unsigned color = 0,
66 QGraphicsItem* parent = 0);
70 virtual QRectF boundingRect()
const;
72 inline double length()
const {
return m_length; };
74 virtual void paint(QPainter* painter,
const QStyleOptionGraphicsItem* option,
82 inline void setLength(
double length) { m_length = length; };
87 void setProperties(
const QTransform& m);
94 inline void setText(
const QString& text) { m_text = text; };
99 inline void setVertical(
bool vertical) { m_vertical = vertical; };
101 inline QString text()
const {
return m_text; };
103 virtual int type()
const {
return Type; };
107 inline bool vertical()
const {
return m_vertical; };
118 virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent* event);
120 void setProperties();
122 QRectF textRect()
const;
124 double m_length, l2, wRel;