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// Qt-Security score:significant reason:default
4
5#ifndef QQMLSTRINGSORTER_H
6#define QQMLSTRINGSORTER_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 <QCollator>
20#include <QtQmlModels/private/qqmlrolesorter_p.h>
21
22QT_BEGIN_NAMESPACE
23
24class QQmlSortFilterProxyModel;
26
27class Q_QMLMODELS_EXPORT QQmlStringSorter : public QQmlRoleSorter
28{
29 Q_OBJECT
30 Q_PROPERTY(Qt::CaseSensitivity caseSensitivity READ caseSensitivity WRITE setCaseSensitivity NOTIFY caseSensitivityChanged)
31 Q_PROPERTY(bool ignorePunctuation READ ignorePunctuation WRITE setIgnorePunctuation NOTIFY ignorePunctuationChanged)
32 Q_PROPERTY(QLocale locale READ locale WRITE setLocale NOTIFY localeChanged)
33 Q_PROPERTY(bool numericMode READ numericMode WRITE setNumericMode NOTIFY numericModeChanged)
34 QML_NAMED_ELEMENT(StringSorter)
35 QML_ADDED_IN_VERSION(6, 10)
36
37public:
38 explicit QQmlStringSorter(QObject *parent = nullptr);
39 ~QQmlStringSorter() = default;
40
41 Qt::CaseSensitivity caseSensitivity() const;
42 void setCaseSensitivity(Qt::CaseSensitivity caseSensitivity);
43
44 bool ignorePunctuation() const;
45 void setIgnorePunctuation(bool ignorePunctation);
46
47 QLocale locale() const;
48 void setLocale(const QLocale& locale);
49
50 bool numericMode() const;
51 void setNumericMode(bool numericMode);
52
53 QPartialOrdering compare(const QModelIndex& sourceLeft, const QModelIndex& sourceRight, const QQmlSortFilterProxyModel *proxyModel) const override;
54
55Q_SIGNALS:
56 void caseSensitivityChanged();
57 void ignorePunctuationChanged();
58 void localeChanged();
59 void numericModeChanged();
60
61private:
62 Q_DECLARE_PRIVATE(QQmlStringSorter)
63};
64
66{
67 Q_DECLARE_PUBLIC (QQmlStringSorter)
68
69public:
71};
72
73QT_END_NAMESPACE
74
75#endif // QQMLSTRINGSORTER_H