summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@qt.io>2018-05-22 15:56:48 +0300
committerMiikka Heikkinen <miikka.heikkinen@qt.io>2018-05-23 11:09:16 +0000
commit413a3adee6eb4f3f754f7ba05cba156a39780d99 (patch)
treebcd5b51c8568350f1ed90de1f6781e9fb84a7286
parent71c5fd229cd62dce18a883a1bba8ddb7aaefcf7f (diff)
Expand parents of selected rows upon selection
Previously dragging a new object form basic objects to scene view would not trigger parent expansion. Rather than make a special case about that, changed it so that all row selection triggers parental expansion. Change-Id: Iae38a8b462012c127ac22fb8bca07cfd4f8c36d3 Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io> Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/RowManager.cpp15
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineWidget.cpp11
2 files changed, 16 insertions, 10 deletions
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/RowManager.cpp b/src/Authoring/Studio/Palettes/TimelineGraphicsView/RowManager.cpp
index a599defc..4d5cc82e 100644
--- a/src/Authoring/Studio/Palettes/TimelineGraphicsView/RowManager.cpp
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/RowManager.cpp
@@ -43,6 +43,8 @@
#include "Doc.h"
#include <QtWidgets/qgraphicslinearlayout.h>
+#include <QtCore/qpointer.h>
+#include <QtCore/qtimer.h>
RowManager::RowManager(TimelineGraphicsScene *scene, QGraphicsLinearLayout *layoutLabels,
QGraphicsLinearLayout *layoutTimeline)
@@ -231,6 +233,19 @@ void RowManager::setRowSelection(RowTree *row, bool selected)
if (!m_selectedRows.contains(row))
m_selectedRows.append(row);
row->setState(InteractiveTimelineItem::Selected);
+ // Expand parents if not expanded
+ QPointer<RowTree> pRow = row->parentRow();
+ if (!pRow.isNull()) {
+ QTimer::singleShot(0, [pRow]() {
+ if (!pRow.isNull()) {
+ RowTree *parentRow = pRow.data();
+ while (parentRow) {
+ parentRow->updateExpandStatus(RowTree::ExpandState::Expanded, true);
+ parentRow = parentRow->parentRow();
+ }
+ }
+ });
+ }
} else {
m_selectedRows.removeAll(row);
row->setState(InteractiveTimelineItem::Normal);
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineWidget.cpp b/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineWidget.cpp
index 5417b5e1..2836435e 100644
--- a/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineWidget.cpp
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineWidget.cpp
@@ -910,17 +910,8 @@ void TimelineWidget::enableDnD(bool b)
m_viewTreeHeader->setInteractive(!b);
m_viewTreeContent->setInteractive(!b);
- if (!b) { // object successfully dropped on the timeline tree
- if (m_graphicsScene->rowMover()->insertionParent()
- && !m_graphicsScene->rowMover()->insertionParent()->expanded()
- && !m_fullReconstruct) {
- RowTree *insertionParent = m_graphicsScene->rowMover()->insertionParent();
- QTimer::singleShot(0, this, [=]() {
- insertionParent->updateExpandStatus(RowTree::ExpandState::Expanded, false);
- });
- }
+ if (!b) // object successfully dropped on the timeline tree
m_graphicsScene->rowMover()->end(true);
- }
}
Qt3DSDMTimelineItemBinding *TimelineWidget::getBindingForHandle(int handle,