matrixion/src/emoji/EmojiModel.h

40 lines
972 B
C
Raw Normal View History

2021-03-05 02:35:15 +03:00
// SPDX-FileCopyrightText: 2021 Nheko Contributors
//
// 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
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
}