From 457f42c9ca93e45f718403086a2b36991b3e0c1a Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Wed, 1 Nov 2023 22:28:58 +0100 Subject: Fix pending reply sizing --- src/timeline/EventDelegateChooser.cpp | 2 +- src/timeline/EventDelegateChooser.h | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/timeline/EventDelegateChooser.cpp b/src/timeline/EventDelegateChooser.cpp index f299b991..5ce8d63e 100644 --- a/src/timeline/EventDelegateChooser.cpp +++ b/src/timeline/EventDelegateChooser.cpp @@ -142,7 +142,7 @@ EventDelegateChooser::DelegateIncubator::setInitialState(QObject *obj) auto attached = qobject_cast( qmlAttachedPropertiesObject(obj)); Q_ASSERT(attached != nullptr); - attached->setIsReply(this->forReply); + attached->setIsReply(this->forReply || chooser.limitAsReply_); for (const auto &role : roles) { const auto &roleName = roleNames[role.role()]; diff --git a/src/timeline/EventDelegateChooser.h b/src/timeline/EventDelegateChooser.h index df1953ab..139b143a 100644 --- a/src/timeline/EventDelegateChooser.h +++ b/src/timeline/EventDelegateChooser.h @@ -137,6 +137,7 @@ class EventDelegateChooser : public QQuickItem Q_PROPERTY(int maxWidth READ maxWidth WRITE setMaxWidth NOTIFY maxWidthChanged) Q_PROPERTY(int replyInset READ replyInset WRITE setReplyInset NOTIFY replyInsetChanged) Q_PROPERTY(int mainInset READ mainInset WRITE setMainInset NOTIFY mainInsetChanged) + Q_PROPERTY(bool limitAsReply READ limitAsReply WRITE setLimitAsReply NOTIFY limitAsReplyChanged) public: QQmlListProperty choices(); @@ -156,6 +157,12 @@ public: sameWidth_ = width; emit sameWidthChanged(); } + bool limitAsReply() const { return limitAsReply_; } + void setLimitAsReply(bool width) + { + limitAsReply_ = width; + emit limitAsReplyChanged(); + } int maxWidth() const { return maxWidth_; } void setMaxWidth(int width) { @@ -229,6 +236,7 @@ signals: void eventIdChanged(); void replyToChanged(); void sameWidthChanged(); + void limitAsReplyChanged(); void maxWidthChanged(); void replyInsetChanged(); void mainInsetChanged(); @@ -264,10 +272,11 @@ private: TimelineModel *room_{nullptr}; QString eventId_; QString replyId; - bool sameWidth_ = false; - int maxWidth_ = 400; - int replyInset_ = 0; - int mainInset_ = 0; + bool sameWidth_ = false; + bool limitAsReply_ = false; + int maxWidth_ = 400; + int replyInset_ = 0; + int mainInset_ = 0; static void appendChoice(QQmlListProperty *, EventDelegateChoice *); static qsizetype choiceCount(QQmlListProperty *); -- cgit 1.4.1