diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2019-03-13 09:50:14 +0100 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2019-04-27 03:49:51 +0000 |
commit | 3d55d182704e2c2b01aa3e5fc159507e322dd281 (patch) | |
tree | 2c7308cca349ddfec4de657496f80c399accf87f /src/imports | |
parent | 0bcaed279fc303ffd0fd6e77b0ebc83a4519ac74 (diff) |
Add BoundaryRule
[ChangeLog][Qt Labs Animation] Added the BoundaryRule QML type, a
PropertyValueInterceptor that restricts the range of values a numeric
property can have, applies "resistance" when the value is overshooting,
and provides the ability to animate it back within range.
Change-Id: I677b407a351c12b0c5b23c34a45933154310c2cd
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Diffstat (limited to 'src/imports')
-rw-r--r-- | src/imports/imports.pro | 1 | ||||
-rw-r--r-- | src/imports/labsanimation/dependencies.json | 2 | ||||
-rw-r--r-- | src/imports/labsanimation/labsanimation.pro | 11 | ||||
-rw-r--r-- | src/imports/labsanimation/plugin.cpp | 81 | ||||
-rw-r--r-- | src/imports/labsanimation/plugins.qmltypes | 36 | ||||
-rw-r--r-- | src/imports/labsanimation/qmldir | 3 |
6 files changed, 134 insertions, 0 deletions
diff --git a/src/imports/imports.pro b/src/imports/imports.pro index 24e93fec1c..9b1cfa6aa8 100644 --- a/src/imports/imports.pro +++ b/src/imports/imports.pro @@ -4,6 +4,7 @@ SUBDIRS += \ builtins \ qtqml \ models \ + labsanimation \ labsmodels qtConfig(thread): SUBDIRS += folderlistmodel diff --git a/src/imports/labsanimation/dependencies.json b/src/imports/labsanimation/dependencies.json new file mode 100644 index 0000000000..0d4f101c7a --- /dev/null +++ b/src/imports/labsanimation/dependencies.json @@ -0,0 +1,2 @@ +[ +] diff --git a/src/imports/labsanimation/labsanimation.pro b/src/imports/labsanimation/labsanimation.pro new file mode 100644 index 0000000000..64e076401f --- /dev/null +++ b/src/imports/labsanimation/labsanimation.pro @@ -0,0 +1,11 @@ +CXX_MODULE = qml +TARGET = labsanimationplugin +TARGETPATH = Qt/labs/animation +IMPORT_VERSION = 1.0 + +SOURCES += \ + plugin.cpp + +QT = qml-private quick-private + +load(qml_plugin) diff --git a/src/imports/labsanimation/plugin.cpp b/src/imports/labsanimation/plugin.cpp new file mode 100644 index 0000000000..d8c0c071ca --- /dev/null +++ b/src/imports/labsanimation/plugin.cpp @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtQml/qqmlextensionplugin.h> +#include <QtQml/qqml.h> + +#include <private/qquickboundaryrule_p.h> + +QT_BEGIN_NAMESPACE + +/*! + \qmlmodule Qt.labs.animation 1.0 + \title Qt Quick experimental animation types + \ingroup qmlmodules + \brief Provides QML experimental types for animation + \since 5.14 + + This QML module contains experimental QML types related to animation. + + To use the types in this module, import the module with the following line: + + \code + import Qt.labs.animation 1.0 + \endcode +*/ + +//![class decl] +class QtLabsAnimationPlugin : public QQmlExtensionPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) +public: + QtLabsAnimationPlugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) { } + void registerTypes(const char *uri) override + { + Q_ASSERT(QLatin1String(uri) == QLatin1String("Qt.labs.animation")); + qmlRegisterType<QQuickBoundaryRule>(uri, 1, 0, "BoundaryRule"); + qmlRegisterModule(uri, 1, 0); + } +}; +//![class decl] + +QT_END_NAMESPACE + +#include "plugin.moc" diff --git a/src/imports/labsanimation/plugins.qmltypes b/src/imports/labsanimation/plugins.qmltypes new file mode 100644 index 0000000000..065e65ad7a --- /dev/null +++ b/src/imports/labsanimation/plugins.qmltypes @@ -0,0 +1,36 @@ +import QtQuick.tooling 1.2 + +// This file describes the plugin-supplied types contained in the library. +// It is used for QML tooling purposes only. +// +// This file was auto-generated by: +// 'qmlplugindump -nonrelocatable Qt.labs.animation 1.0' + +Module { + dependencies: ["QtQuick 2.0"] + Component { + name: "QQuickBoundaryRule" + prototype: "QObject" + exports: ["Qt.labs.animation/BoundaryRule 1.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "OvershootFilter" + values: { + "None": 0, + "Peak": 1 + } + } + Property { name: "enabled"; type: "bool" } + Property { name: "minimum"; type: "double" } + Property { name: "minimumOvershoot"; type: "double" } + Property { name: "maximum"; type: "double" } + Property { name: "maximumOvershoot"; type: "double" } + Property { name: "overshootScale"; type: "double" } + Property { name: "currentOvershoot"; type: "double"; isReadonly: true } + Property { name: "peakOvershoot"; type: "double"; isReadonly: true } + Property { name: "overshootFilter"; type: "OvershootFilter" } + Property { name: "easing"; type: "QEasingCurve" } + Property { name: "returnDuration"; type: "int" } + Method { name: "returnToBounds"; type: "bool" } + } +} diff --git a/src/imports/labsanimation/qmldir b/src/imports/labsanimation/qmldir new file mode 100644 index 0000000000..b24fc98bfa --- /dev/null +++ b/src/imports/labsanimation/qmldir @@ -0,0 +1,3 @@ +module Qt.labs.animation +plugin labsanimationplugin +classname QtLabsAnimationPlugin |