Fix context menu not appearing in room media scroll view

MessageDelegate calls model.findEvent(root.eventId), which existed in
MessageFilterModel but was missing in MediaMessageFilterModel. This adds
a findEvent() implementation to MediaMessageFilterModel so the context
menu works correctly in the media scroll view.
This commit is contained in:
Azhar Momin
2026-02-07 12:37:10 +05:30
committed by Joshua Goins
parent 44f78353ab
commit 6b664b0547
2 changed files with 10 additions and 0 deletions

View File

@@ -87,6 +87,11 @@ QHash<int, QByteArray> MediaMessageFilterModel::roleNames() const
return roles;
}
const Quotient::RoomEvent *MediaMessageFilterModel::findEvent(const QString &eventId) const
{
return static_cast<MessageFilterModel *>(sourceModel())->findEvent(eventId);
}
int MediaMessageFilterModel::getRowForEventId(const QString &eventId) const
{
for (auto i = 0; i < rowCount(); i++) {

View File

@@ -63,5 +63,10 @@ public:
*/
[[nodiscard]] QHash<int, QByteArray> roleNames() const override;
/**
* @brief Finds the event of the given event ID in the model, returning nullptr if no matches were found.
*/
Q_INVOKABLE const Quotient::RoomEvent *findEvent(const QString &eventId) const;
int getRowForEventId(const QString &eventId) const;
};