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