Commit 83ca52c5 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Rename model

parent 2e2b8792
Pipeline #80937 passed with stage
in 8 minutes and 24 seconds
......@@ -16,8 +16,11 @@
using namespace KPIMTextEdit;
EmoticonUnicodeTab::EmoticonUnicodeTab(QWidget *parent)
: QTabWidget(parent)
, mEmoticonUnicodeModel(new EmoticonUnicodeModel(this))
{
mEmoticonUnicodeModel->setEmoticonList(EmoticonUnicodeUtils::allUnicode());
setTabBarAutoHide(true);
loadEmoticons();
QFont f;
f.setPointSize(22);
......@@ -36,17 +39,15 @@ void EmoticonUnicodeTab::searchUnicode(const QString &str)
if (searchVisible) {
setCurrentIndex(mSearchTabIndex);
}
mEmoticonUnicodeProxyModel->setFilterFixedString(str);
mEmoticonUnicodeSearchProxyModel->setFilterFixedString(str);
}
void EmoticonUnicodeTab::createSearchTab()
{
auto allEmojisView = new EmoticonListView(this);
auto emoticonModel = new EmoticonUnicodeModel(this);
mEmoticonUnicodeProxyModel = new EmoticonUnicodeProxyModel(this);
mEmoticonUnicodeProxyModel->setSourceModel(emoticonModel);
emoticonModel->setEmoticonList(EmoticonUnicodeUtils::allUnicode());
allEmojisView->setModel(mEmoticonUnicodeProxyModel);
mEmoticonUnicodeSearchProxyModel = new EmoticonUnicodeProxyModel(this);
mEmoticonUnicodeSearchProxyModel->setSourceModel(mEmoticonUnicodeModel);
allEmojisView->setModel(mEmoticonUnicodeSearchProxyModel);
mSearchTabIndex = addTab(allEmojisView, i18n("Search"));
connect(allEmojisView, &KPIMTextEdit::EmoticonListView::emojiItemSelected, this, &EmoticonUnicodeTab::itemSelected);
}
......
......@@ -14,6 +14,7 @@
namespace KPIMTextEdit
{
class EmoticonUnicodeProxyModel;
class EmoticonUnicodeModel;
/**
* @brief The EmoticonUnicodeTab class
* @author Laurent Montel <montel@kde.org>
......@@ -34,7 +35,8 @@ Q_SIGNALS:
private:
void createPlainTextEmoticonTab(const QString &str, const QVector<EmoticonUnicodeUtils::EmoticonStruct> &emoticons);
void createSearchTab();
EmoticonUnicodeProxyModel *mEmoticonUnicodeProxyModel = nullptr;
EmoticonUnicodeModel *const mEmoticonUnicodeModel;
EmoticonUnicodeProxyModel *mEmoticonUnicodeSearchProxyModel = nullptr;
int mSearchTabIndex = -1;
};
}
......
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