From 6ed6360bfde189191bd976d8969c2834b33ec64e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Wed, 17 Jan 2018 21:35:51 +0100 Subject: Add logicblock and Control Unit to scheme --- qtmips_gui/coreview/logicblock.h | 44 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 qtmips_gui/coreview/logicblock.h (limited to 'qtmips_gui/coreview/logicblock.h') diff --git a/qtmips_gui/coreview/logicblock.h b/qtmips_gui/coreview/logicblock.h new file mode 100644 index 0000000..4c1310c --- /dev/null +++ b/qtmips_gui/coreview/logicblock.h @@ -0,0 +1,44 @@ +#ifndef LOGICBLOCK_H +#define LOGICBLOCK_H + +#include +#include +#include +#include +#include "connection.h" + +namespace coreview { + +class LogicBlock : public QGraphicsItem { +public: + LogicBlock(QString name); + LogicBlock(QVector name); + ~LogicBlock(); + + QRectF boundingRect() const; + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); + + void setPos(qreal x, qreal y); + void setSize(qreal width, qreal height); + + // This creates new connector + // Position is determined by x and y in 0 to 1 range and is mapped to real size of this block + // Using x=y and x=-y coordinates is not supported + const Connector *new_connector(qreal x, qreal y); + +private: + QVector text; + QRectF box; + + struct Con { + Connector *con; + qreal x, y; + QPointF p; + }; + QVector connectors; + QPointF con_pos(qreal x, qreal y); +}; + +} + +#endif // LOGICBLOCK_H -- cgit v1.2.3