mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-25 20:48:52 +03:00
Fix small timestamp misalignment
This commit is contained in:
parent
30fb46e25b
commit
3c1f9696df
2 changed files with 6 additions and 3 deletions
|
@ -52,7 +52,7 @@ namespace timeline
|
||||||
static const int msgMargin = 11;
|
static const int msgMargin = 11;
|
||||||
static const int avatarSize = 36;
|
static const int avatarSize = 36;
|
||||||
static const int headerSpacing = 5;
|
static const int headerSpacing = 5;
|
||||||
static const int headerLeftMargin = 12;
|
static const int headerLeftMargin = 15;
|
||||||
|
|
||||||
namespace fonts
|
namespace fonts
|
||||||
{
|
{
|
||||||
|
|
|
@ -330,14 +330,17 @@ void TimelineItem::setupSimpleLayout()
|
||||||
QTextEdit htmlText(timestamp_->text());
|
QTextEdit htmlText(timestamp_->text());
|
||||||
QString plainText = htmlText.toPlainText();
|
QString plainText = htmlText.toPlainText();
|
||||||
|
|
||||||
|
timestamp_->adjustSize();
|
||||||
|
|
||||||
// Align the end of the avatar bubble with the end of the timestamp for
|
// 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.
|
// 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();
|
int defaultFontHeight = QFontMetrics(font_).ascent();
|
||||||
|
|
||||||
timestamp_->setAlignment(Qt::AlignTop);
|
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);
|
topLayout_->setContentsMargins(conf::timeline::msgMargin, conf::timeline::msgMargin / 3, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue