diff options
Diffstat (limited to 'Swift/QtUI/Whiteboard/QtWhiteboardWindow.cpp')
-rw-r--r-- | Swift/QtUI/Whiteboard/QtWhiteboardWindow.cpp | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/Swift/QtUI/Whiteboard/QtWhiteboardWindow.cpp b/Swift/QtUI/Whiteboard/QtWhiteboardWindow.cpp index 612e467..0a1afe3 100644 --- a/Swift/QtUI/Whiteboard/QtWhiteboardWindow.cpp +++ b/Swift/QtUI/Whiteboard/QtWhiteboardWindow.cpp @@ -245,15 +245,21 @@ namespace Swift { } FreehandLineItem* freehandLineItem = qgraphicsitem_cast<FreehandLineItem*>(item); if (freehandLineItem != 0) { - QVector<QPointF> points = freehandLineItem->points(); - QVector<QPointF>::iterator it; - std::stringstream stream; - stream << "F"; - QPoint point; - for (it = points.begin(); it != points.end(); ++it) { - stream << it->x() << "," << it->y() << ","; + WhiteboardFreehandPathElement::ref element = boost::make_shared<WhiteboardFreehandPathElement>(); + QColor color = freehandLineItem->pen().color(); + std::vector<std::pair<int, int> > points; + QVector<QPointF>::const_iterator it = freehandLineItem->points().constBegin(); + for ( ; it != freehandLineItem->points().constEnd(); ++it) { + points.push_back(std::pair<int, int>(it->x(), it->y())); } - stream >> serialized; + + element->setColor(Color(color.red(), color.green(), color.blue(), color.alpha())); + element->setPenWidth(freehandLineItem->pen().width()); + element->setPoints(points); + + element->setID(freehandLineItem->data(0).toString().toStdString()); + whiteboardSession_->sendElement(element); + } } |