summaryrefslogtreecommitdiffstats
path: root/src/Authoring/Studio/Palettes/TimelineGraphicsView/RowMover.cpp
diff options
context:
space:
mode:
authorMahmoud Badri <mahmoud.badri@qt.io>2018-06-07 11:44:51 +0300
committerMahmoud Badri <mahmoud.badri@qt.io>2018-06-07 10:09:08 +0000
commitab754c656ec67aaa3684476d438ca5e869c62219 (patch)
tree8f5b0ced6cc1643f4cf99d94df40bea1158c077f /src/Authoring/Studio/Palettes/TimelineGraphicsView/RowMover.cpp
parent103309d9c7ab10fc1b48723c2a2f4721ef91c973 (diff)
Fix some property graph expansion issues
Fixed the following 2 issues which happen when one or more property rows graphs are expanded: - selecting keyframes by selection rectangle - tree rows context menu targeting the correct row Also got rid of the correctIndex() method (and some related methods) which caused some limitations. Task-number: QT3DS-1892 Change-Id: I64b817d54da4a471c0ada8e74a13b61b44f5820f Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io> Reviewed-by: Kaj Grönholm <kaj.gronholm@qt.io> Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Diffstat (limited to 'src/Authoring/Studio/Palettes/TimelineGraphicsView/RowMover.cpp')
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/RowMover.cpp28
1 files changed, 9 insertions, 19 deletions
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/RowMover.cpp b/src/Authoring/Studio/Palettes/TimelineGraphicsView/RowMover.cpp
index 44c01622..65be2cdd 100644
--- a/src/Authoring/Studio/Palettes/TimelineGraphicsView/RowMover.cpp
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/RowMover.cpp
@@ -156,20 +156,6 @@ void RowMover::updateState(int depth, double y)
setVisible(true);
}
-RowTree *RowMover::getRowAtPos(const QPointF &scenePos)
-{
- QList<QGraphicsItem *> items = m_scene->items(scenePos);
-
- int index = 0;
- while (index < items.size()) {
- QGraphicsItem *item = items.at(index++);
- if (item->type() == TimelineItem::TypeRowTree)
- return static_cast<RowTree *>(item);
- }
-
- return nullptr;
-}
-
bool RowMover::isNextSiblingRow(RowTree *rowMain, RowTree *rowSibling) const
{
// order matters, rowSibling is below rowMain
@@ -208,8 +194,10 @@ void RowMover::updateTargetRow(const QPointF &scenePos, EStudioObjectType rowTyp
theRowType = m_sourceRows[0]->rowType();
// row will be inserted just below rowInsert1 and just above rowInsert2 (if it exists)
- RowTree *rowInsert1 = getRowAtPos(scenePos + QPointF(0, TimelineConstants::ROW_H * -.5));
- RowTree *rowInsert2 = getRowAtPos(scenePos + QPointF(0, TimelineConstants::ROW_H * .5));
+ RowTree *rowInsert1 = m_scene->rowManager()
+ ->getRowAtPos(scenePos + QPointF(0, TimelineConstants::ROW_H * -.5));
+ RowTree *rowInsert2 = m_scene->rowManager()
+ ->getRowAtPos(scenePos + QPointF(0, TimelineConstants::ROW_H * .5));
bool valid = rowInsert1 && theRowType != OBJTYPE_MATERIAL
&& theRowType != OBJTYPE_CUSTOMMATERIAL;
@@ -219,10 +207,12 @@ void RowMover::updateTargetRow(const QPointF &scenePos, EStudioObjectType rowTyp
// after the property
if (rowInsert1->isProperty()) {
rowInsert1 = rowInsert1->parentRow()->childProps().last();
- rowInsert2 = getRowAtPos(QPointF(0, rowInsert1->y() + TimelineConstants::ROW_H));
+ rowInsert2 = m_scene->rowManager()
+ ->getRowAtPos(QPointF(0, rowInsert1->y() + TimelineConstants::ROW_H));
} else if (rowInsert1->hasPropertyChildren() && rowInsert1->expanded()) {
rowInsert1 = rowInsert1->childProps().last();
- rowInsert2 = getRowAtPos(QPointF(0, rowInsert1->y() + TimelineConstants::ROW_H));
+ rowInsert2 = m_scene->rowManager()
+ ->getRowAtPos(QPointF(0, rowInsert1->y() + TimelineConstants::ROW_H));
}
// calc insertion depth
@@ -320,7 +310,7 @@ void RowMover::updateTargetRow(const QPointF &scenePos, EStudioObjectType rowTyp
valid = false;
}
if (valid) {
- updateState(depth, rowInsert1->y() + TimelineConstants::ROW_H);
+ updateState(depth, rowInsert1->y() + rowInsert1->size().height());
// auto expand
if (!rowInsert1->locked() && !rowInsert1->expanded() && rowInsert1->isContainer()