Il 12/10/20 15:31, Александр Иваш ha scritto:
Is there any example for re-ordering of QTableView entries implemented in QSortFilterProxyModel (ideally drag-n-drop-driven)? If not, what is the best way to implement it? I'm thinking about implementing reordering as 'custom sorting' - but it will require me to collect all the QModelIndex-es in the separate list (which can be then reorderedand used for custom sorting).
Just to make sure I understood, do you need a proxy model that allows to reorder the rows of a given source model via DND?
The issue with such approach is that QModelIndex-es are short-living and I need to track its lifetime somehow.... Any better ideas?
QPersistentModelIndex. But it sounds like it's not _really_ needed, you need a way to map integers (row numbers from the source model) into other integers (row numbers after the proxy).
HTH, -- Giuseppe D'Angelo | giuseppe.dang...@kdab.com | Senior Software Engineer KDAB (France) S.A.S., a KDAB Group company Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com KDAB - The Qt, C++ and OpenGL Experts
smime.p7s
Description: Firma crittografica S/MIME
_______________________________________________ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest