aboutsummaryrefslogtreecommitdiff
path: root/qtmips_gui/coreview/programcounter.h
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2017-12-15 22:45:28 +0100
committerKarel Kočí <cynerd@email.cz>2017-12-15 22:45:28 +0100
commite6ca4b4568e311b47239bfe83de15ed9e91c57b9 (patch)
tree3da2f72faf360058bae02c35b0c724233bd64d61 /qtmips_gui/coreview/programcounter.h
parentbbea996112eb7ac81ec50d2af08f4bd681d0e50d (diff)
downloadqtmips-e6ca4b4568e311b47239bfe83de15ed9e91c57b9.tar.gz
qtmips-e6ca4b4568e311b47239bfe83de15ed9e91c57b9.tar.bz2
qtmips-e6ca4b4568e311b47239bfe83de15ed9e91c57b9.zip
Implement few initial graphic elements
Diffstat (limited to 'qtmips_gui/coreview/programcounter.h')
-rw-r--r--qtmips_gui/coreview/programcounter.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/qtmips_gui/coreview/programcounter.h b/qtmips_gui/coreview/programcounter.h
new file mode 100644
index 0000000..98b161d
--- /dev/null
+++ b/qtmips_gui/coreview/programcounter.h
@@ -0,0 +1,42 @@
+#ifndef PROGRAMCOUNTER_H
+#define PROGRAMCOUNTER_H
+
+#include <QGraphicsObject>
+#include <QPainter>
+#include "qtmipsmachine.h"
+#include "../coreview.h"
+#include "connection.h"
+
+namespace coreview {
+
+class ProgramCounter : public QGraphicsObject {
+ Q_OBJECT
+public:
+ ProgramCounter(QtMipsMachine *machine);
+
+ QRectF boundingRect() const;
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
+
+ void setPos(qreal x, qreal y);
+ const Connector *connector_in() const;
+ const Connector *connector_out() const;
+
+private slots:
+ void pc_update(std::uint32_t val);
+
+private:
+ QGraphicsSimpleTextItem value;
+ QGraphicsSimpleTextItem name;
+
+ Connector *con_in, *con_out;
+};
+
+}
+
+#else
+
+namespace coreview {
+ class ProgramCounter;
+};
+
+#endif // PROGRAMCOUNTER_H