当前位置: 首页>>代码示例>>C++>>正文


C++ QEasingCurve::setCustomType方法代码示例

本文整理汇总了C++中QEasingCurve::setCustomType方法的典型用法代码示例。如果您正苦于以下问题:C++ QEasingCurve::setCustomType方法的具体用法?C++ QEasingCurve::setCustomType怎么用?C++ QEasingCurve::setCustomType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QEasingCurve的用法示例。


在下文中一共展示了QEasingCurve::setCustomType方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: operators

void tst_QEasingCurve::operators()
{
    // operator=
    QEasingCurve curve;
    QEasingCurve curve2;
    curve.setCustomType(&discreteEase);
    curve2 = curve;
    QCOMPARE(curve2.type(), QEasingCurve::Custom);
    QCOMPARE(curve2.valueForProgress(0.0), 0.0);
    QCOMPARE(curve2.valueForProgress(0.05), 0.0);
    QCOMPARE(curve2.valueForProgress(0.15), 0.1);
    QCOMPARE(curve2.valueForProgress(0.25), 0.2);
    QCOMPARE(curve2.valueForProgress(0.35), 0.3);
    QCOMPARE(curve2.valueForProgress(0.999999), 0.9);

    // operator==
    curve.setType(QEasingCurve::InBack);
    curve2 = curve;
    curve2.setOvershoot(qreal(1.70158f));
    QCOMPARE(curve.overshoot(), curve2.overshoot());
    QVERIFY(curve2 == curve);

    curve.setOvershoot(3.0);
    QVERIFY(curve2 != curve);
    curve2.setOvershoot(3.0);
    QVERIFY(curve2 == curve);

    curve2.setType(QEasingCurve::Linear);
    QCOMPARE(curve.overshoot(), curve2.overshoot());
    QVERIFY(curve2 != curve);
    curve2.setType(QEasingCurve::InBack);
    QCOMPARE(curve.overshoot(), curve2.overshoot());
    QVERIFY(curve2 == curve);
}
开发者ID:Akheon23,项目名称:chromecast-mirrored-source.vendor,代码行数:34,代码来源:tst_qeasingcurve.cpp

示例2: animateItemRectVisible

void QtViewportInteractionEngine::animateItemRectVisible(const QRectF& itemRect)
{
    ASSERT(m_scaleAnimation->state() == QAbstractAnimation::Stopped);

    ASSERT(!scrollAnimationActive());
    if (scrollAnimationActive())
        return;

    QRectF currentItemRectVisible = m_viewport->mapRectToWebContent(m_viewport->boundingRect());
    if (itemRect == currentItemRectVisible)
        return;

    // FIXME: Investigate why that animation doesn't run when we are unfocused.
    if (!m_viewport->isVisible() || !m_viewport->hasFocus()) {
        // Apply the end result immediately when we are non-visible.
        setItemRectVisible(itemRect);
        return;
    }

    QEasingCurve easingCurve;
    easingCurve.setCustomType(physicalOvershoot);

    m_scaleAnimation->setDuration(kScaleAnimationDurationMillis);
    m_scaleAnimation->setEasingCurve(easingCurve);

    m_scaleAnimation->setStartValue(currentItemRectVisible);
    m_scaleAnimation->setEndValue(itemRect);

    m_scaleAnimation->start();
}
开发者ID:Spencerx,项目名称:webkit,代码行数:30,代码来源:QtViewportInteractionEngine.cpp

示例3: sipAddException

static PyObject *meth_QEasingCurve_setCustomType(PyObject *sipSelf, PyObject *sipArgs)
{
    PyObject *sipParseErr = NULL;

    {
        PyObject * a0;
        QEasingCurve *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "BF", &sipSelf, sipType_QEasingCurve, &sipCpp, &a0))
        {
            sipErrorState sipError = sipErrorNone;

#line 232 "C:\\Users\\marcus\\Downloads\\PyQt-gpl-5.4\\PyQt-gpl-5.4\\sip/QtCore/qeasingcurve.sip"
        int i;
        ec_custom_type *ct;
        
        for (i = 0; i < ec_nr_custom_types; ++i)
        {
            ct = &ec_custom_types[i];
        
            if (!ct->py_func || ct->py_func == a0)
                break;
        }
        
        if (i == ec_nr_custom_types)
        {
            PyErr_Format(PyExc_ValueError, "a maximum of %d different easing functions are supported", ec_nr_custom_types);
            sipError = sipErrorFail;
        }
        else
        {
            if (!ct->py_func)
            {
                ct->py_func = a0;
                Py_INCREF(a0);
            }
        
            sipCpp->setCustomType(ct->func);
        }
#line 401 "C:\\Users\\marcus\\Downloads\\PyQt-gpl-5.4\\PyQt-gpl-5.4\\QtCore/sipQtCoreQEasingCurve.cpp"

            if (sipError == sipErrorFail)
                return 0;

            if (sipError == sipErrorNone)
            {
            Py_INCREF(Py_None);
            return Py_None;
            }

            sipAddException(sipError, &sipParseErr);
        }
    }

    /* Raise an exception if the arguments couldn't be parsed. */
    sipNoMethod(sipParseErr, sipName_QEasingCurve, sipName_setCustomType, doc_QEasingCurve_setCustomType);

    return NULL;
}
开发者ID:rff255,项目名称:python-qt5,代码行数:59,代码来源:sipQtCoreQEasingCurve.cpp

示例4: operators

void tst_QEasingCurve::operators()
{
    // operator=
    QEasingCurve curve;
    QEasingCurve curve2;
    curve.setCustomType(&discreteEase);
    curve2 = curve;
    QCOMPARE(curve2.type(), QEasingCurve::Custom);
    QCOMPARE(curve2.valueForProgress(0.0), 0.0);
    QCOMPARE(curve2.valueForProgress(0.05), 0.0);
    QCOMPARE(curve2.valueForProgress(0.15), 0.1);
    QCOMPARE(curve2.valueForProgress(0.25), 0.2);
    QCOMPARE(curve2.valueForProgress(0.35), 0.3);
    QCOMPARE(curve2.valueForProgress(0.999999), 0.9);

    // operator==
    curve.setType(QEasingCurve::InBack);
    curve2 = curve;
    curve2.setOvershoot(qreal(1.70158));
    QCOMPARE(curve.overshoot(), curve2.overshoot());
    QVERIFY(curve2 == curve);

    curve.setOvershoot(3.0);
    QVERIFY(curve2 != curve);
    curve2.setOvershoot(3.0);
    QVERIFY(curve2 == curve);

    curve2.setType(QEasingCurve::Linear);
    QCOMPARE(curve.overshoot(), curve2.overshoot());
    QVERIFY(curve2 != curve);
    curve2.setType(QEasingCurve::InBack);
    QCOMPARE(curve.overshoot(), curve2.overshoot());
    QVERIFY(curve2 == curve);

    QEasingCurve curve3;
    QEasingCurve curve4;
    curve4.setAmplitude(curve4.amplitude());
    QEasingCurve curve5;
    curve5.setAmplitude(0.12345);
    QVERIFY(curve3 == curve4); // default value and not assigned
    QVERIFY(curve3 != curve5); // unassinged and other value
    QVERIFY(curve4 != curve5);
}
开发者ID:mpvader,项目名称:qt,代码行数:43,代码来源:tst_qeasingcurve.cpp

示例5: spawnEnemies

void GameScene::spawnEnemies(GraphicsEnemyObject::EnemyType type, bool inverted)
{
    QEasingCurve curve;

    switch (type)
    {
    case GraphicsEnemyObject::EnemyType::White:
    case GraphicsEnemyObject::EnemyType::Green:
        curve.setType(static_cast<QEasingCurve::Type>(qrand() % 41));
        break;
    case GraphicsEnemyObject::EnemyType::Boss:
        curve.setCustomType(&CustomEasingCurve::simpleEasingCurve);
        break;
    }

    auto enemy = new GraphicsEnemyObject(type, curve, inverted);
    addItem(enemy);
    connect(enemy, &GraphicsEnemyObject::cannonTriggered, this,
        &GameScene::planeShot);
    connect(enemy, &GraphicsEnemyObject::exploded, this,
        &GameScene::planeExploded);
}
开发者ID:jsfdez,项目名称:1942,代码行数:22,代码来源:gamescene.cpp

示例6: setCustomType

void tst_QEasingCurve::setCustomType()
{
    QEasingCurve curve;
    curve.setCustomType(&discreteEase);
    QCOMPARE(curve.type(), QEasingCurve::Custom);
    QCOMPARE(curve.valueForProgress(0.0), 0.0);
    QCOMPARE(curve.valueForProgress(0.05), 0.0);
    QCOMPARE(curve.valueForProgress(0.10), 0.1);
    QCOMPARE(curve.valueForProgress(0.15), 0.1);
    QCOMPARE(curve.valueForProgress(0.20), 0.2);
    QCOMPARE(curve.valueForProgress(0.25), 0.2);
    QCOMPARE(curve.valueForProgress(0.30), 0.3);
    QCOMPARE(curve.valueForProgress(0.35), 0.3);
    QCOMPARE(curve.valueForProgress(0.999999), 0.9);

    curve.setType(QEasingCurve::Linear);
    QCOMPARE(curve.type(), QEasingCurve::Linear);
    QCOMPARE(curve.valueForProgress(0.0), 0.0);
    QCOMPARE(curve.valueForProgress(0.1), 0.1);
    QCOMPARE(curve.valueForProgress(0.5), 0.5);
    QCOMPARE(curve.valueForProgress(0.99), 0.99);
}
开发者ID:mpvader,项目名称:qt,代码行数:22,代码来源:tst_qeasingcurve.cpp


注:本文中的QEasingCurve::setCustomType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。