|
QtPass 2.0.0
Developer documentation
|
Indeterminate progress indicator: twelve fading capsules that turn while the application is busy. More...
#include <qprogressindicator.h>
Public Slots | |
| void | startAnimation () |
| Start the spin animation from its first position. | |
| void | stopAnimation () |
| Stop the spin animation. | |
| void | setAnimationDelay (int delay) |
| Set the delay between animation steps. | |
| void | setDisplayedWhenStopped (bool state) |
| Set whether the indicator is drawn while it does not animate. | |
| void | setColor (const QColor &color) |
| Set the colour the indicator is drawn in. | |
Public Member Functions | |
| QProgressIndicator (QWidget *parent=nullptr) | |
| Create a stopped indicator with a fixed size policy that never takes keyboard focus. | |
| auto | animationDelay () const -> int |
| Delay between animation steps. | |
| auto | isAnimated () const -> bool |
| Whether the indicator is animating. | |
| auto | isDisplayedWhenStopped () const -> bool |
| Whether the indicator is drawn while it does not animate. | |
| auto | color () const -> const QColor & |
| Colour set with setColor(). | |
| auto | sizeHint () const -> QSize override |
| Preferred size of the indicator. | |
| auto | heightForWidth (int w) const -> int override |
| Keep the indicator square. | |
Protected Member Functions | |
| void | timerEvent (QTimerEvent *event) override |
| Turn the indicator one step (30 degrees) and repaint. | |
| void | paintEvent (QPaintEvent *event) override |
| Draw the twelve capsules, the newest opaque and the rest fading. | |
Private Attributes | |
| int | m_angle {0} |
| Rotation of the first capsule, in degrees. | |
| int | m_timerId {-1} |
| Id of the animation timer, or -1 while stopped. | |
| int | m_delay {40} |
| Milliseconds between two animation steps. | |
| bool | m_displayedWhenStopped {false} |
| Whether the indicator is drawn while it does not animate. | |
| QColor | m_color |
| Colour from setColor(); invalid means the palette colour. | |
Indeterminate progress indicator: twelve fading capsules that turn while the application is busy.
The widget is square. By default it draws nothing while it does not animate, but it stays shown and keeps its place in the layout. It draws in the palette's window text colour unless setColor() gave it a valid colour of its own, so it follows a light or dark theme.
Written by Morgan Leborgne (MIT licence) and maintained here since 2015.
Definition at line 27 of file qprogressindicator.h.
|
explicit |
Create a stopped indicator with a fixed size policy that never takes keyboard focus.
| parent | Widget the indicator is placed in. |
Definition at line 11 of file qprogressindicator.cpp.
|
inlinenodiscard |
Delay between animation steps.
Definition at line 43 of file qprogressindicator.h.
|
inlinenodiscard |
Colour set with setColor().
Definition at line 64 of file qprogressindicator.h.
|
nodiscardoverride |
Keep the indicator square.
| w | Width on offer. |
Definition at line 66 of file qprogressindicator.cpp.
|
nodiscard |
Whether the indicator is animating.
Definition at line 16 of file qprogressindicator.cpp.
|
nodiscard |
Whether the indicator is drawn while it does not animate.
Definition at line 24 of file qprogressindicator.cpp.
|
overrideprotected |
Draw the twelve capsules, the newest opaque and the rest fading.
| event | Paint event; not used. |
Definition at line 74 of file qprogressindicator.cpp.
|
slot |
Set the delay between animation steps.
A value above 40 slows the animation, a smaller one speeds it up. A running animation goes on with the new delay.
| delay | Delay in milliseconds. |
Definition at line 46 of file qprogressindicator.cpp.
|
slot |
Set the colour the indicator is drawn in.
| color | The colour to use. An invalid QColor goes back to the palette's window text colour. |
Definition at line 58 of file qprogressindicator.cpp.
|
slot |
Set whether the indicator is drawn while it does not animate.
| state | true to draw it when stopped, false to draw nothing then. |
Definition at line 18 of file qprogressindicator.cpp.
|
nodiscardoverride |
Preferred size of the indicator.
Definition at line 64 of file qprogressindicator.cpp.
|
slot |
Start the spin animation from its first position.
Definition at line 28 of file qprogressindicator.cpp.
|
slot |
Stop the spin animation.
Definition at line 36 of file qprogressindicator.cpp.
|
overrideprotected |
Turn the indicator one step (30 degrees) and repaint.
| event | Timer event; not used. |
Definition at line 68 of file qprogressindicator.cpp.
|
private |
Rotation of the first capsule, in degrees.
Definition at line 133 of file qprogressindicator.h.
|
private |
Colour from setColor(); invalid means the palette colour.
Definition at line 141 of file qprogressindicator.h.
|
private |
Milliseconds between two animation steps.
Definition at line 137 of file qprogressindicator.h.
|
private |
Whether the indicator is drawn while it does not animate.
Definition at line 139 of file qprogressindicator.h.
|
private |
Id of the animation timer, or -1 while stopped.
Definition at line 135 of file qprogressindicator.h.