bus joint paint now configured with BlockView::setBusSquareNodes(), square or round. By default round
This commit is contained in:
@@ -16,6 +16,7 @@ BlockBusItem::BlockBusItem(const BlockBusItem & other): QGraphicsObject(), Prope
|
||||
setPen(other.pen());
|
||||
setBrush(other.brush());
|
||||
setBusType(other.busType());
|
||||
square_node = other.square_node;
|
||||
max_ep = other.max_ep;
|
||||
pol = other.pol;
|
||||
segments = other.segments;
|
||||
@@ -46,6 +47,7 @@ void BlockBusItem::_init() {
|
||||
bu.setColor(Qt::darkGray);
|
||||
}
|
||||
setPen(pu); setBrush(bu);
|
||||
square_node = false;
|
||||
max_ep = 0;
|
||||
selPoint = selSegment = state_ = -1;
|
||||
pen_width = 2.;
|
||||
@@ -219,6 +221,12 @@ void BlockBusItem::setColor(const QColor & c) {
|
||||
}
|
||||
|
||||
|
||||
void BlockBusItem::setSquareNodes(bool yes) {
|
||||
square_node = yes;
|
||||
update();
|
||||
}
|
||||
|
||||
|
||||
void BlockBusItem::markAsInput() {
|
||||
mark_in = true;
|
||||
mark_out = false;
|
||||
@@ -299,7 +307,7 @@ QList<BlockItem * > BlockBusItem::connectedBlocks() const {
|
||||
QSet<BlockItem * > ret;
|
||||
foreach (BlockItemPin * p, pins)
|
||||
ret << p->parent();
|
||||
return ret.toList();
|
||||
return ret.values();
|
||||
}
|
||||
|
||||
|
||||
@@ -678,7 +686,7 @@ void BlockBusItem::mouseMoveEvent(QGraphicsSceneMouseEvent * e) {
|
||||
|
||||
|
||||
void BlockBusItem::mouseReleaseEvent(QGraphicsSceneMouseEvent * e) {
|
||||
mm_mods = 0;
|
||||
mm_mods = Qt::KeyboardModifiers();
|
||||
int btncnt = 0;
|
||||
if (e->buttons().testFlag(Qt::LeftButton)) btncnt++;
|
||||
if (e->buttons().testFlag(Qt::RightButton)) btncnt++;
|
||||
@@ -727,7 +735,10 @@ void BlockBusItem::paint(QPainter * p, const QStyleOptionGraphicsItem * o, QWidg
|
||||
p->setPen(_pen);
|
||||
p->drawLine(pol[segments[i].first], pol[segments[i].second]);
|
||||
if (pointSegmentsCount(segments[i].first) > 2) {
|
||||
p->drawEllipse(pol[segments[i].first], pen_width*0.7, pen_width*0.7);
|
||||
_pen.setWidthF(pen_width * 1.8 + 2.);
|
||||
_pen.setCapStyle(square_node ? Qt::SquareCap : Qt::RoundCap);
|
||||
p->setPen(_pen);
|
||||
p->drawPoint(pol[segments[i].first]);
|
||||
}
|
||||
}
|
||||
p->setPen(_pen);
|
||||
|
||||
Reference in New Issue
Block a user