summaryrefslogtreecommitdiff
path: root/conversationmodel.cpp
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi92@disroot.org>2026-02-03 18:29:18 +0100
committerXavier Del Campo Romero <xavi92@disroot.org>2026-02-03 18:29:18 +0100
commit997e9b168d362a50cdcdc82c6cc3488a6852737a (patch)
treefebf644d675ef07128f5c313e78a728a97aee89c /conversationmodel.cpp
parent0311bed34d80abe518f11838271e39d1615ebf67 (diff)
downloadyachat6-997e9b168d362a50cdcdc82c6cc3488a6852737a.tar.gz
Load conversations dynamically
Diffstat (limited to 'conversationmodel.cpp')
-rw-r--r--conversationmodel.cpp34
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;
+}