Decomposed painting of box content divider.

This commit is contained in:
23rd 2022-05-05 12:55:14 +03:00
parent 9b6e11db62
commit 83553d0826
2 changed files with 17 additions and 0 deletions

View file

@ -34,12 +34,20 @@ BoxContentDivider::BoxContentDivider(
void BoxContentDivider::paintEvent(QPaintEvent *e) {
QPainter p(this);
p.fillRect(e->rect(), _bg);
paintTop(p);
paintBottom(p);
}
void BoxContentDivider::paintTop(QPainter &p) {
const auto dividerFillTop = QRect(
0,
0,
width(),
st::boxDividerTop.height());
st::boxDividerTop.fill(p, dividerFillTop);
}
void BoxContentDivider::paintBottom(QPainter &p) {
const auto dividerFillBottom = myrtlrect(
0,
height() - st::boxDividerBottom.height(),
@ -48,4 +56,8 @@ void BoxContentDivider::paintEvent(QPaintEvent *e) {
st::boxDividerBottom.fill(p, dividerFillBottom);
}
const style::color &BoxContentDivider::color() const {
return _bg;
}
} // namespace Ui

View file

@ -21,9 +21,14 @@ public:
int height,
const style::color &bg);
[[nodiscard]] const style::color &color() const;
protected:
void paintEvent(QPaintEvent *e) override;
void paintTop(QPainter &p);
void paintBottom(QPainter &p);
private:
const style::color &_bg;