summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI/Whiteboard/WhiteboardElementDrawingVisitor.h')
-rw-r--r--Swift/QtUI/Whiteboard/WhiteboardElementDrawingVisitor.h23
1 files changed, 22 insertions, 1 deletions
diff --git a/Swift/QtUI/Whiteboard/WhiteboardElementDrawingVisitor.h b/Swift/QtUI/Whiteboard/WhiteboardElementDrawingVisitor.h
index ebc9045..4b2f7ed 100644
--- a/Swift/QtUI/Whiteboard/WhiteboardElementDrawingVisitor.h
+++ b/Swift/QtUI/Whiteboard/WhiteboardElementDrawingVisitor.h
@@ -10,8 +10,10 @@
#include <Swiften/Whiteboard/Elements/WhiteboardLineElement.h>
#include <Swiften/Whiteboard/Elements/WhiteboardPolygonElement.h>
#include <Swiften/Whiteboard/Elements/WhiteboardTextElement.h>
+#include <Swiften/Whiteboard/Elements/WhiteboardEllipseElement.h>
#include <Swiften/Whiteboard/Elements/WhiteboardFreehandPathElement.h>
#include <Swift/QtUI/Whiteboard/GView.h>
+#include <QtSwiftUtil.h>
namespace Swift {
class WhiteboardElementDrawingVisitor : public WhiteboardElementVisitor {
@@ -60,7 +62,7 @@ namespace Swift {
}
void visit(WhiteboardPolygonElement& element) {
- QGraphicsPolygonItem* item = qgraphicsitem_cast<QGraphicsPolygonItem*>(graphicsView_->getItem(QString::fromStdString(element.getID())));
+ QGraphicsPolygonItem* item = qgraphicsitem_cast<QGraphicsPolygonItem*>(graphicsView_->getItem(P2QSTRING(element.getID())));
if (item == 0) {
item = new QGraphicsPolygonItem();
QPen pen;
@@ -86,6 +88,25 @@ namespace Swift {
}
+ void visit(WhiteboardEllipseElement& element) {
+ QRectF rect;
+
+ rect.setTopLeft(QPointF(element.getCX()-element.getRX(), element.getCY()-element.getRY()));
+ rect.setBottomRight(QPointF(element.getCX()+element.getRX(), element.getCY()+element.getRY()));
+
+ QGraphicsEllipseItem* item = new QGraphicsEllipseItem(rect);
+ QPen pen;
+ QBrush brush(Qt::SolidPattern);
+ Color penColor = element.getPenColor();
+ Color brushColor = element.getBrushColor();
+ pen.setColor(QColor(penColor.getRed(), penColor.getGreen(), penColor.getBlue(), penColor.getAlpha()));
+ pen.setWidth(element.getPenWidth());
+ brush.setColor(QColor(brushColor.getRed(), brushColor.getGreen(), brushColor.getBlue(), brushColor.getAlpha()));
+ item->setPen(pen);
+ item->setBrush(brush);
+ graphicsView_->scene()->addItem(item);
+ }
+
private:
GView* graphicsView_;
};