summaryrefslogtreecommitdiffstats
path: root/src/Authoring/Studio/Palettes/TimelineGraphicsView/RowMover.cpp
diff options
context:
space:
mode:
authorMahmoud Ali <Mahmoud.Badri@qt.io>2018-05-09 18:55:17 +0300
committerMahmoud Badri <mahmoud.badri@qt.io>2018-05-11 09:07:35 +0000
commit02106701b2ab9e997e0f7604291c093e47c845e2 (patch)
tree27f4253e33fb834969c64bfb14d985c1e17482e0 /src/Authoring/Studio/Palettes/TimelineGraphicsView/RowMover.cpp
parent9335d89a11964d619c28a1f4c808f8475e4293f8 (diff)
Allow moving a row under a collapsed row
Also remove GV from the timeline title Task-number: QT3DS-1548 Change-Id: I5daf2e70be8e28fc3070f7032a3d443c321a0c19 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Diffstat (limited to 'src/Authoring/Studio/Palettes/TimelineGraphicsView/RowMover.cpp')
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/RowMover.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/RowMover.cpp b/src/Authoring/Studio/Palettes/TimelineGraphicsView/RowMover.cpp
index ca1ce405..b600c1a6 100644
--- a/src/Authoring/Studio/Palettes/TimelineGraphicsView/RowMover.cpp
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/RowMover.cpp
@@ -177,8 +177,7 @@ void RowMover::updateTargetRow(int mouseX, int mouseY)
int depthMin = nextRowAtIndex ? nextRowAtIndex->depth() : 3;
int depthMax = rowAtIndex->depth();
- if (rowAtIndex->isContainer() && rowAtIndex->expanded()
- && rowAtIndex != m_sourceRow) {
+ if (rowAtIndex->isContainer() && rowAtIndex != m_sourceRow) {
depthMax++; // Container: allow insertion as a child
} else if (rowAtIndex->isPropertyOrMaterial()
&& !rowAtIndex->parentRow()->isContainer()) {
@@ -205,9 +204,13 @@ void RowMover::updateTargetRow(int mouseX, int mouseY)
if (valid) {
// calc insertion index
int index = rowAtIndex->index() + 1;
- if ((rowAtIndex->isProperty() && depth == rowAtIndex->depth())
- || rowAtIndex == insertParent) {
+ if (rowAtIndex->isProperty() && depth == rowAtIndex->depth()) {
index = 0;
+ } else if (rowAtIndex == insertParent) {
+ if (insertParent->expanded() || insertParent->childRows().empty())
+ index = 0;
+ else
+ index = insertParent->childRows().last()->index() + 1;
} else if (depth < rowAtIndex->depth()) {
RowTree *row = rowAtIndex;
for (int i = depth; i < rowAtIndex->depth(); ++i)
@@ -215,9 +218,9 @@ void RowMover::updateTargetRow(int mouseX, int mouseY)
index = row->index() + 1;
}
- if (m_sourceRow && insertParent == m_sourceRow->parentRow()
- && index > m_sourceRow->index()) {
- index--;
+ if (m_sourceRow && m_sourceRow->parentRow() == insertParent
+ && index > m_sourceRow->index()) { // moving down under the same parent
+ index--; // m_sourceRow is removed from layout, shift index up by 1
}
updateState(index, depth, indexRaw);