QSkinny 0.8.0
C++/Qt UI toolkit
Loading...
Searching...
No Matches
QskBoundedRangeInput.h
1/******************************************************************************
2 * QSkinny - Copyright (C) The authors
3 * SPDX-License-Identifier: BSD-3-Clause
4 *****************************************************************************/
5
6#ifndef QSK_BOUNDED_RANGE_INPUT_H
7#define QSK_BOUNDED_RANGE_INPUT_H
8
9#include "QskBoundedInput.h"
10#include "QskIntervalF.h"
11
12class QSK_EXPORT QskBoundedRangeInput : public QskBoundedInput
13{
14 Q_OBJECT
15
16 Q_PROPERTY( qreal lowerValue READ lowerValue
17 WRITE setLowerValue NOTIFY lowerValueChanged )
18
19 Q_PROPERTY( qreal upperValue READ upperValue
20 WRITE setUpperValue NOTIFY upperValueChanged )
21
22 Q_PROPERTY( QskIntervalF range READ range WRITE setRange
23 RESET resetRange NOTIFY rangeChanged )
24
26
27 public:
28 QskBoundedRangeInput( QQuickItem* parent = nullptr );
29 QskBoundedRangeInput( const QskIntervalF&, QQuickItem* parent = nullptr );
30 ~QskBoundedRangeInput() override;
31
32 void setRange( qreal lowerValue, qreal upperValue );
33 void resetRange();
34
35 QskIntervalF range() const;
36
37 qreal lowerValue() const;
38 qreal upperValue() const;
39
40 // [0.0, 1.0]
41 qreal lowerValueAsRatio() const;
42 qreal upperValueAsRatio() const;
43
44 public Q_SLOTS:
45 void setRange( const QskIntervalF& );
46
47 void setLowerValue( qreal );
48 void setUpperValue( qreal );
49
50 void setLowerValueAsRatio( qreal );
51 void setUpperValueAsRatio( qreal );
52
53 Q_SIGNALS:
54 void rangeChanged( const QskIntervalF& );
55 void lowerValueChanged( qreal );
56 void upperValueChanged( qreal );
57
58 protected:
59 virtual QskIntervalF fixupRange( const QskIntervalF& ) const;
60
61 void alignInput() override;
62
63 private:
64 void setRangeInternal( const QskIntervalF& );
65 void adjustValue();
66
67 QskIntervalF m_range;
68};
69
70#endif