summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Swift/QtUI/Whiteboard/GView.cpp5
-rw-r--r--Swift/QtUI/Whiteboard/GView.h1
-rw-r--r--Swift/QtUI/Whiteboard/WhiteboardElementDrawingVisitor.h2
-rw-r--r--Swiften/Parser/PayloadParsers/WhiteboardParser.cpp2
4 files changed, 8 insertions, 2 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();
diff --git a/Swiften/Parser/PayloadParsers/WhiteboardParser.cpp b/Swiften/Parser/PayloadParsers/WhiteboardParser.cpp
index aca3103..0477988 100644
--- a/Swiften/Parser/PayloadParsers/WhiteboardParser.cpp
+++ b/Swiften/Parser/PayloadParsers/WhiteboardParser.cpp
@@ -164,7 +164,7 @@ namespace Swift {
brushColor.setAlpha(opacityToAlpha(attributes.getAttributeValue("fill-opacity").get_value_or("1")));
whiteboardElement->setPenColor(penColor);
whiteboardElement->setBrushColor(brushColor);
-
+ whiteboardElement->setID(attributes.getAttributeValue("id").get_value_or(""));
getPayloadInternal()->setElement(whiteboardElement);
} else if (element == "text") {
int x = 0;