39 lines
817 B
C++
39 lines
817 B
C++
#include "piccodeitem.h"
|
|
|
|
|
|
|
|
PicCodeItem::PicCodeItem(QGraphicsItem *parent, QGraphicsScene *scene, const SourceType type)
|
|
:PicTextItem(parent, scene, type)
|
|
{
|
|
setFlag(QGraphicsItem::ItemIsMovable);
|
|
setFlag(QGraphicsItem::ItemIsSelectable);
|
|
setFlag(QGraphicsItem::ItemIsFocusable);
|
|
setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
|
|
}
|
|
|
|
QVariant PicCodeItem::source()
|
|
{
|
|
return imagePath;
|
|
}
|
|
|
|
void PicCodeItem::setSource(QVariant var)
|
|
{
|
|
imagePath = var.toString();
|
|
applyModify();
|
|
}
|
|
|
|
QImage PicCodeItem::itemImage()
|
|
{
|
|
return QImage(imagePath);
|
|
}
|
|
|
|
void PicCodeItem::setCustomAttrs(const QXmlStreamAttributes &attrs)
|
|
{
|
|
imagePath = attrs.value("CodeImage").toString();
|
|
}
|
|
|
|
void PicCodeItem::saveCustomAttrs(QXmlStreamAttributes &attrs)
|
|
{
|
|
attrs.append("CodeImage", imagePath);
|
|
}
|