Refine MessageContentModel further

Create some standard functions that should hopefully make it easier to manage the model contents. Used for file stuff for now.
This commit is contained in:
James Graham
2025-07-06 21:16:17 +01:00
parent 4f5e096e7e
commit 17fa2246da
2 changed files with 69 additions and 29 deletions

View File

@@ -132,9 +132,16 @@ private:
void initializeModel();
void initializeEvent();
void getEvent();
void updateFileInfo();
QList<MessageComponent> m_components;
bool hasComponentType(MessageComponentType::Type type);
void forEachComponentOfType(MessageComponentType::Type type, std::function<void(const QModelIndex &)> function);
void forEachComponentOfType(QList<MessageComponentType::Type> types, std::function<void(const QModelIndex &)> function);
std::function<void(const QModelIndex &)> m_fileInfoFunction = [this](const QModelIndex &index) {
Q_EMIT dataChanged(index, index, {MessageContentModel::FileTransferInfoRole});
};
void resetModel();
void resetContent(bool isEditing = false, bool isThreading = false);
QList<MessageComponent> messageContentComponents(bool isEditing = false, bool isThreading = false);