##// END OF EJS Templates
Better way to enable features to user. Do less, but expose signals to user and allow user to descide what to do.
Better way to enable features to user. Do less, but expose signals to user and allow user to descide what to do.

File last commit:

r425:85842e6c8dba
r425:85842e6c8dba
Show More
barvalue.cpp
66 lines | 1.0 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)
{
setVisible(false);
}
void BarValue::setValueString(QString str)
{
mValueString = str;
}
QString BarValue::valueString()
{
return mValueString;
}
void BarValue::setPen(const QPen& pen)
{
mPen = pen;
}
const QPen& BarValue::pen()
{
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)
{
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