summaryrefslogtreecommitdiffstats
path: root/examples/animation/easing
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dietrich-de@nokia.com>2012-08-17 13:23:19 +0200
committerQt by Nokia <qt-info@nokia.com>2012-08-20 12:20:55 +0200
commit806dda08d685bc5f9ed71dfe8b61f21848d48066 (patch)
treea63533a1c4a335ae17adc105abb0ae4e62e2f26e /examples/animation/easing
parent9f942014e31842b512c3198de035d041c59f54a9 (diff)
Moving .qdoc files under examples/widgets/doc
Updated those .qdoc files to refer to the new relative examples emplacement. Images and snippets to be moved later. Also grouped all widgets related examples under widgets. Change-Id: Ib29696e2d8948524537f53e8dda88f9ee26a597f Reviewed-by: J-P Nurmi <j-p.nurmi@nokia.com>
Diffstat (limited to 'examples/animation/easing')
-rw-r--r--examples/animation/easing/animation.h100
-rw-r--r--examples/animation/easing/easing.desktop11
-rw-r--r--examples/animation/easing/easing.pro17
-rw-r--r--examples/animation/easing/easing.qrc5
-rw-r--r--examples/animation/easing/form.ui270
-rw-r--r--examples/animation/easing/images/qt-logo.pngbin5149 -> 0 bytes
-rw-r--r--examples/animation/easing/main.cpp54
-rw-r--r--examples/animation/easing/window.cpp177
-rw-r--r--examples/animation/easing/window.h76
9 files changed, 0 insertions, 710 deletions
diff --git a/examples/animation/easing/animation.h b/examples/animation/easing/animation.h
deleted file mode 100644
index 35cbed4555..0000000000
--- a/examples/animation/easing/animation.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef ANIMATION_H
-#define ANIMATION_H
-
-#include <QtWidgets>
-
-#include <QtCore/qpropertyanimation.h>
-
-class Animation : public QPropertyAnimation {
-public:
- enum PathType {
- LinearPath,
- CirclePath,
- NPathTypes
- };
- Animation(QObject *target, const QByteArray &prop)
- : QPropertyAnimation(target, prop)
- {
- setPathType(LinearPath);
- }
-
- void setPathType(PathType pathType)
- {
- if (pathType >= NPathTypes)
- qWarning("Unknown pathType %d", pathType);
-
- m_pathType = pathType;
- m_path = QPainterPath();
- }
-
- void updateCurrentTime(int currentTime)
- {
- if (m_pathType == CirclePath) {
- if (m_path.isEmpty()) {
- QPointF to = endValue().toPointF();
- QPointF from = startValue().toPointF();
- m_path.moveTo(from);
- m_path.addEllipse(QRectF(from, to));
- }
- int dura = duration();
- const qreal progress = ((dura == 0) ? 1 : ((((currentTime - 1) % dura) + 1) / qreal(dura)));
-
- qreal easedProgress = easingCurve().valueForProgress(progress);
- if (easedProgress > 1.0) {
- easedProgress -= 1.0;
- } else if (easedProgress < 0) {
- easedProgress += 1.0;
- }
- QPointF pt = m_path.pointAtPercent(easedProgress);
- updateCurrentValue(pt);
- emit valueChanged(pt);
- } else {
- QPropertyAnimation::updateCurrentTime(currentTime);
- }
- }
-
- QPainterPath m_path;
- PathType m_pathType;
-};
-
-#endif // ANIMATION_H
diff --git a/examples/animation/easing/easing.desktop b/examples/animation/easing/easing.desktop
deleted file mode 100644
index 56d122217a..0000000000
--- a/examples/animation/easing/easing.desktop
+++ /dev/null
@@ -1,11 +0,0 @@
-[Desktop Entry]
-Encoding=UTF-8
-Version=1.0
-Type=Application
-Terminal=false
-Name=Easing Curves
-Exec=/opt/usr/bin/easing
-Icon=easing
-X-Window-Icon=
-X-HildonDesk-ShowInToolbar=true
-X-Osso-Type=application/x-executable
diff --git a/examples/animation/easing/easing.pro b/examples/animation/easing/easing.pro
deleted file mode 100644
index 155d17d9b9..0000000000
--- a/examples/animation/easing/easing.pro
+++ /dev/null
@@ -1,17 +0,0 @@
-HEADERS = window.h \
- animation.h
-SOURCES = main.cpp \
- window.cpp
-
-FORMS = form.ui
-
-RESOURCES = easing.qrc
-
-# install
-target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/animation/easing
-sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS easing.pro images
-sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/animation/easing
-INSTALLS += target sources
-
-QT += widgets
-
diff --git a/examples/animation/easing/easing.qrc b/examples/animation/easing/easing.qrc
deleted file mode 100644
index 7e112d3a9d..0000000000
--- a/examples/animation/easing/easing.qrc
+++ /dev/null
@@ -1,5 +0,0 @@
-<!DOCTYPE RCC><RCC version="1.0">
- <qresource>
- <file>images/qt-logo.png</file>
- </qresource>
- </RCC> \ No newline at end of file
diff --git a/examples/animation/easing/form.ui b/examples/animation/easing/form.ui
deleted file mode 100644
index 364aebeda6..0000000000
--- a/examples/animation/easing/form.ui
+++ /dev/null
@@ -1,270 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>Form</class>
- <widget class="QWidget" name="Form">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>545</width>
- <height>471</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Easing curves</string>
- </property>
- <layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0" colspan="2">
- <widget class="QListWidget" name="easingCurvePicker">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>120</height>
- </size>
- </property>
- <property name="verticalScrollBarPolicy">
- <enum>Qt::ScrollBarAlwaysOff</enum>
- </property>
- <property name="movement">
- <enum>QListView::Static</enum>
- </property>
- <property name="isWrapping" stdset="0">
- <bool>false</bool>
- </property>
- <property name="viewMode">
- <enum>QListView::IconMode</enum>
- </property>
- <property name="selectionRectVisible">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QGroupBox" name="groupBox_2">
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="title">
- <string>Path type</string>
- </property>
- <layout class="QGridLayout" name="gridLayout_2">
- <item row="0" column="0">
- <widget class="QRadioButton" name="lineRadio">
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>40</height>
- </size>
- </property>
- <property name="layoutDirection">
- <enum>Qt::LeftToRight</enum>
- </property>
- <property name="text">
- <string>Line</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- <attribute name="buttonGroup">
- <string>buttonGroup</string>
- </attribute>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QRadioButton" name="circleRadio">
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>40</height>
- </size>
- </property>
- <property name="text">
- <string>Circle</string>
- </property>
- <attribute name="buttonGroup">
- <string>buttonGroup</string>
- </attribute>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="groupBox">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="title">
- <string>Properties</string>
- </property>
- <layout class="QFormLayout" name="formLayout">
- <property name="fieldGrowthPolicy">
- <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
- </property>
- <item row="0" column="0">
- <widget class="QLabel" name="label">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>30</height>
- </size>
- </property>
- <property name="text">
- <string>Period</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QDoubleSpinBox" name="periodSpinBox">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>30</height>
- </size>
- </property>
- <property name="minimum">
- <double>-1.000000000000000</double>
- </property>
- <property name="singleStep">
- <double>0.100000000000000</double>
- </property>
- <property name="value">
- <double>-1.000000000000000</double>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QDoubleSpinBox" name="amplitudeSpinBox">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>30</height>
- </size>
- </property>
- <property name="minimum">
- <double>-1.000000000000000</double>
- </property>
- <property name="singleStep">
- <double>0.100000000000000</double>
- </property>
- <property name="value">
- <double>-1.000000000000000</double>
- </property>
- </widget>
- </item>
- <item row="4" column="0">
- <widget class="QLabel" name="label_3">
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>30</height>
- </size>
- </property>
- <property name="text">
- <string>Overshoot</string>
- </property>
- </widget>
- </item>
- <item row="4" column="1">
- <widget class="QDoubleSpinBox" name="overshootSpinBox">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>30</height>
- </size>
- </property>
- <property name="minimum">
- <double>-1.000000000000000</double>
- </property>
- <property name="singleStep">
- <double>0.100000000000000</double>
- </property>
- <property name="value">
- <double>-1.000000000000000</double>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="label_2">
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>30</height>
- </size>
- </property>
- <property name="text">
- <string>Amplitude</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
- <item row="1" column="1">
- <widget class="QGraphicsView" name="graphicsView">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
- <buttongroups>
- <buttongroup name="buttonGroup"/>
- </buttongroups>
-</ui>
diff --git a/examples/animation/easing/images/qt-logo.png b/examples/animation/easing/images/qt-logo.png
deleted file mode 100644
index 14ddf2a028..0000000000
--- a/examples/animation/easing/images/qt-logo.png
+++ /dev/null
Binary files differ
diff --git a/examples/animation/easing/main.cpp b/examples/animation/easing/main.cpp
deleted file mode 100644
index 05d4014fc2..0000000000
--- a/examples/animation/easing/main.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-#include "window.h"
-
-int main(int argc, char **argv)
-{
- Q_INIT_RESOURCE(easing);
- QApplication app(argc, argv);
- Window w;
-
- w.resize(400, 400);
- w.show();
-
- return app.exec();
-}
diff --git a/examples/animation/easing/window.cpp b/examples/animation/easing/window.cpp
deleted file mode 100644
index 33468db59c..0000000000
--- a/examples/animation/easing/window.cpp
+++ /dev/null
@@ -1,177 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "window.h"
-
-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();
-}
-
-void Window::createCurveIcons()
-{
- QPixmap pix(m_iconSize);
- QPainter painter(&pix);
- QLinearGradient gradient(0,0, 0, m_iconSize.height());
- gradient.setColorAt(0.0, QColor(240, 240, 240));
- gradient.setColorAt(1.0, QColor(224, 224, 224));
- QBrush brush(gradient);
- const QMetaObject &mo = QEasingCurve::staticMetaObject;
- QMetaEnum metaEnum = mo.enumerator(mo.indexOfEnumerator("Type"));
- // Skip QEasingCurve::Custom
- for (int i = 0; i < QEasingCurve::NCurveTypes - 1; ++i) {
- painter.fillRect(QRect(QPoint(0, 0), m_iconSize), brush);
- QEasingCurve curve((QEasingCurve::Type)i);
- painter.setPen(QColor(0, 0, 255, 64));
- qreal xAxis = m_iconSize.height()/1.5;
- qreal yAxis = m_iconSize.width()/3;
- painter.drawLine(0, xAxis, m_iconSize.width(), xAxis);
- painter.drawLine(yAxis, 0, yAxis, m_iconSize.height());
-
- qreal curveScale = m_iconSize.height()/2;
-
- painter.setPen(Qt::NoPen);
-
- // start point
- painter.setBrush(Qt::red);
- QPoint start(yAxis, xAxis - curveScale * curve.valueForProgress(0));
- painter.drawRect(start.x() - 1, start.y() - 1, 3, 3);
-
- // end point
- painter.setBrush(Qt::blue);
- QPoint end(yAxis + curveScale, xAxis - curveScale * curve.valueForProgress(1));
- painter.drawRect(end.x() - 1, end.y() - 1, 3, 3);
-
- QPainterPath curvePath;
- curvePath.moveTo(start);
- for (qreal t = 0; t <= 1.0; t+=1.0/curveScale) {
- QPoint to;
- to.setX(yAxis + curveScale * t);
- to.setY(xAxis - curveScale * curve.valueForProgress(t));
- curvePath.lineTo(to);
- }
- painter.setRenderHint(QPainter::Antialiasing, true);
- painter.strokePath(curvePath, QColor(32, 32, 32));
- painter.setRenderHint(QPainter::Antialiasing, false);
- QListWidgetItem *item = new QListWidgetItem;
- item->setIcon(QIcon(pix));
- item->setText(metaEnum.key(i));
- m_ui.easingCurvePicker->addItem(item);
- }
-}
-
-void Window::startAnimation()
-{
- m_anim->setStartValue(QPointF(0, 0));
- m_anim->setEndValue(QPointF(100, 100));
- m_anim->setDuration(2000);
- m_anim->setLoopCount(-1); // forever
- m_anim->start();
-}
-
-void Window::curveChanged(int row)
-{
- QEasingCurve::Type curveType = (QEasingCurve::Type)row;
- m_anim->setEasingCurve(curveType);
- m_anim->setCurrentTime(0);
-
- bool isElastic = curveType >= QEasingCurve::InElastic && curveType <= QEasingCurve::OutInElastic;
- bool isBounce = curveType >= QEasingCurve::InBounce && curveType <= QEasingCurve::OutInBounce;
- m_ui.periodSpinBox->setEnabled(isElastic);
- m_ui.amplitudeSpinBox->setEnabled(isElastic || isBounce);
- m_ui.overshootSpinBox->setEnabled(curveType >= QEasingCurve::InBack && curveType <= QEasingCurve::OutInBack);
-}
-
-void Window::pathChanged(int index)
-{
- m_anim->setPathType((Animation::PathType)index);
-}
-
-void Window::periodChanged(double value)
-{
- QEasingCurve curve = m_anim->easingCurve();
- curve.setPeriod(value);
- m_anim->setEasingCurve(curve);
-}
-
-void Window::amplitudeChanged(double value)
-{
- QEasingCurve curve = m_anim->easingCurve();
- curve.setAmplitude(value);
- m_anim->setEasingCurve(curve);
-}
-
-void Window::overshootChanged(double value)
-{
- QEasingCurve curve = m_anim->easingCurve();
- curve.setOvershoot(value);
- m_anim->setEasingCurve(curve);
-}
-
diff --git a/examples/animation/easing/window.h b/examples/animation/easing/window.h
deleted file mode 100644
index bf5014c0cc..0000000000
--- a/examples/animation/easing/window.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "ui_form.h"
-#include "animation.h"
-
-class PixmapItem : public QObject, public QGraphicsPixmapItem
-{
- Q_OBJECT
- Q_PROPERTY(QPointF pos READ pos WRITE setPos)
-public:
- PixmapItem(const QPixmap &pix) : QGraphicsPixmapItem(pix)
- {
- }
-};
-
-class Window : public QWidget {
- Q_OBJECT
-public:
- Window(QWidget *parent = 0);
-private slots:
- void curveChanged(int row);
- void pathChanged(int index);
- void periodChanged(double);
- void amplitudeChanged(double);
- void overshootChanged(double);
-
-private:
- void createCurveIcons();
- void startAnimation();
-
- Ui::Form m_ui;
- QGraphicsScene m_scene;
- PixmapItem *m_item;
- Animation *m_anim;
- QSize m_iconSize;
-};