From 0afe9ca6bf53da111e445d2aea7cfc94e7e3c601 Mon Sep 17 00:00:00 2001 From: jaseg Date: Sun, 9 Aug 2020 17:12:14 +0200 Subject: db backend: mostly feature-complete --- tagitem.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 tagitem.cpp (limited to 'tagitem.cpp') 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); +} -- cgit