using effectiveSubcontrol when setting the position of the handle
This commit is contained in:
parent
fef6e1cef1
commit
9d01f938f5
@ -50,8 +50,6 @@ QskSlider::QskSlider( Qt::Orientation orientation, QQuickItem* parent )
|
||||
else
|
||||
initSizePolicy( QskSizePolicy::Fixed, QskSizePolicy::Minimum );
|
||||
|
||||
setMetric( QskSlider::Handle | QskAspect::Position, valueAsRatio() );
|
||||
|
||||
connect( this, &QskSlider::boundariesChanged, [ this ]() { updatePosition(); } );
|
||||
connect( this, &QskSlider::valueChanged, [ this ]() { updatePosition(); } );
|
||||
}
|
||||
@ -105,6 +103,14 @@ bool QskSlider::isTracking() const
|
||||
return m_data->tracking;
|
||||
}
|
||||
|
||||
void QskSlider::aboutToShow()
|
||||
{
|
||||
const auto subControl = effectiveSubcontrol( QskSlider::Handle );
|
||||
setMetric( subControl | QskAspect::Position, valueAsRatio() );
|
||||
|
||||
Inherited::aboutToShow();
|
||||
}
|
||||
|
||||
QSizeF QskSlider::contentsSizeHint(
|
||||
Qt::SizeHint which, const QSizeF& ) const
|
||||
{
|
||||
@ -223,7 +229,7 @@ void QskSlider::updatePosition()
|
||||
setSkinStateFlag( QskSlider::Minimum, value() <= minimum() );
|
||||
setSkinStateFlag( QskSlider::Maximum, value() >= maximum() );
|
||||
|
||||
const Aspect aspect = QskSlider::Handle | Position | Metric;
|
||||
const auto aspect = effectiveSubcontrol( QskSlider::Handle ) | Position | Metric;
|
||||
|
||||
const auto hint = animation( aspect | skinState() );
|
||||
const qreal pos = valueAsRatio();
|
||||
|
@ -58,6 +58,8 @@ class QSK_EXPORT QskSlider : public QskBoundedValueInput
|
||||
QSizeF handleSize() const;
|
||||
QRectF handleRect() const;
|
||||
|
||||
void aboutToShow() override;
|
||||
|
||||
private:
|
||||
void updatePosition();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user