Added ability to set background color to BoxContentDivider.

This commit is contained in:
23rd 2021-09-06 11:20:02 +03:00
parent 01d10cbdbf
commit e0339b7da1
2 changed files with 20 additions and 3 deletions

View file

@ -18,13 +18,21 @@ BoxContentDivider::BoxContentDivider(QWidget *parent)
}
BoxContentDivider::BoxContentDivider(QWidget *parent, int height)
: RpWidget(parent) {
: BoxContentDivider(parent, height, st::boxDividerBg) {
}
BoxContentDivider::BoxContentDivider(
QWidget *parent,
int height,
const style::color &bg)
: RpWidget(parent)
, _bg(bg) {
resize(width(), height);
}
void BoxContentDivider::paintEvent(QPaintEvent *e) {
QPainter p(this);
p.fillRect(e->rect(), st::boxDividerBg);
p.fillRect(e->rect(), _bg);
const auto dividerFillTop = QRect(
0,
0,

View file

@ -13,11 +13,20 @@ namespace Ui {
class BoxContentDivider : public Ui::RpWidget {
public:
BoxContentDivider(QWidget *parent);
BoxContentDivider(QWidget *parent, int height);
BoxContentDivider(
QWidget *parent,
int height);
BoxContentDivider(
QWidget *parent,
int height,
const style::color &bg);
protected:
void paintEvent(QPaintEvent *e) override;
private:
const style::color &_bg;
};
} // namespace Ui