Skip to content

Commit

Permalink
Added ability to paint icons in center of QRectF.
Browse files Browse the repository at this point in the history
  • Loading branch information
23rd committed Sep 3, 2024
1 parent 6a0b261 commit 9a6b7e0
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions ui/style/style_core_icon.h
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,13 @@ class Icon {
outer.y() + (outer.height() - height()) / 2),
outer.x() * 2 + outer.width());
}
void paintInCenter(QPainter &p, const QRectF &outer) const {
const auto dx = outer.x() + (outer.width() - width()) / 2.;
const auto dy = outer.y() + (outer.height() - height()) / 2.;
p.translate(dx, dy);
_data->paint(p, QPoint(), outer.x() * 2. + outer.width());
p.translate(-dx, -dy);
}
void fill(QPainter &p, const QRect &rect) const {
return _data->fill(p, rect);
}
Expand Down Expand Up @@ -265,6 +272,16 @@ class Icon {
outer.x() * 2 + outer.width(),
colorOverride);
}
void paintInCenter(
QPainter &p,
const QRectF &outer,
QColor override) const {
const auto dx = outer.x() + (outer.width() - width()) / 2;
const auto dy = outer.y() + (outer.height() - height()) / 2;
p.translate(dx, dy);
_data->paint(p, QPoint(), outer.x() * 2 + outer.width(), override);
p.translate(-dx, -dy);
}
void fill(QPainter &p, const QRect &rect, QColor colorOverride) const {
return _data->fill(p, rect, colorOverride);
}
Expand Down

0 comments on commit 9a6b7e0

Please sign in to comment.