KTextAddons

emojimodel.h
1/*
2 SPDX-FileCopyrightText: 2021-2024 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "textemoticonscore_export.h"
10#include <QAbstractListModel>
11#include <TextEmoticonsCore/CustomEmoji>
12#include <TextEmoticonsCore/UnicodeEmoticon>
13namespace TextEmoticonsCore
14{
15class CustomEmojiIconManager;
16/**
17 * @brief The EmojiModel class
18 * @author Laurent Montel <montel@kde.org>
19 */
20class TEXTEMOTICONSCORE_EXPORT EmojiModel : public QAbstractListModel
21{
22 Q_OBJECT
23public:
24 enum EmoticonsRoles {
25 UnicodeEmoji = Qt::UserRole + 1,
26 Identifier,
27 Category,
28 Order,
29 Animated,
30 AnimatedFileName,
31 IsCustom,
32 FileName,
33 };
34 Q_ENUM(EmoticonsRoles)
35
36 explicit EmojiModel(QObject *parent = nullptr);
37 ~EmojiModel() override;
38
39 [[nodiscard]] int rowCount(const QModelIndex &parent = QModelIndex()) const override;
40 [[nodiscard]] QVariant data(const QModelIndex &index, int role) const override;
41
42 [[nodiscard]] const QList<TextEmoticonsCore::UnicodeEmoticon> &emoticonList() const;
43 void setUnicodeEmoticonList(const QList<TextEmoticonsCore::UnicodeEmoticon> &newEmoticonList);
44
45 [[nodiscard]] QList<TextEmoticonsCore::CustomEmoji> customEmojiList() const;
46 void setCustomEmojiList(const QList<TextEmoticonsCore::CustomEmoji> &newCustomEmojiList);
47
48 [[nodiscard]] TextEmoticonsCore::CustomEmojiIconManager *customEmojiIconManager() const;
49 void setCustomEmojiIconManager(TextEmoticonsCore::CustomEmojiIconManager *newCustomEmojiIconManager);
50
51 void setExcludeEmoticons(const QStringList &emoticons);
52
53 QHash<int, QByteArray> roleNames() const override;
54
55private:
56 Q_DISABLE_COPY(EmojiModel)
59 TextEmoticonsCore::CustomEmojiIconManager *mCustomEmojiIconManager = nullptr;
60};
61}
The EmojiModel class.
Definition emojimodel.h:21
UserRole
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:56:02 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.