FunctionSorter QML Type
Ordena los datos en un SortFilterProxyModel basándose en la evaluación del método 'sort' designado. Más...
| Import Statement: | import QtQml.Models |
| Since: | Qt 6.10 |
| Inherits: | |
| Status: | Preliminary |
Este tipo está en desarrollo y está sujeto a cambios.
Descripción detallada
FunctionSorter permite al usuario definir el método 'sort' designado y será evaluado para ordenar los datos. El método toma dos argumentos (lhs y rhs) del tipo de parámetro especificado y se puede acceder a los datos como se indica a continuación para su evaluación,
SortFilterProxyModel { model: sourceModel sorters: [ FunctionSorter { id: functionSorter component RoleData: QtObject { property real age } function sort(lhsData: RoleData, rhsData: RoleData) : int { return (lhsData.age < rhsData.age) ? -1 : ((lhsData === rhsData.age) ? 0 : 1) } } ] }
Nota: El usuario debe invocar explícitamente SortFilterProxyModel::invalidateSorter cada vez que cambie cualquier propiedad qml externa utilizada dentro del método 'sort' designado. Este comportamiento está sujeto a cambios en el futuro, como la invalidación implícita, por lo que el usuario no necesita invocar explícitamente SortFilterProxyModel::invalidateSorter.
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.