2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-30 22:16:14 +00:00

Alpha 1.0.34: Fix tabbed section widget render.

Also fix error message layout in EditCaptionBox.
This commit is contained in:
John Preston
2017-04-21 16:17:54 +03:00
parent 8f719f8c06
commit 33ffa0715d
9 changed files with 44 additions and 18 deletions

View File

@@ -628,7 +628,7 @@ void EditCaptionBox::onCaptionResized() {
}
void EditCaptionBox::updateBoxSize() {
auto newHeight = st::boxPhotoPadding.top() + st::boxPhotoCaptionSkip + _field->height() + st::normalFont->height;
auto newHeight = st::boxPhotoPadding.top() + st::boxPhotoCaptionSkip + _field->height() + errorTopSkip() + st::normalFont->height;
if (_photo || _animated) {
newHeight += _thumbh;
} else if (_thumbw) {
@@ -641,6 +641,10 @@ void EditCaptionBox::updateBoxSize() {
setDimensions(st::boxWideWidth, newHeight);
}
int EditCaptionBox::errorTopSkip() const {
return (st::boxButtonPadding.top() / 2);
}
void EditCaptionBox::paintEvent(QPaintEvent *e) {
BoxContent::paintEvent(e);
@@ -731,14 +735,14 @@ void EditCaptionBox::paintEvent(QPaintEvent *e) {
if (!_error.isEmpty()) {
p.setFont(st::normalFont);
p.setPen(st::boxTextFgError);
p.drawTextLeft(_field->x(), _field->y() + _field->height() + (st::boxButtonPadding.top() / 2), width(), _error);
p.drawTextLeft(_field->x(), _field->y() + _field->height() + errorTopSkip(), width(), _error);
}
}
void EditCaptionBox::resizeEvent(QResizeEvent *e) {
BoxContent::resizeEvent(e);
_field->resize(st::boxWideWidth - st::boxPhotoPadding.left() - st::boxPhotoPadding.right(), _field->height());
_field->moveToLeft(st::boxPhotoPadding.left(), height() - st::normalFont->height - _field->height());
_field->moveToLeft(st::boxPhotoPadding.left(), height() - st::normalFont->height - errorTopSkip() - _field->height());
}
void EditCaptionBox::setInnerFocus() {
@@ -748,7 +752,7 @@ void EditCaptionBox::setInnerFocus() {
void EditCaptionBox::onSave(bool ctrlShiftEnter) {
if (_saveRequestId) return;
HistoryItem *item = App::histItemById(_msgId);
auto item = App::histItemById(_msgId);
if (!item) {
_error = lang(lng_edit_deleted);
update();