BlockView selection fix - many bugs with 1 fix (ctrl+click, ctrl+selection_rect, selection disappear)

This commit is contained in:
2020-10-14 01:47:15 +03:00
parent 32f2c061d1
commit 59711afa14
2 changed files with 9 additions and 1 deletions

View File

@@ -1,4 +1,5 @@
#include "blockview.h"
#include <QApplication>
BlockBusItem::BlockBusItem(bool temp): QGraphicsObject(), PropertyStorage() {
@@ -572,6 +573,11 @@ void BlockBusItem::hoverLeaveEvent(QGraphicsSceneHoverEvent * e) {
setPen(pu); setBrush(bu);
setToolTip(QString());
anim_point_size.stop();
BlockView * bv = 0;
if (!scene()->views().isEmpty())
bv = qobject_cast<BlockView*>(scene()->views().back());
if (bv && (QApplication::mouseButtons() == 0))
bv->cur_bus = 0;
update();
QGraphicsObject::hoverLeaveEvent(e);
}

View File

@@ -363,7 +363,7 @@ bool BlockView::eventFilter(QObject * o, QEvent * e) {
if (cur_bus) {
return false;
}
//qDebug() << "move mm_ci" << mm_ci;
//qDebug() << "move mm_ci" << mm_ci << mm_cancel;
if (mm_ci)
if (mm_ci->data(bvidTmpItem).toBool()) {
mm_ci = 0;
@@ -1210,6 +1210,7 @@ QRectF BlockView::itemsBoundingRect() const {
void BlockView::restoreSelState() {
//qDebug() << "restoreSelState";
foreach (QGraphicsItem * i, sel_items) {
i->setPos(i->data(bvidItemPos).toPointF());
}
@@ -1224,6 +1225,7 @@ void BlockView::restoreSelState() {
void BlockView::saveSelState() {
//qDebug() << "saveSelState";
QList<QGraphicsItem*> gi = scene_->items();
sel_items = scene_->selectedItems();
foreach (QGraphicsItem * i, gi) {