The ProgressIndicator class lets an application display a progress indicator to show that a lengthy task is under way.
More...
#include <ProgressIndicator.h>
Inherits QWidget.
The ProgressIndicator class lets an application display a progress indicator to show that a lengthy task is under way.
Progress indicators are indeterminate and do nothing more than spin to show that the application is busy.
Based on QProgressIndicator 1.0.2 (http://qt-apps.org/content/show.php/QProgressIndicator?content=115762) by Morgan Leborgne (mojo2000)
- See also
- QProgressBar
Definition at line 16 of file ProgressIndicator.h.
| ProgressIndicator::ProgressIndicator |
( |
QWidget * |
parent = 0 | ) |
|
Definition at line 5 of file ProgressIndicator.cc.
10 m_displayedWhenStopped(
false),
12 m_penColor(Qt::lightGray)
14 setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
15 setFocusPolicy(Qt::NoFocus);
| int ProgressIndicator::animationDelay |
( |
| ) |
const |
|
inline |
Returns the delay between animation steps.
- Returns
- The number of milliseconds between animation steps. By default, the animation delay is set to 40 milliseconds.
- See also
- setAnimationDelay
Definition at line 30 of file ProgressIndicator.h.
| const QColor& ProgressIndicator::color |
( |
| ) |
const |
|
inline |
| int ProgressIndicator::heightForWidth |
( |
int |
w | ) |
const |
| bool ProgressIndicator::isAnimated |
( |
| ) |
const |
| bool ProgressIndicator::isDisplayedWhenStopped |
( |
| ) |
const |
Returns a Boolean value indicating whether the receiver shows itself even when it is not animating.
- Returns
- Return true if the progress indicator shows itself even when it is not animating. By default, it returns false.
- See also
- setDisplayedWhenStopped
Definition at line 30 of file ProgressIndicator.cc.
32 return m_displayedWhenStopped;
| void ProgressIndicator::paintEvent |
( |
QPaintEvent * |
event | ) |
|
|
protectedvirtual |
Definition at line 95 of file ProgressIndicator.cc.
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);
const QColor & penColor() const
const QColor & color() const
| const QColor& ProgressIndicator::penColor |
( |
| ) |
const |
|
inline |
| void ProgressIndicator::setAnimationDelay |
( |
int |
delay | ) |
|
|
slot |
Sets the delay between animation steps. Setting the delay to a value larger than 40 slows the animation, while setting the delay to a smaller value speeds it up.
- Parameters
-
| delay | The delay, in milliseconds. |
- See also
- animationDelay
Definition at line 53 of file ProgressIndicator.cc.
61 m_timerId = startTimer(m_delay);
| void ProgressIndicator::setColor |
( |
const QColor & |
color | ) |
|
|
slot |
Sets the color of the components to the given color.
- See also
- color
Definition at line 64 of file ProgressIndicator.cc.
const QColor & color() const
| void ProgressIndicator::setDisplayedWhenStopped |
( |
bool |
state | ) |
|
|
slot |
Sets whether the component hides itself when it is not animating.
- Parameters
-
| state | The animation state. Set false to hide the progress indicator when it is not animating; otherwise true. |
- See also
- isDisplayedWhenStopped
Definition at line 23 of file ProgressIndicator.cc.
25 m_displayedWhenStopped = state;
| void ProgressIndicator::setPenColor |
( |
const QColor & |
color | ) |
|
|
slot |
Sets the color of the pen (responsible for the outline of the components) to the given color.
- See also
- color
Definition at line 71 of file ProgressIndicator.cc.
const QColor & color() const
| QSize ProgressIndicator::sizeHint |
( |
| ) |
const |
|
virtual |
| void ProgressIndicator::startAnimation |
( |
| ) |
|
|
slot |
| void ProgressIndicator::stopAnimation |
( |
| ) |
|
|
slot |
| void ProgressIndicator::timerEvent |
( |
QTimerEvent * |
event | ) |
|
|
protectedvirtual |
| QColor ProgressIndicator::color |
|
readwrite |
| int ProgressIndicator::delay |
|
readwrite |
| bool ProgressIndicator::displayedWhenStopped |
|
readwrite |
| QColor ProgressIndicator::penColor |
|
readwrite |
The documentation for this class was generated from the following files:
- /build/rock-master-18.09-gui-rock-widget-collection-0.20180124/src/progress_indicator/ProgressIndicator.h
- /build/rock-master-18.09-gui-rock-widget-collection-0.20180124/src/progress_indicator/ProgressIndicator.cc