| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,48 @@ |
| 1 |
+/* |
|
| 2 |
+ * Author: Pawel Jablonski |
|
| 3 |
+ * E-mail: pj@xirx.net |
|
| 4 |
+ * WWW: xirx.net |
|
| 5 |
+ * GIT: git.xirx.net |
|
| 6 |
+ * |
|
| 7 |
+ * License: You can use this code however you like |
|
| 8 |
+ * but leave information about the original author. |
|
| 9 |
+ * Code is free for non-commercial and commercial use. |
|
| 10 |
+ */ |
|
| 11 |
+ |
|
| 12 |
+#ifndef LCDVIEW_H |
|
| 13 |
+#define LCDVIEW_H |
|
| 14 |
+ |
|
| 15 |
+#include <QGraphicsView> |
|
| 16 |
+#include <QGraphicsScene> |
|
| 17 |
+#include <QPixmap> |
|
| 18 |
+#include <QGraphicsPixmapItem> |
|
| 19 |
+#include <QImage> |
|
| 20 |
+#include <QMouseEvent> |
|
| 21 |
+#include <QScopedPointer> |
|
| 22 |
+ |
|
| 23 |
+#include "lcd.h" |
|
| 24 |
+ |
|
| 25 |
+//! This class contains LCD view using to present LCD data on UI |
|
| 26 |
+class LCDView : public QGraphicsView |
|
| 27 |
+{
|
|
| 28 |
+ Q_OBJECT |
|
| 29 |
+ |
|
| 30 |
+ public: |
|
| 31 |
+ static const int WIDTH = (LCD::CHAR_WIDTH * LCD::WIDTH); //!< Horizontal resolution |
|
| 32 |
+ static const int HEIGHT = (LCD::CHAR_HEIGHT * LCD::HEIGHT); //!< Vertical resolution |
|
| 33 |
+ |
|
| 34 |
+ LCDView(QWidget *parent = nullptr); |
|
| 35 |
+ |
|
| 36 |
+ void reset(); |
|
| 37 |
+ |
|
| 38 |
+ private: |
|
| 39 |
+ QScopedPointer<QGraphicsScene> scene; //!< Scene used to rendering |
|
| 40 |
+ QGraphicsPixmapItem *pixmapItem; //!< Pixel buffer used as a canvas to paint the console |
|
| 41 |
+ |
|
| 42 |
+ void mousePressEvent(QMouseEvent *event) override; |
|
| 43 |
+ |
|
| 44 |
+ public slots: |
|
| 45 |
+ void drawSlot(LCD::Buffer buffer); |
|
| 46 |
+}; |
|
| 47 |
+ |
|
| 48 |
+#endif |