diff --git a/ui/layers/layers.style b/ui/layers/layers.style index a07cd19..018ef3e 100644 --- a/ui/layers/layers.style +++ b/ui/layers/layers.style @@ -160,6 +160,7 @@ boxDividerHeight: 10px; separatePanelBorderCacheSize: 60px; separatePanelTitleHeight: 62px; +separatePanelNoTitleHeight: 32px; separatePanelClose: IconButton(boxTitleClose) { width: 60px; height: 60px; diff --git a/ui/widgets/separate_panel.cpp b/ui/widgets/separate_panel.cpp index f302edf..4176ba3 100644 --- a/ui/widgets/separate_panel.cpp +++ b/ui/widgets/separate_panel.cpp @@ -93,7 +93,8 @@ SeparatePanel::SeparatePanel(QWidget *parent) : RpWidget(parent) , _close(this, st::separatePanelClose) , _back(this, object_ptr(this, st::separatePanelBack)) -, _body(this) { +, _body(this) +, _titleHeight(st::separatePanelTitleHeight) { setMouseTracking(true); setWindowIcon(QGuiApplication::windowIcon()); initControls(); @@ -107,6 +108,11 @@ void SeparatePanel::setTitle(rpl::producer title) { updateTitleGeometry(width()); } +void SeparatePanel::setTitleHeight(int height) { + _titleHeight = height; + updateControlsGeometry(); +} + void SeparatePanel::initControls() { widthValue( ) | rpl::start_with_next([=](int width) { @@ -127,6 +133,9 @@ void SeparatePanel::initControls() { }, _back->lifetime()); _back->hide(anim::type::instant); _titleLeft.stop(); + + _back->raise(); + _close->raise(); } void SeparatePanel::updateTitleGeometry(int newWidth) { @@ -552,7 +561,7 @@ void SeparatePanel::resizeEvent(QResizeEvent *e) { } void SeparatePanel::updateControlsGeometry() { - const auto top = _padding.top() + st::separatePanelTitleHeight; + const auto top = _padding.top() + _titleHeight; _body->setGeometry( _padding.left(), top, @@ -716,7 +725,7 @@ void SeparatePanel::mousePressEvent(QMouseEvent *e) { _padding.left(), _padding.top(), width() - _padding.left() - _padding.right(), - st::separatePanelTitleHeight); + _titleHeight); if (e->button() == Qt::LeftButton) { if (dragArea.contains(e->pos())) { const auto dragViaSystem = [&] { diff --git a/ui/widgets/separate_panel.h b/ui/widgets/separate_panel.h index 029dc8f..311c02f 100644 --- a/ui/widgets/separate_panel.h +++ b/ui/widgets/separate_panel.h @@ -34,6 +34,7 @@ public: explicit SeparatePanel(QWidget *parent = nullptr); void setTitle(rpl::producer title); + void setTitleHeight(int height); void setInnerSize(QSize size); [[nodiscard]] QRect innerGeometry() const; @@ -105,6 +106,7 @@ private: rpl::event_stream<> _userCloseRequests; rpl::event_stream<> _closeEvents; + int _titleHeight = 0; bool _hideOnDeactivate = false; bool _useTransparency = true; style::margins _padding;