| 1 | // Copyright (C) 2016 The Qt Company Ltd. |
|---|---|
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses |
| 5 | |
| 6 | #include "qquickcumulativedirection_p.h" |
| 7 | QT_BEGIN_NAMESPACE |
| 8 | |
| 9 | /*! |
| 10 | \qmltype CumulativeDirection |
| 11 | \nativetype QQuickCumulativeDirection |
| 12 | \inqmlmodule QtQuick.Particles |
| 13 | \inherits Direction |
| 14 | \brief For specifying a direction made of other directions. |
| 15 | \ingroup qtquick-particles |
| 16 | |
| 17 | The CumulativeDirection element will act as a direction that sums the directions within it. |
| 18 | */ |
| 19 | QQuickCumulativeDirection::QQuickCumulativeDirection(QObject *parent):QQuickDirection(parent) |
| 20 | { |
| 21 | } |
| 22 | |
| 23 | QQmlListProperty<QQuickDirection> QQuickCumulativeDirection::directions() |
| 24 | { |
| 25 | return QQmlListProperty<QQuickDirection>(this, &m_directions);//TODO: Proper list property |
| 26 | } |
| 27 | |
| 28 | QPointF QQuickCumulativeDirection::sample(const QPointF &from) |
| 29 | { |
| 30 | QPointF ret; |
| 31 | foreach (QQuickDirection* dir, m_directions) |
| 32 | ret += dir->sample(from); |
| 33 | return ret; |
| 34 | } |
| 35 | |
| 36 | QT_END_NAMESPACE |
| 37 | |
| 38 | #include "moc_qquickcumulativedirection_p.cpp" |
| 39 |
