aboutsummaryrefslogtreecommitdiff
path: root/qtmips_gui/coreview/constant.h
blob: 2d60f04aaf084f20c38041a2ddc5fa38a2f3cb2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#ifndef CONSTANT_H
#define CONSTANT_H

#include <QGraphicsObject>
#include <QPainter>
#include <QGraphicsSimpleTextItem>
#include "connection.h"

namespace coreview {

class Constant : public QGraphicsObject {
    Q_OBJECT
public:
    Constant(const Connector *con, const QString &text);
    ~Constant();

    QRectF boundingRect() const;
    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);

    void set_text(const QString &text);

private slots:
    void ref_con_updated(QPointF);

private:
    QGraphicsSimpleTextItem text;
    Connector *con_our;
    Connection *conn;

    void set_text_pos();
};

}

#endif // CONSTANT_H