diff --git a/qad/blockview/blockview.cpp b/qad/blockview/blockview.cpp index b3610dc..77fad3c 100644 --- a/qad/blockview/blockview.cpp +++ b/qad/blockview/blockview.cpp @@ -534,13 +534,10 @@ bool BlockView::eventFilter(QObject * o, QEvent * e) { //qDebug() << "!!!"; if (match_bus == 0) { BlockBusItem * nb = new BlockBusItem(tmp_bus); - loadBus(nb); - addItem(nb); - //qDebug() << "also" << tmp_buses; + addItem(nb, tmp_buses.isEmpty()); foreach (BlockBusItem * b, tmp_buses) { nb = new BlockBusItem(*b); - loadBus(nb); - addItem(nb); + addItem(nb, b == tmp_buses.back()); } } else { if (connectTmpToBus(match_bus)) { @@ -875,13 +872,13 @@ void BlockView::clearSelection() { } -void BlockView::addItem(QGraphicsItem * item) { +void BlockView::addItem(QGraphicsItem * item, bool emit_action) { scene_->addItem(item); applyGridStep(); if (item->data(1005) == "connection") { loadBus(qgraphicsitem_cast(item)); connect((BlockBusItem*)item, SIGNAL(destroyed(QObject*)), this, SLOT(removedBus(QObject*)), Qt::UniqueConnection); - emitActionEvent(BlockItemBase::BusAdd, QList() << item); + if (emit_action) emitActionEvent(BlockItemBase::BusAdd, QList() << item); emit connectionsChanged(); return; } @@ -889,7 +886,7 @@ void BlockView::addItem(QGraphicsItem * item) { connect((BlockItem*)item, SIGNAL(destroyed(QObject*)), this, SLOT(removedBlock(QObject*)), Qt::UniqueConnection); connect((BlockItem*)item, SIGNAL(blockHoverEnter(BlockItem*)), this, SIGNAL(blockHoverEnter(BlockItem*)), Qt::UniqueConnection); connect((BlockItem*)item, SIGNAL(blockHoverLeave(BlockItem*)), this, SIGNAL(blockHoverLeave(BlockItem*)), Qt::UniqueConnection); - emitActionEvent(BlockItemBase::BlockAdd, QList() << item); + if (emit_action) emitActionEvent(BlockItemBase::BlockAdd, QList() << item); return; } item->setData(1009, "decor"); diff --git a/qad/blockview/blockview.h b/qad/blockview/blockview.h index 03f1c74..b65f99f 100644 --- a/qad/blockview/blockview.h +++ b/qad/blockview/blockview.h @@ -233,7 +233,7 @@ public slots: void removeSelected(); void removeAll(); void clearSelection(); - void addItem(QGraphicsItem * item); + void addItem(QGraphicsItem * item, bool emit_action = true); signals: void blockDoubleClicked(BlockItem * );