Added ability to call RippleButton::paintRipple with QPoint.
This commit is contained in:
parent
5f7ee9ed81
commit
4dd6444cb2
4 changed files with 21 additions and 10 deletions
|
|
@ -120,6 +120,13 @@ void RippleButton::setForceRippled(
|
|||
update();
|
||||
}
|
||||
|
||||
void RippleButton::paintRipple(
|
||||
QPainter &p,
|
||||
const QPoint &point,
|
||||
const QColor *colorOverride) {
|
||||
paintRipple(p, point.x(), point.y(), colorOverride);
|
||||
}
|
||||
|
||||
void RippleButton::paintRipple(QPainter &p, int x, int y, const QColor *colorOverride) {
|
||||
if (_ripple) {
|
||||
_ripple->paint(p, x, y, width(), colorOverride);
|
||||
|
|
@ -365,7 +372,7 @@ void RoundButton::paintEvent(QPaintEvent *e) {
|
|||
drawRect(_roundRectOver);
|
||||
}
|
||||
|
||||
paintRipple(p, rounded.x(), rounded.y());
|
||||
paintRipple(p, rounded.topLeft());
|
||||
|
||||
p.setFont(_st.font);
|
||||
const auto textTop = _st.padding.top() + _st.textTop;
|
||||
|
|
@ -438,7 +445,7 @@ void IconButton::setRippleColorOverride(const style::color *colorOverride) {
|
|||
void IconButton::paintEvent(QPaintEvent *e) {
|
||||
Painter p(this);
|
||||
|
||||
paintRipple(p, _st.rippleAreaPosition.x(), _st.rippleAreaPosition.y(), _rippleColorOverride ? &(*_rippleColorOverride)->c : nullptr);
|
||||
paintRipple(p, _st.rippleAreaPosition, _rippleColorOverride ? &(*_rippleColorOverride)->c : nullptr);
|
||||
|
||||
auto down = isDown();
|
||||
auto overIconOpacity = (down || forceRippled()) ? 1. : _a_over.value(isOver() ? 1. : 0.);
|
||||
|
|
@ -554,7 +561,7 @@ void CrossButton::paintEvent(QPaintEvent *e) {
|
|||
auto shown = _showAnimation.value(_shown ? 1. : 0.);
|
||||
p.setOpacity(shown);
|
||||
|
||||
paintRipple(p, _st.crossPosition.x(), _st.crossPosition.y());
|
||||
paintRipple(p, _st.crossPosition);
|
||||
|
||||
auto loading = 0.;
|
||||
if (_loadingAnimation.animating()) {
|
||||
|
|
|
|||
|
|
@ -58,7 +58,15 @@ public:
|
|||
|
||||
void clearState() override;
|
||||
|
||||
void paintRipple(QPainter &p, int x, int y, const QColor *colorOverride = nullptr);
|
||||
void paintRipple(
|
||||
QPainter &p,
|
||||
const QPoint &point,
|
||||
const QColor *colorOverride = nullptr);
|
||||
void paintRipple(
|
||||
QPainter &p,
|
||||
int x,
|
||||
int y,
|
||||
const QColor *colorOverride = nullptr);
|
||||
|
||||
void finishAnimating();
|
||||
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ void CallButton::paintEvent(QPaintEvent *e) {
|
|||
} else {
|
||||
rippleColorInterpolated = anim::color(_stFrom->button.ripple.color, _stTo->button.ripple.color, _progress);
|
||||
}
|
||||
paintRipple(p, _stFrom->button.rippleAreaPosition.x(), _stFrom->button.rippleAreaPosition.y(), rippleColorOverride);
|
||||
paintRipple(p, _stFrom->button.rippleAreaPosition, rippleColorOverride);
|
||||
|
||||
auto positionFrom = iconPosition(_stFrom);
|
||||
if (paintFrom) {
|
||||
|
|
|
|||
|
|
@ -570,11 +570,7 @@ void Checkbox::paintEvent(QPaintEvent *e) {
|
|||
p.setOpacity(_st.disabledOpacity);
|
||||
} else {
|
||||
auto color = anim::color(_st.rippleBg, _st.rippleBgActive, active);
|
||||
paintRipple(
|
||||
p,
|
||||
check.x() + _st.rippleAreaPosition.x(),
|
||||
check.y() + _st.rippleAreaPosition.y(),
|
||||
&color);
|
||||
paintRipple(p, check.topLeft() + _st.rippleAreaPosition, &color);
|
||||
}
|
||||
|
||||
auto realCheckRect = myrtlrect(check);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue