diff --git a/src/widget/wtracktableview.cpp b/src/widget/wtracktableview.cpp index 3edc55ad07d5..6d44578ad0b6 100644 --- a/src/widget/wtracktableview.cpp +++ b/src/widget/wtracktableview.cpp @@ -414,20 +414,21 @@ void WTrackTableView::loadTrackModel(QAbstractItemModel *model) { // the flags(...) function that we're already using in LibraryTableModel. I // haven't been able to get it to stop us from using a model as a drag // target though, so my hax above may not be completely unjustified. - setVisible(true); - if (m_sorting) { - // Sorting has to be applied after setVisible(true), since only visible - // WTrackTableViews will be sorted - applySorting(); - } restoreVScrollBarPos(newModel); // restoring scrollBar position using model pointer as key // scrollbar positions with respect to different models are backed by map } +void WTrackTableView::showEvent(QShowEvent *event) { + WLibraryTableView::showEvent(event); + if (m_sorting) { + applySorting(); + } +} + void WTrackTableView::createActions() { DEBUG_ASSERT(m_pMenu); DEBUG_ASSERT(m_pSamplerMenu); diff --git a/src/widget/wtracktableview.h b/src/widget/wtracktableview.h index 8eaef53c484c..59b46c89a4d4 100644 --- a/src/widget/wtracktableview.h +++ b/src/widget/wtracktableview.h @@ -106,6 +106,7 @@ class WTrackTableView : public WLibraryTableView { void dragMoveEvent(QDragMoveEvent * event) override; void dragEnterEvent(QDragEnterEvent * event) override; void dropEvent(QDropEvent * event) override; + void showEvent(QShowEvent *event) override; void lockBpm(bool lock); void enableCachedOnly();