qskinny/src/controls/QskProgressBar.h

83 lines
2.4 KiB
C
Raw Normal View History

2020-07-31 16:57:22 +02:00
/******************************************************************************
* QSkinny - Copyright (C) 2016 Uwe Rathmann
* This file may be used under the terms of the QSkinny License, Version 1.0
*****************************************************************************/
2020-08-01 17:51:45 +02:00
#ifndef QSK_PROGRESS_BAR_H
#define QSK_PROGRESS_BAR_H
2020-07-31 16:57:22 +02:00
#include "QskBoundedControl.h"
class QskIntervalF;
2020-08-01 17:51:45 +02:00
class QSK_EXPORT QskProgressBar : public QskBoundedControl
2020-07-31 16:57:22 +02:00
{
Q_OBJECT
Q_PROPERTY( Qt::Orientation orientation READ orientation
WRITE setOrientation NOTIFY orientationChanged )
Q_PROPERTY( qreal origin READ origin
WRITE setOrigin RESET resetOrigin NOTIFY originChanged )
Q_PROPERTY( qreal value READ value WRITE setValue NOTIFY valueChanged )
Q_PROPERTY( qreal valueAsRatio READ valueAsRatio
WRITE setValueAsRatio NOTIFY valueChanged )
using Inherited = QskBoundedControl;
public:
2020-08-03 08:02:13 +02:00
QSK_SUBCONTROLS( Groove, Bar )
2020-07-31 16:57:22 +02:00
2020-08-01 17:51:45 +02:00
QskProgressBar( Qt::Orientation, QQuickItem* parent = nullptr );
QskProgressBar( Qt::Orientation, qreal min, qreal max, QQuickItem* parent = nullptr );
QskProgressBar( const QskIntervalF&, QQuickItem* parent = nullptr );
QskProgressBar( qreal min, qreal max, QQuickItem* parent = nullptr );
QskProgressBar( QQuickItem* parent = nullptr );
2020-07-31 16:57:22 +02:00
2020-08-01 17:51:45 +02:00
~QskProgressBar() override;
2020-07-31 16:57:22 +02:00
Qt::Orientation orientation() const;
void setOrientation( Qt::Orientation orientation );
QskAspect::Placement effectivePlacement() const override;
2020-08-03 08:02:13 +02:00
void setBarGradient( const QskGradient & );
void resetBarGradient();
QskGradient barGradient() const;
2020-07-31 16:57:22 +02:00
void setThickness( qreal );
qreal thickness() const;
void resetOrigin();
qreal origin() const;
qreal value() const;
qreal valueAsRatio() const; // [0.0, 1.0]
using QskBoundedControl::valueAsRatio;
public Q_SLOTS:
void setValue( qreal );
void setValueAsRatio( qreal );
void setOrigin( qreal );
Q_SIGNALS:
void orientationChanged( Qt::Orientation );
void valueChanged( qreal );
void originChanged( qreal );
protected:
QSizeF contentsSizeHint( Qt::SizeHint, const QSizeF& ) const override;
void componentComplete() override;
private:
void setValueInternal( qreal value );
void adjustBoundaries( bool increasing );
void adjustValue();
class PrivateData;
std::unique_ptr< PrivateData > m_data;
};
#endif