diff options
author | jaseg <git-bigdata-wsl-arch@jaseg.de> | 2020-12-17 15:43:37 +0100 |
---|---|---|
committer | jaseg <git-bigdata-wsl-arch@jaseg.de> | 2020-12-17 15:43:37 +0100 |
commit | 6a484c615ae3f04873fe41a415277ef6c2c37573 (patch) | |
tree | b2f429eb1baf703463821624691921e1426b7361 /tagscene.cpp | |
parent | c6713d0876ce2d99f912151c9884477606909681 (diff) | |
download | numberator-master.tar.gz numberator-master.tar.bz2 numberator-master.zip |
Diffstat (limited to 'tagscene.cpp')
-rw-r--r-- | tagscene.cpp | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/tagscene.cpp b/tagscene.cpp index c5777e0..a10bd2d 100644 --- a/tagscene.cpp +++ b/tagscene.cpp @@ -90,6 +90,29 @@ void TagScene::selectTag(const Tag &tag) it->setSelected(true); } +void TagScene::setTool(ToolType tool) +{ + abortTool(); + m_tool = tool; + + if (tool == ToolType::TAG_TOOL) { + m_tagToolState = TAG_TOOL_ANCHOR; + + } else if (tool == ToolType::SELECTION_TOOL) { + + } +} + +void TagScene::abortTool() +{ + if (m_tool == ToolType::TAG_TOOL) { + removeItem(m_previewTag); + + } else if (m_tool == ToolType::SELECTION_TOOL) { + + } +} + void TagScene::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) { QGraphicsItem *it = itemAt(event->scenePos(), QTransform()); @@ -111,3 +134,29 @@ void TagScene::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) tagDoubleClicked(tagitem->tag()); } + +void TagScene::mouseMoveEvent(QGraphicsSceneMouseEvent *event) +{ + if (m_tool == ToolType::TAG_TOOL) { + if (m_tagToolState == TAG_TOOL_LABEL) { + Tag t = m_previewTag->tag(); + t.labelPos = event->scenePos(); + m_previewTag->tagUpdated(t); + } + } +} + +void TagScene::mousePressEvent(QGraphicsSceneMouseEvent *event) +{ + if (m_tool == ToolType::TAG_TOOL) { + if (m_tagToolState == TAG_TOOL_ANCHOR) { + m_previewTag->tagUpdated(Tag(m_proj->getNextAutoTagName(), event->scenePos())); + m_tagToolState = TAG_TOOL_LABEL; + + } else { /* TAG_TOOL_LABEL */ + removeItem(m_previewTag); + m_proj->createTag(m_previewTag->tag()); + m_tagToolState = TAG_TOOL_ANCHOR; + } + } +} |