diff --git a/Telegram/SourceFiles/info/info_content_widget.cpp b/Telegram/SourceFiles/info/info_content_widget.cpp index 550e049a8b..869beaa97b 100644 --- a/Telegram/SourceFiles/info/info_content_widget.cpp +++ b/Telegram/SourceFiles/info/info_content_widget.cpp @@ -114,7 +114,17 @@ bool ContentWidget::isStackBottom() const { void ContentWidget::paintEvent(QPaintEvent *e) { Painter p(this); - p.fillRect(e->rect(), _bg); + if (_paintPadding.isNull()) { + p.fillRect(e->rect(), _bg); + } else { + const auto &r = e->rect(); + const auto padding = QMargins( + 0, + std::min(0, (r.top() - _paintPadding.top())), + 0, + std::min(0, (r.bottom() - _paintPadding.bottom()))); + p.fillRect(r + padding, _bg); + } } void ContentWidget::setGeometryWithTopMoved( @@ -249,6 +259,10 @@ rpl::producer ContentWidget::selectedListValue() const { return rpl::single(SelectedItems(Storage::SharedMediaType::Photo)); } +void ContentWidget::setPaintPadding(const style::margins &padding) { + _paintPadding = padding; +} + void ContentWidget::saveChanges(FnMut done) { done(); } diff --git a/Telegram/SourceFiles/info/info_content_widget.h b/Telegram/SourceFiles/info/info_content_widget.h index 900885d1ea..01008d38c7 100644 --- a/Telegram/SourceFiles/info/info_content_widget.h +++ b/Telegram/SourceFiles/info/info_content_widget.h @@ -103,6 +103,8 @@ protected: void scrollTo(const Ui::ScrollToRequest &request); [[nodiscard]] rpl::producer scrollTopValue() const; + void setPaintPadding(const style::margins &padding); + private: RpWidget *doSetInnerWidget(object_ptr inner); void updateControlsGeometry(); @@ -126,6 +128,9 @@ private: // Saving here topDelta in setGeometryWithTopMoved() to get it passed to resizeEvent(). int _topDelta = 0; + // To paint round edges from content. + style::margins _paintPadding; + }; class ContentMemento {