31 lines
810 B
C++
31 lines
810 B
C++
#include "tagitem.h"
|
|
|
|
TagItem::TagItem(const Tag &tag)
|
|
: valid(true)
|
|
{
|
|
setFlags(QGraphicsItem::ItemIsMovable
|
|
| QGraphicsItem::ItemIsSelectable
|
|
| QGraphicsItem::ItemIsFocusable);
|
|
/* TODO text_it.setFlags(QGraphicsItem::ItemIgnoresTransformations);
|
|
*/
|
|
tagUpdated(tag);
|
|
}
|
|
|
|
void TagItem::tagUpdated(const Tag &tag)
|
|
{
|
|
m_tag = tag;
|
|
setText(tag.name);
|
|
setPos(tag.anchor);
|
|
}
|
|
|
|
QVariant TagItem::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value)
|
|
{
|
|
if (change == ItemPositionChange) {
|
|
/* https://gist.github.com/csukuangfj/c2a06416062bec9ed99eddd705c21275#file-qgraphicsscenetest-cpp-L90
|
|
*
|
|
*/
|
|
/* FIXME */
|
|
|
|
}
|
|
return QGraphicsItem::itemChange(change, value);
|
|
}
|