Blockview changes:
1) Теперь для создания сегмента не надо держать Shift, а перемешение шины теперь с нажатой клавишей Shift 2) Режим трассировки шин теперь пытается проложить маршрут с возможностью пересечения шины под прямым углом 3) Теперь рисуются точки соединения сегментов если их больше 2х 4) Обновлена подсказка в tooltip p.s. update pip)
This commit is contained in:
@@ -496,7 +496,12 @@ void BlockBusItem::testPoint(QPointF pos, int * sel_point, int * sel_segment) {
|
||||
|
||||
|
||||
void BlockBusItem::hoverEnterEvent(QGraphicsSceneHoverEvent * e) {
|
||||
tt = bus_name + (bus_name.isEmpty() ? "" : "\n\n") + tr("Add point: Ctrl + LeftClick\nRemove point\\segment: Ctrl + RightClick\nNew branch: Shift + LeftClick\nRemove connection: Shift + RightClick");
|
||||
tt = bus_name + (bus_name.isEmpty() ? "" : "\n\n")
|
||||
+ tr("Add point: Ctrl + LeftClick\n"
|
||||
"Remove point\\segment: Ctrl + RightClick\n"
|
||||
"Remove connection: Shift + RightClick\n"
|
||||
"Move point\\segment: Shift + LeftPress\n"
|
||||
"Change trace mode: press Shift, when mouse move");
|
||||
}
|
||||
|
||||
|
||||
@@ -563,12 +568,12 @@ void BlockBusItem::mousePressEvent(QGraphicsSceneMouseEvent * e) {
|
||||
QMetaObject::invokeMethod(scene()->views().back(), "newBranchCancel");
|
||||
}
|
||||
new_segment = false;
|
||||
if ((selPoint < 0 || selPoint > pol.size() - 1) && (selSegment < 0)) {
|
||||
if ((selPoint < 0 || selPoint > pol.size() - 1) && (selSegment < 0) && e->modifiers().testFlag(Qt::ShiftModifier)) {
|
||||
QGraphicsObject::mousePressEvent(e);
|
||||
return;
|
||||
}
|
||||
int btncnt = 0;
|
||||
if (endpoints().contains(selPoint) && e->button() == Qt::LeftButton)
|
||||
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->buttons().testFlag(Qt::LeftButton)) btncnt++;
|
||||
if (e->buttons().testFlag(Qt::RightButton)) btncnt++;
|
||||
@@ -591,28 +596,26 @@ void BlockBusItem::mousePressEvent(QGraphicsSceneMouseEvent * e) {
|
||||
prepareGeometryChange();
|
||||
return;
|
||||
}
|
||||
if (e->modifiers().testFlag(Qt::ShiftModifier)) {
|
||||
if (e->buttons().testFlag(Qt::LeftButton)) {
|
||||
if (selSegment >= 0)
|
||||
press_pos = quantize(nearestPointOnLine(pol[segments[selSegment].first], pol[segments[selSegment].second], e->scenePos()), grid_step);
|
||||
else {
|
||||
if (selPoint >= 0)
|
||||
press_pos = pol[selPoint];
|
||||
else
|
||||
if (e->buttons().testFlag(Qt::LeftButton) && e->modifiers().testFlag(Qt::NoModifier)) {
|
||||
if (selSegment >= 0)
|
||||
press_pos = quantize(nearestPointOnLine(pol[segments[selSegment].first], pol[segments[selSegment].second], e->scenePos()), grid_step);
|
||||
else {
|
||||
if (selPoint >= 0)
|
||||
press_pos = pol[selPoint];
|
||||
else
|
||||
return;
|
||||
}
|
||||
if (max_ep >= 2) {
|
||||
if (endpointCount() >= max_ep)
|
||||
if (pointSegmentsCount(selPoint) >= 2 || selSegment >= 0)
|
||||
return;
|
||||
}
|
||||
if (max_ep >= 2) {
|
||||
if (endpointCount() >= max_ep)
|
||||
if (pointSegmentsCount(selPoint) >= 2 || selSegment >= 0)
|
||||
return;
|
||||
}
|
||||
QMetaObject::invokeMethod(scene()->views().back(), "newBranch", Q_ARG(BlockBusItem * , this));
|
||||
new_segment = true;
|
||||
return;
|
||||
}
|
||||
if (e->buttons().testFlag(Qt::RightButton)) {
|
||||
deleteLater();
|
||||
}
|
||||
QMetaObject::invokeMethod(scene()->views().back(), "newBranch", Q_ARG(BlockBusItem * , this));
|
||||
new_segment = true;
|
||||
return;
|
||||
}
|
||||
if (e->buttons().testFlag(Qt::RightButton) && e->modifiers().testFlag(Qt::ShiftModifier)) {
|
||||
deleteLater();
|
||||
}
|
||||
if (e->modifiers().testFlag(Qt::ControlModifier)) {
|
||||
if (e->buttons().testFlag(Qt::RightButton)) {
|
||||
@@ -635,24 +638,22 @@ void BlockBusItem::mousePressEvent(QGraphicsSceneMouseEvent * e) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (e->modifiers().testFlag(Qt::ShiftModifier)) {
|
||||
if (e->buttons().testFlag(Qt::RightButton)) {
|
||||
if (deleted) return;
|
||||
deleted = true;
|
||||
}
|
||||
if (e->buttons().testFlag(Qt::RightButton)) {
|
||||
if (deleted) return;
|
||||
deleted = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BlockBusItem::mouseMoveEvent(QGraphicsSceneMouseEvent * e) {
|
||||
if (temp_ || mm_cancel) return;
|
||||
if (((selPoint < 0 || selPoint > pol.size() - 1) && (selSegment < 0)) && !new_segment) {
|
||||
if (((selPoint < 0 || selPoint > pol.size() - 1) && (selSegment < 0)) && !new_segment && mm_mods.testFlag(Qt::ShiftModifier)) {
|
||||
QGraphicsObject::mouseMoveEvent(e);
|
||||
return;
|
||||
}
|
||||
qp = quantize(e->scenePos(), grid_step);
|
||||
lp = qp - lp;
|
||||
if (e->buttons().testFlag(Qt::LeftButton) && mm_mods.testFlag(Qt::ShiftModifier) && new_segment) {
|
||||
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()));
|
||||
return;
|
||||
}
|
||||
@@ -722,6 +723,7 @@ void BlockBusItem::paint(QPainter * p, const QStyleOptionGraphicsItem * o, QWidg
|
||||
if (im_bus.isNull()) {
|
||||
for (int i = 0; i < segments.size(); ++i) {
|
||||
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);
|
||||
}
|
||||
} else {
|
||||
QBrush br;
|
||||
|
||||
Reference in New Issue
Block a user