fix: tabular number message length (#6366)

This commit is contained in:
pajlada
2025-08-02 12:57:04 +02:00
committed by GitHub
parent 4a14064425
commit f6f5cc5dbc
2 changed files with 18 additions and 12 deletions
+17 -12
View File
@@ -166,18 +166,18 @@ void SplitInput::initLayout()
auto box = hboxLayout.emplace<QVBoxLayout>().withoutMargin();
box->setSpacing(0);
{
auto textEditLength =
box.emplace<QLabel>().assign(&this->ui_.textEditLength);
textEditLength->setAlignment(Qt::AlignRight);
this->ui_.textEditLength = new QLabel();
// Right-align the labels contents
this->ui_.textEditLength->setAlignment(Qt::AlignRight);
box->addWidget(this->ui_.textEditLength);
box->addStretch(1);
box.emplace<SvgButton>(
SvgButton::Src{
.dark = ":/buttons/emote.svg",
.light = ":/buttons/emoteDark.svg",
},
nullptr, QSize{6, 3})
.assign(&this->ui_.emoteButton);
this->ui_.emoteButton = new SvgButton(
{
.dark = ":/buttons/emote.svg",
.light = ":/buttons/emoteDark.svg",
},
nullptr, QSize{6, 3});
box->addWidget(this->ui_.emoteButton, 0, Qt::AlignRight);
}
// ---- misc
@@ -242,6 +242,7 @@ void SplitInput::scaleChangedEvent(float scale)
this->ui_.vbox->setSpacing(this->marginForTheme());
}
}
// TODO: This font does _not_ get updated when you change your chat font
this->ui_.textEdit->setFont(
app->getFonts()->getFont(FontStyle::ChatMedium, scale));
@@ -252,8 +253,12 @@ void SplitInput::scaleChangedEvent(float scale)
this->ui_.textEdit->setStyleSheet(this->theme->splits.input.styleSheet);
this->ui_.textEdit->setPalette(placeholderPalette);
// TODO: This font does _not_ get updated when you change your chat font
// NOTE: We're using TimestampMedium here to get a font that uses the tnum font feature,
// meaning numbers get equal width & don't bounce around while the user is typing.
this->ui_.textEditLength->setFont(
app->getFonts()->getFont(FontStyle::ChatMedium, scale));
app->getFonts()->getFont(FontStyle::TimestampMedium, scale));
// TODO: This font does _not_ get updated when you change your chat font
this->ui_.replyLabel->setFont(
app->getFonts()->getFont(FontStyle::ChatMediumBold, scale));
}