summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMateusz Piekos <mateuszpiekos@gmail.com>2012-05-30 12:40:27 (GMT)
committerMateusz Piekos <mateuszpiekos@gmail.com>2012-05-30 12:40:27 (GMT)
commitf20c70620ff8a15079bef36a844800cf544662e0 (patch)
tree4f9293726d9a8f41a31f69d05622fd32791d5b73 /Swift/QtUI/Whiteboard/GView.h
parente7db09d201280cb64de649f5e33ca13d82045f38 (diff)
downloadswift-contrib-f20c70620ff8a15079bef36a844800cf544662e0.zip
swift-contrib-f20c70620ff8a15079bef36a844800cf544662e0.tar.bz2
Added whiteboard files to swift tree
Diffstat (limited to 'Swift/QtUI/Whiteboard/GView.h')
-rw-r--r--Swift/QtUI/Whiteboard/GView.h49
1 files changed, 49 insertions, 0 deletions
diff --git a/Swift/QtUI/Whiteboard/GView.h b/Swift/QtUI/Whiteboard/GView.h
new file mode 100644
index 0000000..dd620e8
--- /dev/null
+++ b/Swift/QtUI/Whiteboard/GView.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2012 Mateusz Piękos
+ * Licensed under the simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
+ */
+
+#pragma once
+
+#include <QGraphicsView>
+#include <QGraphicsLineItem>
+#include <QMouseEvent>
+#include <QPen>
+#include <iostream>
+
+#include "TextDialog.h"
+
+using namespace std;
+
+namespace Swift {
+ class GView : public QGraphicsView {
+ Q_OBJECT;
+ public:
+ enum Mode { Rubber, Line, Rect, Circle, HandLine, FilledHandLine, Text, Polygon, Select };
+ GView(QGraphicsScene* scene, QWidget* parent = 0);
+ void setLineWidth(int i);
+ void setLineColor(QColor color);
+ QColor getLineColor();
+ void setBrushColor(QColor color);
+ QColor getBrushColor();
+ void setMode(Mode mode);
+ void mouseMoveEvent(QMouseEvent* event);
+ void mousePressEvent(QMouseEvent* event);
+ void mouseReleaseEvent(QMouseEvent* event);
+
+ public slots:
+ void moveUpSelectedItem();
+ void moveDownSelectedItem();
+
+ private:
+ int zValue;
+ bool mousePressed;
+ QPen pen;
+ QBrush brush;
+ Mode mode;
+ QGraphicsItem* lastItem;
+ QGraphicsRectItem* selectionRect;
+ TextDialog* textDialog;
+ };
+}