Fixed error display in EditCaptionBox.

This commit is contained in:
23rd 2022-03-04 18:48:11 +03:00
parent f57ef43dc7
commit 0e08cffedb
2 changed files with 6 additions and 2 deletions

View File

@ -580,6 +580,7 @@ void EditCaptionBox::captionResized() {
void EditCaptionBox::updateBoxSize() { void EditCaptionBox::updateBoxSize() {
auto footerHeight = 0; auto footerHeight = 0;
footerHeight += st::normalFont->height + errorTopSkip();
if (_field) { if (_field) {
footerHeight += st::boxPhotoCaptionSkip + _field->height(); footerHeight += st::boxPhotoCaptionSkip + _field->height();
} }
@ -613,13 +614,15 @@ void EditCaptionBox::paintEvent(QPaintEvent *e) {
void EditCaptionBox::resizeEvent(QResizeEvent *e) { void EditCaptionBox::resizeEvent(QResizeEvent *e) {
BoxContent::resizeEvent(e); BoxContent::resizeEvent(e);
const auto errorHeight = st::normalFont->height + errorTopSkip();
auto bottom = height(); auto bottom = height();
{ {
const auto resultScrollHeight = bottom const auto resultScrollHeight = bottom
- _field->height() - _field->height()
- st::boxPhotoCaptionSkip - st::boxPhotoCaptionSkip
- (_controls->isHidden() ? 0 : _controls->heightNoMargins()) - (_controls->isHidden() ? 0 : _controls->heightNoMargins())
- st::boxPhotoPadding.top(); - st::boxPhotoPadding.top()
- errorHeight;
const auto minThumbH = st::sendBoxAlbumGroupSize.height() const auto minThumbH = st::sendBoxAlbumGroupSize.height()
+ st::sendBoxAlbumGroupSkipTop * 2; + st::sendBoxAlbumGroupSkipTop * 2;
const auto diff = resultScrollHeight - minThumbH; const auto diff = resultScrollHeight - minThumbH;
@ -628,6 +631,7 @@ void EditCaptionBox::resizeEvent(QResizeEvent *e) {
} }
} }
bottom -= errorHeight;
_field->resize(st::sendMediaPreviewSize, _field->height()); _field->resize(st::sendMediaPreviewSize, _field->height());
_field->moveToLeft( _field->moveToLeft(
st::boxPhotoPadding.left(), st::boxPhotoPadding.left(),

View File

@ -55,7 +55,7 @@ EdgeButton::EdgeButton(
const style::RippleAnimation &st) const style::RippleAnimation &st)
: Ui::RippleButton(parent, st) : Ui::RippleButton(parent, st)
, _fg(fg) , _fg(fg)
, _text(st::semiboldTextStyle, text.toUpper()) , _text(st::semiboldTextStyle, text)
, _width(_text.maxWidth() , _width(_text.maxWidth()
+ st::photoEditorTextButtonPadding.left() + st::photoEditorTextButtonPadding.left()
+ st::photoEditorTextButtonPadding.right()) + st::photoEditorTextButtonPadding.right())