diff options
Diffstat (limited to 'include/timeline/widgets/ImageItem.h')
-rw-r--r-- | include/timeline/widgets/ImageItem.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/include/timeline/widgets/ImageItem.h b/include/timeline/widgets/ImageItem.h index d8a12c22..146aa7f6 100644 --- a/include/timeline/widgets/ImageItem.h +++ b/include/timeline/widgets/ImageItem.h @@ -57,6 +57,9 @@ protected: void mousePressEvent(QMouseEvent *event) override; void resizeEvent(QResizeEvent *event) override; + //! Whether the user can interact with the displayed image. + bool isInteractive_ = true; + private: void openUrl(); @@ -81,3 +84,28 @@ private: QSharedPointer<MatrixClient> client_; }; + +class StickerItem : public ImageItem +{ + Q_OBJECT + +public: + StickerItem(QSharedPointer<MatrixClient> client, + const mtx::events::Sticker &event, + QWidget *parent = nullptr) + : ImageItem{client, + QString::fromStdString(event.content.url), + QString::fromStdString(event.content.body), + event.content.info.size, + parent} + , event_{event} + { + isInteractive_ = false; + setCursor(Qt::ArrowCursor); + setMouseTracking(false); + setAttribute(Qt::WA_Hover, false); + } + +private: + mtx::events::Sticker event_; +}; |