| 1 | // Copyright (C) 2025 The Qt Company Ltd. |
|---|---|
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QQMLFUNCTIONSORTER_P_H |
| 5 | #define QQMLFUNCTIONSORTER_P_H |
| 6 | |
| 7 | // W A R N I N G |
| 8 | // ------------- |
| 9 | // |
| 10 | // This file is not part of the Qt API. It exists purely as an |
| 11 | // implementation detail. This header file may change from version to |
| 12 | // version without notice, or even be removed. |
| 13 | // |
| 14 | // We mean it. |
| 15 | // |
| 16 | |
| 17 | #include <QtQmlModels/private/qqmlrolesorter_p.h> |
| 18 | #include <QtQmlModels/private/qqmlsorterbase_p.h> |
| 19 | |
| 20 | QT_BEGIN_NAMESPACE |
| 21 | |
| 22 | class QQmlSortFilterProxyModel; |
| 23 | class QQmlFunctionSorterPrivate; |
| 24 | |
| 25 | class Q_QMLMODELS_EXPORT QQmlFunctionSorter : public QQmlSorterBase, public QQmlParserStatus |
| 26 | { |
| 27 | Q_OBJECT |
| 28 | Q_INTERFACES(QQmlParserStatus) |
| 29 | QML_NAMED_ELEMENT(FunctionSorter) |
| 30 | QML_ADDED_IN_VERSION(6, 10) |
| 31 | |
| 32 | public: |
| 33 | explicit QQmlFunctionSorter(QObject *parent = nullptr); |
| 34 | ~QQmlFunctionSorter() override; |
| 35 | |
| 36 | virtual QPartialOrdering compare(const QModelIndex&, const QModelIndex&, const QQmlSortFilterProxyModel *) const override; |
| 37 | |
| 38 | private: |
| 39 | void classBegin() override {}; |
| 40 | void componentComplete() override; |
| 41 | |
| 42 | private: |
| 43 | Q_DECLARE_PRIVATE(QQmlFunctionSorter) |
| 44 | }; |
| 45 | |
| 46 | class QQmlFunctionSorterPrivate : public QQmlRoleSorterPrivate |
| 47 | { |
| 48 | Q_DECLARE_PUBLIC (QQmlFunctionSorter) |
| 49 | |
| 50 | public: |
| 51 | QMetaMethod m_method; |
| 52 | mutable QVariant m_lhsParameterData; |
| 53 | mutable QVariant m_rhsParameterData; |
| 54 | }; |
| 55 | |
| 56 | QT_END_NAMESPACE |
| 57 | |
| 58 | #endif // QQMLFUNCTIONSORTER_P_H |
| 59 |
