matrixion/src/emoji/EmojiModel.h

43 lines
1.1 KiB
C
Raw Normal View History

2021-03-05 02:35:15 +03:00
// SPDX-FileCopyrightText: 2021 Nheko Contributors
// SPDX-FileCopyrightText: 2022 Nheko Contributors
// SPDX-FileCopyrightText: 2023 Nheko Contributors
2021-03-05 02:35:15 +03:00
//
// SPDX-License-Identifier: GPL-3.0-or-later
#pragma once
#include <QAbstractListModel>
#include <QSet>
#include <QSortFilterProxyModel>
#include <QVector>
#include "Provider.h"
namespace emoji {
/*
* Provides access to the emojis in Provider.h to QML
*/
class EmojiModel : public QAbstractListModel
{
2021-09-18 01:22:33 +03:00
Q_OBJECT
public:
2021-09-18 01:22:33 +03:00
enum Roles
{
Unicode = Qt::UserRole, // unicode of emoji
Category, // category of emoji
ShortName, // shortext of the emoji
2022-04-22 19:49:57 +03:00
UnicodeName, // true unicode name of the emoji
2021-09-18 01:22:33 +03:00
Emoji, // Contains everything from the Emoji
};
2021-09-18 01:22:33 +03:00
using QAbstractListModel::QAbstractListModel;
2021-09-18 01:22:33 +03:00
Q_INVOKABLE int categoryToIndex(int category);
2021-09-18 01:22:33 +03:00
QHash<int, QByteArray> roleNames() const override;
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
};
2021-01-23 04:07:23 +03:00
}