QRectF rect(mapToScene(m_clickEvent).x(), track * m_tracksHeight + m_tracksHeight / 2, sceneRect().width() - mapToScene(m_clickEvent).x(), m_tracksHeight / 2 - 2);
bool isOk;
- selection = checkForGroups(rect, isOk);
+ selection = checkForGroups(rect, &isOk);
if (!isOk) {
// groups found on track, do not allow the move
emit displayMessage(i18n("Cannot use spacer in a track with a group"), ErrorMessage);
setDocumentModified();
}
-QList<QGraphicsItem *> CustomTrackView::checkForGroups(const QRectF &rect, bool &ok)
+QList<QGraphicsItem *> CustomTrackView::checkForGroups(const QRectF &rect, bool *ok)
{
// Check there is no group going over several tracks there, or that would result in timeline corruption
QList<QGraphicsItem *> selection = scene()->items(rect);
+ *ok = true;
int maxHeight = m_tracksHeight * 1.5;
for (int i = 0; i < selection.count(); i++) {
// Check that we don't try to move a group with clips on other tracks
if (selection.at(i)->type() == GROUPWIDGET && (selection.at(i)->boundingRect().height() >= maxHeight)) {
- ok = false;
+ *ok = false;
break;
} else if (selection.at(i)->parentItem() && (selection.at(i)->parentItem()->boundingRect().height() >= maxHeight)) {
- ok = false;
+ *ok = false;
break;
}
}
QRectF rect(pos.frames(m_document->fps()), track * m_tracksHeight + m_tracksHeight / 2, sceneRect().width() - pos.frames(m_document->fps()), m_tracksHeight / 2 - 2);
bool isOk;
- QList<QGraphicsItem *> items = checkForGroups(rect, isOk);
+ QList<QGraphicsItem *> items = checkForGroups(rect, &isOk);
if (!isOk) {
// groups found on track, do not allow the move
emit displayMessage(i18n("Cannot remove space in a track with a group"), ErrorMessage);
// Make sure there is no group in the way
QRectF rect(pos.frames(m_document->fps()), track * m_tracksHeight + m_tracksHeight / 2, sceneRect().width() - pos.frames(m_document->fps()), m_tracksHeight / 2 - 2);
bool isOk;
- QList<QGraphicsItem *> items = checkForGroups(rect, isOk);
+ QList<QGraphicsItem *> items = checkForGroups(rect, &isOk);
if (!isOk) {
// groups found on track, do not allow the move
emit displayMessage(i18n("Cannot insert space in a track with a group"), ErrorMessage);
/** Whether an item can be moved to a new position without colliding with similar items */
bool itemCollision(AbstractClipItem *item, ItemInfo newPos);
/** Selects all items in the scene rect, and sets ok to false if a group going over several tracks is found in it */
- QList<QGraphicsItem *> checkForGroups(const QRectF &rect, bool &ok);
+ QList<QGraphicsItem *> checkForGroups(const QRectF &rect, bool *ok);
private slots:
void slotRefreshGuides();