Added ability to set custom stroke ratio for arcs.
This commit is contained in:
parent
315a0457cf
commit
f03209c1f9
2 changed files with 11 additions and 1 deletions
|
|
@ -209,7 +209,11 @@ bool ArcsAnimation::isArcFinished(const Arc &arc) const {
|
|||
void ArcsAnimation::paint(Painter &p, std::optional<QColor> colorOverride) {
|
||||
PainterHighQualityEnabler hq(p);
|
||||
QPen pen;
|
||||
pen.setWidth(_st.stroke);
|
||||
if (_strokeRatio) {
|
||||
pen.setWidthF(_st.stroke * _strokeRatio);
|
||||
} else {
|
||||
pen.setWidth(_st.stroke);
|
||||
}
|
||||
pen.setCapStyle(Qt::RoundCap);
|
||||
pen.setColor(colorOverride ? (*colorOverride) : _st.fg->c);
|
||||
p.setPen(pen);
|
||||
|
|
@ -228,5 +232,8 @@ void ArcsAnimation::paint(Painter &p, std::optional<QColor> colorOverride) {
|
|||
}
|
||||
}
|
||||
|
||||
void ArcsAnimation::setStrokeRatio(float ratio) {
|
||||
_strokeRatio = ratio;
|
||||
}
|
||||
|
||||
} // namespace Ui::Paint
|
||||
|
|
|
|||
|
|
@ -57,6 +57,8 @@ public:
|
|||
float finishedWidth() const;
|
||||
float height() const;
|
||||
|
||||
void setStrokeRatio(float ratio);
|
||||
|
||||
private:
|
||||
struct Arc {
|
||||
QRectF rect;
|
||||
|
|
@ -82,6 +84,7 @@ private:
|
|||
const QRectF _emptyRect;
|
||||
|
||||
float64 _currentValue = 0.;
|
||||
float _strokeRatio = 0.;
|
||||
|
||||
rpl::event_stream<> _startUpdateRequests;
|
||||
rpl::event_stream<> _stopUpdateRequests;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue