summaryrefslogtreecommitdiffstats
path: root/src/Authoring/Qt3DStudio/Palettes
diff options
context:
space:
mode:
authorMahmoud Badri <mahmoud.badri@qt.io>2019-09-02 13:46:38 +0300
committerMahmoud Badri <mahmoud.badri@qt.io>2019-09-02 14:02:52 +0300
commit468ba00e70dc0fabde63f544d4eaaf9cddc4f8ac (patch)
treed93ea75bd64d18c5c2a25df7975f0b87bc17d14d /src/Authoring/Qt3DStudio/Palettes
parent5b1373a189bbdc17fdb7fd51b051bc9e7dc791f2 (diff)
Maintain the property graph expand status
...when changing slides, animation state, etc. Task-number: QT3DS-3917 Change-Id: Ib65cf4cc0d1dc3d393305879256d3269f1045b87 Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io> Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Diffstat (limited to 'src/Authoring/Qt3DStudio/Palettes')
-rw-r--r--src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/TimelineGraphicsScene.cpp5
-rw-r--r--src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/TimelineGraphicsScene.h8
-rw-r--r--src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/TimelineWidget.cpp2
-rw-r--r--src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/ui/RowTimelinePropertyGraph.cpp4
-rw-r--r--src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/ui/RowTree.cpp28
-rw-r--r--src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/ui/RowTreeLabel.h1
6 files changed, 40 insertions, 8 deletions
diff --git a/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/TimelineGraphicsScene.cpp b/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/TimelineGraphicsScene.cpp
index 6aff79cb..b792639f 100644
--- a/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/TimelineGraphicsScene.cpp
+++ b/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/TimelineGraphicsScene.cpp
@@ -741,6 +741,11 @@ TExpandMap &TimelineGraphicsScene::expandMap()
return m_expandMap;
}
+TPropGraphHeightMap &TimelineGraphicsScene::propGraphHeightMap()
+{
+ return m_propGraphHeightMap;
+}
+
void TimelineGraphicsScene::resetMousePressParams()
{
m_autoScrollTimelineTimer.stop();
diff --git a/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/TimelineGraphicsScene.h b/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/TimelineGraphicsScene.h
index fbdecefd..a6e6a1a6 100644
--- a/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/TimelineGraphicsScene.h
+++ b/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/TimelineGraphicsScene.h
@@ -56,7 +56,9 @@ QT_FORWARD_DECLARE_CLASS(QGraphicsLinearLayout)
QT_FORWARD_DECLARE_CLASS(QGraphicsView)
QT_FORWARD_DECLARE_CLASS(QLabel)
-typedef QHash<qt3dsdm::Qt3DSDMInstanceHandle, RowTree::ExpandState> TExpandMap;
+using TExpandMap = QHash<qt3dsdm::Qt3DSDMInstanceHandle, RowTree::ExpandState>;
+using TPropGraphHeightMap = QHash<qt3dsdm::Qt3DSDMInstanceHandle,
+ QHash<qt3dsdm::Qt3DSDMPropertyHandle, int>>;
class TimelineGraphicsScene : public QGraphicsScene
{
@@ -64,7 +66,7 @@ class TimelineGraphicsScene : public QGraphicsScene
public:
explicit TimelineGraphicsScene(TimelineWidget *timelineWidget);
- virtual ~TimelineGraphicsScene();
+ virtual ~TimelineGraphicsScene() override;
void setTimelineScale(int scale);
void setControllerText(const QString &controller);
@@ -86,6 +88,7 @@ public:
void resetMouseCursor();
void updateSnapSteps();
TExpandMap &expandMap();
+ TPropGraphHeightMap &propGraphHeightMap();
void resetMousePressParams();
QLabel *timebarTooltip();
void updateAutoScrolling(double scenePosY);
@@ -158,6 +161,7 @@ private:
double m_lastAutoScrollX = -1.0;
double m_lastAutoScrollY = -1.0;
TExpandMap m_expandMap;
+ TPropGraphHeightMap m_propGraphHeightMap;
QPointer<RowTree> m_releaseSelectRow = nullptr;
bool m_autoScrollDownOn = false;
bool m_autoScrollUpOn = false;
diff --git a/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/TimelineWidget.cpp b/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/TimelineWidget.cpp
index 12bd415b..4f5e25f1 100644
--- a/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/TimelineWidget.cpp
+++ b/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/TimelineWidget.cpp
@@ -424,6 +424,7 @@ void TimelineWidget::OnClosingPresentation()
{
m_connections.clear();
m_graphicsScene->expandMap().clear();
+ m_graphicsScene->propGraphHeightMap().clear();
// Hide timeline widget when presentation is closed
setVisible(false);
@@ -576,6 +577,7 @@ void TimelineWidget::onAssetDeleted(qt3dsdm::Qt3DSDMInstanceHandle inInstance)
m_graphicsScene->rowManager()->deleteRow(row);
m_handlesMap.remove(inInstance);
m_graphicsScene->expandMap().remove(inInstance);
+ m_graphicsScene->propGraphHeightMap().remove(inInstance);
// Ensure row deletions are finalized
if (!m_asyncUpdateTimer.isActive())
m_asyncUpdateTimer.start();
diff --git a/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/ui/RowTimelinePropertyGraph.cpp b/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/ui/RowTimelinePropertyGraph.cpp
index eefe6282..a17ee632 100644
--- a/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/ui/RowTimelinePropertyGraph.cpp
+++ b/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/ui/RowTimelinePropertyGraph.cpp
@@ -71,7 +71,7 @@ void RowTimelinePropertyGraph::paintGraphs(QPainter *painter, const QRectF &rect
static const QPointF edgeOffset(RULER_EDGE_OFFSET, 0);
- // draw graph base line (graph_Y)
+ // draw graph baseline (graph_Y)
painter->setPen(QPen(CStudioPreferences::studioColor3()));
painter->drawLine(edgeOffset.x(), m_graphY, rect.right(), m_graphY);
@@ -366,7 +366,7 @@ void RowTimelinePropertyGraph::updateChannelFiltering(const QVector<bool> &activ
m_activeChannels.clear();
m_activeChannelsIndex.clear();
- const auto animHandles = m_propBinding->animationHandles();
+ const auto animHandles = m_rowTimeline->rowTree()->propBinding()->animationHandles();
for (int i = 0; i < activeChannels.size(); ++i) {
if (activeChannels[i]) {
m_activeChannels.append(animHandles[i]);
diff --git a/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/ui/RowTree.cpp b/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/ui/RowTree.cpp
index cb0b7470..63862c5a 100644
--- a/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/ui/RowTree.cpp
+++ b/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/ui/RowTree.cpp
@@ -180,8 +180,7 @@ void RowTree::animateExpand(ExpandState state)
// so let's make sure the animation is stopped first.
m_expandAnimation.stop();
m_expandHeightAnimation->setEndValue(QSizeF(size().width(), endHeight));
- m_expandTimelineHeightAnimation->setEndValue(QSizeF(m_rowTimeline->size().width(),
- endHeight));
+ m_expandTimelineHeightAnimation->setEndValue(QSizeF(m_rowTimeline->size().width(), endHeight));
m_expandOpacityAnimation->setEndValue(endOpacity);
m_expandTimelineOpacityAnimation->setEndValue(endOpacity);
@@ -631,9 +630,24 @@ void RowTree::setPropBinding(ITimelineItemProperty *binding)
for (int i = 0; i < m_rectChannels.size(); ++i)
m_rectChannels[i].setRect(22, TimelineConstants::ROW_H * (i+1), 16, 16);
- if (parentRow()->expanded())
+ if (m_parentRow->expanded()) {
setRowVisible(true);
+ // restore property graph expand state if saved
+ if (m_scene->propGraphHeightMap().contains(m_parentRow->instance())) {
+ int propGraphH = m_scene->propGraphHeightMap().value(m_parentRow->instance())
+ .value(m_PropBinding->getPropertyHandle(), 0);
+ m_propGraphExpanded = propGraphH > 0;
+ if (m_propGraphExpanded) {
+ m_propGraphHeight = propGraphH;
+ setMaximumSize(QSizeF(size().width(), m_propGraphHeight));
+ m_rowTimeline->setMaximumSize(QSizeF(size().width(), m_propGraphHeight));
+ m_rowTimeline->propertyGraph()->setExpandHeight(m_propGraphHeight);
+ m_rowTimeline->propertyGraph()->updateChannelFiltering(m_activeChannels);
+ }
+ }
+ }
+
// Update label color
m_labelItem.setMaster(m_PropBinding->IsMaster());
@@ -1106,6 +1120,8 @@ TreeControlType RowTree::getClickedControl(const QPointF &scenePos)
? TimelineConstants::ROW_GRAPH_H_MAX : TimelineConstants::ROW_GRAPH_H;
m_rowTimeline->propertyGraph()->setExpandHeight(m_propGraphHeight);
animateExpand(ExpandState::Expanded);
+ m_scene->propGraphHeightMap()[m_parentRow->instance()]
+ .insert(m_PropBinding->getPropertyHandle(), m_propGraphHeight);
} else if (m_rectColorGradient.contains(p)) { // toggle color gradient
m_rowTimeline->toggleColorGradient();
} else { // toggle channels
@@ -1495,8 +1511,14 @@ void RowTree::togglePropertyExpanded(const QPointF &scenePos)
m_rowTimeline->propertyGraph()->setExpandHeight(m_propGraphHeight);
m_rowTimeline->propertyGraph()->updateChannelFiltering(m_activeChannels);
animateExpand(ExpandState::Expanded);
+
+ m_scene->propGraphHeightMap()[m_parentRow->instance()]
+ .insert(m_PropBinding->getPropertyHandle(), m_propGraphHeight);
} else {
animateExpand(ExpandState::Collapsed);
+
+ m_scene->propGraphHeightMap()[m_parentRow->instance()]
+ .remove(m_PropBinding->getPropertyHandle());
}
}
diff --git a/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/ui/RowTreeLabel.h b/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/ui/RowTreeLabel.h
index 980591f6..c438a366 100644
--- a/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/ui/RowTreeLabel.h
+++ b/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/ui/RowTreeLabel.h
@@ -70,7 +70,6 @@ private:
bool m_locked;
bool m_master;
bool m_acceptOnFocusOut;
-
};
#endif // ROWTREELABELITEM_H