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) ...@@ -11,6 +11,10 @@ EmoticonListView::EmoticonListView(QWidget *parent)
{ {
setViewMode(QListView::IconMode); setViewMode(QListView::IconMode);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
connect(this, &QListView::activated, this, [this](const QModelIndex &index) {
const QString emojiStr = index.data().toString();
Q_EMIT emojiItemSelected(emojiStr);
});
} }
EmoticonListView::~EmoticonListView() EmoticonListView::~EmoticonListView()
......
...@@ -15,5 +15,7 @@ class KPIMTEXTEDIT_TESTS_EXPORT EmoticonListView : public QListView ...@@ -15,5 +15,7 @@ class KPIMTEXTEDIT_TESTS_EXPORT EmoticonListView : public QListView
public: public:
explicit EmoticonListView(QWidget *parent = nullptr); explicit EmoticonListView(QWidget *parent = nullptr);
~EmoticonListView() override; ~EmoticonListView() override;
Q_SIGNALS:
void emojiItemSelected(const QString &str);
}; };
} }
...@@ -48,6 +48,7 @@ void EmoticonUnicodeTab::createSearchTab() ...@@ -48,6 +48,7 @@ void EmoticonUnicodeTab::createSearchTab()
emoticonModel->setEmoticonList(EmoticonUnicodeUtils::unicodeFaceEmoji() + EmoticonUnicodeUtils::unicodeAnimalsEmoji()); emoticonModel->setEmoticonList(EmoticonUnicodeUtils::unicodeFaceEmoji() + EmoticonUnicodeUtils::unicodeAnimalsEmoji());
allEmojisView->setModel(mEmoticonUnicodeProxyModel); allEmojisView->setModel(mEmoticonUnicodeProxyModel);
mSearchTabIndex = addTab(allEmojisView, i18n("Search")); mSearchTabIndex = addTab(allEmojisView, i18n("Search"));
connect(allEmojisView, &KPIMTextEdit::EmoticonListView::emojiItemSelected, this, &EmoticonUnicodeTab::itemSelected);
} }
void EmoticonUnicodeTab::loadEmoticons() void EmoticonUnicodeTab::loadEmoticons()
......
Markdown is supported
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