mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Added ability to set padding for background in Info::ContentWidget.
This commit is contained in:
parent
9236dd3acb
commit
6a8ccde527
2 changed files with 20 additions and 1 deletions
|
@ -114,7 +114,17 @@ bool ContentWidget::isStackBottom() const {
|
||||||
|
|
||||||
void ContentWidget::paintEvent(QPaintEvent *e) {
|
void ContentWidget::paintEvent(QPaintEvent *e) {
|
||||||
Painter p(this);
|
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(
|
void ContentWidget::setGeometryWithTopMoved(
|
||||||
|
@ -249,6 +259,10 @@ rpl::producer<SelectedItems> ContentWidget::selectedListValue() const {
|
||||||
return rpl::single(SelectedItems(Storage::SharedMediaType::Photo));
|
return rpl::single(SelectedItems(Storage::SharedMediaType::Photo));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ContentWidget::setPaintPadding(const style::margins &padding) {
|
||||||
|
_paintPadding = padding;
|
||||||
|
}
|
||||||
|
|
||||||
void ContentWidget::saveChanges(FnMut<void()> done) {
|
void ContentWidget::saveChanges(FnMut<void()> done) {
|
||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,6 +103,8 @@ protected:
|
||||||
void scrollTo(const Ui::ScrollToRequest &request);
|
void scrollTo(const Ui::ScrollToRequest &request);
|
||||||
[[nodiscard]] rpl::producer<int> scrollTopValue() const;
|
[[nodiscard]] rpl::producer<int> scrollTopValue() const;
|
||||||
|
|
||||||
|
void setPaintPadding(const style::margins &padding);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
RpWidget *doSetInnerWidget(object_ptr<RpWidget> inner);
|
RpWidget *doSetInnerWidget(object_ptr<RpWidget> inner);
|
||||||
void updateControlsGeometry();
|
void updateControlsGeometry();
|
||||||
|
@ -126,6 +128,9 @@ private:
|
||||||
// Saving here topDelta in setGeometryWithTopMoved() to get it passed to resizeEvent().
|
// Saving here topDelta in setGeometryWithTopMoved() to get it passed to resizeEvent().
|
||||||
int _topDelta = 0;
|
int _topDelta = 0;
|
||||||
|
|
||||||
|
// To paint round edges from content.
|
||||||
|
style::margins _paintPadding;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class ContentMemento {
|
class ContentMemento {
|
||||||
|
|
Loading…
Add table
Reference in a new issue