diff options
Diffstat (limited to 'Swift/QtUI/Whiteboard/WhiteboardElementDrawingVisitor.h')
-rw-r--r-- | Swift/QtUI/Whiteboard/WhiteboardElementDrawingVisitor.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/Swift/QtUI/Whiteboard/WhiteboardElementDrawingVisitor.h b/Swift/QtUI/Whiteboard/WhiteboardElementDrawingVisitor.h new file mode 100644 index 0000000..962fd79 --- /dev/null +++ b/Swift/QtUI/Whiteboard/WhiteboardElementDrawingVisitor.h @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2012 Mateusz Piękos + * Licensed under the simplified BSD license. + * See Documentation/Licenses/BSD-simplified.txt for more information. + */ + +#pragma once + +#include <Swiften/Whiteboard/Elements/WhiteboardElementVisitor.h> +#include <Swiften/Whiteboard/Elements/WhiteboardLineElement.h> +#include <Swift/QtUI/Whiteboard/GView.h> + +namespace Swift { + class WhiteboardElementDrawingVisitor : public WhiteboardElementVisitor { + public: + WhiteboardElementDrawingVisitor(GView* graphicsView) : graphicsView_(graphicsView) {} + + void visit(const WhiteboardLineElement* element) { + QGraphicsLineItem *item = new QGraphicsLineItem(element->x1(), element->y1(), element->x2(), element->y2()); + graphicsView_->scene()->addItem(item); + } + + private: + GView* graphicsView_; + }; +} |