You must not change the model of a QTree/Table/ListWidget - if you want to set a custom model, use the corresponding QTree/Table/ListView classes.
You don't need a QSortFilterProxyModel for a QTreeWidget. See the documentation how to achieve sorting there: https://doc.qt.io/qt-5/qtreewidgetitem.html#operator-lt