##// END OF EJS Templates
build fix.
build fix.

File last commit:

r737:e81beeb51921
r744:4a4cc4b22b41
Show More
barvalue.cpp
73 lines | 1.1 KiB | text/x-c | CppLexer
#include "barvalue_p.h"
#include <QPainter>
#include <QPen>
QTCOMMERCIALCHART_BEGIN_NAMESPACE
BarValue::BarValue(QBarSet &set, QGraphicsItem *parent)
: QGraphicsObject(parent),
mBarSet(set),
mXpos(0),
mYpos(0),
mWidth(0),
mHeight(0)
{
setVisible(false);
}
void BarValue::setValueString(QString str)
{
mValueString = str;
}
QString BarValue::valueString()
{
return mValueString;
}
void BarValue::setPen(const QPen pen)
{
mPen = pen;
}
QPen BarValue::pen() const
{
return mPen;
}
void BarValue::resize(qreal w, qreal h)
{
mWidth = w;
mHeight = h;
}
void BarValue::setPos(qreal x, qreal y)
{
mXpos = x;
mYpos = y;
}
void BarValue::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
Q_UNUSED(option)
Q_UNUSED(widget)
if (isVisible()) {
painter->setPen(mPen);
painter->drawText(boundingRect(), mValueString);
}
}
QRectF BarValue::boundingRect() const
{
QRectF r(mXpos, mYpos, mWidth, mHeight);
return r;
}
void BarValue::toggleVisible()
{
setVisible(!isVisible());
}
#include "moc_barvalue_p.cpp"
QTCOMMERCIALCHART_END_NAMESPACE