BlockView right-click, ctrl+left-click fixes
This commit is contained in:
@@ -520,10 +520,16 @@ void BlockBusItem::hoverMoveEvent(QGraphicsSceneHoverEvent * e) {
|
||||
int ps = selSegment;
|
||||
bool empt = !(selPoint >= 0 || selSegment >= 0);
|
||||
testPoint(sp, &selPoint, &selSegment);
|
||||
BlockView * bv = 0;
|
||||
if (!scene()->views().isEmpty()) {
|
||||
bv = qobject_cast<BlockView*>(scene()->views().back());
|
||||
}
|
||||
if ((selPoint >= 0 && pp != selPoint) || (selSegment >= 0 && ps != selSegment)) {
|
||||
if (((BlockView *)scene()->views().back())->isBlockAnimationEnabled()) {
|
||||
setPointSize(0);
|
||||
anim_point_size.start();
|
||||
if (bv) {
|
||||
if (bv->isBlockAnimationEnabled()) {
|
||||
setPointSize(0);
|
||||
anim_point_size.start();
|
||||
}
|
||||
} else setPointSize(anim_point_size.endValue().toDouble());
|
||||
}
|
||||
|
||||
@@ -536,8 +542,10 @@ void BlockBusItem::hoverMoveEvent(QGraphicsSceneHoverEvent * e) {
|
||||
}
|
||||
setToolTip(tt);
|
||||
update();
|
||||
if (bv) bv->cur_bus = this;
|
||||
return;
|
||||
}
|
||||
if (bv) bv->cur_bus = 0;
|
||||
setToolTip(QString());
|
||||
QList<QGraphicsItem * > il = scene()->items(sp, Qt::ContainsItemBoundingRect, Qt::DescendingOrder), bil;
|
||||
bil << this;
|
||||
@@ -572,6 +580,13 @@ void BlockBusItem::hoverLeaveEvent(QGraphicsSceneHoverEvent * e) {
|
||||
void BlockBusItem::mousePressEvent(QGraphicsSceneMouseEvent * e) {
|
||||
if (temp_) return;
|
||||
lp = quantize(e->scenePos(), grid_step);
|
||||
if (e->button() != Qt::RightButton)
|
||||
bpol = pol;
|
||||
BlockView * bv = 0;
|
||||
if (!scene()->views().isEmpty()) {
|
||||
bv = qobject_cast<BlockView*>(scene()->views().back());
|
||||
}
|
||||
if (bv) bv->cur_bus = this;
|
||||
if (new_segment) {
|
||||
QMetaObject::invokeMethod(scene()->views().back(), "newBranchCancel");
|
||||
}
|
||||
@@ -582,7 +597,6 @@ void BlockBusItem::mousePressEvent(QGraphicsSceneMouseEvent * e) {
|
||||
}
|
||||
int btncnt = 0;
|
||||
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()));
|
||||
}
|
||||
@@ -594,7 +608,7 @@ void BlockBusItem::mousePressEvent(QGraphicsSceneMouseEvent * e) {
|
||||
//qDebug() << "bus revert";
|
||||
mm_cancel = true;
|
||||
moved = false;
|
||||
QPointF lp = qp - press_pos;
|
||||
/*QPointF lp = qp - press_pos;
|
||||
//qDebug() << lp;
|
||||
if (selPoint >= 0 && selPoint <= pol.size() - 1) {
|
||||
pol[selPoint] += lp;
|
||||
@@ -603,7 +617,8 @@ void BlockBusItem::mousePressEvent(QGraphicsSceneMouseEvent * e) {
|
||||
pol[segments[selSegment].first] += lp;
|
||||
pol[segments[selSegment].second] += lp;
|
||||
}
|
||||
moved = true;
|
||||
moved = true;*/
|
||||
pol = bpol;
|
||||
prepareGeometryChange();
|
||||
return;
|
||||
}
|
||||
@@ -629,6 +644,7 @@ void BlockBusItem::mousePressEvent(QGraphicsSceneMouseEvent * e) {
|
||||
deleteLater();
|
||||
}
|
||||
if (e->modifiers().testFlag(Qt::ControlModifier)) {
|
||||
//qDebug() << "remove" << selPoint << selSegment;
|
||||
if (e->buttons().testFlag(Qt::RightButton)) {
|
||||
if (selPoint >= 0 && selPoint <= pol.size() - 1) {
|
||||
removePoint(selPoint);
|
||||
@@ -677,7 +693,6 @@ void BlockBusItem::mouseMoveEvent(QGraphicsSceneMouseEvent * e) {
|
||||
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)
|
||||
@@ -687,6 +702,7 @@ void BlockBusItem::mouseMoveEvent(QGraphicsSceneMouseEvent * e) {
|
||||
pol[segments[selSegment].second] += lp;
|
||||
}
|
||||
moved = true;
|
||||
//if (bv) bv->bus_moved = true;
|
||||
prepareGeometryChange();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user