From 0e08cffedbe1bf53fa2dc99efadaf0816f846a3c Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Fri, 4 Mar 2022 18:48:11 +0300 Subject: [PATCH] Fixed error display in EditCaptionBox. --- Telegram/SourceFiles/boxes/edit_caption_box.cpp | 6 +++++- Telegram/SourceFiles/editor/photo_editor_controls.cpp | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/boxes/edit_caption_box.cpp b/Telegram/SourceFiles/boxes/edit_caption_box.cpp index 629b451fd..506439024 100644 --- a/Telegram/SourceFiles/boxes/edit_caption_box.cpp +++ b/Telegram/SourceFiles/boxes/edit_caption_box.cpp @@ -580,6 +580,7 @@ void EditCaptionBox::captionResized() { void EditCaptionBox::updateBoxSize() { auto footerHeight = 0; + footerHeight += st::normalFont->height + errorTopSkip(); if (_field) { footerHeight += st::boxPhotoCaptionSkip + _field->height(); } @@ -613,13 +614,15 @@ void EditCaptionBox::paintEvent(QPaintEvent *e) { void EditCaptionBox::resizeEvent(QResizeEvent *e) { BoxContent::resizeEvent(e); + const auto errorHeight = st::normalFont->height + errorTopSkip(); auto bottom = height(); { const auto resultScrollHeight = bottom - _field->height() - st::boxPhotoCaptionSkip - (_controls->isHidden() ? 0 : _controls->heightNoMargins()) - - st::boxPhotoPadding.top(); + - st::boxPhotoPadding.top() + - errorHeight; const auto minThumbH = st::sendBoxAlbumGroupSize.height() + st::sendBoxAlbumGroupSkipTop * 2; const auto diff = resultScrollHeight - minThumbH; @@ -628,6 +631,7 @@ void EditCaptionBox::resizeEvent(QResizeEvent *e) { } } + bottom -= errorHeight; _field->resize(st::sendMediaPreviewSize, _field->height()); _field->moveToLeft( st::boxPhotoPadding.left(), diff --git a/Telegram/SourceFiles/editor/photo_editor_controls.cpp b/Telegram/SourceFiles/editor/photo_editor_controls.cpp index 18dc356c4..b9e1963ee 100644 --- a/Telegram/SourceFiles/editor/photo_editor_controls.cpp +++ b/Telegram/SourceFiles/editor/photo_editor_controls.cpp @@ -55,7 +55,7 @@ EdgeButton::EdgeButton( const style::RippleAnimation &st) : Ui::RippleButton(parent, st) , _fg(fg) -, _text(st::semiboldTextStyle, text.toUpper()) +, _text(st::semiboldTextStyle, text) , _width(_text.maxWidth() + st::photoEditorTextButtonPadding.left() + st::photoEditorTextButtonPadding.right())