#include "qtextlabel.h"
#include <QPainter>
#include <canvasitemfactory.h>
#include <QPaintEvent>

QTextLabel::QTextLabel(CanvasItem *item, QWidget *parent)
	: item(item), QLabel(parent), textWidth(0)
{
}

QTextLabel::~QTextLabel()
{
}

void QTextLabel::paintEvent(QPaintEvent *e)
{
	QFontMetrics fontMetrics(font());
	QPainter painter(this);
    	painter.setRenderHint(QPainter::Antialiasing);

	QPen pen(item->color);
	painter.setPen(pen);
	if (!item->clip.isNull()) {
	    //painter.setClipRect(item->clip);
	    painter.drawText(e->rect(), item->text);
	} else
	    painter.drawText(e->rect(), item->text);
}
