QSkinny 0.8.0
C++/Qt UI toolkit
Loading...
Searching...
No Matches
QskProgressIndicator.h
1/******************************************************************************
2 * QSkinny - Copyright (C) The authors
3 * SPDX-License-Identifier: BSD-3-Clause
4 *****************************************************************************/
5
6#ifndef QSK_PROGRESS_INDICATOR_H
7#define QSK_PROGRESS_INDICATOR_H
8
9#include "QskBoundedControl.h"
10
11class QskIntervalF;
12
13class QSK_EXPORT QskProgressIndicator : public QskBoundedControl
14{
15 Q_OBJECT
16
17 Q_PROPERTY( qreal extent READ extent
18 WRITE setExtent RESET resetExtent NOTIFY extentChanged )
19
20 Q_PROPERTY( bool indeterminate READ isIndeterminate
21 WRITE setIndeterminate NOTIFY indeterminateChanged )
22
23 Q_PROPERTY( qreal origin READ origin
24 WRITE setOrigin RESET resetOrigin NOTIFY originChanged )
25
26 Q_PROPERTY( qreal value READ value WRITE setValue NOTIFY valueChanged )
27 Q_PROPERTY( qreal valueAsRatio READ valueAsRatio
28 WRITE setValueAsRatio NOTIFY valueChanged )
29
31
32 public:
33 QSK_SUBCONTROLS( Groove, Fill )
34
35 QskProgressIndicator( QQuickItem* parent = nullptr );
36 QskProgressIndicator( qreal min, qreal max, QQuickItem* parent = nullptr );
37 QskProgressIndicator( const QskIntervalF&, QQuickItem* parent = nullptr );
38
39 ~QskProgressIndicator() override;
40
41 bool isIndeterminate() const;
42 void setIndeterminate( bool on = true );
43
44 void setFillGradient( const QskGradient& );
45 void resetFillGradient();
46 QskGradient fillGradient() const;
47
48 void setExtent( qreal );
49 void resetExtent();
50 qreal extent() const;
51
52 void resetOrigin();
53 qreal origin() const;
54
55 qreal value() const;
56 qreal valueAsRatio() const; // [0.0, 1.0]
57 using QskBoundedControl::valueAsRatio;
58
59 public Q_SLOTS:
60 void setValue( qreal );
61 void setValueAsRatio( qreal );
62 void setOrigin( qreal );
63
64 Q_SIGNALS:
65 void extentChanged( qreal );
66 void indeterminateChanged( bool );
67 void valueChanged( qreal );
68 void originChanged( qreal );
69
70 protected:
71 void componentComplete() override;
72 void itemChange( ItemChange, const ItemChangeData& ) override;
73
74 private:
75 void setValueInternal( qreal value );
76 void adjustBoundaries( bool increasing );
77 void adjustValue();
78
79 class PrivateData;
80 std::unique_ptr< PrivateData > m_data;
81};
82
83#endif
void itemChange(ItemChange, const ItemChangeData &) override