KTextAddons

emojisortfilterproxymodel.h
1/*
2 SPDX-FileCopyrightText: 2021-2025 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6#pragma once
7
8#include "textemoticonscore_export.h"
9#include <QSortFilterProxyModel>
10#include <TextEmoticonsCore/EmojiModelManager>
11#include <memory>
12namespace TextEmoticonsCore
13{
14/**
15 * @brief The EmojiProxyModel class
16 * @author Laurent Montel <montel@kde.org>
17 */
18class TEXTEMOTICONSCORE_EXPORT EmojiSortFilterProxyModel : public QSortFilterProxyModel
19{
21
22 Q_PROPERTY(QString category READ category WRITE setCategory NOTIFY categoryChanged)
23 Q_PROPERTY(QStringList recentEmoticons READ recentEmoticons WRITE setRecentEmoticons NOTIFY recentEmoticonsChanged)
24 Q_PROPERTY(EmojiModelManager::EmojiTone emojiTone READ emojiTone WRITE setEmojiTone NOTIFY emojiToneChanged)
25
26public:
27 explicit EmojiSortFilterProxyModel(QObject *parent = nullptr);
28 ~EmojiSortFilterProxyModel() override;
29 [[nodiscard]] QString category() const;
30 void setCategory(const QString &newCategories);
31
32 [[nodiscard]] QStringList recentEmoticons() const;
33 void setRecentEmoticons(const QStringList &newRecentEmoticons);
34
35 [[nodiscard]] QString searchIdentifier() const;
36 void setSearchIdentifier(const QString &newSearchIdentifier);
37
38 [[nodiscard]] EmojiModelManager::EmojiTone emojiTone() const;
39 void setEmojiTone(EmojiModelManager::EmojiTone tone);
40
41 [[nodiscard]] QString emojiToneSuffix() const;
43 void categoryChanged();
44 void recentEmoticonsChanged();
45 void emojiToneChanged();
46
47protected:
48 [[nodiscard]] bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override;
49 [[nodiscard]] bool lessThan(const QModelIndex &left, const QModelIndex &right) const override;
50
51private:
52 class EmojiProxyModelPrivate;
53 std::unique_ptr<EmojiProxyModelPrivate> const d;
54};
55}
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
Q_SIGNALSQ_SIGNALS
QSortFilterProxyModel(QObject *parent)
virtual QModelIndex parent(const QModelIndex &child) const const override
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Feb 21 2025 11:46:43 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.