forked from qt-creator/qt-creator
Add edit camera controls for 3D edit view
Add edit camera controls and grid helper to 3D edit view. Task-number: QDS-1127 Change-Id: Ice5ea0fcca18d59dc8a2907710e16c6688b90628 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io> Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
This commit is contained in:
committed by
Pasi Keränen
parent
3ee870a3d8
commit
c2c8b9a5d6
@@ -0,0 +1,59 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2019 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** 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 General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||
** 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-3.0.html.
|
||||
**
|
||||
****************************************************************************/
|
||||
#include "cameracontrolhelper.h"
|
||||
|
||||
namespace QmlDesigner {
|
||||
namespace Internal {
|
||||
|
||||
CameraControlHelper::CameraControlHelper()
|
||||
: QObject()
|
||||
{
|
||||
m_timer.setInterval(16);
|
||||
m_timer.setSingleShot(false);
|
||||
QObject::connect(&m_timer, &QTimer::timeout,
|
||||
this, &CameraControlHelper::handleUpdateTimer);
|
||||
}
|
||||
|
||||
bool CameraControlHelper::enabled()
|
||||
{
|
||||
return m_enabled;
|
||||
}
|
||||
|
||||
void CameraControlHelper::handleUpdateTimer()
|
||||
{
|
||||
emit updateInputs();
|
||||
}
|
||||
|
||||
void CameraControlHelper::setEnabled(bool enabled)
|
||||
{
|
||||
if (enabled)
|
||||
m_timer.start();
|
||||
else
|
||||
m_timer.stop();
|
||||
m_enabled = enabled;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2019 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** 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 General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||
** 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-3.0.html.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QTimer>
|
||||
|
||||
namespace QmlDesigner {
|
||||
namespace Internal {
|
||||
class CameraControlHelper : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged)
|
||||
|
||||
public:
|
||||
CameraControlHelper();
|
||||
|
||||
bool enabled();
|
||||
void setEnabled(bool enabled);
|
||||
|
||||
public slots:
|
||||
void handleUpdateTimer();
|
||||
|
||||
signals:
|
||||
void updateInputs();
|
||||
void enabledChanged(bool enabled);
|
||||
|
||||
private:
|
||||
bool m_enabled = false;
|
||||
QTimer m_timer;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
HEADERS += $$PWD/cameracontrolhelper.h
|
||||
SOURCES += $$PWD/cameracontrolhelper.cpp
|
||||
Reference in New Issue
Block a user