diff --git a/tests/src/components/chat/ChatModel.cpp b/tests/src/components/chat/ChatModel.cpp index 470f9bd33..888e828a8 100644 --- a/tests/src/components/chat/ChatModel.cpp +++ b/tests/src/components/chat/ChatModel.cpp @@ -9,7 +9,8 @@ QHash ChatModel::roleNames () const { QHash roles; - roles[Qt::DisplayRole] = "$chatEntry"; + roles[Roles::ChatEntry] = "$chatEntry"; + roles[Roles::SectionDate] = "$sectionDate"; return roles; } @@ -19,8 +20,12 @@ QVariant ChatModel::data (const QModelIndex &index, int role) const { if (row < 0 || row >= m_entries.count()) return QVariant(); - if (role == Qt::DisplayRole) - return QVariant::fromValue(m_entries[row]); + switch (role) { + case: Roles::ChatEntry + return QVariant::fromValue(m_entries[row]); + case: Roles::SectionDate + return QVariant::fromValue(m_entries[row]["sectionDate"]); + } return QVariant(); } diff --git a/tests/src/components/chat/ChatModel.hpp b/tests/src/components/chat/ChatModel.hpp index de5e9e7b1..14e950e8d 100644 --- a/tests/src/components/chat/ChatModel.hpp +++ b/tests/src/components/chat/ChatModel.hpp @@ -17,6 +17,11 @@ class ChatModel : public QAbstractListModel { ); public: + enum Roles { + ChatEntry = Qt::DisplayRole, + SectionDate + }; + ChatModel (QObject *parent = Q_NULLPTR) : QAbstractListModel(parent) {} int rowCount (const QModelIndex &index = QModelIndex()) const { diff --git a/tests/ui/modules/Linphone/Chat/Chat.qml b/tests/ui/modules/Linphone/Chat/Chat.qml index ac1c6235b..1da0d8ba9 100644 --- a/tests/ui/modules/Linphone/Chat/Chat.qml +++ b/tests/ui/modules/Linphone/Chat/Chat.qml @@ -26,7 +26,7 @@ ColumnLayout { section { criteria: ViewSection.FullString delegate: sectionHeading - property: '$chatEntry.sectionDate' + property: '$sectionDate' } // ---------------------------------------------------------------