Important: Please read the Qt Code of Conduct -

[SOLVED] How to detect QTreeView has been re-sorted?

  • I need to execute code after the tree view (my subclass of QTreeView) has been updated due to sorting changing - different sort column or direction selected by user (or otherwise).
    It seems that overriding

    @void QTreeViewsortByColumn(int column, Qt::SortOrder order)@

    would do the trick (I would execute my code after calling the parent's implementation), but sadly this method is not virtual. What can I do?

    P. S. This is why you make ALL the methods virtual in framework classes of this kind.

  • Found it. What I needed is

    @virtual void QSortFilterProxyModel::sort ( int column, Qt::SortOrder order = Qt::AscendingOrder )@

Log in to reply