oKcerG / SortFilterProxyModel

A nicely exposed QSortFilterProxyModel for QML
MIT License
303 stars 102 forks source link

QML transition effect doesn't work with sorted model #34

Closed ejahandar closed 7 years ago

ejahandar commented 7 years ago

Hi, i have custom model which derivative from QAbstractListModel, custom model could be updated by backend at any time and i will sort that in custom model, the custom model goes to SortFilterProxyModel for filtering, sorting and filtering are ok but transition effect for move and moveDisplaced doesn't work anymore, i have eliminated SortFilterProxyModel and the effects comes. also i have disabled sorting in my custom model, with SortFilterProxyModel sorting is ok by the effects are gone.

in my custom model, i just have used beginMoveRows endMoveRows for swaping rows.

oKcerG commented 7 years ago

Hello,

That seems to be a limitation of the upstream class QSortFilterProxyModel, it doesn't emit move signals when the source model does, it just emits a layoutChanged signal : https://code.woboq.org/qt5/qtbase/src/corelib/itemmodels/qsortfilterproxymodel.cpp.html#_ZN28QSortFilterProxyModelPrivate27_q_sourceRowsAboutToBeMovedERK11QModelIndexiiS2_i

I'm afraid I can't do much about this bug. Maybe try reporting (or fixing) it upstream.

oKcerG commented 7 years ago

add or remove transitions are working as expected though

iberiozko commented 7 years ago

cc, it seems impossible to implement move() on resorting.

ejahandar commented 7 years ago

is it bug inside qt or something else?

cc, it seems impossible to implement move() on resorting.