diff options
Diffstat (limited to 'conversationmodel.cpp')
| -rw-r--r-- | conversationmodel.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/conversationmodel.cpp b/conversationmodel.cpp new file mode 100644 index 0000000..8257fb1 --- /dev/null +++ b/conversationmodel.cpp @@ -0,0 +1,34 @@ +#include "conversationmodel.h" +#include <QAbstractItemModel> + +int ConversationModel::rowCount(const QModelIndex &parent) const +{ + qDebug() << conversations.count(); + return conversations.count(); +} + +QVariant ConversationModel::data(const QModelIndex &index, int role) const +{ + qDebug() << conversations; + return conversations.at(index.row()); +} + +void ConversationModel::append(const QString &value) +{ + beginInsertRows(QModelIndex(), rowCount(), rowCount()); + endInsertRows(); + conversations << value; + qDebug() << conversations; + qDebug() << conversations.count(); +} + +bool ConversationModel::setData(const QModelIndex &index, const QVariant &value, + int role) +{ + return false; +} + +QStringList ConversationModel::getConversations() const +{ + return conversations; +} |
