mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-17 22:57:11 +02:00
Fix paddings in text messages disabler.
This commit is contained in:
parent
a26bae70c7
commit
95bdb925d5
1 changed files with 18 additions and 4 deletions
|
@ -1063,10 +1063,26 @@ base::unique_qptr<Ui::RpWidget> CreateDisabledFieldView(
|
|||
st::historySendDisabled);
|
||||
label->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||
raw->setPointerCursor(false);
|
||||
|
||||
const auto &st = st::historyComposeField;
|
||||
|
||||
const auto metrics = QFontMetricsF(st.style.font->f);
|
||||
const auto realAscent = int(base::SafeRound(metrics.ascent()));
|
||||
const auto ascentAdd = st.style.font->ascent - realAscent;
|
||||
const auto customFontMarginTop = ascentAdd;
|
||||
const auto leading = qMax(metrics.leading(), qreal(0.0));
|
||||
const auto adjustment = (metrics.ascent() + leading)
|
||||
- ((st.style.font->height * 4) / 5);
|
||||
const auto placeholderCustomFontSkip = int(base::SafeRound(-adjustment));
|
||||
|
||||
const auto margins = st.textMargins
|
||||
+ st.placeholderMargins
|
||||
+ QMargins(0, style::ConvertScale(4)
|
||||
+ placeholderCustomFontSkip
|
||||
+ customFontMarginTop, 0, 0);
|
||||
|
||||
raw->widthValue(
|
||||
) | rpl::start_with_next([=](int width) {
|
||||
const auto &st = st::historyComposeField;
|
||||
const auto margins = (st.textMargins + st.placeholderMargins);
|
||||
const auto available = width - margins.left() - margins.right();
|
||||
const auto skip = st::historySendDisabledIconSkip;
|
||||
label->resizeToWidth(available - skip);
|
||||
|
@ -1075,8 +1091,6 @@ base::unique_qptr<Ui::RpWidget> CreateDisabledFieldView(
|
|||
raw->paintRequest(
|
||||
) | rpl::start_with_next([=] {
|
||||
auto p = QPainter(raw);
|
||||
const auto &st = st::historyComposeField;
|
||||
const auto margins = (st.textMargins + st.placeholderMargins);
|
||||
const auto &icon = st::historySendDisabledIcon;
|
||||
icon.paint(
|
||||
p,
|
||||
|
|
Loading…
Add table
Reference in a new issue