diff options
Diffstat (limited to 'Swift/QtUI')
-rw-r--r-- | Swift/QtUI/Whiteboard/GView.cpp | 5 | ||||
-rw-r--r-- | Swift/QtUI/Whiteboard/GView.h | 1 | ||||
-rw-r--r-- | Swift/QtUI/Whiteboard/WhiteboardElementDrawingVisitor.h | 2 |
3 files changed, 7 insertions, 1 deletions
diff --git a/Swift/QtUI/Whiteboard/GView.cpp b/Swift/QtUI/Whiteboard/GView.cpp index a450808..588f369 100644 --- a/Swift/QtUI/Whiteboard/GView.cpp +++ b/Swift/QtUI/Whiteboard/GView.cpp @@ -50,6 +50,11 @@ namespace Swift { return items_.value(id); } + void GView::addItem(QGraphicsItem* item, QString id) { + scene()->addItem(item); + items_.insert(id, item); + } + void GView::mouseMoveEvent(QMouseEvent* event) { if (!mousePressed) { diff --git a/Swift/QtUI/Whiteboard/GView.h b/Swift/QtUI/Whiteboard/GView.h index 1a4dc42..8b416a1 100644 --- a/Swift/QtUI/Whiteboard/GView.h +++ b/Swift/QtUI/Whiteboard/GView.h @@ -32,6 +32,7 @@ namespace Swift { void mousePressEvent(QMouseEvent* event); void mouseReleaseEvent(QMouseEvent* event); QGraphicsItem* getItem(const QString id) const; + void addItem(QGraphicsItem* item, QString id); public slots: void moveUpSelectedItem(); diff --git a/Swift/QtUI/Whiteboard/WhiteboardElementDrawingVisitor.h b/Swift/QtUI/Whiteboard/WhiteboardElementDrawingVisitor.h index 214ea10..f3d2526 100644 --- a/Swift/QtUI/Whiteboard/WhiteboardElementDrawingVisitor.h +++ b/Swift/QtUI/Whiteboard/WhiteboardElementDrawingVisitor.h @@ -74,7 +74,7 @@ namespace Swift { brush.setColor(QColor(brushColor.getRed(), brushColor.getGreen(), brushColor.getBlue(), brushColor.getAlpha())); item->setPen(pen); item->setBrush(brush); - graphicsView_->scene()->addItem(item); + graphicsView_->addItem(item, P2QSTRING(element.getID())); } QPolygonF polygon; std::vector<std::pair<int, int> >::const_iterator it = element.getPoints().begin(); |