diff options
author | Pavel Pisa <pisa@cmp.felk.cvut.cz> | 2019-02-13 18:37:51 +0100 |
---|---|---|
committer | Pavel Pisa <pisa@cmp.felk.cvut.cz> | 2019-02-13 18:37:51 +0100 |
commit | 93c5ade08250e419b7dbc3177db6fba93163fd34 (patch) | |
tree | b28d4f1bb4c36edbd60bf634d0d71a6d880b592d /qtmips_gui/coreview | |
parent | 9f1ddc2b38469d5028aec5ba7b68131d711f2622 (diff) | |
download | qtmips-93c5ade08250e419b7dbc3177db6fba93163fd34.tar.gz qtmips-93c5ade08250e419b7dbc3177db6fba93163fd34.tar.bz2 qtmips-93c5ade08250e419b7dbc3177db6fba93163fd34.zip |
Include simple serial port terminal and prepare empty peripheral dock.
Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Diffstat (limited to 'qtmips_gui/coreview')
-rw-r--r-- | qtmips_gui/coreview/logicblock.cpp | 9 | ||||
-rw-r--r-- | qtmips_gui/coreview/logicblock.h | 12 |
2 files changed, 17 insertions, 4 deletions
diff --git a/qtmips_gui/coreview/logicblock.cpp b/qtmips_gui/coreview/logicblock.cpp index 2aabe7f..e2c5e24 100644 --- a/qtmips_gui/coreview/logicblock.cpp +++ b/qtmips_gui/coreview/logicblock.cpp @@ -47,7 +47,7 @@ using namespace coreview; LogicBlock::LogicBlock(QString name) : LogicBlock(QVector<QString>({name})) { } -LogicBlock::LogicBlock(QVector<QString> name) : QGraphicsItem(nullptr) { +LogicBlock::LogicBlock(QVector<QString> name) : QGraphicsObject(nullptr) { QFont font; font.setPointSize(7); @@ -82,7 +82,7 @@ void LogicBlock::paint(QPainter *painter, const QStyleOptionGraphicsItem *option } void LogicBlock::setPos(qreal x, qreal y) { - QGraphicsItem::setPos(x, y); + QGraphicsObject::setPos(x, y); for (int i = 0; i < connectors.size(); i++) { struct Con &c = connectors[i]; c.con->setPos(x + c.p.x(), y + c.p.y()); @@ -134,3 +134,8 @@ QPointF LogicBlock::con_pos(qreal x, qreal y) { py += GAP * sign(y); return QPointF(px, py); } + +void LogicBlock::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) { + QGraphicsObject::mouseDoubleClickEvent(event); + emit open_block(); +} diff --git a/qtmips_gui/coreview/logicblock.h b/qtmips_gui/coreview/logicblock.h index 27c2951..a384b06 100644 --- a/qtmips_gui/coreview/logicblock.h +++ b/qtmips_gui/coreview/logicblock.h @@ -36,15 +36,17 @@ #ifndef LOGICBLOCK_H #define LOGICBLOCK_H -#include <QGraphicsItem> +#include <QGraphicsObject> #include <QPainter> #include <QGraphicsSimpleTextItem> #include <QVector> +#include <QObject> #include "connection.h" namespace coreview { -class LogicBlock : public QGraphicsItem { +class LogicBlock : public QGraphicsObject { + Q_OBJECT public: LogicBlock(QString name); LogicBlock(QVector<QString> name); @@ -61,6 +63,9 @@ public: // Using x=y and x=-y coordinates is not supported const Connector *new_connector(qreal x, qreal y); +signals: + void open_block(); + private: QVector<QGraphicsSimpleTextItem*> text; QRectF box; @@ -72,6 +77,9 @@ private: }; QVector<struct Con> connectors; QPointF con_pos(qreal x, qreal y); + +protected: + void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event); }; } |