本文整理汇总了C++中QPropertyAnimation::setDuration方法的典型用法代码示例。如果您正苦于以下问题:C++ QPropertyAnimation::setDuration方法的具体用法?C++ QPropertyAnimation::setDuration怎么用?C++ QPropertyAnimation::setDuration使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QPropertyAnimation
的用法示例。
在下文中一共展示了QPropertyAnimation::setDuration方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: goBack
void CardItem::goBack(bool kieru){
if(home_pos == pos()){
if(kieru)
setOpacity(0.0);
return;
}
QPropertyAnimation *goback = new QPropertyAnimation(this, "pos");
goback->setEndValue(home_pos);
goback->setEasingCurve(QEasingCurve::OutQuart);
goback->setDuration(300);
if(kieru){
QParallelAnimationGroup *group = new QParallelAnimationGroup;
QPropertyAnimation *disappear = new QPropertyAnimation(this, "opacity");
disappear->setStartValue(0.0);
disappear->setKeyValueAt(0.2, 1.0);
disappear->setKeyValueAt(0.8, 1.0);
disappear->setEndValue(0.0);
goback->setDuration(1000);
disappear->setDuration(1000);
group->addAnimation(goback);
group->addAnimation(disappear);
// prevent the cover face bug
setEnabled(false);
group->start(QParallelAnimationGroup::DeleteWhenStopped);
}else
goback->start(QPropertyAnimation::DeleteWhenStopped);
}
示例2: animateNextEpisode
void UnseenEpisodeWidget::animateNextEpisode()
{
_currentWidget->setEnabled(false);
_nextWidget = _makeWidget();
if (_nextWidget) {
layout()->addWidget(_nextWidget);
_currentWidget->setMinimumWidth(_currentWidget->width());
_nextWidget->setMinimumWidth(_currentWidget->width());
QPoint finalPos = _currentWidget->pos();
int duration = 600;
QPropertyAnimation *slideOut = new QPropertyAnimation(_currentWidget, "pos", this);
slideOut->setDuration(duration);
slideOut->setStartValue(finalPos);
slideOut->setEndValue(QPoint(finalPos.x() - _currentWidget->width(), finalPos.y()));
slideOut->setEasingCurve(QEasingCurve::OutQuart);
QPropertyAnimation *slideIn = new QPropertyAnimation(_nextWidget, "pos", this);
slideIn->setDuration(duration);
slideIn->setStartValue(QPoint(finalPos.x() + _currentWidget->width(), finalPos.y()));
slideIn->setEndValue(finalPos);
slideIn->setEasingCurve(QEasingCurve::OutQuart);
QParallelAnimationGroup *group = new QParallelAnimationGroup(_currentWidget);
group->addAnimation(slideOut);
group->addAnimation(slideIn);
group->start(QAbstractAnimation::DeleteWhenStopped);
group->connect(group, SIGNAL(finished()), this, SLOT(setupNewCurrent()));
}
}
示例3: appear
void LinkSelectionItem::appear(const QPointF& animStartPos, const QRectF& linkRect)
{
QGraphicsBlurEffect* blur = new QGraphicsBlurEffect();
blur->setBlurHints(QGraphicsBlurEffect::PerformanceHint);
blur->setBlurRadius(15);
setGraphicsEffect(blur);
QPropertyAnimation* rectAnimation = new QPropertyAnimation(this, "rect");
rectAnimation->setDuration(s_appearAnimDuration);
rectAnimation->setStartValue(QRectF(animStartPos, QSize(3, 3)));
rectAnimation->setEndValue(linkRect);
rectAnimation->setEasingCurve(QEasingCurve::OutExpo);
QPropertyAnimation* opacityAnimation = new QPropertyAnimation(this, "opacity");
opacityAnimation->setDuration(s_disappearAnimDuration);
opacityAnimation->setStartValue(s_linkOpacity);
opacityAnimation->setEndValue(0.0);
opacityAnimation->setEasingCurve(QEasingCurve::InExpo);
m_linkSelectiogroup.addAnimation(rectAnimation);
m_linkSelectiogroup.addAnimation(opacityAnimation);
m_linkSelectiogroup.start();
}
示例4: setEmotion
void Photo::setEmotion(const QString &emotion, bool permanent) {
if (emotion == ".") {
hideEmotion();
return;
}
QString path = QString("image/system/emotion/%1.png").arg(emotion);
if (QFile::exists(path)) {
QPixmap pixmap = QPixmap(path);
emotion_item->setPixmap(pixmap);
emotion_item->setPos((G_PHOTO_LAYOUT.m_normalWidth - pixmap.width()) / 2,
(G_PHOTO_LAYOUT.m_normalHeight - pixmap.height()) / 2);
_layBetween(emotion_item, _m_chainIcon, _m_roleComboBox);
QPropertyAnimation *appear = new QPropertyAnimation(emotion_item, "opacity");
appear->setStartValue(0.0);
if (permanent) {
appear->setEndValue(1.0);
appear->setDuration(500);
} else {
appear->setKeyValueAt(0.25, 1.0);
appear->setKeyValueAt(0.75, 1.0);
appear->setEndValue(0.0);
appear->setDuration(2000);
}
appear->start(QAbstractAnimation::DeleteWhenStopped);
} else {
PixmapAnimation::GetPixmapAnimation(this, emotion);
}
}
示例5: QPropertyAnimation
void
StatsGauge::setValue( int v )
{
if ( maximum() == 0 || v == 0 )
return;
if ( v == m_targetValue )
return;
m_targetValue = v;
{
QPropertyAnimation* a = new QPropertyAnimation( (QProgressBar*)this, "value" );
a->setEasingCurve( QEasingCurve( QEasingCurve::OutQuad ) );
a->setStartValue( value() > 0 ? value() : 1 );
a->setEndValue( v );
a->setDuration( 2000 );
connect( a, SIGNAL( finished() ), a, SLOT( deleteLater() ) );
a->start();
}
{
QPropertyAnimation* a = new QPropertyAnimation( (QProgressBar*)this, "percentage" );
a->setEasingCurve( QEasingCurve( QEasingCurve::OutQuad ) );
a->setStartValue( (float)0 );
a->setEndValue( (float)v / (float)maximum() );
a->setDuration( 2000 );
connect( a, SIGNAL( finished() ), a, SLOT( deleteLater() ) );
a->start();
}
}
示例6: setPrepareAddedToWindowManager
void DockModeWindow::setPrepareAddedToWindowManager() {
m_prepareAddedToWm = true;
if (G_LIKELY(s_dockGlow == 0)) {
QString path(Settings::LunaSettings()->lunaSystemResourcesPath.c_str());
path.append("/dockmode/dock-loading-glow.png");
s_dockGlow = new QPixmap(path);
if(s_dockGlow)
s_dockGlowRefCount++;
if (!s_dockGlow || s_dockGlow->isNull()) {
g_critical("%s: Failed to load image '%s'", __PRETTY_FUNCTION__, qPrintable(path));
}
} else {
s_dockGlowRefCount++;
}
ApplicationDescription* appDesc = static_cast<Window*>(this)->appDescription();
int size = Settings::LunaSettings()->splashIconSize;
m_icon.load(appDesc->splashIconName().c_str());
if (!m_icon.isNull()) {
// scale splash icon to fit the devices screen dimensions
m_icon = m_icon.scaled(size, size, Qt::KeepAspectRatio, Qt::SmoothTransformation);
}
else {
// just use the launcher icon
m_icon = appDesc->getDefaultLaunchPoint()->icon();
int newWidth = qMin((int)(m_icon.width()*1.5), size);
int newHeight = qMin((int)(m_icon.height()*1.5), size);
m_icon = m_icon.scaled(newWidth, newHeight, Qt::KeepAspectRatio, Qt::SmoothTransformation);
}
// set up the pulsing animation
QPropertyAnimation* pulseIn = new QPropertyAnimation(this, "pulseOpacity");
pulseIn->setDuration(AS(cardLoadingPulseDuration));
pulseIn->setEasingCurve(AS_CURVE(cardLoadingPulseCurve));
pulseIn->setEndValue(1.0);
QPropertyAnimation* pulseOut = new QPropertyAnimation(this, "pulseOpacity");
pulseOut->setDuration(AS(cardLoadingPulseDuration));
pulseOut->setEasingCurve(AS_CURVE(cardLoadingPulseCurve));
pulseOut->setEndValue(0.0);
QSequentialAnimationGroup* pulseGroup = new QSequentialAnimationGroup;
pulseGroup->addAnimation(pulseIn);
pulseGroup->addAnimation(pulseOut);
pulseGroup->setLoopCount(-1);
m_pulseAnimation.addPause(AS(cardLoadingTimeBeforeShowingPulsing));
m_pulseAnimation.addAnimation(pulseGroup);
m_loadingOverlayEnabled = true;
m_pulseAnimation.start();
update();
}
示例7: init
/*!
* \internal
*/
void QtMaterialRaisedButtonPrivate::init()
{
Q_Q(QtMaterialRaisedButton);
shadowStateMachine = new QStateMachine(q);
normalState = new QState;
pressedState = new QState;
effect = new QGraphicsDropShadowEffect;
effect->setBlurRadius(7);
effect->setOffset(QPointF(0, 2));
effect->setColor(QColor(0, 0, 0, 75));
q->setBackgroundMode(Qt::OpaqueMode);
q->setMinimumHeight(42);
q->setGraphicsEffect(effect);
q->setBaseOpacity(0.3);
shadowStateMachine->addState(normalState);
shadowStateMachine->addState(pressedState);
normalState->assignProperty(effect, "offset", QPointF(0, 2));
normalState->assignProperty(effect, "blurRadius", 7);
pressedState->assignProperty(effect, "offset", QPointF(0, 5));
pressedState->assignProperty(effect, "blurRadius", 29);
QAbstractTransition *transition;
transition = new QEventTransition(q, QEvent::MouseButtonPress);
transition->setTargetState(pressedState);
normalState->addTransition(transition);
transition = new QEventTransition(q, QEvent::MouseButtonDblClick);
transition->setTargetState(pressedState);
normalState->addTransition(transition);
transition = new QEventTransition(q, QEvent::MouseButtonRelease);
transition->setTargetState(normalState);
pressedState->addTransition(transition);
QPropertyAnimation *animation;
animation = new QPropertyAnimation(effect, "offset", q);
animation->setDuration(100);
shadowStateMachine->addDefaultAnimation(animation);
animation = new QPropertyAnimation(effect, "blurRadius", q);
animation->setDuration(100);
shadowStateMachine->addDefaultAnimation(animation);
shadowStateMachine->setInitialState(normalState);
shadowStateMachine->start();
}
示例8: offset
void ShortLocater::on_ShortCalib_2_clicked()
{
m_objoffset=new offset(IDMMLib,this);
QPropertyAnimation *animation = new QPropertyAnimation(m_objoffset, "geometry");
animation->setDuration(10000);
animation->setStartValue(QRect(300, 200, 50, 50));
animation->setEndValue(QRect(300, 300, 240, 170));
animation->setEasingCurve(QEasingCurve::Linear);
animation->setDuration(1000);
animation->start();
m_objoffset->show();
}
示例9: animateShow
void IconButton::animateShow(bool visible) {
if (visible) {
QPropertyAnimation *animation = new QPropertyAnimation(this, "iconOpacity");
animation->setDuration(FADE_TIME);
animation->setEndValue(1.0);
animation->start(QAbstractAnimation::DeleteWhenStopped);
} else {
QPropertyAnimation *animation = new QPropertyAnimation(this, "iconOpacity");
animation->setDuration(FADE_TIME);
animation->setEndValue(0.0);
animation->start(QAbstractAnimation::DeleteWhenStopped);
}
}
示例10: goBack
QAbstractAnimation* CardItem::goBack(bool kieru,bool fadein,bool fadeout){
if(home_pos == pos()){
if(kieru && home_pos != QPointF(-6, 8))
setOpacity(0.0);
return NULL;
}
QPropertyAnimation *goback = new QPropertyAnimation(this, "pos");
goback->setEndValue(home_pos);
goback->setEasingCurve(QEasingCurve::OutQuad);
goback->setDuration(500);
if(kieru){
QParallelAnimationGroup *group = new QParallelAnimationGroup;
QPropertyAnimation *disappear = new QPropertyAnimation(this, "opacity");
if(fadein)disappear->setStartValue(0.0);
disappear->setEndValue(1.0);
if(fadeout)disappear->setEndValue(0.0);
disappear->setKeyValueAt(0.2, 1.0);
disappear->setKeyValueAt(0.8, 1.0);
qreal dx = home_pos.x()-pos().x();
qreal dy = home_pos.y()-pos().y();
int length = sqrt(dx*dx+dy*dy);
length = qBound(500/3,length,400);
goback->setDuration(length*3);
disappear->setDuration(length*3);
group->addAnimation(goback);
group->addAnimation(disappear);
// prevent the cover face bug
setEnabled(false);
group->start(QParallelAnimationGroup::DeleteWhenStopped);
return group;
}else
{
setOpacity(this->isEnabled() ? 1.0 : 0.7);
goback->start(QPropertyAnimation::DeleteWhenStopped);
return goback;
}
}
示例11: slideUsbSeclect
void DProgressFrame::slideUsbSeclect() {
if (m_Active) {
return;
}
else {
m_Active=true;
}
this->layout()->setEnabled(false);
m_TopShadow->show();
m_ProcessLabel->setPixmap(QPixmap(""));
emit changedUsbSeclet();
int offsetx=frameRect().width(); //inherited from mother
int offsety=frameRect().height();//inherited from mother
m_SecondWidget->setGeometry(0, 0, offsetx, offsety);
offsetx=0;
//offsety=offsety;
//re-position the next widget outside/aside of the display area
QPoint pnext=m_SecondWidget->pos();
QPoint pnow=m_FirstWidget->pos();
m_FirstWidget->move(pnow.x(), pnow.y()- offsety + 64+ 36);
m_SecondWidget->move(pnext.x(), pnext.y() + 64+ 36);
//make it visible/show
m_SecondWidget->show();
m_SecondWidget->raise();
m_TopShadow->raise();
//animate both, the now and next widget to the side, using movie framework
QPropertyAnimation *animnow = new QPropertyAnimation(m_FirstWidget, "pos");
animnow->setDuration(m_Speed);
animnow->setEasingCurve(QEasingCurve::OutBack);
animnow->setStartValue(QPoint(pnow.x(), pnow.y()));
animnow->setEndValue(QPoint(offsetx+pnow.x(), -offsety+pnow.y() + 64 + 36));
QPropertyAnimation *animnext = new QPropertyAnimation(m_SecondWidget, "pos");
animnext->setDuration(m_Speed);
animnext->setEasingCurve(QEasingCurve::OutBack);
animnext->setStartValue(QPoint(pnext.x(), offsety+pnext.y()));
animnext->setEndValue(QPoint(pnext.x(), pnext.y() + 64+ 36));
m_AnimGroup = new QParallelAnimationGroup;
m_AnimGroup->addAnimation(animnow);
m_AnimGroup->addAnimation(animnext);
connect(m_AnimGroup, SIGNAL(finished()),this,SLOT(slideUsbDone()));
m_Active=true;
m_AnimGroup->start();
}
示例12: spinTo
void Canvas::spinTo(float new_yaw, float new_pitch)
{
QPropertyAnimation* a = new QPropertyAnimation(this, "_yaw", this);
a->setDuration(100);
a->setStartValue(yaw);
a->setEndValue(new_yaw);
QPropertyAnimation* b = new QPropertyAnimation(this, "_pitch", this);
b->setDuration(100);
b->setStartValue(pitch);
b->setEndValue(new_pitch);
a->start(QPropertyAnimation::DeleteWhenStopped);
b->start(QPropertyAnimation::DeleteWhenStopped);
}
示例13: animationDeplacement
void Unite::animationDeplacement(vector<Case *> chemin ) {
this->setSelected(false);
float decalageX,decalageY;
Case* caseActu=chemin[0];
QSequentialAnimationGroup *group = new QSequentialAnimationGroup();
QSequentialAnimationGroup *animPm = new QSequentialAnimationGroup();
QParallelAnimationGroup *groupPara = new QParallelAnimationGroup();
QPointF OS = offset();
int anim;
int j=1;
for (unsigned int i=1;i<chemin.size(); i++) {
QPropertyAnimation *animation = new QPropertyAnimation(this, "offset");
animation->setDuration(200);
decalageX = (chemin[i]->getX()-caseActu->getX())*SIZE;
decalageY = (chemin[i]->getY()-caseActu->getY())*SIZE;
if (decalageX>0)
anim=30;
else if (decalageX<0)
anim=20;
else if (decalageY<0)
anim=10;
else if (decalageY>0)
anim=0;
QPropertyAnimation *animPix = new QPropertyAnimation(this, "pixmap");
animPix->setDuration(200);
animPix->setStartValue(anim);
animPix->setEndValue(anim+7);
animPm->addAnimation(animPix);
animation->setStartValue(OS);
OS=QPointF(OS.x()+decalageX,OS.y()+decalageY);
animation->setEndValue(OS);
group->addAnimation(animation);
j++;
caseActu=chemin[i];
}
groupPara->addAnimation(group);
groupPara->addAnimation(animPm);
groupPara->start();
this->setSelected(true);
}
示例14: rebuildChart
void QocViewWidget::rebuildChart()
{
QPushButton *pb = qobject_cast<QPushButton *>(sender());
// QParallelAnimationGroup *group = new QParallelAnimationGroup();
QSequentialAnimationGroup *group = new QSequentialAnimationGroup();
if (pb)
{
pb->setEnabled(false);
connect(group, SIGNAL(finished()), this, SLOT(animationFinished()));
connect(this, SIGNAL(animationEnded(bool)), pb, SLOT(setEnabled(bool)));
}
QList<QocAbstractChartItem *> items = m_chart->items(QocAbstractChart::ChartLayer);
foreach(QocAbstractChartItem *item, items)
{
QocAbstractValueItem *i = qobject_cast<QocAbstractValueItem *>(item);
if ( i )
{
QPropertyAnimation *anim = new QPropertyAnimation(i, "value", group);
anim->setStartValue(0);
anim->setEndValue(i->value());
anim->setDuration(2000/items.size());
group->addAnimation(anim);
// i->blockSignals(true);
i->setValue(0);
// i->blockSignals(false);
}
}
示例15: Show
void RocketStorageAuthDialog::Show()
{
if (isVisible())
return;
show();
setFocus(Qt::ActiveWindowFocusReason);
activateWindow();
setWindowOpacity(0.0);
QPropertyAnimation *showAnim = new QPropertyAnimation(this, "windowOpacity", this);
showAnim->setStartValue(0.0);
showAnim->setEndValue(1.0);
showAnim->setDuration(300);
showAnim->setEasingCurve(QEasingCurve(QEasingCurve::InOutQuad));
showAnim->start();
plugin_->Notifications()->CenterToMainWindow(this);
if (!plugin_->Notifications()->IsForegroundDimmed())
{
plugin_->Notifications()->DimForeground();
restoreForeground_ = true;
}
}