From 15dc47555ad71beec827ebb7c56e4d596c42ecce Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 15 Apr 2022 22:01:43 +0200 Subject: [PATCH] [3rdparty] Constness for waitingspinner The accessors can be (should be!) const. --- 3rdparty/waitingspinnerwidget.cpp | 26 +++++++++++++------------- 3rdparty/waitingspinnerwidget.h | 24 ++++++++++++------------ 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/3rdparty/waitingspinnerwidget.cpp b/3rdparty/waitingspinnerwidget.cpp index 3f98969d5..cd5e1b07e 100644 --- a/3rdparty/waitingspinnerwidget.cpp +++ b/3rdparty/waitingspinnerwidget.cpp @@ -120,7 +120,7 @@ void WaitingSpinnerWidget::paintEvent(QPaintEvent *) { if (!_text.isEmpty()) { painter.setPen(QPen(_textColor)); - painter.drawText(QRect(0, _imageSize.height(), width(), height() - _imageSize.height()), + painter.drawText(QRect(0, _imageSize.height(), width(), height() - _imageSize.height()), Qt::AlignBottom | Qt::AlignHCenter, _text); } } @@ -175,52 +175,52 @@ void WaitingSpinnerWidget::setInnerRadius(int radius) { updateSize(); } -void WaitingSpinnerWidget::setText(QString text) { +void WaitingSpinnerWidget::setText(const QString& text) { _text = text; updateSize(); } -QColor WaitingSpinnerWidget::color() { +QColor WaitingSpinnerWidget::color() const { return _color; } -QColor WaitingSpinnerWidget::textColor() { +QColor WaitingSpinnerWidget::textColor() const { return _textColor; } -QString WaitingSpinnerWidget::text() { +QString WaitingSpinnerWidget::text() const { return _text; } -qreal WaitingSpinnerWidget::roundness() { +qreal WaitingSpinnerWidget::roundness() const { return _roundness; } -qreal WaitingSpinnerWidget::minimumTrailOpacity() { +qreal WaitingSpinnerWidget::minimumTrailOpacity() const { return _minimumTrailOpacity; } -qreal WaitingSpinnerWidget::trailFadePercentage() { +qreal WaitingSpinnerWidget::trailFadePercentage() const { return _trailFadePercentage; } -qreal WaitingSpinnerWidget::revolutionsPersSecond() { +qreal WaitingSpinnerWidget::revolutionsPersSecond() const { return _revolutionsPerSecond; } -int WaitingSpinnerWidget::numberOfLines() { +int WaitingSpinnerWidget::numberOfLines() const { return _numberOfLines; } -int WaitingSpinnerWidget::lineLength() { +int WaitingSpinnerWidget::lineLength() const { return _lineLength; } -int WaitingSpinnerWidget::lineWidth() { +int WaitingSpinnerWidget::lineWidth() const { return _lineWidth; } -int WaitingSpinnerWidget::innerRadius() { +int WaitingSpinnerWidget::innerRadius() const { return _innerRadius; } diff --git a/3rdparty/waitingspinnerwidget.h b/3rdparty/waitingspinnerwidget.h index b600d6727..b180e268a 100644 --- a/3rdparty/waitingspinnerwidget.h +++ b/3rdparty/waitingspinnerwidget.h @@ -69,19 +69,19 @@ public: void setLineLength(int length); void setLineWidth(int width); void setInnerRadius(int radius); - void setText(QString text); + void setText(const QString& text); - QColor color(); - QColor textColor(); - QString text(); - qreal roundness(); - qreal minimumTrailOpacity(); - qreal trailFadePercentage(); - qreal revolutionsPersSecond(); - int numberOfLines(); - int lineLength(); - int lineWidth(); - int innerRadius(); + QColor color() const; + QColor textColor() const; + QString text() const; + qreal roundness() const; + qreal minimumTrailOpacity() const; + qreal trailFadePercentage() const; + qreal revolutionsPersSecond() const; + int numberOfLines() const; + int lineLength() const; + int lineWidth() const; + int innerRadius() const; bool isSpinning() const;