diff --git a/lib/tlTimelineUI/TimelineWidget.cpp b/lib/tlTimelineUI/TimelineWidget.cpp index 98b91ccf8..a9f2b2c2f 100644 --- a/lib/tlTimelineUI/TimelineWidget.cpp +++ b/lib/tlTimelineUI/TimelineWidget.cpp @@ -28,6 +28,8 @@ namespace tl std::shared_ptr scrollWidget; std::shared_ptr timelineItem; + std::function&)> insertCallback; + enum class MouseMode { None, @@ -340,7 +342,11 @@ namespace tl //! Sets a callback for inserting items void TimelineWidget::setInsertCallback(const std::function&)>& value) { - _p->timelineItem->setInsertCallback(value); + TLRENDER_P(); + p.insertCallback = value; + + if (p.timelineItem) + p.timelineItem->setInsertCallback(value); } void TimelineWidget::mousePressEvent(ui::MouseClickEvent& event) @@ -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); }