diff options
author | Mahmoud Badri <mahmoud.badri@qt.io> | 2018-07-24 12:03:05 +0300 |
---|---|---|
committer | Mahmoud Badri <mahmoud.badri@qt.io> | 2018-07-27 07:55:49 +0000 |
commit | a82f40e97355a341c6d4ad897200bb8753a9b407 (patch) | |
tree | 4b3443e37d0be7dade88628678c9fab5ec872484 /src/Authoring/Studio/Palettes/TimelineGraphicsView/RowMover.cpp | |
parent | 926684e8988cad373f274730c1c8b0c1dcfe1ca4 (diff) |
Allow DnD presentations from the project palette to the timeline rows
Task-number: QT3DS-1951
Change-Id: Iae861c2f777d8e62a17e2331aea1913390d05453
Reviewed-by: Janne Kangas <janne.kangas@qt.io>
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
Diffstat (limited to 'src/Authoring/Studio/Palettes/TimelineGraphicsView/RowMover.cpp')
-rw-r--r-- | src/Authoring/Studio/Palettes/TimelineGraphicsView/RowMover.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/RowMover.cpp b/src/Authoring/Studio/Palettes/TimelineGraphicsView/RowMover.cpp index ab7e5686..a2c2659b 100644 --- a/src/Authoring/Studio/Palettes/TimelineGraphicsView/RowMover.cpp +++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/RowMover.cpp @@ -141,6 +141,9 @@ void RowMover::end(bool force) row->setDnDState(RowTree::DnDState::None, RowTree::DnDState::Any, true); m_sourceRows.clear(); + if (m_insertionTarget) + m_insertionTarget->setDnDState(RowTree::DnDState::None); + setVisible(false); resetInsertionParent(); updateTargetRowLater = {}; @@ -190,6 +193,27 @@ bool RowMover::isSourceRowsDescendant(RowTree *row) const // i.e. when dragging from project or basic objects palettes void RowMover::updateTargetRow(const QPointF &scenePos, EStudioObjectType rowType) { + // DnD a presentation from the project panel (to set it as a subpresentation) + if (rowType == OBJTYPE_PRESENTATION) { + if (m_insertionTarget) + m_insertionTarget->setDnDState(RowTree::DnDState::None, RowTree::DnDState::SP_TARGET); + + RowTree *rowAtMouse = m_scene->rowManager()->getRowAtPos(scenePos); + if (rowAtMouse) { + // m_insertionTarget will go through CFileDropSource::ValidateTarget() which will + // filter out invalid drop rows + m_insertionTarget = rowAtMouse; + m_insertType = Q3DStudio::DocumentEditorInsertType::LastChild; + + if (rowAtMouse->rowType() == OBJTYPE_LAYER || rowAtMouse->rowType() == OBJTYPE_MATERIAL + || rowAtMouse->rowType() == OBJTYPE_IMAGE) { + m_insertionTarget->setDnDState(RowTree::DnDState::SP_TARGET); + } + } + + return; + } + EStudioObjectType theRowType = rowType; if (theRowType == OBJTYPE_UNKNOWN && m_sourceRows.size() == 1) theRowType = m_sourceRows[0]->rowType(); |