Commit b20a7307 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Fix crash on new project with Qt 5.14

Related to #494
parent 31c339ff
Pipeline #13248 passed with stage
in 15 minutes and 28 seconds
...@@ -65,6 +65,7 @@ TimelineWidget::TimelineWidget(QWidget *parent) ...@@ -65,6 +65,7 @@ TimelineWidget::TimelineWidget(QWidget *parent)
// Build transition model for context menu // Build transition model for context menu
m_transitionModel = TransitionTreeModel::construct(true, this); m_transitionModel = TransitionTreeModel::construct(true, this);
m_transitionProxyModel = std::make_unique<TransitionFilter>(this); m_transitionProxyModel = std::make_unique<TransitionFilter>(this);
m_sortModel = std::make_unique<QSortFilterProxyModel>(this);
static_cast<TransitionFilter *>(m_transitionProxyModel.get())->setFilterType(true, TransitionType::Favorites); static_cast<TransitionFilter *>(m_transitionProxyModel.get())->setFilterType(true, TransitionType::Favorites);
m_transitionProxyModel->setSourceModel(m_transitionModel.get()); m_transitionProxyModel->setSourceModel(m_transitionModel.get());
m_transitionProxyModel->setSortRole(AssetTreeModel::NameRole); m_transitionProxyModel->setSortRole(AssetTreeModel::NameRole);
...@@ -89,6 +90,8 @@ TimelineWidget::TimelineWidget(QWidget *parent) ...@@ -89,6 +90,8 @@ TimelineWidget::TimelineWidget(QWidget *parent)
TimelineWidget::~TimelineWidget() TimelineWidget::~TimelineWidget()
{ {
rootContext()->setContextProperty("multitrack", 0);
rootContext()->setContextProperty("timeline", 0);
delete m_proxy; delete m_proxy;
} }
...@@ -113,11 +116,9 @@ const QStringList TimelineWidget::sortedItems(const QStringList &items, bool isT ...@@ -113,11 +116,9 @@ const QStringList TimelineWidget::sortedItems(const QStringList &items, bool isT
void TimelineWidget::setModel(const std::shared_ptr<TimelineItemModel> &model, MonitorProxy *proxy) void TimelineWidget::setModel(const std::shared_ptr<TimelineItemModel> &model, MonitorProxy *proxy)
{ {
m_sortModel = std::make_unique<QSortFilterProxyModel>(this);
m_sortModel->setSourceModel(model.get()); m_sortModel->setSourceModel(model.get());
m_sortModel->setSortRole(TimelineItemModel::SortRole); m_sortModel->setSortRole(TimelineItemModel::SortRole);
m_sortModel->sort(0, Qt::DescendingOrder); m_sortModel->sort(0, Qt::DescendingOrder);
m_proxy->setModel(model); m_proxy->setModel(model);
rootContext()->setContextProperty("multitrack", m_sortModel.get()); rootContext()->setContextProperty("multitrack", m_sortModel.get());
rootContext()->setContextProperty("controller", model.get()); rootContext()->setContextProperty("controller", model.get());
......
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