// Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB). // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include QT_BEGIN_NAMESPACE namespace Qt3DInput { namespace Input { namespace Quick { Quick3DLogicalDevice::Quick3DLogicalDevice(QObject *parent) : QObject(parent) { } QQmlListProperty Quick3DLogicalDevice::qmlAxes() { using qt_size_type = qsizetype; using ListContentType = QAxis; auto appendFunction = [](QQmlListProperty *list, ListContentType *axes) { Quick3DLogicalDevice *device = qobject_cast(list->object); device->parentLogicalDevice()->addAxis(axes); }; auto countFunction = [](QQmlListProperty *list) -> qt_size_type { Quick3DLogicalDevice *device = qobject_cast(list->object); return device->parentLogicalDevice()->axes().size(); }; auto atFunction = [](QQmlListProperty *list, qt_size_type index) -> ListContentType * { Quick3DLogicalDevice *device = qobject_cast(list->object); return device->parentLogicalDevice()->axes().at(index); }; auto clearFunction = [](QQmlListProperty *list) { Quick3DLogicalDevice *device = qobject_cast(list->object); const auto axes = device->parentLogicalDevice()->axes(); for (QAxis *axis : axes) device->parentLogicalDevice()->removeAxis(axis); }; return QQmlListProperty(this, nullptr, appendFunction, countFunction, atFunction, clearFunction); } QQmlListProperty Quick3DLogicalDevice::qmlActions() { using qt_size_type = qsizetype; using ListContentType = QAction; auto appendFunction = [](QQmlListProperty *list, ListContentType *action) { Quick3DLogicalDevice *device = qobject_cast(list->object); device->parentLogicalDevice()->addAction(action); }; auto countFunction = [](QQmlListProperty *list) -> qt_size_type { Quick3DLogicalDevice *device = qobject_cast(list->object); return device->parentLogicalDevice()->actions().size(); }; auto atFunction = [](QQmlListProperty *list, qt_size_type index) -> ListContentType * { Quick3DLogicalDevice *device = qobject_cast(list->object); return device->parentLogicalDevice()->actions().at(index); }; auto clearFunction = [](QQmlListProperty *list) { Quick3DLogicalDevice *device = qobject_cast(list->object); const auto actions = device->parentLogicalDevice()->actions(); for (QAction *action : actions) device->parentLogicalDevice()->removeAction(action); }; return QQmlListProperty(this, nullptr, appendFunction, countFunction, atFunction, clearFunction); } } // namespace Quick } // namespace Input } // namespace Qt3DInput QT_END_NAMESPACE #include "moc_quick3dlogicaldevice_p.cpp"