Correctly unset effectstack on timeline item deletion

parent 960f4a95
...@@ -105,7 +105,6 @@ void AssetPanel::showTransition(int tid, std::shared_ptr<AssetParameterModel> tr ...@@ -105,7 +105,6 @@ void AssetPanel::showTransition(int tid, std::shared_ptr<AssetParameterModel> tr
{ {
clear(); clear();
QString transitionId = transitionModel->getAssetId(); QString transitionId = transitionModel->getAssetId();
m_transitionWidget->setProperty("compositionId", tid);
QString transitionName = TransitionsRepository::get()->getName(transitionId); QString transitionName = TransitionsRepository::get()->getName(transitionId);
m_assetTitle->setText(i18n("%1 properties", transitionName)); m_assetTitle->setText(i18n("%1 properties", transitionName));
m_transitionWidget->setVisible(true); m_transitionWidget->setVisible(true);
...@@ -165,28 +164,38 @@ void AssetPanel::showEffectStack(const QString &itemName, std::shared_ptr<Effect ...@@ -165,28 +164,38 @@ void AssetPanel::showEffectStack(const QString &itemName, std::shared_ptr<Effect
void AssetPanel::clearAssetPanel(int itemId) void AssetPanel::clearAssetPanel(int itemId)
{ {
if (itemId == -1 || m_transitionWidget->property("compositionId").toInt() == itemId || m_effectStackWidget->property("clipId").toInt() == itemId) { ObjectId id = m_effectStackWidget->stackOwner();
if (id.first == ObjectType::TimelineClip && id.second == itemId) {
clear(); clear();
} else {
id = m_transitionWidget->stackOwner();
if (id.first == ObjectType::TimelineComposition && id.second == itemId) {
clear();
}
} }
} }
void AssetPanel::adjustAssetPanelRange(int itemId, int in, int out) void AssetPanel::adjustAssetPanelRange(int itemId, int in, int out)
{ {
if (m_effectStackWidget->property("clipId").toInt() == itemId) { ObjectId id = m_effectStackWidget->stackOwner();
if (id.first == ObjectType::TimelineClip && id.second == itemId) {
m_effectStackWidget->setRange(in, out); m_effectStackWidget->setRange(in, out);
} else {
id = m_transitionWidget->stackOwner();
if (id.first == ObjectType::TimelineComposition && id.second == itemId) {
m_transitionWidget->setRange(in, out);
}
} }
} }
void AssetPanel::clear() void AssetPanel::clear()
{ {
m_transitionWidget->setVisible(false); m_transitionWidget->setVisible(false);
m_transitionWidget->setProperty("compositionId", QVariant());
m_transitionWidget->unsetModel(); m_transitionWidget->unsetModel();
m_effectStackWidget->setVisible(false); m_effectStackWidget->setVisible(false);
m_splitButton->setVisible(false); m_splitButton->setVisible(false);
m_timelineButton->setVisible(false); m_timelineButton->setVisible(false);
m_switchBuiltStack->setVisible(false); m_switchBuiltStack->setVisible(false);
m_effectStackWidget->setProperty("clipId", QVariant());
m_effectStackWidget->unsetModel(); m_effectStackWidget->unsetModel();
m_assetTitle->setText(QString()); m_assetTitle->setText(QString());
} }
......
...@@ -402,6 +402,7 @@ void TimelineController::deleteSelectedClips() ...@@ -402,6 +402,7 @@ void TimelineController::deleteSelectedClips()
} }
} }
m_selection.selectedItems.clear(); m_selection.selectedItems.clear();
emit selectionChanged();
} }
void TimelineController::copyItem() void TimelineController::copyItem()
......
...@@ -77,3 +77,8 @@ ObjectId TransitionStackView::stackOwner() const ...@@ -77,3 +77,8 @@ ObjectId TransitionStackView::stackOwner() const
} }
return ObjectId(ObjectType::NoItem, -1); return ObjectId(ObjectType::NoItem, -1);
} }
void TransitionStackView::setRange(int in, int out)
{
AssetParameterView::setRange(QPair<int, int>(in, out));
}
...@@ -35,6 +35,7 @@ public: ...@@ -35,6 +35,7 @@ public:
TransitionStackView(QWidget *parent = nullptr); TransitionStackView(QWidget *parent = nullptr);
void setModel(const std::shared_ptr<AssetParameterModel> &model, QPair<int, int> range, QSize frameSize, bool addSpacer = false); void setModel(const std::shared_ptr<AssetParameterModel> &model, QPair<int, int> range, QSize frameSize, bool addSpacer = false);
ObjectId stackOwner() const; ObjectId stackOwner() const;
void setRange(int in, int out);
private slots: private slots:
void updateTrack(int newTrack); void updateTrack(int newTrack);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment