Fix small timestamp misalignment
2 files changed, 6 insertions, 3 deletions
diff --git a/include/Config.h b/include/Config.h
index 147f4446..e33fd959 100644
--- a/include/Config.h
+++ b/include/Config.h
@@ -52,7 +52,7 @@ namespace timeline
static const int msgMargin = 11;
static const int avatarSize = 36;
static const int headerSpacing = 5;
-static const int headerLeftMargin = 12;
+static const int headerLeftMargin = 15;
namespace fonts
{
diff --git a/src/TimelineItem.cc b/src/TimelineItem.cc
index 7db1c7cf..24b1c90f 100644
--- a/src/TimelineItem.cc
+++ b/src/TimelineItem.cc
@@ -330,14 +330,17 @@ void TimelineItem::setupSimpleLayout()
QTextEdit htmlText(timestamp_->text());
QString plainText = htmlText.toPlainText();
+ timestamp_->adjustSize();
+
// Align the end of the avatar bubble with the end of the timestamp for
// messages with and without avatar. Otherwise their bodies would not be aligned.
- int offset = std::max(0, conf::timeline::avatarSize - timestamp_->fontMetrics().width(plainText));
+ int tsWidth = timestamp_->fontMetrics().width(plainText);
+ int offset = std::max(0, conf::timeline::avatarSize - tsWidth);
int defaultFontHeight = QFontMetrics(font_).ascent();
timestamp_->setAlignment(Qt::AlignTop);
- timestamp_->setContentsMargins(offset, defaultFontHeight - timestamp_->fontMetrics().ascent(), 0, 0);
+ timestamp_->setContentsMargins(offset + 1, defaultFontHeight - timestamp_->fontMetrics().ascent(), 0, 0);
topLayout_->setContentsMargins(conf::timeline::msgMargin, conf::timeline::msgMargin / 3, 0, 0);
}
|