6#include "QskProgressIndicator.h"
8#include "QskIntervalF.h"
9#include "QskFunctions.h"
10#include "QskAnimator.h"
22 : m_indicator( indicator )
24 setAutoRepeat(
true );
27 setWindow( indicator->window() );
30 void advance( qreal value )
override
33 m_indicator->update();
41class QskProgressIndicator::PrivateData
46 if ( !isIndeterminate )
54 if ( indicator->window() && indicator->isVisible() )
56 if ( animator ==
nullptr )
57 animator =
new PositionAnimator( indicator );
68 PositionAnimator* animator =
nullptr;
73 bool hasOrigin =
false;
74 bool isIndeterminate =
false;
79 , m_data( new PrivateData )
81 m_data->value = minimum();
83 connect(
this, &QskBoundedControl::boundariesChanged,
84 this, &QskProgressIndicator::adjustValue );
99 delete m_data->animator;
104 return m_data->isIndeterminate;
109 if ( on == m_data->isIndeterminate )
112 m_data->isIndeterminate = on;
113 m_data->updateIndeterminateAnimator(
this );
156 if ( isComponentComplete() )
159 if( !m_data->hasOrigin || !qskFuzzyCompare( m_data->origin,
origin ) )
161 m_data->hasOrigin =
true;
171 if ( m_data->hasOrigin )
173 m_data->hasOrigin =
false;
182 if ( m_data->hasOrigin )
184 return boundedValue( m_data->origin );
192 return m_data->hasOrigin;
197 if ( isComponentComplete() )
200 setValueInternal(
value );
205 return m_data->value;
210 ratio = qBound( 0.0, ratio, 1.0 );
211 setValue( minimum() + ratio * boundaryLength() );
221 Inherited::componentComplete();
225void QskProgressIndicator::adjustValue()
227 if ( isComponentComplete() )
228 setValueInternal( boundedValue( m_data->value ) );
231void QskProgressIndicator::setValueInternal( qreal value )
233 if ( !qskFuzzyCompare(
value, m_data->value ) )
235 m_data->value =
value;
243 const QQuickItem::ItemChangeData& value )
245 switch(
static_cast< int >( change ) )
247 case QQuickItem::ItemVisibleHasChanged:
248 case QQuickItem::ItemSceneChange:
250 m_data->updateIndeterminateAnimator(
this );
258#include "moc_QskProgressIndicator.cpp"
void itemChange(ItemChange, const ItemChangeData &) override
Base class for progress indicators.
void itemChange(ItemChange, const ItemChangeData &) override
void setFillGradient(const QskGradient &)
bool isIndeterminate() const
QskGradient fillGradient() const
static const QskAspect::Subcontrol Fill
void componentComplete() override
void extentChanged(qreal)
void setValueAsRatio(qreal)
void originChanged(qreal)
void indeterminateChanged(bool)
QskProgressIndicator(QQuickItem *parent=nullptr)
void setIndeterminate(bool on=true)
~QskProgressIndicator() override
static const QskAspect::Subcontrol Groove
bool resetColor(QskAspect)
Removes a color hint from the local table.
QskGradient gradientHint(QskAspect, QskSkinHintStatus *=nullptr) const
Retrieves a color hint as gradient.
bool setGradientHint(QskAspect, const QskGradient &)
Sets a gradient as color hint.
bool setMetric(QskAspect, qreal)
Sets a metric hint.
bool resetMetric(QskAspect)
Removes a metric hint from the local table.