git-svn-id: svn://db.shs.com.ru/libs@403 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -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<BlockBusItem*>(item));
|
||||
connect((BlockBusItem*)item, SIGNAL(destroyed(QObject*)), this, SLOT(removedBus(QObject*)), Qt::UniqueConnection);
|
||||
emitActionEvent(BlockItemBase::BusAdd, QList<QGraphicsItem*>() << item);
|
||||
if (emit_action) emitActionEvent(BlockItemBase::BusAdd, QList<QGraphicsItem*>() << 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<QGraphicsItem*>() << item);
|
||||
if (emit_action) emitActionEvent(BlockItemBase::BlockAdd, QList<QGraphicsItem*>() << item);
|
||||
return;
|
||||
}
|
||||
item->setData(1009, "decor");
|
||||
|
||||
@@ -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 * );
|
||||
|
||||
Reference in New Issue
Block a user