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 };
32 Q_ENUM(EmoticonsRoles)
33
34 explicit EmojiModel(QObject *parent = nullptr);
35 ~EmojiModel() override;
36
37 [[nodiscard]] int rowCount(const QModelIndex &parent = QModelIndex()) const override;
38 [[nodiscard]] QVariant data(const QModelIndex &index, int role) const override;
39
40 [[nodiscard]] const QList<TextEmoticonsCore::UnicodeEmoticon> &emoticonList() const;
41 void setUnicodeEmoticonList(const QList<TextEmoticonsCore::UnicodeEmoticon> &newEmoticonList);
42
43 [[nodiscard]] QList<TextEmoticonsCore::CustomEmoji> customEmojiList() const;
44 void setCustomEmojiList(const QList<TextEmoticonsCore::CustomEmoji> &newCustomEmojiList);
45
46 [[nodiscard]] TextEmoticonsCore::CustomEmojiIconManager *customEmojiIconManager() const;
47 void setCustomEmojiIconManager(TextEmoticonsCore::CustomEmojiIconManager *newCustomEmojiIconManager);
48
49 void setExcludeEmoticons(const QStringList &emoticons);
50
51 QHash<int, QByteArray> roleNames() const override;
52
53private:
54 Q_DISABLE_COPY(EmojiModel)
57 TextEmoticonsCore::CustomEmojiIconManager *mCustomEmojiIconManager = nullptr;
58};
59}
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 Mon Nov 4 2024 16:29:59 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.