diff options
author | Mahmoud Badri <mahmoud.badri@qt.io> | 2018-05-29 15:41:57 +0300 |
---|---|---|
committer | Mahmoud Badri <mahmoud.badri@qt.io> | 2018-05-30 09:18:30 +0000 |
commit | 22c412cc609330d05b99beec11e0201ff99a3002 (patch) | |
tree | c64dd6d26637342213a3f095acc968f8661885e3 | |
parent | 88a2ffdb8c4d28c3e72ce0cddecf6f07a5184dcc (diff) |
Allow moving rows at the root level inside a component
Task-number: QT3DS-1821
Change-Id: Ibbb8f56faec76c14eca54fc7d3414f1d18129119
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
-rw-r--r-- | src/Authoring/Studio/Palettes/TimelineGraphicsView/RowMover.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/RowMover.cpp b/src/Authoring/Studio/Palettes/TimelineGraphicsView/RowMover.cpp index c51fe27d..7b215686 100644 --- a/src/Authoring/Studio/Palettes/TimelineGraphicsView/RowMover.cpp +++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/RowMover.cpp @@ -209,8 +209,15 @@ void RowMover::updateTargetRow(const QPointF &scenePos, EStudioObjectType rowTyp } // calc insertion depth + bool inAComponent = static_cast<RowTree *>(m_scene->layoutTree()->itemAt(1)) + ->rowType() == OBJTYPE_COMPONENT; int depth; - int depthMin = rowInsert2 ? rowInsert2->depth() : (theRowType == OBJTYPE_LAYER ? 2 : 3); + int depthMin = 2; + if (rowInsert2) + depthMin = rowInsert2->depth(); + else if (theRowType != OBJTYPE_LAYER && !inAComponent) + depthMin = 3; + int depthMax = rowInsert1->depth(); if (!rowInsert1->locked() && rowInsert1->isContainer() && !m_sourceRows.contains(rowInsert1)) { @@ -228,7 +235,6 @@ void RowMover::updateTargetRow(const QPointF &scenePos, EStudioObjectType rowTyp depth = (scenePos.x() - LEFT_MARGIN) / TimelineConstants::ROW_DEPTH_STEP; depth = qBound(depthMin, depth, depthMax); } - // calc insertion parent RowTree *insertParent = rowInsert1; for (int i = rowInsert1->depth(); i >= depth; --i) @@ -248,7 +254,8 @@ void RowMover::updateTargetRow(const QPointF &scenePos, EStudioObjectType rowTyp // or object under itself, or under unacceptable parent for (auto sourceRow : qAsConst(m_sourceRows)) { if ((sourceRow->isMaster() && sourceRow->rowType() != OBJTYPE_LAYER - && !m_insertionParent->isMaster()) + && !m_insertionParent->isMaster() + && insertParent->rowType() != OBJTYPE_COMPONENT) || m_insertionParent->isDecendentOf(sourceRow) || m_insertionParent == sourceRow || !CStudioObjectTypes::AcceptableParent(sourceRow->rowType(), @@ -297,7 +304,8 @@ void RowMover::updateTargetRow(const QPointF &scenePos, EStudioObjectType rowTyp // auto expand if (!rowInsert1->locked() && !rowInsert1->expanded() && rowInsert1->isContainer() - && !rowInsert1->empty() && !isSourceRowsDescendant(rowInsert1)) { + && !rowInsert1->empty() && !isSourceRowsDescendant(rowInsert1) + && depth == rowInsert1->depth() + 1) { updateTargetRowLater = std::bind(&RowMover::updateTargetRow, this, scenePos, rowType); m_rowAutoExpand = rowInsert1; |