diff options
-rw-r--r-- | lib/events/eventcontent.h | 2 | ||||
-rw-r--r-- | lib/events/roommessageevent.h | 8 |
2 files changed, 6 insertions, 4 deletions
diff --git a/lib/events/eventcontent.h b/lib/events/eventcontent.h index c26cb931..e7656de5 100644 --- a/lib/events/eventcontent.h +++ b/lib/events/eventcontent.h @@ -25,6 +25,7 @@ #include <QtCore/QMimeType> #include <QtCore/QSize> #include <QtCore/QUrl> +#include <QtCore/QMetaType> namespace Quotient { namespace EventContent { @@ -276,3 +277,4 @@ namespace EventContent { using FileContent = UrlWithThumbnailContent<FileInfo>; } // namespace EventContent } // namespace Quotient +Q_DECLARE_METATYPE(const Quotient::EventContent::TypedBase*) diff --git a/lib/events/roommessageevent.h b/lib/events/roommessageevent.h index b393382a..e95aabfc 100644 --- a/lib/events/roommessageevent.h +++ b/lib/events/roommessageevent.h @@ -34,7 +34,7 @@ class RoomMessageEvent : public RoomEvent { Q_PROPERTY(QString msgType READ rawMsgtype CONSTANT) Q_PROPERTY(QString plainBody READ plainBody CONSTANT) Q_PROPERTY(QMimeType mimeType READ mimeType STORED false CONSTANT) - Q_PROPERTY(EventContent::TypedBase* content READ content CONSTANT) + Q_PROPERTY(const EventContent::TypedBase* content READ content CONSTANT) public: DEFINE_EVENT_TYPEID("m.room.message", RoomMessageEvent) @@ -62,13 +62,13 @@ public: MsgType msgtype() const; QString rawMsgtype() const; QString plainBody() const; - EventContent::TypedBase* content() const { return _content.data(); } + const EventContent::TypedBase* content() const { return _content.data(); } template <typename VisitorT> - void editContent(VisitorT visitor) + void editContent(VisitorT&& visitor) { visitor(*_content); editJson()[ContentKeyL] = assembleContentJson(plainBody(), rawMsgtype(), - content()); + _content.data()); } QMimeType mimeType() const; bool hasTextContent() const; |