Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qqmlsortercompositor_p.h
Go to the documentation of this file.
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// Qt-Security score:significant reason:default
4
5#ifndef QQMLSORTERCOMPOSITOR_H
6#define QQMLSORTERCOMPOSITOR_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtQmlModels/private/qqmlsorterbase_p.h>
20
21QT_BEGIN_NAMESPACE
22
23class QQmlSortFilterProxyModel;
25
27{
28 Q_OBJECT
29 QML_ANONYMOUS
31
32public:
33 explicit QQmlSorterCompositor(QObject *parent = nullptr);
35
38
39 static void append(QQmlListProperty<QQmlSorterBase> *sorterComp, QQmlSorterBase *sorter);
40 static qsizetype count(QQmlListProperty<QQmlSorterBase> *sorterComp);
41 static QQmlSorterBase* at(QQmlListProperty<QQmlSorterBase> *sorterComp, qsizetype index);
42 static void clear(QQmlListProperty<QQmlSorterBase> *sorterComp);
43
44 QPartialOrdering compare(const QModelIndex &, const QModelIndex &, const QQmlSortFilterProxyModel *) const override { return QPartialOrdering::Unordered; };
45 bool lessThan(const QModelIndex &sourceLeft, const QModelIndex &sourceRight, const QQmlSortFilterProxyModel *proxyModel) const;
46 void updateSorters();
48
49private:
50 void append(QQmlSorterBase *sorter);
51 qsizetype count();
52 QQmlSorterBase* at(qsizetype index);
53 void clear();
54
55public slots:
56 void updateCache();
57
58private:
60};
61
63{
64 Q_DECLARE_PUBLIC(QQmlSorterCompositor)
65
66public:
67 void init();
68 void setPrimarySorter(QQmlSorterBase *sorter);
69 QPointer<QQmlSorterBase> primarySorter() const { return m_primarySorter; }
70 void resetPrimarySorter();
71
72 // Holds sorters in the same order as declared in the qml
74 // Holds effective sorters that will be evaluated with the
75 // model content
77 QQmlSortFilterProxyModel *m_sfpmModel = nullptr;
79};
80
81QT_END_NAMESPACE
82
83#endif // QQMLSORTERCOMPOSITOR_H
QList< QQmlSorterBase * > m_effectiveSorters
QPointer< QQmlSorterBase > m_primarySorter
void setPrimarySorter(QQmlSorterBase *sorter)
QQmlSortFilterProxyModel * m_sfpmModel
QList< QQmlSorterBase * > m_sorters
QPointer< QQmlSorterBase > primarySorter() const
QPartialOrdering compare(const QModelIndex &, const QModelIndex &, const QQmlSortFilterProxyModel *) const override
static void clear(QQmlListProperty< QQmlSorterBase > *sorterComp)
QQmlListProperty< QQmlSorterBase > sortersListProperty()
static void append(QQmlListProperty< QQmlSorterBase > *sorterComp, QQmlSorterBase *sorter)
QList< QQmlSorterBase * > sorters()
bool lessThan(const QModelIndex &sourceLeft, const QModelIndex &sourceRight, const QQmlSortFilterProxyModel *proxyModel) const
static qsizetype count(QQmlListProperty< QQmlSorterBase > *sorterComp)
static QQmlSorterBase * at(QQmlListProperty< QQmlSorterBase > *sorterComp, qsizetype index)