minor changes
This commit is contained in:
parent
be53343375
commit
3763bd5bad
|
@ -6,11 +6,6 @@
|
||||||
#include "CircularProgressBarSkinlet.h"
|
#include "CircularProgressBarSkinlet.h"
|
||||||
#include "CircularProgressBar.h"
|
#include "CircularProgressBar.h"
|
||||||
|
|
||||||
#include <QskPaintedNode.h>
|
|
||||||
|
|
||||||
#include <QEasingCurve>
|
|
||||||
#include <QPainter>
|
|
||||||
|
|
||||||
CircularProgressBarSkinlet::CircularProgressBarSkinlet( QskSkin* skin )
|
CircularProgressBarSkinlet::CircularProgressBarSkinlet( QskSkin* skin )
|
||||||
: QskSkinlet( skin )
|
: QskSkinlet( skin )
|
||||||
{
|
{
|
||||||
|
@ -38,9 +33,11 @@ QSGNode* CircularProgressBarSkinlet::updateSubNode(
|
||||||
}
|
}
|
||||||
case BarRole:
|
case BarRole:
|
||||||
{
|
{
|
||||||
const qreal startAngle = 90.0;
|
|
||||||
const auto bar = static_cast< const CircularProgressBar* >( skinnable );
|
const auto bar = static_cast< const CircularProgressBar* >( skinnable );
|
||||||
|
|
||||||
|
const qreal startAngle = 90.0;
|
||||||
const qreal spanAngle = 360.0 * bar->valueAsRatio();
|
const qreal spanAngle = 360.0 * bar->valueAsRatio();
|
||||||
|
|
||||||
return updateArcNode( skinnable, node, startAngle, -spanAngle,
|
return updateArcNode( skinnable, node, startAngle, -spanAngle,
|
||||||
CircularProgressBar::Bar );
|
CircularProgressBar::Bar );
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,13 +20,17 @@ Cube::Cube( QQuickItem* parent )
|
||||||
|
|
||||||
void Cube::startAnimation( Qsk::Direction direction )
|
void Cube::startAnimation( Qsk::Direction direction )
|
||||||
{
|
{
|
||||||
auto animator = dynamic_cast< QskStackBoxAnimator4* >( this->animator() );
|
using Animator = QskStackBoxAnimator4;
|
||||||
|
|
||||||
|
auto animator = qobject_cast< Animator* >( this->animator() );
|
||||||
|
|
||||||
if ( animator == nullptr )
|
if ( animator == nullptr )
|
||||||
{
|
{
|
||||||
animator = new QskStackBoxAnimator4( this );
|
animator = new Animator( this );
|
||||||
animator->setEasingCurve( QEasingCurve::InOutQuad );
|
animator->setEasingCurve( QEasingCurve::InOutQuad );
|
||||||
animator->setDuration( 1000 );
|
animator->setDuration( 1000 );
|
||||||
|
|
||||||
|
setAnimator( animator );
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto orientation = ( direction == Qsk::LeftToRight || direction == Qsk::RightToLeft )
|
const auto orientation = ( direction == Qsk::LeftToRight || direction == Qsk::RightToLeft )
|
||||||
|
@ -36,20 +40,18 @@ void Cube::startAnimation( Qsk::Direction direction )
|
||||||
const bool inverted = ( direction == Qsk::LeftToRight || direction == Qsk::TopToBottom );
|
const bool inverted = ( direction == Qsk::LeftToRight || direction == Qsk::TopToBottom );
|
||||||
animator->setInverted( inverted );
|
animator->setInverted( inverted );
|
||||||
|
|
||||||
setAnimator( animator );
|
|
||||||
|
|
||||||
int newIndex;
|
int newIndex;
|
||||||
|
|
||||||
switch( direction )
|
switch( direction )
|
||||||
{
|
{
|
||||||
case Qsk::LeftToRight:
|
case Qsk::LeftToRight:
|
||||||
case Qsk::TopToBottom:
|
case Qsk::TopToBottom:
|
||||||
newIndex = currentIndex() + 1;
|
newIndex = currentIndex() + 1;
|
||||||
break;
|
break;
|
||||||
case Qsk::RightToLeft:
|
case Qsk::RightToLeft:
|
||||||
case Qsk::BottomToTop:
|
case Qsk::BottomToTop:
|
||||||
newIndex = currentIndex() - 1;
|
newIndex = currentIndex() - 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
newIndex %= itemCount();
|
newIndex %= itemCount();
|
||||||
|
@ -109,8 +111,7 @@ void MainItem::gestureEvent( QskGestureEvent* event )
|
||||||
direction = ( delta.y() < 0 ) ? Qsk::TopToBottom : Qsk::BottomToTop;
|
direction = ( delta.y() < 0 ) ? Qsk::TopToBottom : Qsk::BottomToTop;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ### uncomment once animations are working:
|
m_cube->startAnimation( direction );
|
||||||
// m_cube->startAnimation( direction );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue