Correctly resize box title if it has top button

This commit is contained in:
Eric Kotato 2020-05-06 03:24:15 +03:00
parent a76cb8e35e
commit 8bab33ccc9

View file

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