summary refs log tree commit diff
path: root/src/timeline/TimelineItem.cc
diff options
context:
space:
mode:
authorChris Tarazi <tarazichris@gmail.com>2018-02-04 17:22:55 -0800
committerChris Tarazi <tarazichris@gmail.com>2018-02-07 21:32:20 -0800
commita15079c68f444b883a6ccb64385a2bc0c7ec107c (patch)
tree53457020266809ace0c90f72c9d437f50b689a12 /src/timeline/TimelineItem.cc
parentMerge pull request #231 from xvitaly/fedora (diff)
downloadnheko-a15079c68f444b883a6ccb64385a2bc0c7ec107c.tar.xz
Fix #217: create space for checkmark beforehand
Diffstat (limited to '')
-rw-r--r--src/timeline/TimelineItem.cc15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/timeline/TimelineItem.cc b/src/timeline/TimelineItem.cc
index 93987d52..db5f19e6 100644
--- a/src/timeline/TimelineItem.cc
+++ b/src/timeline/TimelineItem.cc
@@ -61,6 +61,10 @@ TimelineItem::init()
 
         mainLayout_->setContentsMargins(conf::timeline::headerLeftMargin, 0, 0, 0);
         mainLayout_->setSpacing(0);
+
+        checkmark_ = new QLabel(" ", this);
+        checkmark_->setStyleSheet(
+          QString("font-size: %1px;").arg(conf::timeline::fonts::timestamp));
 }
 
 /*
@@ -108,6 +112,7 @@ TimelineItem::TimelineItem(mtx::events::MessageType ty,
                 messageLayout_->addWidget(body_, 1);
         }
 
+        messageLayout_->addWidget(checkmark_);
         messageLayout_->addWidget(timestamp_);
         mainLayout_->addLayout(messageLayout_);
 }
@@ -239,6 +244,7 @@ TimelineItem::TimelineItem(const mtx::events::RoomEvent<mtx::events::msg::Notice
                 messageLayout_->addWidget(body_, 1);
         }
 
+        messageLayout_->addWidget(checkmark_);
         messageLayout_->addWidget(timestamp_);
         mainLayout_->addLayout(messageLayout_);
 }
@@ -285,6 +291,7 @@ TimelineItem::TimelineItem(const mtx::events::RoomEvent<mtx::events::msg::Emote>
                 messageLayout_->addWidget(body_, 1);
         }
 
+        messageLayout_->addWidget(checkmark_);
         messageLayout_->addWidget(timestamp_);
         mainLayout_->addLayout(messageLayout_);
 }
@@ -336,6 +343,7 @@ TimelineItem::TimelineItem(const mtx::events::RoomEvent<mtx::events::msg::Text>
                 messageLayout_->addWidget(body_, 1);
         }
 
+        messageLayout_->addWidget(checkmark_);
         messageLayout_->addWidget(timestamp_);
         mainLayout_->addLayout(messageLayout_);
 }
@@ -343,11 +351,8 @@ TimelineItem::TimelineItem(const mtx::events::RoomEvent<mtx::events::msg::Text>
 void
 TimelineItem::markReceived()
 {
-        auto checkmark = new QLabel("✓", this);
-        checkmark->setStyleSheet(QString("font-size: %1px;").arg(conf::timeline::fonts::timestamp));
-        checkmark->setAlignment(Qt::AlignTop);
-
-        messageLayout_->insertWidget(1, checkmark);
+        checkmark_->setText("✓");
+        checkmark_->setAlignment(Qt::AlignTop);
 }
 
 // Only the body is displayed.