using positionHint methods
This commit is contained in:
parent
22bee7e62e
commit
f45be55e90
@ -151,10 +151,10 @@ class MySkinEditor : public QskSkinHintTableEditor
|
||||
|
||||
for( auto state : { A::NoState, Q::Disabled } )
|
||||
{
|
||||
const auto aspect = Q::Cursor | state | A::Position;
|
||||
const auto aspect = Q::Cursor | state;
|
||||
|
||||
setMetric( aspect, 0 );
|
||||
setMetric( aspect | Q::Checked, 1 );
|
||||
setPosition( aspect, 0 );
|
||||
setPosition( aspect | Q::Checked, 1 );
|
||||
}
|
||||
|
||||
setAnimation( Q::Cursor | A::Metric, animator() );
|
||||
|
@ -65,7 +65,7 @@ QRectF MyToggleButtonSkinlet::subControlRect( const QskSkinnable* skinnable,
|
||||
}
|
||||
else if( subControl == Q::Cursor )
|
||||
{
|
||||
auto position = skinnable->metric( Q::Cursor | QskAspect::Position );
|
||||
auto position = skinnable->positionHint( Q::Cursor );
|
||||
if ( button->isInverted() )
|
||||
position = 1.0 - position;
|
||||
|
||||
|
@ -552,10 +552,10 @@ void Editor::setupSwitchButton()
|
||||
|
||||
for( auto state : { A::NoState, Q::Disabled } )
|
||||
{
|
||||
auto aspect = Q::Handle | state | A::Position;
|
||||
auto aspect = Q::Handle | state;
|
||||
|
||||
setMetric( aspect, 0 );
|
||||
setMetric( aspect | Q::Checked, 1 );
|
||||
setPosition( aspect, 0 );
|
||||
setPosition( aspect | Q::Checked, 1 );
|
||||
}
|
||||
|
||||
setAnimation( Q::Handle | A::Color, qskDuration );
|
||||
|
@ -330,8 +330,8 @@ void Editor::setupMenu()
|
||||
setColor( Q::Text, QColor( 255, 255, 255 ) );
|
||||
setFontRole( Q::Text, QskSkin::SmallFont );
|
||||
|
||||
setMetric( Q::Panel | A::Position, 0 );
|
||||
setMetric( Q::Panel | A::Position | QskPopup::Closed, 1 );
|
||||
setPosition( Q::Panel, 0 );
|
||||
setPosition( Q::Panel | QskPopup::Closed, 1 );
|
||||
|
||||
setAnimation( Q::Panel | A::Metric, 150 );
|
||||
setAnimation( Q::Cursor | A::Metric, 50, QEasingCurve::OutCubic );
|
||||
@ -924,10 +924,10 @@ void Editor::setupSwitchButton()
|
||||
|
||||
for( auto state : { A::NoState, Q::Disabled } )
|
||||
{
|
||||
auto aspect = Q::Handle | state | A::Position;
|
||||
auto aspect = Q::Handle | state;
|
||||
|
||||
setMetric( aspect, 0 );
|
||||
setMetric( aspect | Q::Checked, 1 );
|
||||
setPosition( aspect, 0 );
|
||||
setPosition( aspect | Q::Checked, 1 );
|
||||
}
|
||||
|
||||
setAnimation( Q::Handle | A::Metric, qskDuration );
|
||||
|
@ -30,10 +30,8 @@ namespace
|
||||
|
||||
void advance( qreal value ) override
|
||||
{
|
||||
const auto aspect = QskProgressBar::Bar | QskAspect::Position;
|
||||
|
||||
m_progressBar->setMetric( aspect, value );
|
||||
m_progressBar->update();
|
||||
if ( m_progressBar->setPositionHint( QskProgressBar::Bar, value ) )
|
||||
m_progressBar->update();
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -17,7 +17,7 @@ static inline QskIntervalF qskBarInterval( const QskProgressBar* bar )
|
||||
|
||||
if ( bar->isIndeterminate() )
|
||||
{
|
||||
const auto pos = bar->metric( QskProgressBar::Bar | QskAspect::Position );
|
||||
const auto pos = bar->positionHint( QskProgressBar::Bar );
|
||||
|
||||
static const QEasingCurve curve( QEasingCurve::InOutCubic );
|
||||
|
||||
|
@ -107,7 +107,7 @@ bool QskSlider::isTracking() const
|
||||
|
||||
void QskSlider::aboutToShow()
|
||||
{
|
||||
setMetric( Handle | QskAspect::Position, valueAsRatio() );
|
||||
setPositionHint( Handle, valueAsRatio() );
|
||||
Inherited::aboutToShow();
|
||||
}
|
||||
|
||||
@ -221,7 +221,7 @@ void QskSlider::mouseReleaseEvent( QMouseEvent* event )
|
||||
|
||||
qreal QskSlider::handlePosition() const
|
||||
{
|
||||
return metric( Handle | QskAspect::Position );
|
||||
return positionHint( Handle );
|
||||
}
|
||||
|
||||
void QskSlider::moveHandle()
|
||||
@ -235,20 +235,19 @@ void QskSlider::moveHandleTo( qreal value, const QskAnimationHint& hint )
|
||||
setSkinStateFlag( QskSlider::Minimum, value <= minimum() );
|
||||
setSkinStateFlag( QskSlider::Maximum, value >= maximum() );
|
||||
|
||||
const auto aspect = Handle | QskAspect::Metric | QskAspect::Position;
|
||||
|
||||
const qreal pos = valueAsRatio( value );
|
||||
|
||||
if ( hint.duration > 0 )
|
||||
if ( hint.isValid() )
|
||||
{
|
||||
const qreal oldPos = metric( aspect );
|
||||
setMetric( aspect, pos );
|
||||
const qreal oldPos = positionHint( Handle );
|
||||
setPositionHint( Handle, pos );
|
||||
|
||||
const auto aspect = Handle | QskAspect::Metric | QskAspect::Position;
|
||||
startTransition( aspect, hint, oldPos, pos );
|
||||
}
|
||||
else
|
||||
{
|
||||
setMetric( aspect, pos );
|
||||
setPositionHint( Handle, pos );
|
||||
}
|
||||
|
||||
update();
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
static inline qreal qskEffectivePosition( const QskSwitchButton* switchButton )
|
||||
{
|
||||
auto pos = switchButton->metric( QskSwitchButton::Handle | QskAspect::Position );
|
||||
auto pos = switchButton->positionHint( QskSwitchButton::Handle );
|
||||
pos = qBound( 0.0, pos, 1.0 );
|
||||
|
||||
if( switchButton->isInverted() )
|
||||
|
Loading…
x
Reference in New Issue
Block a user