コード例 #1
0
ファイル: fademanager.cpp プロジェクト: Iownnoname/qt
void FadeManager::addTarget(QWidget *target, int msecs)
{
    QGraphicsOpacityEffect *effectContainer;
    effectContainer = new QGraphicsOpacityEffect(this);
    QPropertyAnimation *anim;
    anim = new QPropertyAnimation(effectContainer, "opacity", this);
    target->setGraphicsEffect(effectContainer);
    anim->setDuration(msecs);
    setMode(anim, FadeIn, effectContainer);
    anim->setObjectName(target->objectName()); //To find them later on by set or delete
    a_parallelAnimations.addAnimation(anim);
}
コード例 #2
0
ファイル: fademanager.cpp プロジェクト: Iownnoname/qt
void FadeManager::addTarget(QWidget *target, FadeManager::FadeMode mode,
                                int msecs, FadeManager::AnimationSequenceType sequence)
{
    QGraphicsOpacityEffect *effectContainer;
    effectContainer = new QGraphicsOpacityEffect(this);
    QPropertyAnimation *anim;
    anim = new QPropertyAnimation(effectContainer, "opacity", this);
    target->setGraphicsEffect(effectContainer);
    anim->setDuration(msecs);
    setMode(anim, mode, effectContainer);

    anim->setObjectName(target->objectName()); //To find them later on by set or delete
    if(sequence == Parallel)
        a_parallelAnimations.addAnimation(anim);
    else
        a_sequentialAnimations.addAnimation(anim);
}