ui: moved timeline selection signal queue to timeline

Probably a safer way to do this
This commit is contained in:
itsmattkc
2022-04-12 09:28:51 -07:00
parent 25d0196094
commit 60f80d4a14
4 changed files with 15 additions and 12 deletions
+1 -7
View File
@@ -155,11 +155,6 @@ NodeParamView::NodeParamView(bool create_keyframe_view, QWidget *parent) :
&QApplication::focusChanged,
this,
&NodeParamView::FocusChanged);
ctx_update_timer_ = new QTimer(this);
ctx_update_timer_->setInterval(1);
ctx_update_timer_->setSingleShot(true);
connect(ctx_update_timer_, &QTimer::timeout, this, &NodeParamView::UpdateContexts);
}
NodeParamView::~NodeParamView()
@@ -298,8 +293,7 @@ void NodeParamView::SetContexts(const QVector<Node *> &contexts)
{
// Setting contexts is expensive, so we queue it here to prevent multiple calls in a short timespan
contexts_ = contexts;
ctx_update_timer_->stop();
ctx_update_timer_->start();
UpdateContexts();
}
void NodeParamView::resizeEvent(QResizeEvent *event)
-2
View File
@@ -135,8 +135,6 @@ private:
QVector<Node*> contexts_;
QVector<Node*> current_contexts_;
QTimer *ctx_update_timer_;
private slots:
void UpdateGlobalScrollBar();
+12 -3
View File
@@ -185,6 +185,14 @@ TimelineWidget::TimelineWidget(QWidget *parent) :
connect(Core::instance(), &Core::ToolChanged, this, &TimelineWidget::ToolChanged);
connect(Core::instance(), &Core::AddableObjectChanged, this, &TimelineWidget::AddableObjectChanged);
signal_block_change_timer_ = new QTimer(this);
signal_block_change_timer_->setInterval(1);
signal_block_change_timer_->setSingleShot(true);
connect(signal_block_change_timer_, &QTimer::timeout, this, [this]{
signal_block_change_timer_->stop();
emit BlockSelectionChanged(selected_blocks_);
});
}
TimelineWidget::~TimelineWidget()
@@ -1163,7 +1171,8 @@ void TimelineWidget::SetScrollZoomsByDefaultOnAllViews(bool e)
void TimelineWidget::SignalBlockSelectionChange()
{
emit BlockSelectionChanged(selected_blocks_);
signal_block_change_timer_->stop();
signal_block_change_timer_->start();
}
void TimelineWidget::AddGhost(TimelineViewGhostItem *ghost)
@@ -1336,7 +1345,7 @@ void TimelineWidget::SignalSelectedBlocks(QVector<Block *> input, bool filter)
selected_blocks_.append(input);
emit SignalBlockSelectionChange();
SignalBlockSelectionChange();
}
void TimelineWidget::SignalDeselectedBlocks(const QVector<Block *> &deselected_blocks)
@@ -1349,7 +1358,7 @@ void TimelineWidget::SignalDeselectedBlocks(const QVector<Block *> &deselected_b
selected_blocks_.removeOne(b);
}
emit SignalBlockSelectionChange();
SignalBlockSelectionChange();
}
void TimelineWidget::SignalDeselectedAllBlocks()
@@ -322,6 +322,8 @@ private:
MultiUndoCommand *subtitle_show_command_;
QTimer *signal_block_change_timer_;
class SetSplitterSizesCommand : public UndoCommand
{
public: