10 m_displayedWhenStopped(false),
12 m_penColor(Qt::lightGray)
14 setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
15 setFocusPolicy(Qt::NoFocus);
20 return (m_timerId != -1);
25 m_displayedWhenStopped = state;
32 return m_displayedWhenStopped;
40 m_timerId = startTimer(m_delay);
61 m_timerId = startTimer(m_delay);
90 m_angle = (m_angle+30)%360;
100 int width = qMin(this->width(), this->height());
103 p.setRenderHint(QPainter::Antialiasing);
105 int outerRadius = (width-1)*0.5;
106 int innerRadius = (width-1)*0.5*0.38;
108 int capsuleHeight = outerRadius - innerRadius;
109 int capsuleWidth = (width > 32 ) ? capsuleHeight *.23 : capsuleHeight *.35;
110 int capsuleRadius = capsuleWidth/2;
112 for (
int i=0; i<12; i++)
114 QColor
color = m_color;
115 qreal alpha = 1.0f - (i/12.0f);
116 color.setAlphaF(alpha);
119 penColor.setAlphaF(alpha);
122 pen.setColor(penColor);
127 p.translate(rect().center());
128 p.rotate(m_angle - i*30.0f);
129 p.drawRoundedRect(-capsuleWidth*0.5, -(innerRadius+capsuleHeight), capsuleWidth, capsuleHeight, capsuleRadius, capsuleRadius);
bool isDisplayedWhenStopped() const
virtual QSize sizeHint() const
int heightForWidth(int w) const
virtual void paintEvent(QPaintEvent *event)
void setAnimationDelay(int delay)
const QColor & penColor() const
ProgressIndicator(QWidget *parent=0)
void setPenColor(const QColor &color)
const QColor & color() const
void setDisplayedWhenStopped(bool state)
virtual void timerEvent(QTimerEvent *event)
void setColor(const QColor &color)