Skip to content

Commit

Permalink
Fixed callback.
Browse files Browse the repository at this point in the history
  • Loading branch information
ggarra13 committed Sep 26, 2023
1 parent 0a3ae7e commit 4704b4c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/tlTimelineUI/TimelineWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ namespace tl
std::shared_ptr<ui::ScrollWidget> scrollWidget;
std::shared_ptr<TimelineItem> timelineItem;

std::function<void(const std::vector<timeline::InsertData>&)> insertCallback;

enum class MouseMode
{
None,
Expand Down Expand Up @@ -340,7 +342,11 @@ namespace tl
//! Sets a callback for inserting items
void TimelineWidget::setInsertCallback(const std::function<void(const std::vector<timeline::InsertData>&)>& value)
{
_p->timelineItem->setInsertCallback(value);
TLRENDER_P();
p.insertCallback = value;

if (p.timelineItem)
p.timelineItem->setInsertCallback(value);
}

void TimelineWidget::mousePressEvent(ui::MouseClickEvent& event)
Expand Down Expand Up @@ -560,6 +566,7 @@ namespace tl
context);
p.timelineItem->setEditable(p.editable->get());
p.timelineItem->setStopOnScrub(p.stopOnScrub->get());
p.timelineItem->setInsertCallback(p.insertCallback);
p.scrollWidget->setScrollPos(scrollPos);
p.scrollWidget->setWidget(p.timelineItem);
}
Expand Down

0 comments on commit 4704b4c

Please sign in to comment.