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:
committed by
Joshua Goins
parent
44f78353ab
commit
6b664b0547
@@ -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++) {
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user