summaryrefslogtreecommitdiff
path: root/tagitem.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tagitem.cpp')
-rw-r--r--tagitem.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/tagitem.cpp b/tagitem.cpp
new file mode 100644
index 0000000..d251428
--- /dev/null
+++ b/tagitem.cpp
@@ -0,0 +1,31 @@
+#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);
+}