本文整理汇总了C++中QSequentialAnimationGroup::addAnimation方法的典型用法代码示例。如果您正苦于以下问题:C++ QSequentialAnimationGroup::addAnimation方法的具体用法?C++ QSequentialAnimationGroup::addAnimation怎么用?C++ QSequentialAnimationGroup::addAnimation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSequentialAnimationGroup
的用法示例。
在下文中一共展示了QSequentialAnimationGroup::addAnimation方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: startingAnimation
void CMainWindow::startingAnimation()
{
setWindowFlags(Qt::Window | Qt::FramelessWindowHint); //FramelessWindowHint wymagane do przezroczystego t³a
setAttribute(Qt::WA_TranslucentBackground, true);
QRect screenRect = QApplication::desktop()->screenGeometry();
QSequentialAnimationGroup *group = new QSequentialAnimationGroup(this);
QPropertyAnimation* fadeIn = new QPropertyAnimation(this, "windowOpacity", this);
fadeIn->setDuration(2000);
fadeIn->setStartValue(0.0);
fadeIn->setEndValue(1.0);
group->addAnimation(fadeIn);
QParallelAnimationGroup *moveGroup = new QParallelAnimationGroup(this);
QPropertyAnimation* imageRight = new QPropertyAnimation(pandemicImage, "geometry", this);
imageRight->setStartValue(pandemicImage->geometry());
imageRight->setEndValue(pandemicImage->geometry().translated(screenRect.width() - pandemicImage->geometry().right(), 0));
imageRight->setDuration(1000);
imageRight->setEasingCurve(QEasingCurve::InOutCubic);
moveGroup->addAnimation(imageRight);
QPropertyAnimation* menuLeft = new QPropertyAnimation(menu, "geometry", this);
menuLeft->setStartValue(menu->geometry());
menuLeft->setEndValue(QRect(0,0, screenRect.width()-pandemicImage->width()+1, menu->height()));
menuLeft->setDuration(1000);
menuLeft->setEasingCurve(QEasingCurve::InOutCubic);
moveGroup->addAnimation(menuLeft);
group->addAnimation(moveGroup);
group->start();
connect(group, &QSequentialAnimationGroup::finished, [this]() {
content->setObjectName("body");
});
}
示例2: QGLSceneNode
Tank::Tank(QObject *parent)
: QGLSceneNode(parent)
, m_texture(0)
{
QSequentialAnimationGroup *seq = new QSequentialAnimationGroup(this);
QGraphicsScale3D *scale = new QGraphicsScale3D(this);
addTransform(scale);
QPropertyAnimation *anim = new QPropertyAnimation(scale, "scale");
anim->setDuration(10000);
anim->setStartValue(QVector3D(1.0f, 0.1f, 1.0f));
anim->setEndValue(QVector3D(1.0f, 1.2f, 1.0f));
anim->setEasingCurve(QEasingCurve(QEasingCurve::InOutQuad));
seq->addAnimation(anim);
seq->addPause(2000);
anim = new QPropertyAnimation(scale, "scale");
anim->setDuration(10000);
anim->setStartValue(QVector3D(1.0f, 1.2f, 1.0f));
anim->setEndValue(QVector3D(1.0f, 0.1f, 1.0f));
anim->setEasingCurve(QEasingCurve(QEasingCurve::InOutQuad));
seq->addAnimation(anim);
seq->setLoopCount(-1);
seq->start();
addNode(tankObject());
QGLMaterial *mat = qCreateFluid();
m_texture = mat->texture();
setMaterial(mat);
}
示例3: 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();
}
示例4: init
void MWidgetSlideAnimationPrivate::init()
{
Q_Q(MWidgetSlideAnimation);
direction = MWidgetSlideAnimation::In;
QSequentialAnimationGroup *delayedAnimation = new QSequentialAnimationGroup;
delay = new QPauseAnimation;
positionAnimation = new QPropertyAnimation;
positionAnimation->setPropertyName("pos");
delayedAnimation->addAnimation(delay);
delayedAnimation->addAnimation(positionAnimation);
q->addAnimation(delayedAnimation);
q->connect(delay, SIGNAL(finished()), SLOT(_q_onDelayFinished()));
}
示例5: 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);
}
示例6: 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);
}
}
示例7: setupItemAnimations
void DiscountPage::setupItemAnimations()
{
QState *smallState = new QState();
QState *bigState = new QState();
for (int i = 0; i < this->m_itemList.size(); i++) {
smallState->assignProperty(this->m_itemList[i],"scale", 0);
bigState->assignProperty(this->m_itemList[i],"scale",1);
}
QSequentialAnimationGroup *showItemGroup = new QSequentialAnimationGroup(this);
for (int i = 0; i < this->m_itemList.size(); i++) {
QPropertyAnimation *anim = new QPropertyAnimation(this->m_itemList[i], "scale", this);
anim->setDuration(300);
anim->setEasingCurve(QEasingCurve::OutBack);
showItemGroup->addAnimation(anim);
}
QSignalTransition *trans = smallState->addTransition(this, SIGNAL(start()), bigState);
trans->addAnimation(showItemGroup);
connect(showItemGroup,SIGNAL(finished()),this,SLOT(startSelect()));
trans = bigState->addTransition(this,SIGNAL(quitPage()),smallState);
connect(smallState,SIGNAL(entered()),this,SLOT(closeSelect()));
QStateMachine *states = new QStateMachine(this);
states->addState(smallState);
states->addState(bigState);
states->setInitialState(smallState);
states->start();
}
示例8: start
void Sprite::start(int loops)
{
if(loops<0)loops=0;
QMapIterator<QString, AnimationLine*> i(lines);
QParallelAnimationGroup *pgroup = new QParallelAnimationGroup;
while (i.hasNext()) {
i.next();
AnimationLine * line = i.value();
const QByteArray &name = i.key().toLocal8Bit();
QSequentialAnimationGroup *sgroup = new QSequentialAnimationGroup;
QMapIterator<int,qreal> j(line->frames);
while(j.hasNext())
{
j.next();
QPropertyAnimation *trans = new QPropertyAnimation(this,name);
trans->setStartValue(j.value());
trans->setEasingCurve(line->easings[j.key()]);
if(j.hasNext())
{
trans->setEndValue(j.peekNext().value());
trans->setDuration(j.peekNext().key()-j.key());
}
else
{
trans->setEndValue(j.value());
trans->setDuration(total_time - j.key());
}
sgroup->addAnimation(trans);
}
QPropertyAnimation *trans = new QPropertyAnimation(this,name);
trans->setEndValue(line->frames[0]);
trans->setDuration(resetTime);
sgroup->addAnimation(trans);
pgroup->addAnimation(sgroup);
}
if(--loops)connect(pgroup,SIGNAL(finished()),this,SLOT(start(int)));
else connect(pgroup,SIGNAL(finished()),this,SLOT(deleteLater()));
示例9: _q_FadeAway
void TFutureProgressPrivate::_q_FadeAway()
{
Q_Q(TFutureProgress);
FaderWidget->raise();
QSequentialAnimationGroup *Group = new QSequentialAnimationGroup(q);
QPropertyAnimation *Animation = new QPropertyAnimation(FaderWidget, "Opacity");
Animation->setDuration(600);
Animation->setEndValue(1.0);
Group->addAnimation(Animation);
Animation = new QPropertyAnimation(q, "maximumHeight");
Animation->setDuration(120);
Animation->setEasingCurve(QEasingCurve::InCurve);
Animation->setStartValue(q->sizeHint().height());
Animation->setEndValue(0.0);
Group->addAnimation(Animation);
Group->start(QAbstractAnimation::DeleteWhenStopped);
QObject::connect(Group, SIGNAL(finished()), q, SIGNAL(RemoveMe()));
}
示例10: doAnimation
void IndicatorItem::doAnimation() {
QSequentialAnimationGroup *group = new QSequentialAnimationGroup(this);
QPropertyAnimation *animation = new QPropertyAnimation(this, "finish");
animation->setEndValue(real_finish);
animation->setEasingCurve(QEasingCurve::OutCubic);
animation->setDuration(500);
QPropertyAnimation *pause = new QPropertyAnimation(this, "opacity");
pause->setEndValue(0);
pause->setEasingCurve(QEasingCurve::InQuart);
pause->setDuration(600);
group->addAnimation(animation);
group->addAnimation(pause);
group->start(QAbstractAnimation::DeleteWhenStopped);
connect(group, &QSequentialAnimationGroup::finished, this, &IndicatorItem::deleteLater);
}
示例11: startAlertAnimation
void ContactsViewDelegate::startAlertAnimation()
{
if (!m_alertAnimation)
{
QSequentialAnimationGroup *ag = new QSequentialAnimationGroup(this);
m_alertAnimation = ag;
QPropertyAnimation *aIn = new QPropertyAnimation(this, "alertOpacity");
aIn->setEndValue(qreal(1));
aIn->setEasingCurve(QEasingCurve::OutQuad);
aIn->setDuration(750);
QPropertyAnimation *aOut = new QPropertyAnimation(this, "alertOpacity");
aOut->setEndValue(qreal(0.2));
aOut->setEasingCurve(QEasingCurve::InQuad);
aOut->setDuration(750);
ag->addAnimation(aIn);
ag->addPause(150);
ag->addAnimation(aOut);
ag->setLoopCount(-1);
ag->start();
}
}
示例12: fadeAway
void FutureProgressPrivate::fadeAway()
{
m_isFading = true;
QGraphicsOpacityEffect *opacityEffect = new QGraphicsOpacityEffect;
opacityEffect->setOpacity(1.);
m_q->setGraphicsEffect(opacityEffect);
QSequentialAnimationGroup *group = new QSequentialAnimationGroup(this);
QPropertyAnimation *animation = new QPropertyAnimation(opacityEffect, "opacity");
animation->setDuration(StyleHelper::progressFadeAnimationDuration);
animation->setEndValue(0.);
group->addAnimation(animation);
animation = new QPropertyAnimation(m_q, "maximumHeight");
animation->setDuration(120);
animation->setEasingCurve(QEasingCurve::InCurve);
animation->setStartValue(m_q->sizeHint().height());
animation->setEndValue(0.0);
group->addAnimation(animation);
connect(group, &QAbstractAnimation::finished, m_q, &FutureProgress::removeMe);
group->start(QAbstractAnimation::DeleteWhenStopped);
emit m_q->fadeStarted();
}
示例13: LevelOrder
void AVLTree::LevelOrder()
{
QSequentialAnimationGroup *group = new QSequentialAnimationGroup;
QQueue<TreeNode*> q;
q.push_back(root);
while (!q.empty())
{
TreeNode *node = q.front();
q.pop_front();
if (node == NULL) continue;
group->addAnimation(node->getPopAnim());
q.push_back(node->Lson);
q.push_back(node->Rson);
}
group->start(QAbstractAnimation::DeleteWhenStopped);
}
示例14: Start
void GlanceShower::Start ()
{
if (!TabWidget_)
{
qWarning () << Q_FUNC_INFO
<< "no tab widget set";
return;
}
int count = TabWidget_->count ();
if (count < 2)
return;
QSequentialAnimationGroup *animGroup = new QSequentialAnimationGroup;
int sqr = std::sqrt ((double)count);
int rows = sqr;
int cols = sqr;
if (rows * cols < count)
++cols;
if (rows * cols < count)
++rows;
QRect screenGeom = QApplication::desktop ()->
screenGeometry (Core::Instance ().GetReallyMainWindow ());
int width = screenGeom.width ();
int height = screenGeom.height ();
int singleW = width / cols;
int singleH = height / rows;
int wW = singleW * 4 / 5;
int wH = singleH * 4 / 5;
qreal scaleFactor = 0;
QSize sSize;
int animLength = 500 / (sqr);
QProgressDialog pg;
pg.setMinimumDuration (1000);
pg.setRange (0, count);
for (int row = 0; row < rows; ++row)
for (int column = 0;
column < cols && column + row * cols < count;
++column)
{
int idx = column + row * cols;
pg.setValue (idx);
QWidget *w = TabWidget_->widget (idx);
if (!sSize.isValid ())
sSize = w->size () / 2;
if (sSize != w->size ())
w->resize (sSize * 2);
if (!scaleFactor)
scaleFactor = std::min (static_cast<qreal> (wW) / sSize.width (),
static_cast<qreal> (wH) / sSize.height ());
QPixmap pixmap (sSize * 2);
w->render (&pixmap);
pixmap = pixmap.scaled (sSize,
Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
{
QPainter p (&pixmap);
QPen pen (Qt::black);
pen.setWidth (2 / scaleFactor + 1);
p.setPen (pen);
p.drawRect (QRect (QPoint (0, 0), sSize));
}
GlanceItem *item = new GlanceItem (pixmap);
item->SetIndex (idx);
connect (item,
SIGNAL (clicked (int)),
this,
SLOT (handleClicked (int)));
Scene_->addItem (item);
item->setTransformOriginPoint (sSize.width () / 2, sSize.height () / 2);
item->setScale (scaleFactor);
item->SetIdealScale (scaleFactor);
item->setOpacity (0);
item->moveBy (column * singleW, row * singleH);
QParallelAnimationGroup *pair = new QParallelAnimationGroup;
QPropertyAnimation *posAnim = new QPropertyAnimation (item, "Pos");
posAnim->setDuration (animLength);
posAnim->setStartValue (QPointF (0, 0));
posAnim->setEndValue (QPointF (column * singleW, row * singleH));
posAnim->setEasingCurve (QEasingCurve::OutSine);
pair->addAnimation (posAnim);
QPropertyAnimation *opacityAnim = new QPropertyAnimation (item, "Opacity");
opacityAnim->setDuration (animLength);
opacityAnim->setStartValue (0.);
//.........这里部分代码省略.........
示例15: QGraphicsView
//! [0]
PadNavigator::PadNavigator(const QSize &size, QWidget *parent)
: QGraphicsView(parent)
{
//! [0]
//! [1]
// Splash item
SplashItem *splash = new SplashItem;
splash->setZValue(1);
//! [1]
//! [2]
// Pad item
FlippablePad *pad = new FlippablePad(size);
QGraphicsRotation *flipRotation = new QGraphicsRotation(pad);
QGraphicsRotation *xRotation = new QGraphicsRotation(pad);
QGraphicsRotation *yRotation = new QGraphicsRotation(pad);
flipRotation->setAxis(Qt::YAxis);
xRotation->setAxis(Qt::YAxis);
yRotation->setAxis(Qt::XAxis);
pad->setTransformations(QList<QGraphicsTransform *>()
<< flipRotation
<< xRotation << yRotation);
//! [2]
//! [3]
// Back (proxy widget) item
QGraphicsProxyWidget *backItem = new QGraphicsProxyWidget(pad);
QWidget *widget = new QWidget;
form.setupUi(widget);
form.hostName->setFocus();
backItem->setWidget(widget);
backItem->setVisible(false);
backItem->setFocus();
backItem->setCacheMode(QGraphicsItem::ItemCoordinateCache);
const QRectF r = backItem->rect();
backItem->setTransform(QTransform()
.rotate(180, Qt::YAxis)
.translate(-r.width()/2, -r.height()/2));
//! [3]
//! [4]
// Selection item
RoundRectItem *selectionItem = new RoundRectItem(QRectF(-60, -60, 120, 120), Qt::gray, pad);
selectionItem->setZValue(0.5);
//! [4]
//! [5]
// Splash animations
QPropertyAnimation *smoothSplashMove = new QPropertyAnimation(splash, "y");
QPropertyAnimation *smoothSplashOpacity = new QPropertyAnimation(splash, "opacity");
smoothSplashMove->setEasingCurve(QEasingCurve::InQuad);
smoothSplashMove->setDuration(250);
smoothSplashOpacity->setDuration(250);
//! [5]
//! [6]
// Selection animation
QPropertyAnimation *smoothXSelection = new QPropertyAnimation(selectionItem, "x");
QPropertyAnimation *smoothYSelection = new QPropertyAnimation(selectionItem, "y");
QPropertyAnimation *smoothXRotation = new QPropertyAnimation(xRotation, "angle");
QPropertyAnimation *smoothYRotation = new QPropertyAnimation(yRotation, "angle");
smoothXSelection->setDuration(125);
smoothYSelection->setDuration(125);
smoothXRotation->setDuration(125);
smoothYRotation->setDuration(125);
smoothXSelection->setEasingCurve(QEasingCurve::InOutQuad);
smoothYSelection->setEasingCurve(QEasingCurve::InOutQuad);
smoothXRotation->setEasingCurve(QEasingCurve::InOutQuad);
smoothYRotation->setEasingCurve(QEasingCurve::InOutQuad);
//! [6]
//! [7]
// Flip animation setup
QPropertyAnimation *smoothFlipRotation = new QPropertyAnimation(flipRotation, "angle");
QPropertyAnimation *smoothFlipScale = new QPropertyAnimation(pad, "scale");
QPropertyAnimation *smoothFlipXRotation = new QPropertyAnimation(xRotation, "angle");
QPropertyAnimation *smoothFlipYRotation = new QPropertyAnimation(yRotation, "angle");
QParallelAnimationGroup *flipAnimation = new QParallelAnimationGroup(this);
smoothFlipScale->setDuration(500);
smoothFlipRotation->setDuration(500);
smoothFlipXRotation->setDuration(500);
smoothFlipYRotation->setDuration(500);
smoothFlipScale->setEasingCurve(QEasingCurve::InOutQuad);
smoothFlipRotation->setEasingCurve(QEasingCurve::InOutQuad);
smoothFlipXRotation->setEasingCurve(QEasingCurve::InOutQuad);
smoothFlipYRotation->setEasingCurve(QEasingCurve::InOutQuad);
smoothFlipScale->setKeyValueAt(0, qvariant_cast<qreal>(1.0));
smoothFlipScale->setKeyValueAt(0.5, qvariant_cast<qreal>(0.7));
smoothFlipScale->setKeyValueAt(1, qvariant_cast<qreal>(1.0));
flipAnimation->addAnimation(smoothFlipRotation);
flipAnimation->addAnimation(smoothFlipScale);
flipAnimation->addAnimation(smoothFlipXRotation);
flipAnimation->addAnimation(smoothFlipYRotation);
//! [7]
//! [8]
// Flip animation delayed property assignment
QSequentialAnimationGroup *setVariablesSequence = new QSequentialAnimationGroup;
QPropertyAnimation *setFillAnimation = new QPropertyAnimation(pad, "fill");
//.........这里部分代码省略.........