aboutsummaryrefslogtreecommitdiff
path: root/qtmips_gui/coreview/junction.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qtmips_gui/coreview/junction.cpp')
-rw-r--r--qtmips_gui/coreview/junction.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/qtmips_gui/coreview/junction.cpp b/qtmips_gui/coreview/junction.cpp
index 271284c..494aca6 100644
--- a/qtmips_gui/coreview/junction.cpp
+++ b/qtmips_gui/coreview/junction.cpp
@@ -6,7 +6,9 @@ using namespace coreview;
#define DOT_SIZE 4
//////////////////////
-Junction::Junction() : QGraphicsItem(nullptr) { }
+Junction::Junction(bool point) : QGraphicsItem(nullptr) {
+ this->point = point;
+}
Junction::~Junction() {
for (int i = 0; i < cons.size(); i++)
@@ -14,11 +16,17 @@ Junction::~Junction() {
}
QRectF Junction::boundingRect() const {
- return QRectF(-DOT_SIZE/2, -DOT_SIZE/2, DOT_SIZE, DOT_SIZE);
+ if (point)
+ return QRectF(-DOT_SIZE/2, -DOT_SIZE/2, DOT_SIZE, DOT_SIZE);
+ else
+ return QRectF();
}
void Junction::paint(QPainter *painter, const QStyleOptionGraphicsItem *option __attribute__((unused)), QWidget *widget __attribute__((unused))) {
+ if (!point)
+ return;
painter->setBrush(QBrush(QColor(0, 0, 0)));
+ painter->setPen(QPen(Qt::NoPen)); // Disable pen (render only brush)
painter->drawEllipse(-DOT_SIZE/2, -DOT_SIZE/2, DOT_SIZE, DOT_SIZE);
}
@@ -28,8 +36,8 @@ void Junction::setPos(qreal x, qreal y) {
con->setPos(x, y);
}
-Connector *Junction::new_connector(qreal angle) {
- Connector*n = new Connector(angle);
+Connector *Junction::new_connector(enum Connector::Axis axis) {
+ Connector*n = new Connector(axis);
cons.append(n);
setPos(x(), y()); // set connector's position
return n;