本文整理汇总了C++中QEasingCurve::overshoot方法的典型用法代码示例。如果您正苦于以下问题:C++ QEasingCurve::overshoot方法的具体用法?C++ QEasingCurve::overshoot怎么用?C++ QEasingCurve::overshoot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QEasingCurve
的用法示例。
在下文中一共展示了QEasingCurve::overshoot方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: properties
// Test getting and setting easing properties via the metaobject system.
void tst_QEasingCurve::properties()
{
tst_QEasingProperties obj;
QEasingCurve inOutBack(QEasingCurve::InOutBack);
qreal overshoot = 1.5;
inOutBack.setOvershoot(overshoot);
qreal amplitude = inOutBack.amplitude();
qreal period = inOutBack.period();
obj.setEasing(inOutBack);
QEasingCurve easing = qVariantValue<QEasingCurve>(obj.property("easing"));
QCOMPARE(easing.type(), QEasingCurve::InOutBack);
QCOMPARE(easing.overshoot(), overshoot);
QCOMPARE(easing.amplitude(), amplitude);
QCOMPARE(easing.period(), period);
QEasingCurve linear(QEasingCurve::Linear);
overshoot = linear.overshoot();
amplitude = linear.amplitude();
period = linear.period();
obj.setProperty("easing",
qVariantFromValue(QEasingCurve(QEasingCurve::Linear)));
easing = qVariantValue<QEasingCurve>(obj.property("easing"));
QCOMPARE(easing.type(), QEasingCurve::Linear);
QCOMPARE(easing.overshoot(), overshoot);
QCOMPARE(easing.amplitude(), amplitude);
QCOMPARE(easing.period(), period);
}
示例2: 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);
}
示例3: pix
Window::Window(QWidget *parent)
: QWidget(parent),
m_iconSize(64, 64)
{
m_ui.setupUi(this);
QButtonGroup *buttonGroup = findChild<QButtonGroup *>(); // ### workaround for uic in 4.4
m_ui.easingCurvePicker->setIconSize(m_iconSize);
m_ui.easingCurvePicker->setMinimumHeight(m_iconSize.height() + 50);
buttonGroup->setId(m_ui.lineRadio, 0);
buttonGroup->setId(m_ui.circleRadio, 1);
QEasingCurve dummy;
m_ui.periodSpinBox->setValue(dummy.period());
m_ui.amplitudeSpinBox->setValue(dummy.amplitude());
m_ui.overshootSpinBox->setValue(dummy.overshoot());
connect(m_ui.easingCurvePicker, SIGNAL(currentRowChanged(int)), this, SLOT(curveChanged(int)));
connect(buttonGroup, SIGNAL(buttonClicked(int)), this, SLOT(pathChanged(int)));
connect(m_ui.periodSpinBox, SIGNAL(valueChanged(double)), this, SLOT(periodChanged(double)));
connect(m_ui.amplitudeSpinBox, SIGNAL(valueChanged(double)), this, SLOT(amplitudeChanged(double)));
connect(m_ui.overshootSpinBox, SIGNAL(valueChanged(double)), this, SLOT(overshootChanged(double)));
createCurveIcons();
QPixmap pix(QLatin1String(":/images/qt-logo.png"));
m_item = new PixmapItem(pix);
m_scene.addItem(m_item);
m_ui.graphicsView->setScene(&m_scene);
m_anim = new Animation(m_item, "pos");
m_anim->setEasingCurve(QEasingCurve::OutBounce);
m_ui.easingCurvePicker->setCurrentRow(int(QEasingCurve::OutBounce));
startAnimation();
}
示例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);
}
示例5: if
/*!
Compare this easing curve with \a other and returns true if they are
equal. It will also compare the properties of a curve.
*/
bool QEasingCurve::operator==(const QEasingCurve &other) const
{
bool res = d_ptr->func == other.d_ptr->func
&& d_ptr->type == other.d_ptr->type;
if (res) {
if (d_ptr->config && other.d_ptr->config) {
// catch the config content
res = d_ptr->config->operator==(*(other.d_ptr->config));
} else if (d_ptr->config || other.d_ptr->config) {
// one one has a config object, which could contain default values
res = qFuzzyCompare(amplitude(), other.amplitude()) &&
qFuzzyCompare(period(), other.period()) &&
qFuzzyCompare(overshoot(), other.overshoot());
}
}
return res;
}