diff options
author | Karel Kočí <cynerd@email.cz> | 2018-01-08 21:43:58 +0100 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2018-01-08 21:43:58 +0100 |
commit | 506174a8266eb9842ff9e50a89ddf86cb975be30 (patch) | |
tree | cd1c2905d48c172d2b83e4230b1f76dc46e8f3d3 /qtmips_gui/coreview/connection.h | |
parent | bcdd7c87b1eda7dc6b294cfa0796ce7e36f12b23 (diff) | |
download | qtmips-506174a8266eb9842ff9e50a89ddf86cb975be30.tar.gz qtmips-506174a8266eb9842ff9e50a89ddf86cb975be30.tar.bz2 qtmips-506174a8266eb9842ff9e50a89ddf86cb975be30.zip |
Add coreview progress
Diffstat (limited to 'qtmips_gui/coreview/connection.h')
-rw-r--r-- | qtmips_gui/coreview/connection.h | 46 |
1 files changed, 27 insertions, 19 deletions
diff --git a/qtmips_gui/coreview/connection.h b/qtmips_gui/coreview/connection.h index efe3942..0ee981e 100644 --- a/qtmips_gui/coreview/connection.h +++ b/qtmips_gui/coreview/connection.h @@ -2,59 +2,67 @@ #define COREVIEW_CONNECTION_H #include <QGraphicsObject> -#include <QList> -#include <cmath> -#include "../coreview.h" +#include <QPainter> +#include <QVector> namespace coreview { class Connector : public QObject { Q_OBJECT public: + Connector(qreal angle); + void setPos(qreal x, qreal y); qreal x() const; qreal y() const; QPointF point() const; + QLineF vector() const; + + qreal angle() const; signals: - void updated(); + void updated(QPointF); private: + qreal ang; qreal qx, qy; }; class Connection : public QGraphicsObject { Q_OBJECT public: - Connection(const Connector *a, const Connector *b); + Connection(const Connector *start, const Connector *end); + + QRectF boundingRect() const; + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); void setHasText(bool has); void setText(QString val); + void setAxes(QVector<QLineF>); + private slots: - void moved(); + void moved_start(QPointF); + void moved_end(QPointF); private: QGraphicsSimpleTextItem *value; - QList<QPointF> points; - const Connector *a, *b; + QVector<QPointF> points; + QPointF p_start, p_end; + qreal ang_start, ang_end; + QVector<QLineF> break_axes; QString text; - QRectF boundingRect() const; - void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); + int pen_width; // TODO line width and possibly bus width - - void update_pos(); + void recalc_line(); + void recalc_line_add_point(const QLineF &l1, const QLineF &l2); }; -} - -#else +#define CON_AXIS_X(Y) QLineF(QPointF(0, Y), QPointF(1, Y)) +#define CON_AXIS_Y(X) QLineF(QPointF(X, 0), QPointF(X, 1)) -namespace coreview { - class Connector; - class Connection; -}; +} #endif // COREVIEW_CONNECTION_H |