##// END OF EJS Templates
minor. compilation fix
Michal Klocek -
r116:999187e32a9b
parent child
Show More
@@ -1,42 +1,42
1 #include "barlabel_p.h"
1 #include "barlabel_p.h"
2 #include <QPainter>
2 #include <QPainter>
3 QTCOMMERCIALCHART_BEGIN_NAMESPACE
3 QTCOMMERCIALCHART_BEGIN_NAMESPACE
4
4
5 BarLabel::BarLabel(QGraphicsItem* parent) : ChartItem(parent)
5 BarLabel::BarLabel(QGraphicsItem* parent) : ChartItem(parent)
6 {
6 {
7 }
7 }
8
8
9
9
10 void BarLabel::set(QString label)
10 void BarLabel::set(QString label)
11 {
11 {
12 mLabel = label;
12 mLabel = label;
13 }
13 }
14
14
15 void BarLabel::setPos(qreal x, qreal y)
15 void BarLabel::setPos(qreal x, qreal y)
16 {
16 {
17 mXpos = x;
17 mXpos = x;
18 mYpos = y;
18 mYpos = y;
19 }
19 }
20
20
21 void BarLabel::setSize(const QSize &size)
21 void BarLabel::setSize(const QSizeF &size)
22 {
22 {
23 mSize = size;
23 mSize = size;
24 }
24 }
25
25
26 void BarLabel::setPlotDomain(const PlotDomain& data)
26 void BarLabel::setPlotDomain(const PlotDomain& data)
27 {
27 {
28 mDomain = data;
28 mDomain = data;
29 }
29 }
30
30
31 void BarLabel::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
31 void BarLabel::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
32 {
32 {
33 painter->drawText(boundingRect(),mLabel);
33 painter->drawText(boundingRect(),mLabel);
34 }
34 }
35
35
36 QRectF BarLabel::boundingRect() const
36 QRectF BarLabel::boundingRect() const
37 {
37 {
38 QRectF r(mXpos, mYpos, mXpos + mSize.width(), mYpos + mSize.height());
38 QRectF r(mXpos, mYpos, mXpos + mSize.width(), mYpos + mSize.height());
39 return r;
39 return r;
40 }
40 }
41
41
42 QTCOMMERCIALCHART_END_NAMESPACE
42 QTCOMMERCIALCHART_END_NAMESPACE
@@ -1,36 +1,36
1 #ifndef BARLABEL_H
1 #ifndef BARLABEL_H
2 #define BARLABEL_H
2 #define BARLABEL_H
3
3
4 #include "chartitem_p.h"
4 #include "chartitem_p.h"
5
5
6 QTCOMMERCIALCHART_BEGIN_NAMESPACE
6 QTCOMMERCIALCHART_BEGIN_NAMESPACE
7
7
8 class BarLabel : public ChartItem
8 class BarLabel : public ChartItem
9 {
9 {
10 public:
10 public:
11 BarLabel(QGraphicsItem* parent = 0);
11 BarLabel(QGraphicsItem* parent = 0);
12
12
13 void set(QString label);
13 void set(QString label);
14 void setPos(qreal x, qreal y);
14 void setPos(qreal x, qreal y);
15
15
16 // From ChartItem
16 // From ChartItem
17 void setSize(const QSize &size);
17 void setSize(const QSizeF &size);
18 void setPlotDomain(const PlotDomain& data);
18 void setPlotDomain(const PlotDomain& data);
19
19
20 // From QGraphicsItem
20 // From QGraphicsItem
21 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
21 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
22 QRectF boundingRect() const;
22 QRectF boundingRect() const;
23
23
24 private:
24 private:
25
25
26 PlotDomain mDomain;
26 PlotDomain mDomain;
27 QSize mSize;
27 QSizeF mSize;
28 QString mLabel;
28 QString mLabel;
29 qreal mXpos;
29 qreal mXpos;
30 qreal mYpos;
30 qreal mYpos;
31
31
32 };
32 };
33
33
34 QTCOMMERCIALCHART_END_NAMESPACE
34 QTCOMMERCIALCHART_END_NAMESPACE
35
35
36 #endif // BARLABEL_H
36 #endif // BARLABEL_H
General Comments 0
You need to be logged in to leave comments. Login now