From 1916823c98ce324ff9fb4031027a0ab37c395c37 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Fri, 25 Sep 2020 22:34:09 +0300 Subject: [PATCH] Added skip for title in box when top button is present. --- ui/layers/box_layer_widget.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ui/layers/box_layer_widget.cpp b/ui/layers/box_layer_widget.cpp index fe80d90..92adb6d 100644 --- a/ui/layers/box_layer_widget.cpp +++ b/ui/layers/box_layer_widget.cpp @@ -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 BoxLayerWidget::addTopButton(const style::IconButton &st, F result->setClickedCallback(std::move(clickCallback)); result->show(); updateButtonsPositions(); + updateTitlePosition(); return result; }