BlockView selection rect fix (inside bus bounding rect)

This commit is contained in:
2020-10-14 01:13:30 +03:00
parent f53d5bd53b
commit 3a41f3853c
2 changed files with 13 additions and 3 deletions

View File

@@ -586,7 +586,10 @@ void BlockBusItem::mousePressEvent(QGraphicsSceneMouseEvent * e) {
if (!scene()->views().isEmpty()) {
bv = qobject_cast<BlockView*>(scene()->views().back());
}
if (bv) bv->cur_bus = this;
if (bv) {
if (selPoint >= 0 || selSegment >= 0)
bv->cur_bus = this;
}
if (new_segment) {
QMetaObject::invokeMethod(scene()->views().back(), "newBranchCancel");
}

View File

@@ -231,7 +231,7 @@ bool BlockView::eventFilter(QObject * o, QEvent * e) {
block_emit_selection = false;
emit selectionChanged();
}
//qDebug() << cur_bus;
//qDebug() << "cur_bus" << cur_bus;
if (cur_bus) {
return false;
}
@@ -271,7 +271,7 @@ bool BlockView::eventFilter(QObject * o, QEvent * e) {
return true;
}
mil = scene_->items(scene_point);
//qDebug() << mil;
//qDebug() << "mil" << mil;
while (!mil.isEmpty()) {
mm_ci = mil.front();
if (mm_ci->data(bvidDTHandle).toBool()) return QGraphicsView::eventFilter(o, e);
@@ -358,9 +358,11 @@ bool BlockView::eventFilter(QObject * o, QEvent * e) {
/*if (ghost_) {
ghost_->setPos(quantize(me->scenePos(), grid_step));
}*/
//qDebug() << "move cur_bus" << cur_bus;
if (cur_bus) {
return false;
}
//qDebug() << "move mm_ci" << mm_ci;
if (mm_ci)
if (mm_ci->data(bvidTmpItem).toBool()) {
mm_ci = 0;
@@ -447,6 +449,7 @@ bool BlockView::eventFilter(QObject * o, QEvent * e) {
setCursor(Qt::DragCopyCursor);
}
} else {
//qDebug() << "move smode" << smode;
if (smode == BlockView::SingleSelection) {
if (fmm_drag) {
clearSelection();
@@ -2096,6 +2099,10 @@ void BlockView::removeAll() {
last_multiconnect_pl.clear();
QList<QGraphicsItem*> gi = scene_->items(), ai;
blockSignals(true);
match_bus = bus_from = cur_bus = nullptr;
mm_ci = nullptr;
hpin = nullptr;
ghost_ = nullptr;
foreach (QGraphicsItem * i, gi) {
if (i->data(bvidTmpItem).toBool()) continue;
if (i->data(bvidType).toInt() == bvitBlock)