Added skip for title in box when top button is present.

This commit is contained in:
23rd 2020-09-25 22:34:09 +03:00
parent e712f9b3de
commit 1916823c98

View file

@ -225,7 +225,11 @@ void BoxLayerWidget::updateTitlePosition() {
_titleLeft = st::boxTitlePosition.x();
_titleTop = st::boxTitlePosition.y();
if (_title) {
_title->resizeToWidth(qMin(_title->naturalWidth(), width() - _titleLeft * 2));
const auto topButtonSkip = _topButton ? (_topButton->width() / 2) : 0;
_title->resizeToWidth(
std::min(
_title->naturalWidth(),
width() - _titleLeft * 2 - topButtonSkip));
_title->moveToLeft(_titleLeft, _titleTop);
}
}
@ -274,6 +278,7 @@ QPointer<IconButton> BoxLayerWidget::addTopButton(const style::IconButton &st, F
result->setClickedCallback(std::move(clickCallback));
result->show();
updateButtonsPositions();
updateTitlePosition();
return result;
}