nheko/include/EmojiCategory.h

61 lines
1.6 KiB
C
Raw Normal View History

2017-04-23 20:31:08 +02:00
/*
* nheko Copyright (C) 2017 Konstantinos Sideris <siderisk@auth.gr>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
2017-04-23 20:31:08 +02:00
#include <QHBoxLayout>
#include <QLabel>
#include <QListView>
#include <QStandardItemModel>
#include <QVBoxLayout>
#include <QWidget>
#include "EmojiItemDelegate.h"
#include "EmojiProvider.h"
class EmojiCategory : public QWidget
{
2017-09-10 11:59:21 +02:00
Q_OBJECT
2017-04-23 20:31:08 +02:00
public:
2017-09-10 11:59:21 +02:00
EmojiCategory(QString category, QList<Emoji> emoji, QWidget *parent = nullptr);
~EmojiCategory();
2017-04-23 20:31:08 +02:00
signals:
2017-09-10 11:59:21 +02:00
void emojiSelected(const QString &emoji);
2017-04-23 20:31:08 +02:00
private slots:
2017-09-10 11:59:21 +02:00
inline void clickIndex(const QModelIndex &);
2017-04-23 20:31:08 +02:00
private:
2017-09-10 11:59:21 +02:00
QVBoxLayout *mainLayout_;
2017-04-23 20:31:08 +02:00
2017-09-10 11:59:21 +02:00
QStandardItemModel *itemModel_;
QListView *emojiListView_;
2017-04-23 20:31:08 +02:00
2017-09-10 11:59:21 +02:00
Emoji *data_;
EmojiItemDelegate *delegate_;
2017-04-23 20:31:08 +02:00
2017-09-10 11:59:21 +02:00
QLabel *category_;
2017-04-23 20:31:08 +02:00
};
2017-08-20 12:47:22 +02:00
inline void
EmojiCategory::clickIndex(const QModelIndex &index)
2017-04-23 20:31:08 +02:00
{
2017-09-10 11:59:21 +02:00
emit emojiSelected(index.data(Qt::UserRole).toString());
2017-04-23 20:31:08 +02:00
}