BlockView cosmetics, more enums, fixed right-click on bus point/segment move
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
BlockBusItem::BlockBusItem(bool temp): QGraphicsObject(), PropertyStorage() {
|
||||
temp_ = temp;
|
||||
_init();
|
||||
if (!temp) setData(1005, "connection");
|
||||
if (!temp) setData(bvidType, bvitBus);
|
||||
else hide();
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ BlockBusItem::BlockBusItem(bool temp): QGraphicsObject(), PropertyStorage() {
|
||||
BlockBusItem::BlockBusItem(const BlockBusItem & other): QGraphicsObject(), PropertyStorage() {
|
||||
temp_ = false;
|
||||
_init();
|
||||
setData(1005, "connection");
|
||||
setData(bvidType, bvitBus);
|
||||
setPen(other.pen());
|
||||
setBrush(other.brush());
|
||||
setBusType(other.busType());
|
||||
@@ -543,7 +543,7 @@ void BlockBusItem::hoverMoveEvent(QGraphicsSceneHoverEvent * e) {
|
||||
bil << this;
|
||||
for (int i = 0; i < il.size(); ++i) {
|
||||
QGraphicsItem * b = il[i];
|
||||
if (b->data(1005) == "connection" && b != this) {
|
||||
if ((b->data(bvidType).toInt() == bvitBus) && b != this) {
|
||||
int tp = -1, ts = -1;
|
||||
((BlockBusItem*)b)->testPoint(sp, &tp, &ts);
|
||||
if (tp >= 0 || ts >= 0) {
|
||||
@@ -581,14 +581,17 @@ void BlockBusItem::mousePressEvent(QGraphicsSceneMouseEvent * e) {
|
||||
return;
|
||||
}
|
||||
int btncnt = 0;
|
||||
if (endpoints().contains(selPoint) && (e->button() == Qt::LeftButton) && e->modifiers().testFlag(Qt::ShiftModifier))
|
||||
QMetaObject::invokeMethod(scene()->views().back(), "startBusPointMove", Q_ARG(int, busType()));
|
||||
if ((e->button() == Qt::LeftButton) && e->modifiers().testFlag(Qt::ShiftModifier)) {
|
||||
bpol = pol;
|
||||
if (endpoints().contains(selPoint))
|
||||
QMetaObject::invokeMethod(scene()->views().back(), "startBusPointMove", Q_ARG(int, busType()));
|
||||
}
|
||||
if (e->buttons().testFlag(Qt::LeftButton)) btncnt++;
|
||||
if (e->buttons().testFlag(Qt::RightButton)) btncnt++;
|
||||
if (e->buttons().testFlag(Qt::MidButton)) btncnt++;
|
||||
if (btncnt > 0) mm_mods = e->modifiers();
|
||||
//qDebug() << "press" << e;
|
||||
if (btncnt >= 2 && e->button() == Qt::RightButton) {
|
||||
//qDebug() << "bus revert";
|
||||
mm_cancel = true;
|
||||
moved = false;
|
||||
QPointF lp = qp - press_pos;
|
||||
@@ -659,16 +662,22 @@ void BlockBusItem::mouseMoveEvent(QGraphicsSceneMouseEvent * e) {
|
||||
QGraphicsObject::mouseMoveEvent(e);
|
||||
return;
|
||||
}
|
||||
BlockView * bv = 0;
|
||||
if (!scene()->views().isEmpty()) {
|
||||
bv = qobject_cast<BlockView*>(scene()->views().back());
|
||||
}
|
||||
qp = quantize(e->scenePos(), grid_step);
|
||||
lp = qp - lp;
|
||||
if (e->buttons().testFlag(Qt::LeftButton) && mm_mods.testFlag(Qt::NoModifier) && new_segment) {
|
||||
QMetaObject::invokeMethod(scene()->views().back(), "newBranchTrace", Q_ARG(BlockBusItem * , this), Q_ARG(QPointF, e->scenePos()));
|
||||
if (bv)
|
||||
QMetaObject::invokeMethod(bv, "newBranchTrace", Q_ARG(BlockBusItem * , this), Q_ARG(QPointF, e->scenePos()));
|
||||
return;
|
||||
}
|
||||
if (new_segment) {
|
||||
new_end = qp;
|
||||
prepareGeometryChange();
|
||||
} else {
|
||||
if (bv) bv->cur_bus = this;
|
||||
if (e->buttons().testFlag(Qt::LeftButton)) {
|
||||
lm_point = selPoint >= 0;
|
||||
if (selPoint >= 0 && selPoint <= pol.size() - 1)
|
||||
|
||||
Reference in New Issue
Block a user