Colored emoji support.

Also, this approach seems to have a memory leak while converting
QStringList to QVariant.
This commit is contained in:
Black Hat
2018-08-11 20:48:44 +08:00
parent e30c412637
commit 4dbd0e2dcd
9 changed files with 1552 additions and 1127 deletions

43
src/emojimodel.h Normal file
View File

@@ -0,0 +1,43 @@
#ifndef EMOJIMODEL_H
#define EMOJIMODEL_H
#include <QObject>
#include <QVariant>
class EmojiModel : public QObject {
Q_OBJECT
Q_PROPERTY(QVariant model READ getModel NOTIFY categoryChanged)
Q_PROPERTY(QString category READ getCategory WRITE setCategory NOTIFY
categoryChanged)
public:
explicit EmojiModel(QObject *parent = nullptr);
QVariant getModel();
QString getCategory() { return m_category; }
void setCategory(QString category) {
if (category != m_category) {
m_category = category;
emit categoryChanged();
}
}
private:
static const QStringList people;
static const QStringList nature;
static const QStringList food;
static const QStringList activity;
static const QStringList travel;
static const QStringList objects;
static const QStringList symbols;
static const QStringList flags;
QString m_category = "people";
signals:
void categoryChanged();
public slots:
};
#endif // EMOJIMODEL_H