##// END OF EJS Templates
barcharts: added legend to model. added signals for hover events (for tooltip). updated examples
barcharts: added legend to model. added signals for hover events (for tooltip). updated examples

File last commit:

r273:108ca5a00d74
r280:9b4c1980ee18
Show More
barlabel.cpp
36 lines | 642 B | text/x-c | CppLexer
#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;
}
void BarLabel::setSize(const QSizeF &size)
{
mSize = size;
}
void BarLabel::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
painter->drawText(boundingRect(),mLabel);
}
QRectF BarLabel::boundingRect() const
{
QRectF r(mXpos, mYpos, mSize.width(), mSize.height());
return r;
}
QTCOMMERCIALCHART_END_NAMESPACE