#include "moneyitem.h"
#include <QPainter>
#include <QString>

MoneyItem::MoneyItem(QGraphicsItem *parent) : QGraphicsItem(parent)
{
    money = 0;
    br = QRectF(0,0,100,50);
    pen.setColor(Qt::yellow);
    pen.setWidthF(2.5);
}


void MoneyItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
{
    painter->setPen(pen);
    if (str.isEmpty()) painter->drawText(br,Qt::AlignLeft, "+" + QString::number(money) + "$");
    else painter->drawText(br,Qt::AlignLeft, str);
}


QRectF MoneyItem::boundingRect() const
{
    return br;
}
