本文整理汇总了C++中QPropertyAnimation::setDirection方法的典型用法代码示例。如果您正苦于以下问题:C++ QPropertyAnimation::setDirection方法的具体用法?C++ QPropertyAnimation::setDirection怎么用?C++ QPropertyAnimation::setDirection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QPropertyAnimation
的用法示例。
在下文中一共展示了QPropertyAnimation::setDirection方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: unbounce
void Widget::unbounce()
{
QPropertyAnimation* anim = qobject_cast<QPropertyAnimation*>(m_animation.animationAt(1));
if (!anim)
return;
disconnect(anim, SIGNAL(finished()), this, SLOT(unbounce()));
connect(anim, SIGNAL(finished()), this, SLOT(doneBounce()));
anim->setDirection(QAnimationGroup::Backward);
anim->setEasingCurve(QEasingCurve::InBounce);
anim->setDuration(m_settings.get("gui/bounce_duration").toInt() * 0.75f);
anim->start();
}
示例2: sizeHintChanged
void
Context::Applet::collapse( bool on )
{
qreal finalHeight = ( on ) ? m_heightCollapseOn : m_heightCollapseOff;
const qreal maxHeight = containment()->size().height();
if( (finalHeight > maxHeight) || (finalHeight < 0) )
finalHeight = maxHeight;
prepareGeometryChange();
// warning: view() currently can return pointer to ToolbarView, not the ContextView
ContextView *v = ContextView::self(); // may return null
// Plasma::Applet::view() might return 0, if the widget is not yet constructed, etc.
// \sa https://bugs.kde.org/show_bug.cgi?id=258741. If view is not available
// yet, regardless of the animation setting the preferred size is set
// straight away.
if( !v || !AmarokConfig::animateAppletCollapse() )
{
setPreferredHeight( finalHeight );
emit sizeHintChanged( Qt::PreferredSize );
updateGeometry();
return;
}
if( finalHeight == size().height() )
return;
// debug() << pluginName() << (on ? "collapsing to" : "uncollapsing to") << finalHeight;
QPropertyAnimation *pan = m_animation.data();
if( !pan )
pan = new QPropertyAnimation( this, "preferredSize" );
if( pan->state() == QAbstractAnimation::Running )
pan->stop();
pan->setDuration( 600 );
pan->setEasingCurve( QEasingCurve::InQuad );
pan->setStartValue( size() );
pan->setEndValue( QSizeF(size().width(), finalHeight) );
connect( pan, SIGNAL(finished()), SLOT(collapseAnimationFinished()) );
m_animation = pan;
pan->setDirection( QAbstractAnimation::Forward );
v->addCollapseAnimation( pan );
}
示例3: reverseStart
void Widget::reverseStart()
{
//If last message, play hide animation.
if (m_messageQueue.size() <= 1) {
QPropertyAnimation* bounceAnim = qobject_cast<QPropertyAnimation*>(m_animation.animationAt(1));
if(bounceAnim) {
if(bounceAnim->state() == QAbstractAnimation::Running){
return;
}
}
if (!m_messageQueue.isEmpty()){
if(m_animation.animationAt(1)){
doneBounce();
}
m_messageQueue.pop_front();
}
unsigned int duration = m_settings.get("gui/out_animation_duration").toInt();
QPropertyAnimation* anim = qobject_cast<QPropertyAnimation*>(m_animation.animationAt(0));
if (!anim) {
return;
}
disconnect(anim, SIGNAL(valueChanged(QVariant)), this, m_activePositionSlot.c_str());
anim->setDirection(QAnimationGroup::Backward);
anim->setEasingCurve(QEasingCurve::Type(m_settings.get("gui/out_animation").toInt()));
anim->setDuration(duration);
anim->setCurrentTime(duration);
connect(anim, SIGNAL(valueChanged(QVariant)), this, m_activePositionSlot.c_str());
anim->start();
//m_shortcutGrabber.disableShortcuts();
} else {
autoNext();
}
}