QtPass 1.4.0
Multi-platform GUI for pass, the standard unix password manager.
Loading...
Searching...
No Matches
qprogressindicator.h
Go to the documentation of this file.
1/*
2 * This code is based on https://github.com/mojocorp/QProgressIndicator
3 * and published under
4 *
5 * The MIT License (MIT)
6 *
7 * Copyright (c) 2011 Morgan Leborgne
8 *
9 * Permission is hereby granted, free of charge, to any person obtaining a copy
10 * of this software and associated documentation files (the "Software"), to deal
11 * in the Software without restriction, including without limitation the rights
12 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 * copies of the Software, and to permit persons to whom the Software is
14 * furnished to do so, subject to the following conditions:
15 *
16 * The above copyright notice and this permission notice shall be included in
17 * all copies or substantial portions of the Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 * SOFTWARE.
26 */
27
28#ifndef QPROGRESSINDICATOR_H_
29#define QPROGRESSINDICATOR_H_
30
31#include <QColor>
32#include <QWidget>
33
43class QProgressIndicator : public QWidget {
44 Q_OBJECT
45public:
46 explicit QProgressIndicator(QWidget *parent = 0);
47
53 int animationDelay() const { return m_delay; }
54
60 bool isAnimated() const;
61
68 bool isDisplayedWhenStopped() const;
69
73 const QColor &color() const { return m_color; }
74
75 virtual QSize sizeHint() const;
76 int heightForWidth(int w) const;
77
78public slots:
82 void startAnimation();
83
87 void stopAnimation();
88
95 void setAnimationDelay(int delay);
96
102 void setDisplayedWhenStopped(bool state);
103
107 void setColor(const QColor &color);
108
109protected:
110 virtual void timerEvent(QTimerEvent *event);
111 virtual void paintEvent(QPaintEvent *event);
112
113private:
114 int m_angle;
115 int m_timerId;
116 int m_delay;
117 bool m_displayedWhenStopped;
118 QColor m_color;
119};
120
121#endif // QPROGRESSINDICATOR_H_
The QProgressIndicator class lets an application display a progress indicator to show that a lengthy ...
virtual void timerEvent(QTimerEvent *event)
QProgressIndicator::timerEvent do the actual animation.
void stopAnimation()
Stops the spin animation.
virtual void paintEvent(QPaintEvent *event)
QProgressIndicator::paintEvent draw the spinner.
bool isDisplayedWhenStopped() const
Returns a Boolean value indicating whether the receiver shows itself even when it is not animating.
void startAnimation()
Starts the spin animation.
void setColor(const QColor &color)
Sets the color of the components to the given color.
virtual QSize sizeHint() const
QProgressIndicator::sizeHint default minimum size.
int animationDelay() const
Returns the delay between animation steps.
bool isAnimated() const
Returns a Boolean value indicating whether the component is currently animated.
void setDisplayedWhenStopped(bool state)
Sets whether the component hides itself when it is not animating.
void setAnimationDelay(int delay)
Sets the delay between animation steps.
const QColor & color() const
Returns the color of the component.
int heightForWidth(int w) const
QProgressIndicator::heightForWidth square ratio.