/**************************************************************************** ** ** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB). ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt3D module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:COMM$ ** ** 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. ** ** $QT_END_LICENSE$ ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ****************************************************************************/ #include QT_BEGIN_NAMESPACE namespace Qt3DInput { Q_GLOBAL_STATIC(QuickInputNodeFactory, quick_Input_node_factory) QuickInputNodeFactory *QuickInputNodeFactory::instance() { return quick_Input_node_factory(); } void QuickInputNodeFactory::registerType(const char *className, const char *quickName, int major, int minor) { m_types.insert(className, Type(quickName, major, minor)); } Qt3DCore::QNode *QuickInputNodeFactory::createNode(const char *type) { if (!m_types.contains(type)) return nullptr; Type &typeInfo(m_types[type]); if (!typeInfo.resolved) { typeInfo.resolved = true; typeInfo.t = QQmlMetaType::qmlType(QString::fromLatin1(typeInfo.quickName), typeInfo.version.first, typeInfo.version.second); } return typeInfo.t.isValid() ? qobject_cast(typeInfo.t.create()) : nullptr; } } // namespace Qt3DInput QT_END_NAMESPACE