Apply fixed width for checkmark for all messages

pull/1/head
Chris Tarazi 7 years ago
parent a15079c68f
commit 2dcc01633e
No known key found for this signature in database
GPG Key ID: 746C4A065572CA6B
  1. 2
      include/timeline/TimelineItem.h
  2. 8
      src/timeline/TimelineItem.cc

@ -182,6 +182,7 @@ TimelineItem::setupLocalWidgetLayout(Widget *widget,
messageLayout_->addLayout(widgetLayout, 1);
}
messageLayout_->addWidget(checkmark_);
messageLayout_->addWidget(timestamp_);
mainLayout_->addLayout(messageLayout_);
}
@ -232,6 +233,7 @@ TimelineItem::setupWidgetLayout(Widget *widget,
messageLayout_->addLayout(widgetLayout, 1);
}
messageLayout_->addWidget(checkmark_);
messageLayout_->addWidget(timestamp_);
mainLayout_->addLayout(messageLayout_);
}

@ -30,6 +30,8 @@
#include "timeline/widgets/ImageItem.h"
#include "timeline/widgets/VideoItem.h"
constexpr const static char *CHECKMARK = "";
void
TimelineItem::init()
{
@ -62,7 +64,11 @@ TimelineItem::init()
mainLayout_->setContentsMargins(conf::timeline::headerLeftMargin, 0, 0, 0);
mainLayout_->setSpacing(0);
// Setting fixed width for checkmark because systems may have a differing width for a
// space and the Unicode checkmark.
checkmark_ = new QLabel(" ", this);
checkmark_->setFixedWidth(fm.width(CHECKMARK));
checkmark_->setFont(font_);
checkmark_->setStyleSheet(
QString("font-size: %1px;").arg(conf::timeline::fonts::timestamp));
}
@ -351,7 +357,7 @@ TimelineItem::TimelineItem(const mtx::events::RoomEvent<mtx::events::msg::Text>
void
TimelineItem::markReceived()
{
checkmark_->setText("");
checkmark_->setText(CHECKMARK);
checkmark_->setAlignment(Qt::AlignTop);
}

Loading…
Cancel
Save