Doc: Move the literal code blocks to a separate file

It's easier to override the code blocks this way.

Change-Id: I98d40626a94fdb70a95c50332c2da141e9277070
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
This commit is contained in:
Venugopal Shivashankar 2018-07-24 15:29:16 +02:00
parent a381ba4220
commit ff2a71e310
2 changed files with 17 additions and 15 deletions

View File

@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/ ** Contact: https://www.qt.io/licensing/
** **
** This file is part of the documentation of the Qt Toolkit. ** This file is part of the documentation of the Qt Toolkit.
@ -49,6 +49,17 @@
****************************************************************************/ ****************************************************************************/
//! [0] //! [0]
qreal myEasingFunction(qreal progress); QEasingCurve easing(QEasingCurve::InOutQuad);
for (qreal t = 0.0; t < 1.0; t+=0.1)
qWarning() << "Effective progress" << t << " is
<< easing.valueForProgress(t);
//! [0] //! [0]
//! [1]
QPropertyAnimation animation;
animation.setStartValue(0);
animation.setEndValue(1000);
animation.setDuration(1000);
animation.setEasingCurve(QEasingCurve::InOutQuad);
//! [1]

View File

@ -72,24 +72,15 @@
curve is a linear curve. This is the default behaviour. curve is a linear curve. This is the default behaviour.
For example, For example,
\code
QEasingCurve easing(QEasingCurve::InOutQuad);
for(qreal t = 0.0; t < 1.0; t+=0.1) \snippet code/src_corelib_tools_qeasingcurve.cpp 0
qWarning() << "Effective progress" << t << " is
<< easing.valueForProgress(t);
\endcode
will print the effective progress of the interpolation between 0 and 1. will print the effective progress of the interpolation between 0 and 1.
When using a QPropertyAnimation, the associated easing curve will be used to control the When using a QPropertyAnimation, the associated easing curve will be used to control the
progress of the interpolation between startValue and endValue: progress of the interpolation between startValue and endValue:
\code
QPropertyAnimation animation; \snippet code/src_corelib_tools_qeasingcurve.cpp 1
animation.setStartValue(0);
animation.setEndValue(1000);
animation.setDuration(1000);
animation.setEasingCurve(QEasingCurve::InOutQuad);
\endcode
The ability to set an amplitude, overshoot, or period depends on The ability to set an amplitude, overshoot, or period depends on
the QEasingCurve type. Amplitude access is available to curves the QEasingCurve type. Amplitude access is available to curves