##// END OF EJS Templates
model delegate for bar series. updated examples
model delegate for bar series. updated examples

File last commit:

r149:23a271e217e1
r161:cc2daab2560d
Show More
barlabel.cpp
37 lines | 659 B | text/x-c | CppLexer
sauimone
added labels to barcharts
r114 #include "barlabel_p.h"
#include <QPainter>
QTCOMMERCIALCHART_BEGIN_NAMESPACE
BarLabel::BarLabel(QGraphicsItem* parent) : ChartItem(parent)
{
}
void BarLabel::set(QString label)
{
mLabel = label;
}
void BarLabel::setPos(qreal x, qreal y)
{
mXpos = x;
mYpos = y;
}
Michal Klocek
minor. compilation fix
r116 void BarLabel::setSize(const QSizeF &size)
sauimone
added labels to barcharts
r114 {
mSize = size;
}
void BarLabel::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
painter->drawText(boundingRect(),mLabel);
}
QRectF BarLabel::boundingRect() const
{
QRectF r(mXpos, mYpos, mXpos + mSize.width(), mYpos + mSize.height());
return r;
}
QTCOMMERCIALCHART_END_NAMESPACE