From e6ca4b4568e311b47239bfe83de15ed9e91c57b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Fri, 15 Dec 2017 22:45:28 +0100 Subject: Implement few initial graphic elements --- qtmips_gui/coreview/programcounter.h | 42 ++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 qtmips_gui/coreview/programcounter.h (limited to 'qtmips_gui/coreview/programcounter.h') 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 +#include +#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 -- cgit v1.2.3