From ff2a71e310b18a43a41daf2d197f5715f7c26d29 Mon Sep 17 00:00:00 2001 From: Venugopal Shivashankar Date: Tue, 24 Jul 2018 15:29:16 +0200 Subject: Doc: Move the literal code blocks to a separate file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's easier to override the code blocks this way. Change-Id: I98d40626a94fdb70a95c50332c2da141e9277070 Reviewed-by: Friedemann Kleint Reviewed-by: Topi Reiniƶ --- .../snippets/code/src_corelib_tools_qeasingcurve.cpp | 15 +++++++++++++-- src/corelib/tools/qeasingcurve.cpp | 17 ++++------------- 2 files changed, 17 insertions(+), 15 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/doc/snippets/code/src_corelib_tools_qeasingcurve.cpp b/src/corelib/doc/snippets/code/src_corelib_tools_qeasingcurve.cpp index 0485bd290a..97453e2b06 100644 --- a/src/corelib/doc/snippets/code/src_corelib_tools_qeasingcurve.cpp +++ b/src/corelib/doc/snippets/code/src_corelib_tools_qeasingcurve.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2018 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the documentation of the Qt Toolkit. @@ -49,6 +49,17 @@ ****************************************************************************/ //! [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] +//! [1] + QPropertyAnimation animation; + animation.setStartValue(0); + animation.setEndValue(1000); + animation.setDuration(1000); + animation.setEasingCurve(QEasingCurve::InOutQuad); +//! [1] diff --git a/src/corelib/tools/qeasingcurve.cpp b/src/corelib/tools/qeasingcurve.cpp index e66db58ed7..235ca625c1 100644 --- a/src/corelib/tools/qeasingcurve.cpp +++ b/src/corelib/tools/qeasingcurve.cpp @@ -72,24 +72,15 @@ curve is a linear curve. This is the default behaviour. For example, - \code - QEasingCurve easing(QEasingCurve::InOutQuad); - for(qreal t = 0.0; t < 1.0; t+=0.1) - qWarning() << "Effective progress" << t << " is - << easing.valueForProgress(t); - \endcode + \snippet code/src_corelib_tools_qeasingcurve.cpp 0 + 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 progress of the interpolation between startValue and endValue: - \code - QPropertyAnimation animation; - animation.setStartValue(0); - animation.setEndValue(1000); - animation.setDuration(1000); - animation.setEasingCurve(QEasingCurve::InOutQuad); - \endcode + + \snippet code/src_corelib_tools_qeasingcurve.cpp 1 The ability to set an amplitude, overshoot, or period depends on the QEasingCurve type. Amplitude access is available to curves -- cgit v1.2.3 From 689a1e186b76853144802d9c29f0346856bd5fde Mon Sep 17 00:00:00 2001 From: Andre Hartmann Date: Wed, 5 Sep 2018 20:52:17 +0200 Subject: QString: Fix snippet explaining "non-spaced numbered place markers" The snippet tries to explain the advantage of str.arg("Hello", QString::number(20), QString::number(50)); over str.arg("Hello").arg(20).arg(50); which only makes sense, if str contains the same formating sequence, namely "%1%3%2". That also matches the belonging comment. Amends 8481500f639e3d5e2259db57847a2e7068e30650 Task-number: QTBUG-44044 Change-Id: Ic2595107bc599c6d244ebf88184a5cc5569ed4f1 Reviewed-by: Samuel Gaist Reviewed-by: Thiago Macieira --- src/corelib/doc/snippets/qstring/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib') diff --git a/src/corelib/doc/snippets/qstring/main.cpp b/src/corelib/doc/snippets/qstring/main.cpp index b936f0c057..c8842eec00 100644 --- a/src/corelib/doc/snippets/qstring/main.cpp +++ b/src/corelib/doc/snippets/qstring/main.cpp @@ -291,7 +291,7 @@ void Widget::argFunction() //! [97] //! [98] - str = "%1%2%3"; + str = "%1%3%2"; str.arg("Hello", QString::number(20), QString::number(50)); // returns "Hello5020" //! [98] -- cgit v1.2.3