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
qqmlstringsorter_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
4#ifndef QQMLSTRINGSORTER_H
5#define QQMLSTRINGSORTER_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QCollator>
19#include <QtQmlModels/private/qqmlrolesorter_p.h>
20
21QT_BEGIN_NAMESPACE
22
23class QQmlSortFilterProxyModel;
25
26class Q_QMLMODELS_EXPORT QQmlStringSorter : public QQmlRoleSorter
27{
28 Q_OBJECT
29 Q_PROPERTY(Qt::CaseSensitivity caseSensitivity READ caseSensitivity WRITE setCaseSensitivity NOTIFY caseSensitivityChanged)
30 Q_PROPERTY(bool ignorePunctuation READ ignorePunctuation WRITE setIgnorePunctuation NOTIFY ignorePunctuationChanged)
31 Q_PROPERTY(QLocale locale READ locale WRITE setLocale NOTIFY localeChanged)
32 Q_PROPERTY(bool numericMode READ numericMode WRITE setNumericMode NOTIFY numericModeChanged)
33 QML_NAMED_ELEMENT(StringSorter)
34 QML_ADDED_IN_VERSION(6, 10)
35
36public:
37 explicit QQmlStringSorter(QObject *parent = nullptr);
38 ~QQmlStringSorter() = default;
39
40 Qt::CaseSensitivity caseSensitivity() const;
41 void setCaseSensitivity(Qt::CaseSensitivity caseSensitivity);
42
43 bool ignorePunctuation() const;
44 void setIgnorePunctuation(bool ignorePunctation);
45
46 QLocale locale() const;
47 void setLocale(const QLocale& locale);
48
49 bool numericMode() const;
50 void setNumericMode(bool numericMode);
51
52 QPartialOrdering compare(const QModelIndex& sourceLeft, const QModelIndex& sourceRight, const QQmlSortFilterProxyModel *proxyModel) const override;
53
54Q_SIGNALS:
55 void caseSensitivityChanged();
56 void ignorePunctuationChanged();
57 void localeChanged();
58 void numericModeChanged();
59
60private:
61 Q_DECLARE_PRIVATE(QQmlStringSorter)
62};
63
65{
66 Q_DECLARE_PUBLIC (QQmlStringSorter)
67
68public:
70};
71
72QT_END_NAMESPACE
73
74#endif // QQMLSTRINGSORTER_H