QSkinny 0.8.0
C++/Qt UI toolkit
Loading...
Searching...
No Matches
QskBoundedControl.h
1/******************************************************************************
2 * QSkinny - Copyright (C) The authors
3 * SPDX-License-Identifier: BSD-3-Clause
4 *****************************************************************************/
5
6#ifndef QSK_BOUNDED_CONTROL_H
7#define QSK_BOUNDED_CONTROL_H
8
9#include "QskControl.h"
10
11class QskIntervalF;
12
13class QSK_EXPORT QskBoundedControl : public QskControl
14{
15 Q_OBJECT
16
17 Q_PROPERTY( qreal minimum READ minimum WRITE setMinimum NOTIFY minimumChanged )
18 Q_PROPERTY( qreal maximum READ maximum WRITE setMaximum NOTIFY maximumChanged )
19 Q_PROPERTY( QskIntervalF boundaries READ boundaries
20 WRITE setBoundaries NOTIFY boundariesChanged )
21
22 using Inherited = QskControl;
23
24 public:
25 ~QskBoundedControl() override;
26
27 qreal minimum() const;
28 qreal maximum() const;
29
30 qreal boundaryLength() const;
31
32 void setBoundaries( qreal min, qreal max );
33 QskIntervalF boundaries() const;
34
35 qreal boundedValue( qreal ) const;
36
37 qreal valueAsRatio( qreal ) const;
38 qreal valueFromRatio( qreal ) const;
39
40 public Q_SLOTS:
41 void setMinimum( qreal );
42 void setMaximum( qreal );
43 void setBoundaries( const QskIntervalF& );
44
45 Q_SIGNALS:
46 void minimumChanged( qreal );
47 void maximumChanged( qreal );
48 void boundariesChanged( const QskIntervalF& );
49
50 protected:
51 QskBoundedControl( QQuickItem* parent = nullptr );
52 QskBoundedControl( qreal min, qreal max, QQuickItem* parent = nullptr );
53
54 void componentComplete() override;
55
56 void adjustBoundaries( bool increasing );
57
58 private:
59 qreal m_minimum;
60 qreal m_maximum;
61};
62
63#endif
Base class of all controls.
Definition QskControl.h:23
void componentComplete() override
Definition QskItem.cpp:272