mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 06:26:18 +00:00
Use Ui::Text::String in Ui::RoundButton.
This commit is contained in:
@@ -296,7 +296,9 @@ emojiPanButton: RoundButton(defaultActiveButton) {
|
||||
textTop: 2px;
|
||||
}
|
||||
emojiPanExpand: RoundButton(defaultActiveButton) {
|
||||
font: font(12px bold);
|
||||
style: TextStyle(semiboldTextStyle) {
|
||||
font: font(12px bold);
|
||||
}
|
||||
width: -8px;
|
||||
height: 19px;
|
||||
textTop: 1px;
|
||||
@@ -1499,5 +1501,7 @@ pickLocationChooseOnMap: RoundButton(defaultActiveButton) {
|
||||
height: 44px;
|
||||
textTop: 11px;
|
||||
width: -96px;
|
||||
font: font(15px semibold);
|
||||
style: TextStyle(semiboldTextStyle) {
|
||||
font: font(15px semibold);
|
||||
}
|
||||
}
|
||||
|
@@ -1450,17 +1450,17 @@ void EmojiListWidget::drawCollapsedBadge(
|
||||
int count) {
|
||||
const auto &st = st::emojiPanExpand;
|
||||
const auto text = u"+%1"_q.arg(count - _columnCount * kCollapsedRows + 1);
|
||||
const auto textWidth = st.font->width(text);
|
||||
const auto textWidth = st.style.font->width(text);
|
||||
const auto buttonw = std::max(textWidth - st.width, st.height);
|
||||
const auto buttonh = st.height;
|
||||
const auto buttonx = position.x() + (_singleSize.width() - buttonw) / 2;
|
||||
const auto buttony = position.y() + (_singleSize.height() - buttonh) / 2;
|
||||
_collapsedBg.paint(p, QRect(buttonx, buttony, buttonw, buttonh));
|
||||
p.setPen(this->st().bg);
|
||||
p.setFont(st.font);
|
||||
p.setFont(st.style.font);
|
||||
p.drawText(
|
||||
buttonx + (buttonw - textWidth) / 2,
|
||||
(buttony + st.textTop + st.font->ascent),
|
||||
(buttony + st.textTop + st.style.font->ascent),
|
||||
text);
|
||||
}
|
||||
|
||||
@@ -2546,12 +2546,12 @@ int EmojiListWidget::paintButtonGetWidth(
|
||||
: selected
|
||||
? st::emojiPanButton.textFgOver
|
||||
: st::emojiPanButton.textFg);
|
||||
p.setFont(st::emojiPanButton.font);
|
||||
p.setFont(st::emojiPanButton.style.font);
|
||||
p.drawText(
|
||||
rect.x() - (st::emojiPanButton.width / 2),
|
||||
(rect.y()
|
||||
+ st::emojiPanButton.textTop
|
||||
+ st::emojiPanButton.font->ascent),
|
||||
+ st::emojiPanButton.style.font->ascent),
|
||||
button.text);
|
||||
return emojiRight() - rect.x();
|
||||
}
|
||||
@@ -2678,7 +2678,7 @@ void EmojiListWidget::initButton(
|
||||
const QString &text,
|
||||
bool gradient) {
|
||||
button.text = text;
|
||||
button.textWidth = st::emojiPanButton.font->width(text);
|
||||
button.textWidth = st::emojiPanButton.style.font->width(text);
|
||||
const auto width = button.textWidth - st::emojiPanButton.width;
|
||||
const auto height = st::emojiPanButton.height;
|
||||
const auto factor = style::DevicePixelRatio();
|
||||
|
@@ -213,11 +213,14 @@ StickersListWidget::StickersListWidget(
|
||||
st().pathBg,
|
||||
st().pathFg,
|
||||
[=] { update(); }))
|
||||
, _megagroupSetAbout(st::columnMinimalWidthThird - st::emojiScroll.width - st().headerLeft)
|
||||
, _megagroupSetAbout(st::columnMinimalWidthThird
|
||||
- st::emojiScroll.width
|
||||
- st().headerLeft)
|
||||
, _addText(tr::lng_stickers_featured_add(tr::now))
|
||||
, _addWidth(st::stickersTrendingAdd.font->width(_addText))
|
||||
, _addWidth(st::stickersTrendingAdd.style.font->width(_addText))
|
||||
, _installedText(tr::lng_stickers_featured_installed(tr::now))
|
||||
, _installedWidth(st::stickersTrendingInstalled.font->width(_installedText))
|
||||
, _installedWidth(
|
||||
st::stickersTrendingInstalled.style.font->width(_installedText))
|
||||
, _settings(this, tr::lng_stickers_you_have(tr::now))
|
||||
, _previewTimer([=] { showPreview(); })
|
||||
, _premiumMark(std::make_unique<StickerPremiumMark>(
|
||||
@@ -974,7 +977,7 @@ void StickersListWidget::paintStickers(Painter &p, QRect clip) {
|
||||
const auto &st = installedSet
|
||||
? st::stickersTrendingInstalled
|
||||
: st::stickersTrendingAdd;
|
||||
p.setFont(st.font);
|
||||
p.setFont(st.style.font);
|
||||
p.setPen(selected ? st.textFgOver : st.textFg);
|
||||
p.drawTextLeft(
|
||||
add.x() - (st.width / 2),
|
||||
@@ -1238,7 +1241,7 @@ void StickersListWidget::paintMegagroupEmptySet(Painter &p, int y, bool buttonSe
|
||||
_megagroupSetButtonRipple.reset();
|
||||
}
|
||||
}
|
||||
p.setFont(st::stickerGroupCategoryAdd.font);
|
||||
p.setFont(st::stickerGroupCategoryAdd.style.font);
|
||||
p.setPen(buttonSelected ? st::stickerGroupCategoryAdd.textFgOver : st::stickerGroupCategoryAdd.textFg);
|
||||
p.drawTextLeft(button.x() - (st::stickerGroupCategoryAdd.width / 2), button.y() + st::stickerGroupCategoryAdd.textTop, width(), _megagroupSetButtonText, _megagroupSetButtonTextWidth);
|
||||
}
|
||||
@@ -2734,7 +2737,7 @@ void StickersListWidget::refreshMegagroupSetGeometry() {
|
||||
auto left = megagroupSetInfoLeft();
|
||||
auto availableWidth = (width() - left);
|
||||
auto top = _megagroupSetAbout.countHeight(availableWidth) + st::stickerGroupCategoryAddMargin.top();
|
||||
_megagroupSetButtonTextWidth = st::stickerGroupCategoryAdd.font->width(_megagroupSetButtonText);
|
||||
_megagroupSetButtonTextWidth = st::stickerGroupCategoryAdd.style.font->width(_megagroupSetButtonText);
|
||||
auto buttonWidth = _megagroupSetButtonTextWidth - st::stickerGroupCategoryAdd.width;
|
||||
_megagroupSetButtonRect = QRect(left, top, buttonWidth, st::stickerGroupCategoryAdd.height);
|
||||
}
|
||||
|
Reference in New Issue
Block a user