Commit 9d1a158e authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Allow to insert emoji

parent fc347567
......@@ -11,6 +11,10 @@ EmoticonListView::EmoticonListView(QWidget *parent)
{
setViewMode(QListView::IconMode);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
connect(this, &QListView::activated, this, [this](const QModelIndex &index) {
const QString emojiStr = index.data().toString();
Q_EMIT emojiItemSelected(emojiStr);
});
}
EmoticonListView::~EmoticonListView()
......
......@@ -15,5 +15,7 @@ class KPIMTEXTEDIT_TESTS_EXPORT EmoticonListView : public QListView
public:
explicit EmoticonListView(QWidget *parent = nullptr);
~EmoticonListView() override;
Q_SIGNALS:
void emojiItemSelected(const QString &str);
};
}
......@@ -48,6 +48,7 @@ void EmoticonUnicodeTab::createSearchTab()
emoticonModel->setEmoticonList(EmoticonUnicodeUtils::unicodeFaceEmoji() + EmoticonUnicodeUtils::unicodeAnimalsEmoji());
allEmojisView->setModel(mEmoticonUnicodeProxyModel);
mSearchTabIndex = addTab(allEmojisView, i18n("Search"));
connect(allEmojisView, &KPIMTextEdit::EmoticonListView::emojiItemSelected, this, &EmoticonUnicodeTab::itemSelected);
}
void EmoticonUnicodeTab::loadEmoticons()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment