git-svn-id: svn://db.shs.com.ru/libs@167 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -441,12 +441,15 @@ bool BlockView::eventFilter(QObject * o, QEvent * e) {
|
||||
blockSignals(true);
|
||||
if (moved) {
|
||||
QList<BlockItem*> ci;
|
||||
QList<BlockBusItem*> bi;
|
||||
foreach (QGraphicsItem * b, sel_items)
|
||||
if (b->data(1006) == "item") {
|
||||
ci << qgraphicsitem_cast<BlockItem*>(b);
|
||||
ai << qgraphicsitem_cast<QGraphicsItem*>(b);
|
||||
}
|
||||
copyBlocks(ci, copy_dp);
|
||||
bi = internalBuses(ci);
|
||||
if (!ci.isEmpty()) copyBlocks(ci, copy_dp);
|
||||
if (!bi.isEmpty()) copyBuses(bi, copy_dp);
|
||||
}
|
||||
qDeleteAll(copy_items);
|
||||
copy_items.clear();
|
||||
@@ -1186,6 +1189,20 @@ void BlockView::moveBuses(const QList<QGraphicsItem * > & items, QPointF dp) {
|
||||
}
|
||||
|
||||
|
||||
QList<BlockBusItem * > BlockView::internalBuses(const QList<BlockItem * > & items) {
|
||||
QList<BlockBusItem * > ret;
|
||||
if (items.isEmpty()) return ret;
|
||||
QList<BlockBusItem * > sbl = buses();
|
||||
QSet<BlockItem * > sis = QSet<BlockItem * >::fromList(items);
|
||||
foreach (BlockBusItem * bi, sbl) {
|
||||
QSet<BlockItem * > bis = QSet<BlockItem * >::fromList(bi->connectedBlocks());
|
||||
if ((bis - sis).isEmpty())
|
||||
ret << bi;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void BlockView::adjustThumb() {
|
||||
if (!scene()) return;
|
||||
QSizeF sr = sceneRect().size(), tr;
|
||||
|
||||
Reference in New Issue
Block a user