+ if (snappedPos < 0) snappedPos = 0;
+ // Make sure there is no collision
+ QList<QGraphicsItem *> children = m_selectionGroup->childItems();
+ QPainterPath shape = m_selectionGroup->clipGroupShape(QPointF(snappedPos - m_selectionGroup->sceneBoundingRect().left(), 0));
+ QList<QGraphicsItem*> collidingItems = scene()->items(shape, Qt::IntersectsItemShape);
+ collidingItems.removeAll(m_selectionGroup);
+ for (int i = 0; i < children.count(); i++) {
+ collidingItems.removeAll(children.at(i));
+ }
+ bool collision = false;
+ for (int i = 0; i < collidingItems.count(); i++) {
+ if (collidingItems.at(i)->type() == AVWIDGET) {
+ collision = true;
+ break;
+ }
+ }
+ if (!collision) {
+ // Check transitions
+ shape = m_selectionGroup->transitionGroupShape(QPointF(snappedPos - m_selectionGroup->sceneBoundingRect().left(), 0));
+ collidingItems = scene()->items(shape, Qt::IntersectsItemShape);
+ collidingItems.removeAll(m_selectionGroup);
+ for (int i = 0; i < children.count(); i++) {
+ collidingItems.removeAll(children.at(i));
+ }
+ for (int i = 0; i < collidingItems.count(); i++) {
+ if (collidingItems.at(i)->type() == TRANSITIONWIDGET) {
+ collision = true;
+ break;
+ }
+ }
+ }
+
+ if (!collision)
+ m_selectionGroup->translate(snappedPos - m_selectionGroup->sceneBoundingRect().left(), 0);