summaryrefslogtreecommitdiffstats
path: root/src/render/frontend/qpickingsettings.cpp
diff options
context:
space:
mode:
authorMike Krus <mike.krus@kdab.com>2016-03-08 19:26:04 +0000
committerSean Harmer <sean.harmer@kdab.com>2016-03-11 07:51:57 +0000
commit3adc40a16a947f11db196d3b12be35b675cd1c88 (patch)
treef2f06840791530cbbc9400dca8d2b1e46d3867db /src/render/frontend/qpickingsettings.cpp
parent848b51d024dc9013b7c8816b074b5b8a4fd6d944 (diff)
QRenderSettings: Move picking related properties in QPickingSettings
Have only one picking property returning a pointer to that object (grouped QML property) Backend still has everything in one class though Task-Id: QTBUG-51506 Change-Id: Ib9626420a8ee86ad28168db02b171355499f87e3 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/render/frontend/qpickingsettings.cpp')
-rw-r--r--src/render/frontend/qpickingsettings.cpp111
1 files changed, 111 insertions, 0 deletions
diff --git a/src/render/frontend/qpickingsettings.cpp b/src/render/frontend/qpickingsettings.cpp
new file mode 100644
index 000000000..051dbf082
--- /dev/null
+++ b/src/render/frontend/qpickingsettings.cpp
@@ -0,0 +1,111 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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: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 "qpickingsettings.h"
+#include "qpickingsettings_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+QPickingSettingsPrivate::QPickingSettingsPrivate()
+ : Qt3DCore::QNodePrivate()
+ , m_pickMethod(QPickingSettings::BoundingVolumePicking)
+ , m_pickResultMode(QPickingSettings::NearestPick)
+{
+}
+
+QPickingSettings::QPickingSettings(Qt3DCore::QNode *parent)
+ : Qt3DCore::QNode(*new QPickingSettingsPrivate, parent)
+{
+}
+
+QPickingSettings::QPickingSettings(QPickingSettingsPrivate &dd, Qt3DCore::QNode *parent)
+ : Qt3DCore::QNode(dd, parent)
+{
+}
+
+QPickingSettings::~QPickingSettings()
+{
+ QNode::cleanup();
+}
+
+QPickingSettings::PickMethod QPickingSettings::pickMethod() const
+{
+ Q_D(const QPickingSettings);
+ return d->m_pickMethod;
+}
+
+QPickingSettings::PickResultMode QPickingSettings::pickResultMode() const
+{
+ Q_D(const QPickingSettings);
+ return d->m_pickResultMode;
+}
+
+void QPickingSettings::setPickMethod(QPickingSettings::PickMethod pickMethod)
+{
+ Q_D(QPickingSettings);
+ if (d->m_pickMethod == pickMethod)
+ return;
+
+ d->m_pickMethod = pickMethod;
+ emit pickMethodChanged(pickMethod);
+}
+
+void QPickingSettings::setPickResultMode(QPickingSettings::PickResultMode pickResultMode)
+{
+ Q_D(QPickingSettings);
+ if (d->m_pickResultMode == pickResultMode)
+ return;
+
+ d->m_pickResultMode = pickResultMode;
+ emit pickResultModeChanged(pickResultMode);
+}
+
+void QPickingSettings::copy(const QNode *ref)
+{
+ QNode::copy(ref);
+ const QPickingSettings *object = static_cast<const QPickingSettings *>(ref);
+ d_func()->m_pickMethod = object->d_func()->m_pickMethod;
+ d_func()->m_pickResultMode = object->d_func()->m_pickResultMode;
+}
+
+} // namespace Qt3Drender
+
+QT_END_NAMESPACE