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/latch.h | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 qtmips_gui/coreview/latch.h (limited to 'qtmips_gui/coreview/latch.h') diff --git a/qtmips_gui/coreview/latch.h b/qtmips_gui/coreview/latch.h new file mode 100644 index 0000000..a8738b3 --- /dev/null +++ b/qtmips_gui/coreview/latch.h @@ -0,0 +1,45 @@ +#ifndef LATCH_H +#define LATCH_H + +#include +#include +#include "qtmipsexception.h" +#include "qtmipsmachine.h" +#include "../coreview.h" +#include "connection.h" + +namespace coreview { + +class Latch : public QGraphicsObject { + Q_OBJECT +public: + Latch(QtMipsMachine *machine, qreal height); + + QRectF boundingRect() const; + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); + + void setPos(qreal x, qreal y); + + struct ConnectorPair { Connector *in, *out; }; + + struct ConnectorPair new_connector(qreal y); // Create new connectors pair that is given y from top of latch + +private slots: + void tick(); + +private: + qreal height; + QList connectors; + QList connectors_off; + +}; + +} + +#else + +namespace coreview { + class Latch; +}; + +#endif // LATCH_H -- cgit v1.2.3