From 3a41f3853cc5633210dafc412cc98129a1cb8a7c Mon Sep 17 00:00:00 2001 From: Ivan Pelipenko Date: Wed, 14 Oct 2020 01:13:30 +0300 Subject: [PATCH] BlockView selection rect fix (inside bus bounding rect) --- libs/blockview/blockbusitem.cpp | 5 ++++- libs/blockview/blockview.cpp | 11 +++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/libs/blockview/blockbusitem.cpp b/libs/blockview/blockbusitem.cpp index df827b4..fc9d8ae 100644 --- a/libs/blockview/blockbusitem.cpp +++ b/libs/blockview/blockbusitem.cpp @@ -586,7 +586,10 @@ void BlockBusItem::mousePressEvent(QGraphicsSceneMouseEvent * e) { if (!scene()->views().isEmpty()) { bv = qobject_cast(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"); } diff --git a/libs/blockview/blockview.cpp b/libs/blockview/blockview.cpp index 499688c..c4a1d34 100644 --- a/libs/blockview/blockview.cpp +++ b/libs/blockview/blockview.cpp @@ -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 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)