forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/4.11'
Conflicts: cmake/QtCreatorIDEBranding.cmake qbs/modules/qtc/qtc.qbs qtcreator_ide_branding.pri src/plugins/boot2qt/qdbrunconfiguration.cpp src/plugins/boot2qt/qdbrunconfiguration.h src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp src/plugins/qnx/qnxrunconfiguration.cpp src/plugins/remotelinux/remotelinuxrunconfiguration.h Change-Id: I17c8e1bf300bb75d7317ccf7749dd3cc07709c21
This commit is contained in:
2
dist/changes-4.11.0.md
vendored
2
dist/changes-4.11.0.md
vendored
@@ -53,6 +53,8 @@ you can check out from the public Git repository. For example:
|
||||
### Python
|
||||
|
||||
* Simplified registration of language server
|
||||
* Added python settings to configure multiple python interpreters
|
||||
* Simplified switching python interpreters for python projects
|
||||
|
||||
## Help
|
||||
|
||||
|
||||
@@ -28,7 +28,8 @@ HEADERS += $$PWD/removesharedmemorycommand.h
|
||||
HEADERS += $$PWD/puppetalivecommand.h
|
||||
HEADERS += $$PWD/changeselectioncommand.h
|
||||
HEADERS += $$PWD/drop3dlibraryitemcommand.h
|
||||
HEADERS += $$PWD/change3dviewcommand.h
|
||||
HEADERS += $$PWD/update3dviewstatecommand.h
|
||||
HEADERS += $$PWD/enable3dviewcommand.h
|
||||
|
||||
SOURCES += $$PWD/synchronizecommand.cpp
|
||||
SOURCES += $$PWD/debugoutputcommand.cpp
|
||||
@@ -58,4 +59,5 @@ SOURCES += $$PWD/removesharedmemorycommand.cpp
|
||||
SOURCES += $$PWD/puppetalivecommand.cpp
|
||||
SOURCES += $$PWD/changeselectioncommand.cpp
|
||||
SOURCES += $$PWD/drop3dlibraryitemcommand.cpp
|
||||
SOURCES += $$PWD/change3dviewcommand.cpp
|
||||
SOURCES += $$PWD/update3dviewstatecommand.cpp
|
||||
SOURCES += $$PWD/enable3dviewcommand.cpp
|
||||
|
||||
@@ -23,41 +23,43 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "change3dviewcommand.h"
|
||||
#include "enable3dviewcommand.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QDataStream>
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
Change3DViewCommand::Change3DViewCommand() = default;
|
||||
|
||||
Change3DViewCommand::Change3DViewCommand(const QVector<InformationContainer> &informationVector)
|
||||
: m_informationVector(informationVector)
|
||||
// open / close edit view 3D command
|
||||
Enable3DViewCommand::Enable3DViewCommand(bool enable)
|
||||
: m_enable(enable)
|
||||
{
|
||||
}
|
||||
|
||||
QVector<InformationContainer> Change3DViewCommand::informationVector() const
|
||||
bool Enable3DViewCommand::isEnable() const
|
||||
{
|
||||
return m_informationVector;
|
||||
return m_enable;
|
||||
}
|
||||
|
||||
QDataStream &operator<<(QDataStream &out, const Change3DViewCommand &command)
|
||||
QDataStream &operator<<(QDataStream &out, const Enable3DViewCommand &command)
|
||||
{
|
||||
out << command.informationVector();
|
||||
out << qint32(command.isEnable());
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
QDataStream &operator>>(QDataStream &in, Change3DViewCommand &command)
|
||||
QDataStream &operator>>(QDataStream &in, Enable3DViewCommand &command)
|
||||
{
|
||||
in >> command.m_informationVector;
|
||||
qint32 enable;
|
||||
in >> enable;
|
||||
command.m_enable = enable;
|
||||
|
||||
return in;
|
||||
}
|
||||
|
||||
QDebug operator <<(QDebug debug, const Change3DViewCommand &command)
|
||||
QDebug operator<<(QDebug debug, const Enable3DViewCommand &command)
|
||||
{
|
||||
return debug.nospace() << "Change3DViewCommand(auxiliaryChanges: " << command.m_informationVector << ")";
|
||||
return debug.nospace() << "Enable3DViewCommand(enable: " << command.m_enable << ")";
|
||||
}
|
||||
|
||||
} // namespace QmlDesigner
|
||||
@@ -26,32 +26,29 @@
|
||||
#pragma once
|
||||
|
||||
#include <QMetaType>
|
||||
#include <QVector>
|
||||
|
||||
#include "informationcontainer.h"
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
class Change3DViewCommand
|
||||
class Enable3DViewCommand
|
||||
{
|
||||
friend QDataStream &operator>>(QDataStream &in, Change3DViewCommand &command);
|
||||
friend QDebug operator <<(QDebug debug, const Change3DViewCommand &command);
|
||||
friend QDataStream &operator>>(QDataStream &in, Enable3DViewCommand &command);
|
||||
friend QDebug operator<<(QDebug debug, const Enable3DViewCommand &command);
|
||||
|
||||
public:
|
||||
Change3DViewCommand();
|
||||
explicit Change3DViewCommand(const QVector<InformationContainer> &auxiliaryChangeVector);
|
||||
explicit Enable3DViewCommand(bool enable);
|
||||
Enable3DViewCommand() = default;
|
||||
|
||||
QVector<InformationContainer> informationVector() const;
|
||||
bool isEnable() const;
|
||||
|
||||
private:
|
||||
QVector<InformationContainer> m_informationVector;
|
||||
bool m_enable = true;
|
||||
};
|
||||
|
||||
QDataStream &operator<<(QDataStream &out, const Change3DViewCommand &command);
|
||||
QDataStream &operator>>(QDataStream &in, Change3DViewCommand &command);
|
||||
QDataStream &operator<<(QDataStream &out, const Enable3DViewCommand &command);
|
||||
QDataStream &operator>>(QDataStream &in, Enable3DViewCommand &command);
|
||||
|
||||
QDebug operator <<(QDebug debug, const Change3DViewCommand &command);
|
||||
QDebug operator<<(QDebug debug, const Enable3DViewCommand &command);
|
||||
|
||||
} // namespace QmlDesigner
|
||||
|
||||
Q_DECLARE_METATYPE(QmlDesigner::Change3DViewCommand)
|
||||
Q_DECLARE_METATYPE(QmlDesigner::Enable3DViewCommand)
|
||||
@@ -0,0 +1,106 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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 "update3dviewstatecommand.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QDataStream>
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
Update3dViewStateCommand::Update3dViewStateCommand(Qt::WindowStates previousStates,
|
||||
Qt::WindowStates currentStates)
|
||||
: m_previousStates(previousStates)
|
||||
, m_currentStates(currentStates)
|
||||
, m_type(Update3dViewStateCommand::StateChange)
|
||||
{
|
||||
}
|
||||
|
||||
Update3dViewStateCommand::Update3dViewStateCommand(bool active, bool hasPopup)
|
||||
: m_active(active)
|
||||
, m_hasPopup(hasPopup)
|
||||
, m_type(Update3dViewStateCommand::ActiveChange)
|
||||
{
|
||||
}
|
||||
|
||||
Qt::WindowStates Update3dViewStateCommand::previousStates() const
|
||||
{
|
||||
return m_previousStates;
|
||||
}
|
||||
|
||||
Qt::WindowStates Update3dViewStateCommand::currentStates() const
|
||||
{
|
||||
return m_currentStates;
|
||||
}
|
||||
|
||||
bool Update3dViewStateCommand::isActive() const
|
||||
{
|
||||
return m_active;
|
||||
}
|
||||
|
||||
bool Update3dViewStateCommand::hasPopup() const
|
||||
{
|
||||
return m_hasPopup;
|
||||
}
|
||||
|
||||
Update3dViewStateCommand::Type Update3dViewStateCommand::type() const
|
||||
{
|
||||
return m_type;
|
||||
}
|
||||
|
||||
QDataStream &operator<<(QDataStream &out, const Update3dViewStateCommand &command)
|
||||
{
|
||||
out << command.previousStates();
|
||||
out << command.currentStates();
|
||||
out << qint32(command.isActive());
|
||||
out << qint32(command.hasPopup());
|
||||
out << qint32(command.type());
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
QDataStream &operator>>(QDataStream &in, Update3dViewStateCommand &command)
|
||||
{
|
||||
in >> command.m_previousStates;
|
||||
in >> command.m_currentStates;
|
||||
qint32 active;
|
||||
qint32 hasPopup;
|
||||
qint32 type;
|
||||
in >> active;
|
||||
in >> hasPopup;
|
||||
in >> type;
|
||||
command.m_active = active;
|
||||
command.m_hasPopup = hasPopup;
|
||||
command.m_type = Update3dViewStateCommand::Type(type);
|
||||
|
||||
return in;
|
||||
}
|
||||
|
||||
QDebug operator<<(QDebug debug, const Update3dViewStateCommand &command)
|
||||
{
|
||||
return debug.nospace() << "Update3dViewStateCommand(type: " << command.m_type << ")";
|
||||
}
|
||||
|
||||
} // namespace QmlDesigner
|
||||
@@ -25,43 +25,45 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "abstractcustomtool.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QDialog>
|
||||
#include <QMetaType>
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
class FormEditorView;
|
||||
class NodeInstanceView;
|
||||
|
||||
class EditView3DProxyDialog : public QDialog
|
||||
class Update3dViewStateCommand
|
||||
{
|
||||
Q_OBJECT
|
||||
friend QDataStream &operator>>(QDataStream &in, Update3dViewStateCommand &command);
|
||||
friend QDebug operator<<(QDebug debug, const Update3dViewStateCommand &command);
|
||||
|
||||
public:
|
||||
explicit EditView3DProxyDialog(FormEditorView *view);
|
||||
enum Type { StateChange, ActiveChange, Empty };
|
||||
|
||||
void invalidate();
|
||||
explicit Update3dViewStateCommand(Qt::WindowStates previousStates, Qt::WindowStates currentStates);
|
||||
explicit Update3dViewStateCommand(bool active, bool hasPopup);
|
||||
Update3dViewStateCommand() = default;
|
||||
|
||||
protected:
|
||||
void moveEvent(QMoveEvent *event) override;
|
||||
void closeEvent(QCloseEvent *event) override;
|
||||
void hideEvent(QHideEvent *event) override;
|
||||
void focusOutEvent(QFocusEvent *event) override;
|
||||
void focusInEvent(QFocusEvent *event) override;
|
||||
void resizeEvent(QResizeEvent *event) override;
|
||||
bool event(QEvent *event) override;
|
||||
Qt::WindowStates previousStates() const;
|
||||
Qt::WindowStates currentStates() const;
|
||||
|
||||
bool isActive() const;
|
||||
bool hasPopup() const;
|
||||
|
||||
Type type() const;
|
||||
|
||||
private:
|
||||
QRect adjustedRect() const;
|
||||
NodeInstanceView *nodeInstanceView() const;
|
||||
void showView();
|
||||
void hideView();
|
||||
Qt::WindowStates m_previousStates = Qt::WindowNoState;
|
||||
Qt::WindowStates m_currentStates = Qt::WindowNoState;
|
||||
|
||||
QPointer<FormEditorView> m_formEditorView;
|
||||
bool m_active = false;
|
||||
bool m_hasPopup = false;
|
||||
|
||||
Type m_type = Empty;
|
||||
};
|
||||
|
||||
} //QmlDesigner
|
||||
QDataStream &operator<<(QDataStream &out, const Update3dViewStateCommand &command);
|
||||
QDataStream &operator>>(QDataStream &in, Update3dViewStateCommand &command);
|
||||
|
||||
QDebug operator<<(QDebug debug, const Update3dViewStateCommand &command);
|
||||
|
||||
} // namespace QmlDesigner
|
||||
|
||||
Q_DECLARE_METATYPE(QmlDesigner::Update3dViewStateCommand)
|
||||
@@ -41,7 +41,8 @@
|
||||
#include "instancecontainer.h"
|
||||
#include "createinstancescommand.h"
|
||||
#include "createscenecommand.h"
|
||||
#include "change3dviewcommand.h"
|
||||
#include "update3dviewstatecommand.h"
|
||||
#include "enable3dviewcommand.h"
|
||||
#include "changevaluescommand.h"
|
||||
#include "changebindingscommand.h"
|
||||
#include "changeauxiliarycommand.h"
|
||||
@@ -361,9 +362,14 @@ void NodeInstanceClientProxy::createScene(const CreateSceneCommand &command)
|
||||
nodeInstanceServer()->createScene(command);
|
||||
}
|
||||
|
||||
void NodeInstanceClientProxy::change3DView(const Change3DViewCommand &command)
|
||||
void NodeInstanceClientProxy::update3DViewState(const Update3dViewStateCommand &command)
|
||||
{
|
||||
nodeInstanceServer()->change3DView(command);
|
||||
nodeInstanceServer()->update3DViewState(command);
|
||||
}
|
||||
|
||||
void NodeInstanceClientProxy::enable3DView(const Enable3DViewCommand &command)
|
||||
{
|
||||
nodeInstanceServer()->enable3DView(command);
|
||||
}
|
||||
|
||||
void NodeInstanceClientProxy::clearScene(const ClearSceneCommand &command)
|
||||
@@ -453,7 +459,8 @@ void NodeInstanceClientProxy::changeSelection(const ChangeSelectionCommand &comm
|
||||
void NodeInstanceClientProxy::dispatchCommand(const QVariant &command)
|
||||
{
|
||||
static const int createInstancesCommandType = QMetaType::type("CreateInstancesCommand");
|
||||
static const int change3DViewCommandType = QMetaType::type("Change3DViewCommand");
|
||||
static const int update3dViewStateCommand = QMetaType::type("Update3dViewStateCommand");
|
||||
static const int enable3DViewCommandType = QMetaType::type("Enable3DViewCommand");
|
||||
static const int changeFileUrlCommandType = QMetaType::type("ChangeFileUrlCommand");
|
||||
static const int createSceneCommandType = QMetaType::type("CreateSceneCommand");
|
||||
static const int clearSceneCommandType = QMetaType::type("ClearSceneCommand");
|
||||
@@ -477,8 +484,10 @@ void NodeInstanceClientProxy::dispatchCommand(const QVariant &command)
|
||||
|
||||
if (commandType == createInstancesCommandType)
|
||||
createInstances(command.value<CreateInstancesCommand>());
|
||||
else if (commandType == change3DViewCommandType)
|
||||
change3DView(command.value<Change3DViewCommand>());
|
||||
else if (commandType == update3dViewStateCommand)
|
||||
update3DViewState(command.value<Update3dViewStateCommand>());
|
||||
else if (commandType == enable3DViewCommandType)
|
||||
enable3DView(command.value<Enable3DViewCommand>());
|
||||
else if (commandType == changeFileUrlCommandType)
|
||||
changeFileUrl(command.value<ChangeFileUrlCommand>());
|
||||
else if (commandType == createSceneCommandType)
|
||||
|
||||
@@ -45,7 +45,8 @@ class CreateSceneCommand;
|
||||
class CreateInstancesCommand;
|
||||
class ClearSceneCommand;
|
||||
class ReparentInstancesCommand;
|
||||
class Change3DViewCommand;
|
||||
class Update3dViewStateCommand;
|
||||
class Enable3DViewCommand;
|
||||
class ChangeFileUrlCommand;
|
||||
class ChangeValuesCommand;
|
||||
class ChangeAuxiliaryCommand;
|
||||
@@ -96,7 +97,8 @@ protected:
|
||||
void changeFileUrl(const ChangeFileUrlCommand &command);
|
||||
void createScene(const CreateSceneCommand &command);
|
||||
void clearScene(const ClearSceneCommand &command);
|
||||
void change3DView(const Change3DViewCommand &command);
|
||||
void update3DViewState(const Update3dViewStateCommand &command);
|
||||
void enable3DView(const Enable3DViewCommand &command);
|
||||
void removeInstances(const RemoveInstancesCommand &command);
|
||||
void removeProperties(const RemovePropertiesCommand &command);
|
||||
void changePropertyBindings(const ChangeBindingsCommand &command);
|
||||
|
||||
@@ -32,7 +32,8 @@
|
||||
#include "instancecontainer.h"
|
||||
#include "createinstancescommand.h"
|
||||
#include "createscenecommand.h"
|
||||
#include "change3dviewcommand.h"
|
||||
#include "update3dviewstatecommand.h"
|
||||
#include "enable3dviewcommand.h"
|
||||
#include "changevaluescommand.h"
|
||||
#include "changebindingscommand.h"
|
||||
#include "changeauxiliarycommand.h"
|
||||
@@ -91,8 +92,11 @@ void NodeInstanceServerInterface::registerCommands()
|
||||
qRegisterMetaType<CreateSceneCommand>("CreateSceneCommand");
|
||||
qRegisterMetaTypeStreamOperators<CreateSceneCommand>("CreateSceneCommand");
|
||||
|
||||
qRegisterMetaType<Change3DViewCommand>("Change3DViewCommand");
|
||||
qRegisterMetaTypeStreamOperators<Change3DViewCommand>("Change3DViewCommand");
|
||||
qRegisterMetaType<Update3dViewStateCommand>("Update3dViewStateCommand");
|
||||
qRegisterMetaTypeStreamOperators<Update3dViewStateCommand>("Update3dViewStateCommand");
|
||||
|
||||
qRegisterMetaType<Enable3DViewCommand>("Enable3DViewCommand");
|
||||
qRegisterMetaTypeStreamOperators<Enable3DViewCommand>("Enable3DViewCommand");
|
||||
|
||||
qRegisterMetaType<ChangeBindingsCommand>("ChangeBindingsCommand");
|
||||
qRegisterMetaTypeStreamOperators<ChangeBindingsCommand>("ChangeBindingsCommand");
|
||||
|
||||
@@ -33,7 +33,8 @@ class PropertyAbstractContainer;
|
||||
class PropertyBindingContainer;
|
||||
class PropertyValueContainer;
|
||||
|
||||
class Change3DViewCommand;
|
||||
class Update3dViewStateCommand;
|
||||
class Enable3DViewCommand;
|
||||
class ChangeFileUrlCommand;
|
||||
class ChangeValuesCommand;
|
||||
class ChangeBindingsCommand;
|
||||
@@ -67,7 +68,8 @@ public:
|
||||
virtual void changeFileUrl(const ChangeFileUrlCommand &command) = 0;
|
||||
virtual void createScene(const CreateSceneCommand &command) = 0;
|
||||
virtual void clearScene(const ClearSceneCommand &command) = 0;
|
||||
virtual void change3DView(const Change3DViewCommand &command) = 0;
|
||||
virtual void update3DViewState(const Update3dViewStateCommand &command) = 0;
|
||||
virtual void enable3DView(const Enable3DViewCommand &command) = 0;
|
||||
virtual void removeInstances(const RemoveInstancesCommand &command) = 0;
|
||||
virtual void removeProperties(const RemovePropertiesCommand &command) = 0;
|
||||
virtual void changePropertyBindings(const ChangeBindingsCommand &command) = 0;
|
||||
|
||||
@@ -35,6 +35,7 @@ Model {
|
||||
property Node targetNode: null
|
||||
property bool dragging: mouseAreaYZ.dragging || mouseAreaXZ.dragging
|
||||
property bool active: false
|
||||
property MouseArea3D dragHelper: null
|
||||
|
||||
readonly property bool hovering: mouseAreaYZ.hovering || mouseAreaXZ.hovering
|
||||
|
||||
@@ -57,7 +58,7 @@ Model {
|
||||
return;
|
||||
|
||||
var maskedPosition = Qt.vector3d(scenePos.x, 0, 0);
|
||||
_pointerPosPressed = mouseArea.mapPositionToScene(maskedPosition);
|
||||
_pointerPosPressed = mouseArea.dragHelper.mapPositionToScene(maskedPosition);
|
||||
if (targetNode.orientation === Node.RightHanded)
|
||||
_pointerPosPressed.z = -_pointerPosPressed.z;
|
||||
var sp = targetNode.scenePosition;
|
||||
@@ -68,7 +69,7 @@ Model {
|
||||
function calcRelativeDistance(mouseArea, scenePos)
|
||||
{
|
||||
var maskedPosition = Qt.vector3d(scenePos.x, 0, 0);
|
||||
var scenePointerPos = mouseArea.mapPositionToScene(maskedPosition);
|
||||
var scenePointerPos = mouseArea.dragHelper.mapPositionToScene(maskedPosition);
|
||||
if (targetNode.orientation === Node.RightHanded)
|
||||
scenePointerPos.z = -scenePointerPos.z;
|
||||
return scenePointerPos.minus(_pointerPosPressed);
|
||||
@@ -100,6 +101,8 @@ Model {
|
||||
rotation: Qt.vector3d(0, 0, 90)
|
||||
grabsMouse: targetNode
|
||||
active: rootModel.active
|
||||
dragHelper: rootModel.dragHelper
|
||||
|
||||
onPressed: rootModel.handlePressed(mouseAreaYZ, scenePos)
|
||||
onDragged: rootModel.handleDragged(mouseAreaYZ, scenePos)
|
||||
onReleased: rootModel.handleReleased(mouseAreaYZ, scenePos)
|
||||
@@ -115,6 +118,8 @@ Model {
|
||||
rotation: Qt.vector3d(0, 90, 90)
|
||||
grabsMouse: targetNode
|
||||
active: rootModel.active
|
||||
dragHelper: rootModel.dragHelper
|
||||
|
||||
onPressed: rootModel.handlePressed(mouseAreaXZ, scenePos)
|
||||
onDragged: rootModel.handleDragged(mouseAreaXZ, scenePos)
|
||||
onReleased: rootModel.handleReleased(mouseAreaXZ, scenePos)
|
||||
|
||||
@@ -28,19 +28,16 @@ import QtQuick.Window 2.12
|
||||
import QtQuick3D 1.0
|
||||
import QtQuick.Controls 2.0
|
||||
import QtGraphicalEffects 1.0
|
||||
import MouseArea3D 1.0
|
||||
|
||||
Window {
|
||||
id: viewWindow
|
||||
width: 1024
|
||||
height: 768
|
||||
visible: false
|
||||
title: "3D"
|
||||
flags: Qt.Widget | Qt.SplashScreen
|
||||
|
||||
onActiveChanged: {
|
||||
if (viewWindow.active)
|
||||
cameraControl.forceActiveFocus()
|
||||
}
|
||||
visible: true
|
||||
title: "3D Edit View"
|
||||
// need all those flags otherwise the title bar disappears after setting WindowStaysOnTopHint flag later
|
||||
flags: Qt.Window | Qt.WindowTitleHint | Qt.WindowSystemMenuHint | Qt.WindowMinMaxButtonsHint | Qt.WindowCloseButtonHint
|
||||
|
||||
property alias scene: editView.importScene
|
||||
property alias showEditLight: btnEditViewLight.toggled
|
||||
@@ -126,6 +123,15 @@ Window {
|
||||
|
||||
function addLightGizmo(obj)
|
||||
{
|
||||
// Insert into first available gizmo
|
||||
for (var i = 0; i < lightGizmos.length; ++i) {
|
||||
if (!lightGizmos[i].targetNode) {
|
||||
lightGizmos[i].targetNode = obj;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// No free gizmos available, create a new one
|
||||
var component = Qt.createComponent("LightGizmo.qml");
|
||||
if (component.status === Component.Ready) {
|
||||
var gizmo = component.createObject(overlayScene,
|
||||
@@ -139,6 +145,14 @@ Window {
|
||||
|
||||
function addCameraGizmo(obj)
|
||||
{
|
||||
// Insert into first available gizmo
|
||||
for (var i = 0; i < cameraGizmos.length; ++i) {
|
||||
if (!cameraGizmos[i].targetNode) {
|
||||
cameraGizmos[i].targetNode = obj;
|
||||
return;
|
||||
}
|
||||
}
|
||||
// No free gizmos available, create a new one
|
||||
var component = Qt.createComponent("CameraGizmo.qml");
|
||||
if (component.status === Component.Ready) {
|
||||
var geometryName = _generalHelper.generateUniqueName("CameraGeometry");
|
||||
@@ -183,6 +197,11 @@ Window {
|
||||
scale: editOrthoCamera.scale
|
||||
}
|
||||
|
||||
MouseArea3D {
|
||||
id: gizmoDragHelper
|
||||
view3D: overlayView
|
||||
}
|
||||
|
||||
MoveGizmo {
|
||||
id: moveGizmo
|
||||
scale: autoScale.getScale(Qt.vector3d(5, 5, 5))
|
||||
@@ -191,6 +210,7 @@ Window {
|
||||
globalOrientation: btnLocalGlobal.toggled
|
||||
visible: selectedNode && btnMove.selected
|
||||
view3D: overlayView
|
||||
dragHelper: gizmoDragHelper
|
||||
|
||||
onPositionCommit: viewWindow.commitObjectProperty(selectedNode, "position")
|
||||
onPositionMove: viewWindow.changeObjectProperty(selectedNode, "position")
|
||||
@@ -204,6 +224,7 @@ Window {
|
||||
globalOrientation: false
|
||||
visible: selectedNode && btnScale.selected
|
||||
view3D: overlayView
|
||||
dragHelper: gizmoDragHelper
|
||||
|
||||
onScaleCommit: viewWindow.commitObjectProperty(selectedNode, "scale")
|
||||
onScaleChange: viewWindow.changeObjectProperty(selectedNode, "scale")
|
||||
@@ -217,6 +238,7 @@ Window {
|
||||
globalOrientation: btnLocalGlobal.toggled
|
||||
visible: selectedNode && btnRotate.selected
|
||||
view3D: overlayView
|
||||
dragHelper: gizmoDragHelper
|
||||
|
||||
onRotateCommit: viewWindow.commitObjectProperty(selectedNode, "rotation")
|
||||
onRotateChange: viewWindow.changeObjectProperty(selectedNode, "rotation")
|
||||
@@ -457,48 +479,48 @@ Window {
|
||||
|
||||
Rectangle { // top controls bar
|
||||
color: "#aa000000"
|
||||
width: 265
|
||||
width: 290
|
||||
height: btnPerspective.height + 10
|
||||
anchors.top: parent.top
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 100
|
||||
|
||||
ToggleButton {
|
||||
id: btnPerspective
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 5
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 5
|
||||
tooltip: qsTr("Toggle Perspective / Orthographic Projection")
|
||||
states: [{iconId: "ortho", text: qsTr("Orthographic")}, {iconId: "persp", text: qsTr("Perspective")}]
|
||||
Row {
|
||||
padding: 5
|
||||
anchors.fill: parent
|
||||
ToggleButton {
|
||||
id: btnPerspective
|
||||
width: 105
|
||||
tooltip: qsTr("Toggle Perspective / Orthographic Projection")
|
||||
states: [{iconId: "ortho", text: qsTr("Orthographic")}, {iconId: "persp", text: qsTr("Perspective")}]
|
||||
}
|
||||
|
||||
ToggleButton {
|
||||
id: btnLocalGlobal
|
||||
width: 65
|
||||
tooltip: qsTr("Toggle Global / Local Orientation")
|
||||
states: [{iconId: "local", text: qsTr("Local")}, {iconId: "global", text: qsTr("Global")}]
|
||||
}
|
||||
|
||||
ToggleButton {
|
||||
id: btnEditViewLight
|
||||
width: 110
|
||||
toggleBackground: true
|
||||
tooltip: qsTr("Toggle Edit Light")
|
||||
states: [{iconId: "edit_light_off", text: qsTr("Edit Light Off")}, {iconId: "edit_light_on", text: qsTr("Edit Light On")}]
|
||||
}
|
||||
}
|
||||
|
||||
ToggleButton {
|
||||
id: btnLocalGlobal
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 5
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 100
|
||||
tooltip: qsTr("Toggle Global / Local Orientation")
|
||||
states: [{iconId: "local", text: qsTr("Local")}, {iconId: "global", text: qsTr("Global")}]
|
||||
}
|
||||
|
||||
ToggleButton {
|
||||
id: btnEditViewLight
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 5
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 165
|
||||
toggleBackground: true
|
||||
tooltip: qsTr("Toggle Edit Light")
|
||||
states: [{iconId: "edit_light_off", text: qsTr("Edit Light Off")}, {iconId: "edit_light_on", text: qsTr("Edit Light On")}]
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
id: helpText
|
||||
|
||||
property string modKey: _generalHelper.isMacOS ? qsTr("Option") : qsTr("Alt")
|
||||
|
||||
color: "white"
|
||||
text: qsTr("Camera controls: ALT + mouse press and drag. Left: Rotate, Middle: Pan, Right/Wheel: Zoom.")
|
||||
text: qsTr("Camera controls: ") + modKey
|
||||
+ qsTr(" + mouse press and drag. Left: Rotate, Middle: Pan, Right/Wheel: Zoom.")
|
||||
anchors.bottom: parent.bottom
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ Node {
|
||||
property View3D view3D
|
||||
property bool highlightOnHover: true
|
||||
property Node targetNode: null
|
||||
property var selectedNodes: null
|
||||
property var selectedNodes: []
|
||||
readonly property bool selected: {
|
||||
for (var i = 0; i < selectedNodes.length; ++i) {
|
||||
if (selectedNodes[i] === targetNode)
|
||||
|
||||
@@ -37,6 +37,8 @@ Node {
|
||||
readonly property bool dragging: arrowX.dragging || arrowY.dragging || arrowZ.dragging
|
||||
|| planeX.dragging || planeY.dragging || planeZ.dragging
|
||||
|| centerBall.dragging
|
||||
property MouseArea3D dragHelper: null
|
||||
|
||||
position: targetNode ? targetNode.scenePosition : Qt.vector3d(0, 0, 0)
|
||||
orientation: targetNode ? targetNode.orientation : Node.LeftHanded
|
||||
|
||||
@@ -57,6 +59,7 @@ Node {
|
||||
: Qt.rgba(1, 0, 0, 1)
|
||||
view3D: moveGizmo.view3D
|
||||
active: moveGizmo.visible
|
||||
dragHelper: moveGizmo.dragHelper
|
||||
|
||||
onPositionCommit: moveGizmo.positionCommit()
|
||||
onPositionMove: moveGizmo.positionMove()
|
||||
@@ -70,6 +73,7 @@ Node {
|
||||
: Qt.rgba(0, 0.6, 0, 1)
|
||||
view3D: moveGizmo.view3D
|
||||
active: moveGizmo.visible
|
||||
dragHelper: moveGizmo.dragHelper
|
||||
|
||||
onPositionCommit: moveGizmo.positionCommit()
|
||||
onPositionMove: moveGizmo.positionMove()
|
||||
@@ -83,6 +87,7 @@ Node {
|
||||
: Qt.rgba(0, 0, 1, 1)
|
||||
view3D: moveGizmo.view3D
|
||||
active: moveGizmo.visible
|
||||
dragHelper: moveGizmo.dragHelper
|
||||
|
||||
onPositionCommit: moveGizmo.positionCommit()
|
||||
onPositionMove: moveGizmo.positionMove()
|
||||
@@ -100,6 +105,7 @@ Node {
|
||||
: Qt.rgba(1, 0, 0, 1)
|
||||
view3D: moveGizmo.view3D
|
||||
active: moveGizmo.visible
|
||||
dragHelper: moveGizmo.dragHelper
|
||||
|
||||
onPositionCommit: moveGizmo.positionCommit()
|
||||
onPositionMove: moveGizmo.positionMove()
|
||||
@@ -117,6 +123,7 @@ Node {
|
||||
: Qt.rgba(0, 0.6, 0, 1)
|
||||
view3D: moveGizmo.view3D
|
||||
active: moveGizmo.visible
|
||||
dragHelper: moveGizmo.dragHelper
|
||||
|
||||
onPositionCommit: moveGizmo.positionCommit()
|
||||
onPositionMove: moveGizmo.positionMove()
|
||||
@@ -134,6 +141,7 @@ Node {
|
||||
: Qt.rgba(0, 0, 1, 1)
|
||||
view3D: moveGizmo.view3D
|
||||
active: moveGizmo.visible
|
||||
dragHelper: moveGizmo.dragHelper
|
||||
|
||||
onPositionCommit: moveGizmo.positionCommit()
|
||||
onPositionMove: moveGizmo.positionMove()
|
||||
@@ -152,6 +160,7 @@ Node {
|
||||
|
||||
view3D: moveGizmo.view3D
|
||||
active: moveGizmo.visible
|
||||
dragHelper: moveGizmo.dragHelper
|
||||
|
||||
onPositionCommit: moveGizmo.positionCommit()
|
||||
onPositionMove: moveGizmo.positionMove()
|
||||
|
||||
@@ -36,11 +36,12 @@ Model {
|
||||
property Node targetNode: null
|
||||
property bool dragging: mouseArea.dragging
|
||||
property bool active: false
|
||||
property MouseArea3D dragHelper: null
|
||||
|
||||
readonly property bool hovering: mouseArea.hovering
|
||||
|
||||
property var _pointerPosPressed
|
||||
property var _targetStartPos
|
||||
property vector3d _pointerPosPressed
|
||||
property vector3d _targetStartPos
|
||||
|
||||
signal pressed(var mouseArea)
|
||||
signal dragged(var mouseArea, vector3d sceneRelativeDistance)
|
||||
@@ -62,7 +63,7 @@ Model {
|
||||
if (!targetNode)
|
||||
return;
|
||||
|
||||
_pointerPosPressed = mouseArea.mapPositionToScene(scenePos);
|
||||
_pointerPosPressed = mouseArea.dragHelper.mapPositionToScene(scenePos);
|
||||
if (targetNode.orientation === Node.RightHanded)
|
||||
_pointerPosPressed.z = -_pointerPosPressed.z;
|
||||
var sp = targetNode.scenePosition;
|
||||
@@ -72,7 +73,7 @@ Model {
|
||||
|
||||
function calcRelativeDistance(mouseArea, scenePos)
|
||||
{
|
||||
var scenePointerPos = mouseArea.mapPositionToScene(scenePos);
|
||||
var scenePointerPos = mouseArea.dragHelper.mapPositionToScene(scenePos);
|
||||
if (targetNode.orientation === Node.RightHanded)
|
||||
scenePointerPos.z = -scenePointerPos.z;
|
||||
return scenePointerPos.minus(_pointerPosPressed);
|
||||
@@ -103,6 +104,8 @@ Model {
|
||||
height: 120
|
||||
grabsMouse: targetNode
|
||||
active: rootModel.active
|
||||
dragHelper: rootModel.dragHelper
|
||||
|
||||
onPressed: rootModel.handlePressed(mouseArea, scenePos)
|
||||
onDragged: rootModel.handleDragged(mouseArea, scenePos)
|
||||
onReleased: rootModel.handleReleased(mouseArea, scenePos)
|
||||
|
||||
@@ -36,7 +36,7 @@ PlanarDraggable {
|
||||
signal scaleCommit()
|
||||
signal scaleChange()
|
||||
|
||||
property var _startScale
|
||||
property vector3d _startScale
|
||||
|
||||
onPressed: {
|
||||
// Recreate vector so we don't follow the changes in targetNode.sceneScale
|
||||
|
||||
@@ -36,6 +36,7 @@ Node {
|
||||
property bool globalOrientation: true
|
||||
readonly property bool dragging: cameraRing.dragging
|
||||
|| rotRingX.dragging || rotRingY.dragging || rotRingZ.dragging
|
||||
property MouseArea3D dragHelper: null
|
||||
property real currentAngle
|
||||
property point currentMousePos
|
||||
|
||||
@@ -88,6 +89,7 @@ Node {
|
||||
priority: 40
|
||||
view3D: rotateGizmo.view3D
|
||||
active: rotateGizmo.visible
|
||||
dragHelper: rotateGizmo.dragHelper
|
||||
|
||||
onRotateCommit: rotateGizmo.rotateCommit()
|
||||
onRotateChange: rotateGizmo.rotateChange()
|
||||
@@ -107,6 +109,7 @@ Node {
|
||||
priority: 30
|
||||
view3D: rotateGizmo.view3D
|
||||
active: rotateGizmo.visible
|
||||
dragHelper: rotateGizmo.dragHelper
|
||||
|
||||
onRotateCommit: rotateGizmo.rotateCommit()
|
||||
onRotateChange: rotateGizmo.rotateChange()
|
||||
@@ -126,6 +129,7 @@ Node {
|
||||
priority: 20
|
||||
view3D: rotateGizmo.view3D
|
||||
active: rotateGizmo.visible
|
||||
dragHelper: rotateGizmo.dragHelper
|
||||
|
||||
onRotateCommit: rotateGizmo.rotateCommit()
|
||||
onRotateChange: rotateGizmo.rotateChange()
|
||||
@@ -145,6 +149,7 @@ Node {
|
||||
priority: 10
|
||||
view3D: rotateGizmo.view3D
|
||||
active: rotateGizmo.visible
|
||||
dragHelper: rotateGizmo.dragHelper
|
||||
|
||||
onRotateCommit: rotateGizmo.rotateCommit()
|
||||
onRotateChange: rotateGizmo.rotateChange()
|
||||
@@ -226,6 +231,8 @@ Node {
|
||||
circlePickArea: Qt.point(25, 50)
|
||||
grabsMouse: rotateGizmo.targetNode
|
||||
active: rotateGizmo.visible
|
||||
dragHelper: rotateGizmo.dragHelper
|
||||
|
||||
onPressed: freeRotator.handlePressed(screenPos)
|
||||
onDragged: freeRotator.handleDragged(screenPos)
|
||||
onReleased: freeRotator.handleReleased(screenPos)
|
||||
|
||||
@@ -39,6 +39,7 @@ Model {
|
||||
property alias priority: mouseAreaMain.priority
|
||||
property real currentAngle
|
||||
property point currentMousePos
|
||||
property MouseArea3D dragHelper: null
|
||||
|
||||
property vector3d _pointerPosPressed
|
||||
property vector3d _targetPosOnScreen
|
||||
@@ -132,6 +133,8 @@ Model {
|
||||
active: rotateRing.active
|
||||
pickNode: pickModel
|
||||
minAngle: 0.05
|
||||
dragHelper: rotateRing.dragHelper
|
||||
|
||||
onPressed: rotateRing.handlePressed(screenPos, angle)
|
||||
onDragged: rotateRing.handleDragged(screenPos)
|
||||
onReleased: rotateRing.handleReleased(screenPos)
|
||||
|
||||
@@ -37,6 +37,7 @@ Node {
|
||||
readonly property bool dragging: scaleRodX.dragging || scaleRodY.dragging || scaleRodZ.dragging
|
||||
|| planeX.dragging || planeY.dragging || planeZ.dragging
|
||||
|| centerMouseArea.dragging
|
||||
property MouseArea3D dragHelper: null
|
||||
|
||||
position: targetNode ? targetNode.scenePosition : Qt.vector3d(0, 0, 0)
|
||||
orientation: targetNode ? targetNode.orientation : Node.LeftHanded
|
||||
@@ -58,6 +59,7 @@ Node {
|
||||
view3D: scaleGizmo.view3D
|
||||
active: scaleGizmo.visible
|
||||
globalOrientation: scaleGizmo.globalOrientation
|
||||
dragHelper: scaleGizmo.dragHelper
|
||||
|
||||
onScaleCommit: scaleGizmo.scaleCommit()
|
||||
onScaleChange: scaleGizmo.scaleChange()
|
||||
@@ -72,6 +74,7 @@ Node {
|
||||
view3D: scaleGizmo.view3D
|
||||
active: scaleGizmo.visible
|
||||
globalOrientation: scaleGizmo.globalOrientation
|
||||
dragHelper: scaleGizmo.dragHelper
|
||||
|
||||
onScaleCommit: scaleGizmo.scaleCommit()
|
||||
onScaleChange: scaleGizmo.scaleChange()
|
||||
@@ -86,6 +89,7 @@ Node {
|
||||
view3D: scaleGizmo.view3D
|
||||
active: scaleGizmo.visible
|
||||
globalOrientation: scaleGizmo.globalOrientation
|
||||
dragHelper: scaleGizmo.dragHelper
|
||||
|
||||
onScaleCommit: scaleGizmo.scaleCommit()
|
||||
onScaleChange: scaleGizmo.scaleChange()
|
||||
@@ -104,6 +108,7 @@ Node {
|
||||
view3D: scaleGizmo.view3D
|
||||
active: scaleGizmo.visible
|
||||
globalOrientation: scaleGizmo.globalOrientation
|
||||
dragHelper: scaleGizmo.dragHelper
|
||||
|
||||
onScaleCommit: scaleGizmo.scaleCommit()
|
||||
onScaleChange: scaleGizmo.scaleChange()
|
||||
@@ -122,6 +127,7 @@ Node {
|
||||
view3D: scaleGizmo.view3D
|
||||
active: scaleGizmo.visible
|
||||
globalOrientation: scaleGizmo.globalOrientation
|
||||
dragHelper: scaleGizmo.dragHelper
|
||||
|
||||
onScaleCommit: scaleGizmo.scaleCommit()
|
||||
onScaleChange: scaleGizmo.scaleChange()
|
||||
@@ -140,6 +146,7 @@ Node {
|
||||
view3D: scaleGizmo.view3D
|
||||
active: scaleGizmo.visible
|
||||
globalOrientation: scaleGizmo.globalOrientation
|
||||
dragHelper: scaleGizmo.dragHelper
|
||||
|
||||
onScaleCommit: scaleGizmo.scaleCommit()
|
||||
onScaleChange: scaleGizmo.scaleChange()
|
||||
@@ -171,15 +178,16 @@ Node {
|
||||
grabsMouse: scaleGizmo.targetNode
|
||||
priority: 1
|
||||
active: scaleGizmo.visible
|
||||
dragHelper: scaleGizmo.dragHelper
|
||||
|
||||
property var _startScale
|
||||
property var _startScreenPos
|
||||
property vector3d _startScale
|
||||
property point _startScreenPos
|
||||
|
||||
function localScale(screenPos)
|
||||
{
|
||||
var yDelta = screenPos.y - _startScreenPos.y;
|
||||
if (yDelta === 0)
|
||||
return;
|
||||
return _startScale;
|
||||
var scaler = 1.0 + (yDelta * 0.025);
|
||||
if (scaler === 0)
|
||||
scaler = 0.0001;
|
||||
@@ -203,7 +211,6 @@ Node {
|
||||
onDragged: {
|
||||
if (!scaleGizmo.targetNode)
|
||||
return;
|
||||
|
||||
scaleGizmo.targetNode.scale = localScale(screenPos);
|
||||
scaleGizmo.scaleChange();
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ DirectionalDraggable {
|
||||
signal scaleCommit()
|
||||
signal scaleChange()
|
||||
|
||||
property var _startScale
|
||||
property vector3d _startScale
|
||||
|
||||
Model {
|
||||
source: "#Cube"
|
||||
|
||||
@@ -148,16 +148,19 @@ void CameraGeometry::fillVertexData(QByteArray &vertexData, QByteArray &indexDat
|
||||
auto dataPtr = reinterpret_cast<float *>(vertexData.data());
|
||||
auto indexPtr = reinterpret_cast<quint16 *>(indexData.data());
|
||||
|
||||
QMatrix4x4 m;
|
||||
QSSGRenderCamera *camera = m_camera->cameraNode();
|
||||
if (qobject_cast<QQuick3DOrthographicCamera *>(m_camera)) {
|
||||
// For some reason ortho cameras show double what projection suggests,
|
||||
// so give them doubled viewport to match visualization to actual camera view
|
||||
camera->calculateProjection(QRectF(0, 0, m_viewPortRect.width() * 2.0,
|
||||
m_viewPortRect.height() * 2.0));
|
||||
} else {
|
||||
camera->calculateProjection(m_viewPortRect);
|
||||
if (camera) {
|
||||
if (qobject_cast<QQuick3DOrthographicCamera *>(m_camera)) {
|
||||
// For some reason ortho cameras show double what projection suggests,
|
||||
// so give them doubled viewport to match visualization to actual camera view
|
||||
camera->calculateProjection(QRectF(0, 0, m_viewPortRect.width() * 2.0,
|
||||
m_viewPortRect.height() * 2.0));
|
||||
} else {
|
||||
camera->calculateProjection(m_viewPortRect);
|
||||
}
|
||||
m = camera->projection.inverted();
|
||||
}
|
||||
const QMatrix4x4 m = camera->projection.inverted();
|
||||
|
||||
const QVector3D farTopLeft = m * QVector3D(1.f, -1.f, 1.f);
|
||||
const QVector3D farBottomRight = m * QVector3D(-1.f, 1.f, 1.f);
|
||||
|
||||
@@ -222,6 +222,15 @@ QQuick3DNode *GeneralHelper::resolvePick(QQuick3DNode *pickNode)
|
||||
return pickNode;
|
||||
}
|
||||
|
||||
bool GeneralHelper::isMacOS() const
|
||||
{
|
||||
#ifdef Q_OS_MACOS
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@ namespace Internal {
|
||||
class GeneralHelper : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(bool isMacOS READ isMacOS CONSTANT)
|
||||
|
||||
public:
|
||||
GeneralHelper();
|
||||
@@ -70,6 +71,8 @@ public:
|
||||
Q_INVOKABLE QQuick3DNode *resolvePick(QQuick3DNode *pickNode);
|
||||
|
||||
|
||||
bool isMacOS() const;
|
||||
|
||||
signals:
|
||||
void overlayUpdateNeeded();
|
||||
|
||||
|
||||
@@ -83,6 +83,11 @@ QQuick3DNode *MouseArea3D::pickNode() const
|
||||
return m_pickNode;
|
||||
}
|
||||
|
||||
MouseArea3D *MouseArea3D::dragHelper() const
|
||||
{
|
||||
return m_dragHelper;
|
||||
}
|
||||
|
||||
qreal MouseArea3D::x() const
|
||||
{
|
||||
return m_x;
|
||||
@@ -179,6 +184,15 @@ void MouseArea3D::setPickNode(QQuick3DNode *node)
|
||||
emit pickNodeChanged();
|
||||
}
|
||||
|
||||
void MouseArea3D::setDragHelper(MouseArea3D *dragHelper)
|
||||
{
|
||||
if (m_dragHelper == dragHelper)
|
||||
return;
|
||||
|
||||
m_dragHelper = dragHelper;
|
||||
emit dragHelperChanged();
|
||||
}
|
||||
|
||||
void MouseArea3D::setX(qreal x)
|
||||
{
|
||||
if (qFuzzyCompare(m_x, x))
|
||||
@@ -344,6 +358,11 @@ qreal QmlDesigner::Internal::MouseArea3D::getNewRotationAngle(
|
||||
QQuick3DNode *node, const QVector3D &pressPos, const QVector3D ¤tPos,
|
||||
const QVector3D &nodePos, qreal prevAngle, bool trackBall)
|
||||
{
|
||||
const QVector3D dragVector = currentPos - pressPos;
|
||||
|
||||
if (dragVector.length() < 0.001f)
|
||||
return prevAngle;
|
||||
|
||||
// Get camera to node direction in node orientation
|
||||
QVector3D cameraToNodeDir = getCameraToNodeDir(node);
|
||||
if (trackBall) {
|
||||
@@ -433,19 +452,22 @@ void MouseArea3D::applyFreeRotation(QQuick3DNode *node, const QVector3D &startRo
|
||||
node->rotate(degrees, finalAxis, QQuick3DNode::SceneSpace);
|
||||
}
|
||||
|
||||
QVector3D MouseArea3D::getMousePosInPlane(const QPointF &mousePosInView) const
|
||||
QVector3D MouseArea3D::getMousePosInPlane(const MouseArea3D *helper,
|
||||
const QPointF &mousePosInView) const
|
||||
{
|
||||
if (!helper)
|
||||
helper = this;
|
||||
const QVector3D mousePos1(float(mousePosInView.x()), float(mousePosInView.y()), 0);
|
||||
const QVector3D mousePos2(float(mousePosInView.x()), float(mousePosInView.y()), 1);
|
||||
const QVector3D rayPos0 = m_view3D->mapTo3DScene(mousePos1);
|
||||
const QVector3D rayPos1 = m_view3D->mapTo3DScene(mousePos2);
|
||||
const QVector3D globalPlanePosition = mapPositionToScene(QVector3D(0, 0, 0));
|
||||
const QVector3D globalPlanePosition = helper->mapPositionToScene(QVector3D(0, 0, 0));
|
||||
const QVector3D intersectGlobalPos = rayIntersectsPlane(rayPos0, rayPos1,
|
||||
globalPlanePosition, forward());
|
||||
if (qFuzzyCompare(intersectGlobalPos.z(), -1))
|
||||
return intersectGlobalPos;
|
||||
|
||||
return mapPositionFromScene(intersectGlobalPos);
|
||||
return helper->mapPositionFromScene(intersectGlobalPos);
|
||||
}
|
||||
|
||||
bool MouseArea3D::eventFilter(QObject *, QEvent *event)
|
||||
@@ -505,7 +527,13 @@ bool MouseArea3D::eventFilter(QObject *, QEvent *event)
|
||||
case QEvent::MouseButtonPress: {
|
||||
auto const mouseEvent = static_cast<QMouseEvent *>(event);
|
||||
if (mouseEvent->button() == Qt::LeftButton) {
|
||||
m_mousePosInPlane = getMousePosInPlane(mouseEvent->pos());
|
||||
// Reset drag helper area to global transform of this area
|
||||
if (m_dragHelper) {
|
||||
m_dragHelper->setPosition(scenePosition());
|
||||
m_dragHelper->setRotation(sceneRotation());
|
||||
m_dragHelper->setScale(sceneScale());
|
||||
}
|
||||
m_mousePosInPlane = getMousePosInPlane(m_dragHelper, mouseEvent->pos());
|
||||
if (mouseOnTopOfMouseArea(m_mousePosInPlane, mouseEvent->pos())) {
|
||||
setDragging(true);
|
||||
emit pressed(m_mousePosInPlane, mouseEvent->pos(), pickAngle);
|
||||
@@ -527,7 +555,7 @@ bool MouseArea3D::eventFilter(QObject *, QEvent *event)
|
||||
auto const mouseEvent = static_cast<QMouseEvent *>(event);
|
||||
if (mouseEvent->button() == Qt::LeftButton) {
|
||||
if (m_dragging) {
|
||||
QVector3D mousePosInPlane = getMousePosInPlane(mouseEvent->pos());
|
||||
QVector3D mousePosInPlane = getMousePosInPlane(m_dragHelper, mouseEvent->pos());
|
||||
if (qFuzzyCompare(mousePosInPlane.z(), -1))
|
||||
mousePosInPlane = m_mousePosInPlane;
|
||||
setDragging(false);
|
||||
@@ -554,7 +582,8 @@ bool MouseArea3D::eventFilter(QObject *, QEvent *event)
|
||||
case QEvent::MouseMove:
|
||||
case QEvent::HoverMove: {
|
||||
auto const mouseEvent = static_cast<QMouseEvent *>(event);
|
||||
const QVector3D mousePosInPlane = getMousePosInPlane(mouseEvent->pos());
|
||||
const QVector3D mousePosInPlane = getMousePosInPlane(m_dragging ? m_dragHelper : this,
|
||||
mouseEvent->pos());
|
||||
const bool hasMouse = mouseOnTopOfMouseArea(mousePosInPlane, mouseEvent->pos());
|
||||
|
||||
setHovering(hasMouse);
|
||||
|
||||
@@ -55,6 +55,7 @@ class MouseArea3D : public QQuick3DNode
|
||||
Q_PROPERTY(QPointF circlePickArea READ circlePickArea WRITE setCirclePickArea NOTIFY circlePickAreaChanged)
|
||||
Q_PROPERTY(qreal minAngle READ minAngle WRITE setMinAngle NOTIFY minAngleChanged)
|
||||
Q_PROPERTY(QQuick3DNode *pickNode READ pickNode WRITE setPickNode NOTIFY pickNodeChanged)
|
||||
Q_PROPERTY(MouseArea3D *dragHelper READ dragHelper WRITE setDragHelper NOTIFY dragHelperChanged)
|
||||
|
||||
Q_INTERFACES(QQmlParserStatus)
|
||||
|
||||
@@ -76,6 +77,7 @@ public:
|
||||
QPointF circlePickArea() const;
|
||||
qreal minAngle() const;
|
||||
QQuick3DNode *pickNode() const;
|
||||
MouseArea3D *dragHelper() const;
|
||||
|
||||
static qreal mouseDragMultiplier() { return .02; }
|
||||
|
||||
@@ -86,6 +88,7 @@ public slots:
|
||||
void setCirclePickArea(const QPointF &pickArea);
|
||||
void setMinAngle(qreal angle);
|
||||
void setPickNode(QQuick3DNode *node);
|
||||
void setDragHelper(MouseArea3D *dragHelper);
|
||||
|
||||
void setX(qreal x);
|
||||
void setY(qreal y);
|
||||
@@ -126,6 +129,7 @@ signals:
|
||||
void circlePickAreaChanged();
|
||||
void minAngleChanged();
|
||||
void pickNodeChanged();
|
||||
void dragHelperChanged();
|
||||
|
||||
// angle parameter is only set if circlePickArea is specified
|
||||
void pressed(const QVector3D &scenePos, const QPoint &screenPos, qreal angle);
|
||||
@@ -156,7 +160,7 @@ private:
|
||||
bool m_dragging = false;
|
||||
bool m_active = false;
|
||||
|
||||
QVector3D getMousePosInPlane(const QPointF &mousePosInView) const;
|
||||
QVector3D getMousePosInPlane(const MouseArea3D *helper, const QPointF &mousePosInView) const;
|
||||
|
||||
static MouseArea3D *s_mouseGrab;
|
||||
bool m_grabsMouse = false;
|
||||
@@ -164,6 +168,7 @@ private:
|
||||
QPointF m_circlePickArea;
|
||||
qreal m_minAngle = 0.;
|
||||
QQuick3DNode *m_pickNode = nullptr;
|
||||
MouseArea3D *m_dragHelper = nullptr;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -98,6 +98,10 @@ void SelectionBoxGeometry::setTargetNode(QQuick3DNode *targetNode)
|
||||
QObject::connect(model, &QQuick3DModel::geometryChanged,
|
||||
this, &SelectionBoxGeometry::update, Qt::QueuedConnection);
|
||||
}
|
||||
if (m_targetNode) {
|
||||
QObject::connect(m_targetNode, &QQuick3DNode::parentChanged,
|
||||
this, &SelectionBoxGeometry::update, Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
emit targetNodeChanged();
|
||||
update();
|
||||
|
||||
@@ -332,7 +332,11 @@ void NodeInstanceServer::clearScene(const ClearSceneCommand &/*command*/)
|
||||
m_fileUrl.clear();
|
||||
}
|
||||
|
||||
void NodeInstanceServer::change3DView(const Change3DViewCommand &/*command*/)
|
||||
void NodeInstanceServer::update3DViewState(const Update3dViewStateCommand &/*command*/)
|
||||
{
|
||||
}
|
||||
|
||||
void NodeInstanceServer::enable3DView(const Enable3DViewCommand &/*command*/)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -101,7 +101,8 @@ public:
|
||||
void changeIds(const ChangeIdsCommand &command) override;
|
||||
void createScene(const CreateSceneCommand &command) override;
|
||||
void clearScene(const ClearSceneCommand &command) override;
|
||||
void change3DView(const Change3DViewCommand &command) override;
|
||||
void update3DViewState(const Update3dViewStateCommand &command) override;
|
||||
void enable3DView(const Enable3DViewCommand &command) override;
|
||||
void removeInstances(const RemoveInstancesCommand &command) override;
|
||||
void removeProperties(const RemovePropertiesCommand &command) override;
|
||||
void reparentInstances(const ReparentInstancesCommand &command) override;
|
||||
@@ -155,7 +156,7 @@ public slots:
|
||||
void emitParentChanged(QObject *child);
|
||||
|
||||
protected:
|
||||
QList<ServerNodeInstance> createInstances(const QVector<InstanceContainer> &container);
|
||||
virtual QList<ServerNodeInstance> createInstances(const QVector<InstanceContainer> &container);
|
||||
void reparentInstances(const QVector<ReparentContainer> &containerVector);
|
||||
|
||||
Internal::ChildrenChangeEventFilter *childrenChangeEventFilter();
|
||||
|
||||
@@ -40,7 +40,8 @@
|
||||
#include "changefileurlcommand.h"
|
||||
#include "clearscenecommand.h"
|
||||
#include "reparentinstancescommand.h"
|
||||
#include "change3dviewcommand.h"
|
||||
#include "update3dviewstatecommand.h"
|
||||
#include "enable3dviewcommand.h"
|
||||
#include "changevaluescommand.h"
|
||||
#include "changebindingscommand.h"
|
||||
#include "changeidscommand.h"
|
||||
@@ -59,7 +60,7 @@
|
||||
#include "tokencommand.h"
|
||||
#include "removesharedmemorycommand.h"
|
||||
#include "objectnodeinstance.h"
|
||||
#include <drop3dlibraryitemcommand.h>
|
||||
#include "drop3dlibraryitemcommand.h"
|
||||
|
||||
#include "dummycontextobject.h"
|
||||
#include "../editor3d/generalhelper.h"
|
||||
@@ -119,7 +120,7 @@ QObject *Qt5InformationNodeInstanceServer::createEditView3D(QQmlEngine *engine)
|
||||
QWindow *window = qobject_cast<QWindow *>(component.create());
|
||||
|
||||
if (!window) {
|
||||
qWarning() << "Could not create edit view" << component.errors();
|
||||
qWarning() << "Could not create edit view 3D: " << component.errors();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -130,8 +131,6 @@ QObject *Qt5InformationNodeInstanceServer::createEditView3D(QQmlEngine *engine)
|
||||
this, SLOT(handleObjectPropertyCommit(QVariant, QVariant)));
|
||||
QObject::connect(window, SIGNAL(changeObjectProperty(QVariant, QVariant)),
|
||||
this, SLOT(handleObjectPropertyChange(QVariant, QVariant)));
|
||||
QObject::connect(window, SIGNAL(activeChanged()),
|
||||
this, SLOT(handleActiveChanged()));
|
||||
QObject::connect(&m_propertyChangeTimer, &QTimer::timeout,
|
||||
this, &Qt5InformationNodeInstanceServer::handleObjectPropertyChangeTimeout);
|
||||
QObject::connect(&m_selectionChangeTimer, &QTimer::timeout,
|
||||
@@ -150,7 +149,7 @@ QObject *Qt5InformationNodeInstanceServer::createEditView3D(QQmlEngine *engine)
|
||||
return window;
|
||||
}
|
||||
|
||||
// The selection has changed in the 3D edit view. Empty list indicates selection is cleared.
|
||||
// The selection has changed in the edit view 3D. Empty list indicates selection is cleared.
|
||||
void Qt5InformationNodeInstanceServer::handleSelectionChanged(const QVariant &objs)
|
||||
{
|
||||
QList<ServerNodeInstance> instanceList;
|
||||
@@ -231,65 +230,6 @@ void Qt5InformationNodeInstanceServer::modifyVariantValue(
|
||||
}
|
||||
}
|
||||
|
||||
void Qt5InformationNodeInstanceServer::showEditView(const QPoint &pos, const QSize &size)
|
||||
{
|
||||
m_blockViewActivate = false;
|
||||
auto window = qobject_cast<QWindow *>(m_editView3D);
|
||||
if (window) {
|
||||
activateEditView();
|
||||
window->setPosition(pos);
|
||||
window->resize(size);
|
||||
}
|
||||
}
|
||||
|
||||
void Qt5InformationNodeInstanceServer::hideEditView()
|
||||
{
|
||||
m_blockViewActivate = true;
|
||||
auto window = qobject_cast<QWindow *>(m_editView3D);
|
||||
if (window)
|
||||
window->hide();
|
||||
}
|
||||
|
||||
void Qt5InformationNodeInstanceServer::activateEditView()
|
||||
{
|
||||
auto window = qobject_cast<QWindow *>(m_editView3D);
|
||||
if (window) {
|
||||
Qt::WindowFlags flags = window->flags();
|
||||
|
||||
#ifdef Q_OS_MACOS
|
||||
window->setFlags(Qt::Popup);
|
||||
window->show();
|
||||
window->setFlags(flags);
|
||||
#else
|
||||
window->raise();
|
||||
window->setFlags(flags | Qt::WindowStaysOnTopHint);
|
||||
window->show();
|
||||
|
||||
window->requestActivate();
|
||||
window->raise();
|
||||
window->setFlags(flags);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void Qt5InformationNodeInstanceServer::moveEditView(const QPoint &pos)
|
||||
{
|
||||
auto window = qobject_cast<QWindow*>(m_editView3D);
|
||||
if (window) {
|
||||
activateEditView();
|
||||
window->setPosition(pos);
|
||||
}
|
||||
}
|
||||
|
||||
void Qt5InformationNodeInstanceServer::resizeEditView(const QSize &size)
|
||||
{
|
||||
auto window = qobject_cast<QWindow *>(m_editView3D);
|
||||
if (window) {
|
||||
activateEditView();
|
||||
window->resize(size);
|
||||
}
|
||||
}
|
||||
|
||||
void Qt5InformationNodeInstanceServer::handleObjectPropertyCommit(const QVariant &object,
|
||||
const QVariant &propName)
|
||||
{
|
||||
@@ -324,14 +264,6 @@ void Qt5InformationNodeInstanceServer::updateViewPortRect()
|
||||
viewPortProperty.write(viewPortrect);
|
||||
}
|
||||
|
||||
void Qt5InformationNodeInstanceServer::handleActiveChanged()
|
||||
{
|
||||
if (m_blockViewActivate)
|
||||
return;
|
||||
|
||||
activateEditView();
|
||||
}
|
||||
|
||||
Qt5InformationNodeInstanceServer::Qt5InformationNodeInstanceServer(NodeInstanceClientInterface *nodeInstanceClient) :
|
||||
Qt5NodeInstanceServer(nodeInstanceClient)
|
||||
{
|
||||
@@ -409,6 +341,17 @@ void Qt5InformationNodeInstanceServer::modifyProperties(
|
||||
nodeInstanceClient()->valuesModified(createValuesModifiedCommand(properties));
|
||||
}
|
||||
|
||||
QList<ServerNodeInstance> Qt5InformationNodeInstanceServer::createInstances(
|
||||
const QVector<InstanceContainer> &container)
|
||||
{
|
||||
const auto createdInstances = NodeInstanceServer::createInstances(container);
|
||||
|
||||
if (m_editView3D)
|
||||
createCameraAndLightGizmos(createdInstances);
|
||||
|
||||
return createdInstances;
|
||||
}
|
||||
|
||||
void Qt5InformationNodeInstanceServer::handleObjectPropertyChangeTimeout()
|
||||
{
|
||||
modifyVariantValue(m_changedNode, m_changedProperty,
|
||||
@@ -448,16 +391,27 @@ QObject *Qt5InformationNodeInstanceServer::findRootNodeOf3DViewport(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void Qt5InformationNodeInstanceServer::findCamerasAndLights(
|
||||
const QList<ServerNodeInstance> &instanceList,
|
||||
QObjectList &cameras, QObjectList &lights) const
|
||||
void Qt5InformationNodeInstanceServer::createCameraAndLightGizmos(
|
||||
const QList<ServerNodeInstance> &instanceList) const
|
||||
{
|
||||
QObjectList cameras;
|
||||
QObjectList lights;
|
||||
|
||||
for (const ServerNodeInstance &instance : instanceList) {
|
||||
if (instance.isSubclassOf("QQuick3DCamera"))
|
||||
cameras << instance.internalObject();
|
||||
else if (instance.isSubclassOf("QQuick3DAbstractLight"))
|
||||
lights << instance.internalObject();
|
||||
}
|
||||
|
||||
for (auto &obj : qAsConst(cameras)) {
|
||||
QMetaObject::invokeMethod(m_editView3D, "addCameraGizmo",
|
||||
Q_ARG(QVariant, objectToVariant(obj)));
|
||||
}
|
||||
for (auto &obj : qAsConst(lights)) {
|
||||
QMetaObject::invokeMethod(m_editView3D, "addLightGizmo",
|
||||
Q_ARG(QVariant, objectToVariant(obj)));
|
||||
}
|
||||
}
|
||||
|
||||
ServerNodeInstance Qt5InformationNodeInstanceServer::findViewPort(
|
||||
@@ -506,18 +460,7 @@ void Qt5InformationNodeInstanceServer::setup3DEditView(const QList<ServerNodeIns
|
||||
updateViewPortRect();
|
||||
}
|
||||
|
||||
// Create camera and light gizmos
|
||||
QObjectList cameras;
|
||||
QObjectList lights;
|
||||
findCamerasAndLights(instanceList, cameras, lights);
|
||||
for (auto &obj : qAsConst(cameras)) {
|
||||
QMetaObject::invokeMethod(m_editView3D, "addCameraGizmo",
|
||||
Q_ARG(QVariant, objectToVariant(obj)));
|
||||
}
|
||||
for (auto &obj : qAsConst(lights)) {
|
||||
QMetaObject::invokeMethod(m_editView3D, "addLightGizmo",
|
||||
Q_ARG(QVariant, objectToVariant(obj)));
|
||||
}
|
||||
createCameraAndLightGizmos(instanceList);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -748,17 +691,36 @@ void Qt5InformationNodeInstanceServer::changePropertyValues(const ChangeValuesCo
|
||||
startRenderTimer();
|
||||
}
|
||||
|
||||
void Qt5InformationNodeInstanceServer::change3DView(const Change3DViewCommand &command)
|
||||
// update 3D view window state when the main app window state change
|
||||
void Qt5InformationNodeInstanceServer::update3DViewState(const Update3dViewStateCommand &command)
|
||||
{
|
||||
for (const InformationContainer &container : command.informationVector()) {
|
||||
if (container.name() == InformationName::ShowView)
|
||||
showEditView(container.information().toPoint(), container.secondInformation().toSize());
|
||||
else if (container.name() == InformationName::HideView)
|
||||
hideEditView();
|
||||
else if (container.name() == InformationName::MoveView)
|
||||
moveEditView(container.information().toPoint());
|
||||
else if (container.name() == InformationName::ResizeView)
|
||||
resizeEditView(container.secondInformation().toSize());
|
||||
auto window = qobject_cast<QWindow *>(m_editView3D);
|
||||
if (window) {
|
||||
if (command.type() == Update3dViewStateCommand::StateChange) {
|
||||
if (command.previousStates() & Qt::WindowMinimized) // main window expanded from minimize state
|
||||
window->show();
|
||||
else if (command.currentStates() & Qt::WindowMinimized) // main window minimized
|
||||
window->hide();
|
||||
} else if (command.type() == Update3dViewStateCommand::ActiveChange) {
|
||||
window->setFlag(Qt::WindowStaysOnTopHint, command.isActive());
|
||||
|
||||
// main window has a popup open, lower the edit view 3D so that the pop up is visible
|
||||
if (command.hasPopup())
|
||||
window->lower();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Qt5InformationNodeInstanceServer::enable3DView(const Enable3DViewCommand &command)
|
||||
{
|
||||
// TODO: this method is not currently in use as the 3D view is currently enabled by resetting the puppet.
|
||||
// It should however be implemented here.
|
||||
|
||||
auto window = qobject_cast<QWindow *>(m_editView3D);
|
||||
if (window && !command.isEnable()) {
|
||||
// TODO: remove the 3D view
|
||||
} else if (!window && command.isEnable()) {
|
||||
// TODO: create the 3D view
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,12 +38,14 @@ namespace QmlDesigner {
|
||||
class Qt5InformationNodeInstanceServer : public Qt5NodeInstanceServer
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit Qt5InformationNodeInstanceServer(NodeInstanceClientInterface *nodeInstanceClient);
|
||||
|
||||
void reparentInstances(const ReparentInstancesCommand &command) override;
|
||||
void clearScene(const ClearSceneCommand &command) override;
|
||||
void change3DView(const Change3DViewCommand &command) override;
|
||||
void update3DViewState(const Update3dViewStateCommand &command) override;
|
||||
void enable3DView(const Enable3DViewCommand &command) override;
|
||||
void createScene(const CreateSceneCommand &command) override;
|
||||
void completeComponent(const CompleteComponentCommand &command) override;
|
||||
void token(const TokenCommand &command) override;
|
||||
@@ -56,7 +58,6 @@ private slots:
|
||||
void handleObjectPropertyCommit(const QVariant &object, const QVariant &propName);
|
||||
void handleObjectPropertyChange(const QVariant &object, const QVariant &propName);
|
||||
void updateViewPortRect();
|
||||
void handleActiveChanged();
|
||||
|
||||
protected:
|
||||
void collectItemChangesAndSendChangeCommands() override;
|
||||
@@ -67,6 +68,7 @@ protected:
|
||||
bool isDirtyRecursiveForParentInstances(QQuickItem *item) const;
|
||||
void selectInstances(const QList<ServerNodeInstance> &instanceList);
|
||||
void modifyProperties(const QVector<InstancePropertyValueTriple> &properties);
|
||||
QList<ServerNodeInstance> createInstances(const QVector<InstanceContainer> &container) override;
|
||||
|
||||
private:
|
||||
void handleObjectPropertyChangeTimeout();
|
||||
@@ -74,8 +76,7 @@ private:
|
||||
QObject *createEditView3D(QQmlEngine *engine);
|
||||
void setup3DEditView(const QList<ServerNodeInstance> &instanceList);
|
||||
QObject *findRootNodeOf3DViewport(const QList<ServerNodeInstance> &instanceList) const;
|
||||
void findCamerasAndLights( const QList<ServerNodeInstance> &instanceList,
|
||||
QObjectList &cameras, QObjectList &lights) const;
|
||||
void createCameraAndLightGizmos(const QList<ServerNodeInstance> &instanceList) const;
|
||||
ServerNodeInstance findViewPort(const QList<ServerNodeInstance> &instanceList);
|
||||
QVector<InstancePropertyValueTriple> vectorToPropertyValue(const ServerNodeInstance &instance,
|
||||
const PropertyName &propertyName,
|
||||
@@ -84,12 +85,6 @@ private:
|
||||
const PropertyName &propertyName,
|
||||
ValuesModifiedCommand::TransactionOption option);
|
||||
|
||||
void showEditView(const QPoint &pos, const QSize &size);
|
||||
void hideEditView();
|
||||
void activateEditView();
|
||||
void moveEditView(const QPoint &pos);
|
||||
void resizeEditView(const QSize &size);
|
||||
|
||||
QObject *m_editView3D = nullptr;
|
||||
QSet<ServerNodeInstance> m_parentChangedSet;
|
||||
QList<ServerNodeInstance> m_completedComponentList;
|
||||
@@ -99,7 +94,6 @@ private:
|
||||
QVariant m_changedNode;
|
||||
PropertyName m_changedProperty;
|
||||
ServerNodeInstance m_viewPortInstance;
|
||||
bool m_blockViewActivate = false;
|
||||
QObject *m_rootNode = nullptr;
|
||||
ChangeSelectionCommand m_pendingSelectionChangeCommand;
|
||||
};
|
||||
|
||||
@@ -55,8 +55,6 @@ Rectangle {
|
||||
border.color: StudioTheme.Values.themeControlOutline
|
||||
border.width: StudioTheme.Values.border
|
||||
|
||||
property int numVisibleItems: myRepeater.count
|
||||
|
||||
Layout.preferredWidth: StudioTheme.Values.height * 10
|
||||
Layout.preferredHeight: myColumn.height
|
||||
|
||||
@@ -158,6 +156,13 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
id: dummyItem
|
||||
visible: myRepeater.count === 0
|
||||
width: StudioTheme.Values.height
|
||||
height: StudioTheme.Values.height
|
||||
}
|
||||
|
||||
Row {
|
||||
id: row
|
||||
spacing: -StudioTheme.Values.border
|
||||
@@ -175,7 +180,7 @@ Rectangle {
|
||||
StudioControls.AbstractButton {
|
||||
buttonIcon: "+"
|
||||
iconFont: StudioTheme.Constants.font
|
||||
enabled: !myRepeater.dirty
|
||||
enabled: !myRepeater.dirty && !(editableListView.backendValue.isInModel && !editableListView.backendValue.isIdList)
|
||||
onClicked: {
|
||||
var idx = myRepeater.localModel.push("") - 1
|
||||
myRepeater.model = myRepeater.localModel // trigger on change handler
|
||||
@@ -187,7 +192,7 @@ Rectangle {
|
||||
StudioControls.AbstractButton {
|
||||
buttonIcon: "-"
|
||||
iconFont: StudioTheme.Constants.font
|
||||
enabled: myRepeater.model.length
|
||||
enabled: myRepeater.model.length && !(editableListView.backendValue.isInModel && !editableListView.backendValue.isIdList)
|
||||
onClicked: {
|
||||
var lastItem = myColumn.currentIndex === myRepeater.localModel.length - 1
|
||||
if (myColumn.currentItem.initialModelData === "") {
|
||||
|
||||
@@ -768,7 +768,7 @@ QProcess *AndroidManager::runAdbCommandDetached(const QStringList &args, QString
|
||||
{
|
||||
std::unique_ptr<QProcess> p(new QProcess);
|
||||
const QString adb = AndroidConfigurations::currentConfig().adbToolPath().toString();
|
||||
qCDebug(androidManagerLog) << "Running command:" << adb << args.join(' ');
|
||||
qCDebug(androidManagerLog) << "Running command (async):" << CommandLine(adb, args).toUserOutput();
|
||||
p->start(adb, args);
|
||||
if (p->waitForStarted(500) && p->state() == QProcess::Running) {
|
||||
if (deleteOnFinish) {
|
||||
@@ -779,7 +779,9 @@ QProcess *AndroidManager::runAdbCommandDetached(const QStringList &args, QString
|
||||
}
|
||||
|
||||
QString errorStr = QString::fromUtf8(p->readAllStandardError());
|
||||
qCDebug(androidManagerLog) << "Running command failed" << adb << args.join(' ') << errorStr;
|
||||
qCDebug(androidManagerLog) << "Running command (async) failed:"
|
||||
<< CommandLine(adb, args).toUserOutput()
|
||||
<< "Output:" << errorStr;
|
||||
if (err)
|
||||
*err = errorStr;
|
||||
return nullptr;
|
||||
@@ -791,12 +793,12 @@ SdkToolResult AndroidManager::runCommand(const CommandLine &command,
|
||||
Android::SdkToolResult cmdResult;
|
||||
Utils::SynchronousProcess cmdProc;
|
||||
cmdProc.setTimeoutS(timeoutS);
|
||||
qCDebug(androidManagerLog) << "Running command: " << command.toUserOutput();
|
||||
qCDebug(androidManagerLog) << "Running command (sync):" << command.toUserOutput();
|
||||
SynchronousProcessResponse response = cmdProc.run(command, writeData);
|
||||
cmdResult.m_stdOut = response.stdOut().trimmed();
|
||||
cmdResult.m_stdErr = response.stdErr().trimmed();
|
||||
cmdResult.m_success = response.result == Utils::SynchronousProcessResponse::Finished;
|
||||
qCDebug(androidManagerLog) << "Running command finshed:" << command.toUserOutput()
|
||||
qCDebug(androidManagerLog) << "Running command (sync) finshed:" << command.toUserOutput()
|
||||
<< "Success:" << cmdResult.m_success
|
||||
<< "Output:" << response.allRawOutput();
|
||||
if (!cmdResult.success())
|
||||
|
||||
@@ -596,7 +596,7 @@ void AndroidRunnerWorker::handleJdbWaiting()
|
||||
QStringList jdbArgs("-connect");
|
||||
jdbArgs << QString("com.sun.jdi.SocketAttach:hostname=localhost,port=%1")
|
||||
.arg(m_localJdbServerPort.toString());
|
||||
qCDebug(androidRunWorkerLog) << "Starting JDB:" << jdbPath << jdbArgs.join(' ');
|
||||
qCDebug(androidRunWorkerLog) << "Starting JDB:" << CommandLine(jdbPath, jdbArgs).toUserOutput();
|
||||
std::unique_ptr<QProcess, Deleter> jdbProcess(new QProcess, &deleter);
|
||||
jdbProcess->setProcessChannelMode(QProcess::MergedChannels);
|
||||
jdbProcess->start(jdbPath.toString(), jdbArgs);
|
||||
|
||||
@@ -132,6 +132,8 @@ void watcherDeleter(QFutureWatcher<void> *watcher)
|
||||
static bool sdkManagerCommand(const AndroidConfig &config, const QStringList &args,
|
||||
QString *output, int timeout = sdkManagerCmdTimeoutS)
|
||||
{
|
||||
qCDebug(sdkManagerLog) << "Running SDK Manager command (sync):"
|
||||
<< CommandLine(config.sdkManagerToolPath(), args).toUserOutput();
|
||||
SynchronousProcess proc;
|
||||
proc.setProcessEnvironment(AndroidConfigurations::toolsEnvironment(config));
|
||||
proc.setTimeoutS(timeout);
|
||||
@@ -153,6 +155,8 @@ static void sdkManagerCommand(const AndroidConfig &config, const QStringList &ar
|
||||
AndroidSdkManager::OperationOutput &output, double progressQuota,
|
||||
bool interruptible = true, int timeout = sdkManagerOperationTimeoutS)
|
||||
{
|
||||
qCDebug(sdkManagerLog) << "Running SDK Manager command (async):"
|
||||
<< CommandLine(config.sdkManagerToolPath(), args).toUserOutput();
|
||||
int offset = fi.progressValue();
|
||||
SynchronousProcess proc;
|
||||
proc.setProcessEnvironment(AndroidConfigurations::toolsEnvironment(config));
|
||||
|
||||
@@ -86,15 +86,7 @@ QdbRunConfiguration::QdbRunConfiguration(Target *target, Core::Id id)
|
||||
addAspect<WorkingDirectoryAspect>();
|
||||
addAspect<FullCommandLineAspect>(this);
|
||||
|
||||
setUpdater([this, target, exeAspect, symbolsAspect] {
|
||||
const BuildTargetInfo bti = buildTargetInfo();
|
||||
const FilePath localExecutable = bti.targetFilePath;
|
||||
const DeployableFile depFile = target->deploymentData().deployableForLocalFile(localExecutable);
|
||||
|
||||
exeAspect->setExecutable(FilePath::fromString(depFile.remoteFilePath()));
|
||||
symbolsAspect->setFilePath(localExecutable);
|
||||
});
|
||||
|
||||
setUpdater([this] { updateTargetInformation(); });
|
||||
connect(target, &Target::buildSystemUpdated, this, &RunConfiguration::update);
|
||||
|
||||
setDefaultDisplayName(tr("Run on Boot2Qt Device"));
|
||||
@@ -110,6 +102,21 @@ Tasks QdbRunConfiguration::checkForIssues() const
|
||||
return tasks;
|
||||
}
|
||||
|
||||
void QdbRunConfiguration::doAdditionalSetup(const RunConfigurationCreationInfo &)
|
||||
{
|
||||
updateTargetInformation();
|
||||
}
|
||||
|
||||
void QdbRunConfiguration::updateTargetInformation()
|
||||
{
|
||||
const BuildTargetInfo bti = buildTargetInfo();
|
||||
const FilePath localExecutable = bti.targetFilePath;
|
||||
const DeployableFile depFile = target()->deploymentData().deployableForLocalFile(localExecutable);
|
||||
|
||||
aspect<ExecutableAspect>()->setExecutable(FilePath::fromString(depFile.remoteFilePath()));
|
||||
aspect<SymbolFileAspect>()->setFilePath(localExecutable);
|
||||
}
|
||||
|
||||
QString QdbRunConfiguration::defaultDisplayName() const
|
||||
{
|
||||
return RunConfigurationFactory::decoratedTargetName(buildKey(), target());
|
||||
|
||||
@@ -47,7 +47,8 @@ public:
|
||||
|
||||
private:
|
||||
ProjectExplorer::Tasks checkForIssues() const override;
|
||||
|
||||
void doAdditionalSetup(const ProjectExplorer::RunConfigurationCreationInfo &) override;
|
||||
void updateTargetInformation();
|
||||
QString defaultDisplayName() const;
|
||||
};
|
||||
|
||||
|
||||
@@ -125,8 +125,6 @@ const char CLOSE_ALTERNATIVE[] = "QtCreator.Close_Alternative"; // temporary
|
||||
const char CLOSEALL[] = "QtCreator.CloseAll";
|
||||
const char CLOSEOTHERS[] = "QtCreator.CloseOthers";
|
||||
const char CLOSEALLEXCEPTVISIBLE[] = "QtCreator.CloseAllExceptVisible";
|
||||
const char GOTONEXT[] = "QtCreator.GotoNext";
|
||||
const char GOTOPREV[] = "QtCreator.GotoPrevious";
|
||||
const char GOTONEXTINHISTORY[] = "QtCreator.GotoNextInHistory";
|
||||
const char GOTOPREVINHISTORY[] = "QtCreator.GotoPreviousInHistory";
|
||||
const char GO_BACK[] = "QtCreator.GoBack";
|
||||
|
||||
@@ -164,6 +164,8 @@ signals:
|
||||
void coreAboutToClose();
|
||||
void contextAboutToChange(const QList<Core::IContext *> &context);
|
||||
void contextChanged(const Core::Context &context);
|
||||
void windowStateChanged(Qt::WindowStates previousStates, Qt::WindowStates currentStates);
|
||||
void windowActivationChanged(bool isActive, bool hasPopup);
|
||||
|
||||
public:
|
||||
/* internal use */
|
||||
|
||||
@@ -201,6 +201,19 @@ MainWindow::MainWindow()
|
||||
this, &MainWindow::openDroppedFiles);
|
||||
}
|
||||
|
||||
// Edit View 3D needs to know when the main windows's state or activation change
|
||||
void MainWindow::changeEvent(QEvent *event)
|
||||
{
|
||||
if (event->type() == QEvent::WindowStateChange) {
|
||||
emit m_coreImpl->windowStateChanged(m_previousWindowStates, windowState());
|
||||
m_previousWindowStates = windowState();
|
||||
} else if (event->type() == QEvent::ActivationChange) {
|
||||
auto lastChild = qobject_cast<QWidget *>(children().last());
|
||||
bool hasPopup = lastChild && lastChild->isActiveWindow();
|
||||
emit m_coreImpl->windowActivationChanged(isActiveWindow(), hasPopup);
|
||||
}
|
||||
}
|
||||
|
||||
NavigationWidget *MainWindow::navigationWidget(Side side) const
|
||||
{
|
||||
return side == Side::Left ? m_leftNavigationWidget : m_rightNavigationWidget;
|
||||
|
||||
@@ -114,6 +114,7 @@ public slots:
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *event) override;
|
||||
void changeEvent(QEvent *event) override;
|
||||
|
||||
private:
|
||||
void openFile();
|
||||
@@ -192,6 +193,7 @@ private:
|
||||
QToolButton *m_toggleRightSideBarButton = nullptr;
|
||||
QColor m_overrideColor;
|
||||
QList<std::function<bool()>> m_preCloseListeners;
|
||||
Qt::WindowStates m_previousWindowStates = Qt::WindowNoState;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -100,7 +100,7 @@ const char SYMBOLS_FIND_FILTER_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("CppTools", "C
|
||||
// CLANG_VERSION here because it might denote a version that was not yet
|
||||
// released (e.g. 6.0.1, but only 6.0.0 was released).
|
||||
constexpr const char TIDY_DOCUMENTATION_URL_TEMPLATE[]
|
||||
= "https://releases.llvm.org/8.0.0/tools/clang/tools/extra/docs/clang-tidy/checks/%1.html";
|
||||
= "https://releases.llvm.org/8.0.1/tools/clang/tools/extra/docs/clang-tidy/checks/%1.html";
|
||||
|
||||
constexpr const char CLAZY_DOCUMENTATION_URL_TEMPLATE[]
|
||||
= "https://github.com/KDE/clazy/blob/master/docs/checks/README-%1.md";
|
||||
|
||||
@@ -355,6 +355,7 @@ static void addBuiltinConfigs(ClangDiagnosticConfigsModel &model)
|
||||
config.setClangOptions({
|
||||
"-Wall",
|
||||
"-Wextra",
|
||||
"-Wno-c++98-compat"
|
||||
});
|
||||
model.appendOrUpdate(config);
|
||||
|
||||
|
||||
@@ -1675,11 +1675,11 @@ void FakeVimPluginPrivate::editorOpened(IEditor *editor)
|
||||
if (key == "C" || key == "<C-C>")
|
||||
triggerAction(Core::Constants::REMOVE_CURRENT_SPLIT);
|
||||
else if (key == "N" || key == "<C-N>")
|
||||
triggerAction(Core::Constants::GOTONEXT);
|
||||
triggerAction(Core::Constants::GOTO_NEXT_SPLIT);
|
||||
else if (key == "O" || key == "<C-O>")
|
||||
keepOnlyWindow();
|
||||
else if (key == "P" || key == "<C-P>")
|
||||
triggerAction(Core::Constants::GOTOPREV);
|
||||
triggerAction(Core::Constants::GOTO_PREV_SPLIT);
|
||||
else if (key == "S" || key == "<C-S>")
|
||||
triggerAction(Core::Constants::SPLIT);
|
||||
else if (key == "V" || key == "<C-V>")
|
||||
|
||||
@@ -818,6 +818,8 @@ bool Client::reset()
|
||||
m_project = nullptr;
|
||||
for (const DocumentUri &uri : m_diagnostics.keys())
|
||||
removeDiagnostics(uri);
|
||||
for (TextEditor::TextDocument *document : m_resetAssistProvider.keys())
|
||||
resetAssistProviders(document);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -144,8 +144,7 @@ bool DesktopRunConfiguration::fromMap(const QVariantMap &map)
|
||||
if (!RunConfiguration::fromMap(map))
|
||||
return false;
|
||||
|
||||
if (m_kind == Qmake || m_kind == Qbs)
|
||||
updateTargetInformation();
|
||||
updateTargetInformation();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -166,12 +166,12 @@ QList<QByteArray> Macro::tokenizeLine(const QByteArray &line)
|
||||
|
||||
const auto begin = normalizedLine.begin();
|
||||
auto first = std::find(normalizedLine.begin(), normalizedLine.end(), ' ');
|
||||
auto second = std::find(std::next(first), normalizedLine.end(), ' ');
|
||||
const auto end = normalizedLine.end();
|
||||
|
||||
QList<QByteArray> tokens;
|
||||
|
||||
if (first != end) {
|
||||
auto second = std::find(std::next(first), normalizedLine.end(), ' ');
|
||||
tokens.append(QByteArray(begin, int(std::distance(begin, first))));
|
||||
|
||||
std::advance(first, 1);
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "pythonrunconfiguration.h"
|
||||
#include "pythonsettings.h"
|
||||
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
#include <coreplugin/infobar.h>
|
||||
#include <coreplugin/progressmanager/progressmanager.h>
|
||||
|
||||
@@ -446,7 +447,16 @@ void PyLSConfigureAssistant::resetEditorInfoBar(TextEditor::TextDocument *docume
|
||||
|
||||
PyLSConfigureAssistant::PyLSConfigureAssistant(QObject *parent)
|
||||
: QObject(parent)
|
||||
{}
|
||||
{
|
||||
Core::EditorManager::instance();
|
||||
connect(Core::EditorManager::instance(),
|
||||
&Core::EditorManager::documentClosed,
|
||||
this,
|
||||
[this](Core::IDocument *document) {
|
||||
if (auto textDocument = qobject_cast<TextEditor::TextDocument *>(document))
|
||||
resetEditorInfoBar(textDocument);
|
||||
});
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Python
|
||||
|
||||
@@ -140,7 +140,8 @@ extend_qtc_plugin(QmlDesigner
|
||||
valueschangedcommand.cpp valueschangedcommand.h
|
||||
changeselectioncommand.cpp changeselectioncommand.h
|
||||
drop3dlibraryitemcommand.cpp drop3dlibraryitemcommand.h
|
||||
change3dviewcommand.cpp change3dviewcommand.h
|
||||
update3dviewstatecommand.cpp update3dviewstatecommand.h
|
||||
enable3dviewcommand.cpp enable3dviewcommand.h
|
||||
)
|
||||
|
||||
extend_qtc_plugin(QmlDesigner
|
||||
@@ -235,7 +236,6 @@ extend_qtc_plugin(QmlDesigner
|
||||
snappinglinecreator.cpp snappinglinecreator.h
|
||||
toolbox.cpp toolbox.h
|
||||
option3daction.cpp option3daction.h
|
||||
editview3dproxydialog.cpp editview3dproxydialog.h
|
||||
)
|
||||
|
||||
extend_qtc_plugin(QmlDesigner
|
||||
|
||||
@@ -123,7 +123,7 @@ void ActionEditor::updateWindowName()
|
||||
{
|
||||
if (!m_dialog.isNull())
|
||||
{
|
||||
m_dialog->setWindowTitle(tr("Action Editor"));
|
||||
m_dialog->setWindowTitle(tr("Connection Editor"));
|
||||
m_dialog->raise();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -290,7 +290,28 @@ void ConnectionModel::abstractPropertyChanged(const AbstractProperty &abstractPr
|
||||
|
||||
void ConnectionModel::deleteConnectionByRow(int currentRow)
|
||||
{
|
||||
signalHandlerPropertyForRow(currentRow).parentModelNode().destroy();
|
||||
SignalHandlerProperty targetSignal = signalHandlerPropertyForRow(currentRow);
|
||||
QmlDesigner::ModelNode node = targetSignal.parentModelNode();
|
||||
QList<SignalHandlerProperty> allSignals = node.signalProperties();
|
||||
if (allSignals.size() > 1) {
|
||||
if (allSignals.contains(targetSignal))
|
||||
node.removeProperty(targetSignal.name());
|
||||
}
|
||||
else {
|
||||
node.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
void ConnectionModel::removeRowFromTable(const SignalHandlerProperty &property)
|
||||
{
|
||||
for (int currentRow = 0; currentRow < rowCount(); currentRow++) {
|
||||
SignalHandlerProperty targetSignal = signalHandlerPropertyForRow(currentRow);
|
||||
|
||||
if (targetSignal == property) {
|
||||
removeRow(currentRow);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ConnectionModel::handleException()
|
||||
|
||||
@@ -63,6 +63,7 @@ public:
|
||||
void abstractPropertyChanged(const AbstractProperty &abstractProperty);
|
||||
|
||||
void deleteConnectionByRow(int currentRow);
|
||||
void removeRowFromTable(const SignalHandlerProperty &property);
|
||||
|
||||
protected:
|
||||
void addModelNode(const ModelNode &modelNode);
|
||||
|
||||
@@ -108,6 +108,8 @@ void ConnectionView::propertiesAboutToBeRemoved(const QList<AbstractProperty> &
|
||||
dynamicPropertiesModel()->bindingRemoved(property.toBindingProperty());
|
||||
} else if (property.isVariantProperty()) {
|
||||
//### dynamicPropertiesModel->bindingRemoved(property.toVariantProperty());
|
||||
} else if (property.isSignalHandlerProperty()) {
|
||||
connectionModel()->removeRowFromTable(property.toSignalHandlerProperty());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -180,6 +182,11 @@ bool ConnectionView::hasWidget() const
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ConnectionView::isWidgetEnabled()
|
||||
{
|
||||
return widgetInfo().widget->isEnabled();
|
||||
}
|
||||
|
||||
QTableView *ConnectionView::connectionTableView() const
|
||||
{
|
||||
return connectionViewWidget()->connectionTableView();
|
||||
|
||||
@@ -74,6 +74,7 @@ public:
|
||||
|
||||
WidgetInfo widgetInfo() override;
|
||||
bool hasWidget() const override;
|
||||
bool isWidgetEnabled();
|
||||
|
||||
QTableView *connectionTableView() const;
|
||||
QTableView *bindingTableView() const;
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
#include <QToolButton>
|
||||
#include <QStyleFactory>
|
||||
#include <QMenu>
|
||||
#include <QShortcut>
|
||||
|
||||
#include <bindingeditor/actioneditor.h>
|
||||
|
||||
@@ -57,11 +58,13 @@ ConnectionViewWidget::ConnectionViewWidget(QWidget *parent) :
|
||||
ui(new Ui::ConnectionViewWidget)
|
||||
{
|
||||
m_actionEditor = new QmlDesigner::ActionEditor(this);
|
||||
m_deleteShortcut = new QShortcut(this);
|
||||
QObject::connect(m_actionEditor, &QmlDesigner::ActionEditor::accepted,
|
||||
[&]() {
|
||||
if (m_actionEditor->hasModelIndex()) {
|
||||
ConnectionModel *connectionModel = qobject_cast<ConnectionModel *>(ui->connectionView->model());
|
||||
if (connectionModel->rowCount() > m_actionEditor->modelIndex().row())
|
||||
if (connectionModel->connectionView()->isWidgetEnabled()
|
||||
&& (connectionModel->rowCount() > m_actionEditor->modelIndex().row()))
|
||||
{
|
||||
SignalHandlerProperty signalHandler =
|
||||
connectionModel->signalHandlerPropertyForRow(m_actionEditor->modelIndex().row());
|
||||
@@ -123,6 +126,7 @@ ConnectionViewWidget::~ConnectionViewWidget()
|
||||
{
|
||||
delete m_actionEditor;
|
||||
delete ui;
|
||||
delete m_deleteShortcut;
|
||||
}
|
||||
|
||||
void ConnectionViewWidget::setBindingModel(BindingModel *model)
|
||||
@@ -163,7 +167,7 @@ void ConnectionViewWidget::contextMenuEvent(QContextMenuEvent *event)
|
||||
|
||||
QMenu menu(this);
|
||||
|
||||
menu.addAction(tr("Open Action Editor"), [&]() {
|
||||
menu.addAction(tr("Open Connection Editor"), [&]() {
|
||||
if (index.isValid()) {
|
||||
m_actionEditor->showWidget(mapToGlobal(event->pos()).x(), mapToGlobal(event->pos()).y());
|
||||
m_actionEditor->setBindingValue(index.data().toString());
|
||||
@@ -212,6 +216,10 @@ QList<QToolButton *> ConnectionViewWidget::createToolBarWidgets()
|
||||
connect(buttons.constLast(), &QAbstractButton::clicked, this, &ConnectionViewWidget::removeButtonClicked);
|
||||
connect(this, &ConnectionViewWidget::setEnabledRemoveButton, buttons.constLast(), &QWidget::setEnabled);
|
||||
|
||||
m_deleteShortcut->setKey(Qt::Key_Delete);
|
||||
m_deleteShortcut->setContext(Qt::WidgetWithChildrenShortcut);
|
||||
connect(m_deleteShortcut, &QShortcut::activated, this, &ConnectionViewWidget::removeButtonClicked);
|
||||
|
||||
return buttons;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <QAbstractItemView>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QShortcut;
|
||||
class QToolButton;
|
||||
class QTableView;
|
||||
class QListView;
|
||||
@@ -101,6 +102,7 @@ private:
|
||||
private:
|
||||
Ui::ConnectionViewWidget *ui;
|
||||
QmlDesigner::ActionEditor *m_actionEditor;
|
||||
QShortcut *m_deleteShortcut;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -1,168 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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 "editview3dproxydialog.h"
|
||||
#include "formeditorview.h"
|
||||
|
||||
#include <nodeinstanceview.h>
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
#include <utils/hostosinfo.h>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QMouseEvent>
|
||||
#include <QStyle>
|
||||
#include <QWindow>
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
const int borderOffset = 8;
|
||||
|
||||
static int titleBarHeight() {
|
||||
return QApplication::style()->pixelMetric(QStyle::PM_TitleBarHeight);
|
||||
}
|
||||
|
||||
EditView3DProxyDialog::EditView3DProxyDialog(FormEditorView *view) :
|
||||
QDialog(Core::ICore::dialogParent())
|
||||
,m_formEditorView(view)
|
||||
{
|
||||
setFocusPolicy(Qt::ClickFocus);
|
||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||
|
||||
if (Utils::HostOsInfo::isMacHost()) {
|
||||
setWindowFlag(Qt::Tool);
|
||||
setAttribute(Qt::WA_MacAlwaysShowToolWindow);
|
||||
}
|
||||
|
||||
resize(1024, 768);
|
||||
}
|
||||
|
||||
void EditView3DProxyDialog::invalidate()
|
||||
{
|
||||
if (nodeInstanceView() && isVisible())
|
||||
nodeInstanceView()->show3DView(adjustedRect());
|
||||
}
|
||||
|
||||
void EditView3DProxyDialog::moveEvent(QMoveEvent *event)
|
||||
{
|
||||
if (nodeInstanceView())
|
||||
nodeInstanceView()->move3DView(pos() + QPoint(borderOffset, titleBarHeight() + 2 * borderOffset));
|
||||
|
||||
QDialog::moveEvent(event);
|
||||
}
|
||||
|
||||
void EditView3DProxyDialog::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
if (m_formEditorView) {
|
||||
m_formEditorView->toggle3DViewEnabled(false);
|
||||
m_formEditorView->setupOption3DAction();
|
||||
}
|
||||
|
||||
nodeInstanceView()->hide3DView();
|
||||
|
||||
QDialog::closeEvent(event);
|
||||
}
|
||||
|
||||
void EditView3DProxyDialog::hideEvent(QHideEvent *event)
|
||||
{
|
||||
if (m_formEditorView) {
|
||||
m_formEditorView->toggle3DViewEnabled(false);
|
||||
m_formEditorView->setupOption3DAction();
|
||||
}
|
||||
|
||||
nodeInstanceView()->hide3DView();
|
||||
|
||||
QDialog::hideEvent(event);
|
||||
}
|
||||
|
||||
void EditView3DProxyDialog::focusOutEvent(QFocusEvent *event)
|
||||
{
|
||||
if (isVisible())
|
||||
showView();
|
||||
|
||||
QDialog::focusOutEvent(event);
|
||||
}
|
||||
|
||||
void EditView3DProxyDialog::focusInEvent(QFocusEvent *event)
|
||||
{
|
||||
showView();
|
||||
|
||||
QDialog::focusInEvent(event);
|
||||
}
|
||||
|
||||
void EditView3DProxyDialog::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
if (nodeInstanceView())
|
||||
nodeInstanceView()->show3DView(adjustedRect());
|
||||
|
||||
QDialog::resizeEvent(event);
|
||||
}
|
||||
|
||||
bool EditView3DProxyDialog::event(QEvent *event)
|
||||
{
|
||||
if (event->type() == QEvent::WindowActivate) {
|
||||
showView();
|
||||
} else if (event->type() == QEvent::NonClientAreaMouseButtonPress) {
|
||||
auto mouseMoveEvent = static_cast<QMouseEvent *>(event);
|
||||
if (mouseMoveEvent->buttons() & Qt::LeftButton)
|
||||
hideView();
|
||||
} else if (event->type() == QEvent::NonClientAreaMouseButtonRelease) {
|
||||
auto mouseMoveEvent = static_cast<QMouseEvent *>(event);
|
||||
if (mouseMoveEvent->buttons() & Qt::LeftButton)
|
||||
showView();
|
||||
}
|
||||
|
||||
return QDialog::event(event);
|
||||
}
|
||||
|
||||
QRect EditView3DProxyDialog::adjustedRect() const
|
||||
{
|
||||
return QRect(pos(), size()).adjusted(borderOffset,
|
||||
titleBarHeight() + 2 * borderOffset,
|
||||
-borderOffset, titleBarHeight());
|
||||
}
|
||||
|
||||
NodeInstanceView *EditView3DProxyDialog::nodeInstanceView() const
|
||||
{
|
||||
if (m_formEditorView)
|
||||
return m_formEditorView->nodeInstanceView();
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void EditView3DProxyDialog::showView()
|
||||
{
|
||||
if (nodeInstanceView())
|
||||
nodeInstanceView()->show3DView(adjustedRect());
|
||||
}
|
||||
|
||||
void EditView3DProxyDialog::hideView()
|
||||
{
|
||||
if (nodeInstanceView())
|
||||
nodeInstanceView()->hide3DView();
|
||||
}
|
||||
|
||||
} //QmlDesigner
|
||||
@@ -1,6 +1,5 @@
|
||||
VPATH += $$PWD
|
||||
SOURCES += formeditoritem.cpp \
|
||||
editview3dproxydialog.cpp \
|
||||
formeditorview.cpp \
|
||||
formeditorscene.cpp \
|
||||
formeditorwidget.cpp \
|
||||
@@ -41,7 +40,6 @@ SOURCES += formeditoritem.cpp \
|
||||
option3daction.cpp
|
||||
|
||||
HEADERS += formeditorscene.h \
|
||||
editview3dproxydialog.h \
|
||||
formeditorwidget.h \
|
||||
formeditoritem.h \
|
||||
formeditorview.h \
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "formeditorview.h"
|
||||
#include "nodeinstanceview.h"
|
||||
#include "selectiontool.h"
|
||||
#include "movetool.h"
|
||||
#include "option3daction.h"
|
||||
@@ -475,8 +476,6 @@ void FormEditorView::instancesCompleted(const QVector<ModelNode> &completedNodeL
|
||||
itemNodeList.append(item);
|
||||
}
|
||||
}
|
||||
if (node.isRootNode())
|
||||
formEditorWidget()->invalidate3DEditor();
|
||||
}
|
||||
currentTool()->instancesCompleted(itemNodeList);
|
||||
}
|
||||
@@ -598,7 +597,7 @@ void FormEditorView::toggle3DViewEnabled(bool enabled)
|
||||
else
|
||||
rootModelNode().setAuxiliaryData("3d-view", false);
|
||||
|
||||
formEditorWidget()->set3dEditorVisibility(enabled);
|
||||
nodeInstanceView()->enable3DView(enabled);
|
||||
}
|
||||
|
||||
QmlItemNode findRecursiveQmlItemNode(const QmlObjectNode &firstQmlObjectNode)
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "designeractionmanager.h"
|
||||
#include "editview3dproxydialog.h"
|
||||
#include "formeditorwidget.h"
|
||||
#include "formeditorscene.h"
|
||||
#include "qmldesignerplugin.h"
|
||||
@@ -174,14 +173,11 @@ FormEditorWidget::FormEditorWidget(FormEditorView *view) :
|
||||
|
||||
fillLayout->addWidget(m_graphicsView.data());
|
||||
m_graphicsView.data()->setStyleSheet(Theme::replaceCssColors(QString::fromUtf8(Utils::FileReader::fetchQrc(QLatin1String(":/qmldesigner/scrollbar.css")))));
|
||||
|
||||
m_editView3DProxyDialog = new EditView3DProxyDialog(view);
|
||||
}
|
||||
|
||||
void FormEditorWidget::changeTransformTool(bool checked)
|
||||
{
|
||||
if (checked)
|
||||
|
||||
m_formEditorView->changeToTransformTools();
|
||||
}
|
||||
|
||||
@@ -397,17 +393,6 @@ FormEditorGraphicsView *FormEditorWidget::graphicsView() const
|
||||
return m_graphicsView;
|
||||
}
|
||||
|
||||
void FormEditorWidget::set3dEditorVisibility(bool b)
|
||||
{
|
||||
m_editView3DProxyDialog->setVisible(b);
|
||||
}
|
||||
|
||||
void FormEditorWidget::invalidate3DEditor()
|
||||
{
|
||||
if (m_editView3DProxyDialog)
|
||||
m_editView3DProxyDialog->invalidate();
|
||||
}
|
||||
|
||||
DocumentWarningWidget *FormEditorWidget::errorWidget()
|
||||
{
|
||||
if (m_documentErrorWidget.isNull()) {
|
||||
|
||||
@@ -37,7 +37,6 @@ QT_END_NAMESPACE
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
class EditView3DProxyDialog;
|
||||
class ZoomAction;
|
||||
class LineEditAction;
|
||||
class BackgroundAction;
|
||||
@@ -87,9 +86,6 @@ public:
|
||||
|
||||
FormEditorGraphicsView *graphicsView() const;
|
||||
|
||||
void set3dEditorVisibility(bool b);
|
||||
void invalidate3DEditor();
|
||||
|
||||
protected:
|
||||
void wheelEvent(QWheelEvent *event) override;
|
||||
QActionGroup *toolActionGroup() const;
|
||||
@@ -120,7 +116,6 @@ private:
|
||||
QPointer<Option3DAction> m_option3DAction;
|
||||
QPointer<QAction> m_resetAction;
|
||||
QPointer<DocumentWarningWidget> m_documentErrorWidget;
|
||||
QPointer<EditView3DProxyDialog> m_editView3DProxyDialog;
|
||||
};
|
||||
|
||||
} // namespace QmlDesigner
|
||||
|
||||
@@ -389,6 +389,7 @@ void ItemLibraryAssetImporter::parseQuick3DAsset(const QString &file, const QVar
|
||||
|
||||
#else
|
||||
Q_UNUSED(file)
|
||||
Q_UNUSED(options)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -375,7 +375,9 @@ QStringList PropertyEditorValue::getExpressionAsList() const
|
||||
|
||||
bool PropertyEditorValue::idListAdd(const QString &value)
|
||||
{
|
||||
QTC_ASSERT(isIdList(), return false);
|
||||
const QmlDesigner::QmlObjectNode objectNode(modelNode());
|
||||
if (!isIdList() && (objectNode.isValid() && objectNode.hasProperty(name())))
|
||||
return false;
|
||||
|
||||
static const QRegExp rx("^[a-z_]\\w*|^[A-Z]\\w*\\.{1}([a-z_]\\w*\\.?)+");
|
||||
if (!rx.exactMatch(value))
|
||||
@@ -393,7 +395,6 @@ bool PropertyEditorValue::idListRemove(int idx)
|
||||
QTC_ASSERT(isIdList(), return false);
|
||||
|
||||
auto stringList = generateStringList(expression());
|
||||
|
||||
if (idx < 0 || idx >= stringList.size())
|
||||
return false;
|
||||
|
||||
@@ -438,6 +439,8 @@ QString PropertyEditorValue::generateString(const QStringList &stringList) const
|
||||
{
|
||||
if (stringList.size() > 1)
|
||||
return "[" + stringList.join(",") + "]";
|
||||
else if (stringList.isEmpty())
|
||||
return QString();
|
||||
else
|
||||
return stringList.first();
|
||||
}
|
||||
|
||||
@@ -83,6 +83,7 @@ class PropertyEditorValue : public QObject
|
||||
Q_PROPERTY(bool isValid READ isValid NOTIFY isValidChanged FINAL)
|
||||
Q_PROPERTY(bool isTranslated READ isTranslated NOTIFY expressionChanged FINAL)
|
||||
|
||||
Q_PROPERTY(bool isIdList READ isIdList NOTIFY expressionChanged FINAL)
|
||||
Q_PROPERTY(QStringList expressionAsList READ getExpressionAsList NOTIFY expressionChanged FINAL)
|
||||
|
||||
Q_PROPERTY(QString name READ nameAsQString FINAL)
|
||||
|
||||
@@ -280,8 +280,10 @@ void PropertyEditorView::changeExpression(const QString &propertyName)
|
||||
}
|
||||
}
|
||||
|
||||
if (value->expression().isEmpty())
|
||||
if (value->expression().isEmpty()) {
|
||||
value->resetValue();
|
||||
return;
|
||||
}
|
||||
|
||||
if (qmlObjectNode.expression(name) != value->expression() || !qmlObjectNode.propertyAffectedByCurrentState(name))
|
||||
qmlObjectNode.setBindingProperty(name, value->expression());
|
||||
|
||||
@@ -133,6 +133,7 @@ public:
|
||||
QList<NodeProperty> nodeProperties() const;
|
||||
QList<NodeListProperty> nodeListProperties() const;
|
||||
QList<BindingProperty> bindingProperties() const;
|
||||
QList<SignalHandlerProperty> signalProperties() const;
|
||||
PropertyNameList propertyNames() const;
|
||||
|
||||
bool hasProperties() const;
|
||||
|
||||
@@ -51,7 +51,6 @@ class CreateSceneCommand;
|
||||
class CreateInstancesCommand;
|
||||
class ClearSceneCommand;
|
||||
class ReparentInstancesCommand;
|
||||
class Change3DViewCommand;
|
||||
class ChangeFileUrlCommand;
|
||||
class ChangeValuesCommand;
|
||||
class ChangeBindingsCommand;
|
||||
@@ -134,15 +133,14 @@ public:
|
||||
void selectedNodesChanged(const QList<ModelNode> &selectedNodeList,
|
||||
const QList<ModelNode> &lastSelectedNodeList) override;
|
||||
|
||||
void show3DView(const QRect &rect);
|
||||
void move3DView(const QPoint &position);
|
||||
void hide3DView();
|
||||
void mainWindowStateChanged(Qt::WindowStates previousStates, Qt::WindowStates currentStates);
|
||||
void mainWindowActiveChanged(bool active, bool hasPopup);
|
||||
void enable3DView(bool enable);
|
||||
|
||||
protected:
|
||||
void timerEvent(QTimerEvent *event) override;
|
||||
|
||||
private: // functions
|
||||
enum ViewAction { Show, Move, Hide };
|
||||
void activateState(const NodeInstance &instance);
|
||||
void activateBaseState();
|
||||
|
||||
@@ -167,7 +165,6 @@ private: // functions
|
||||
|
||||
|
||||
CreateSceneCommand createCreateSceneCommand();
|
||||
Change3DViewCommand createChange3DViewCommand(ViewAction action, const QPoint &pos = {}, const QSize &size = {}) const;
|
||||
ClearSceneCommand createClearSceneCommand() const;
|
||||
CreateInstancesCommand createCreateInstancesCommand(const QList<NodeInstance> &instanceList) const;
|
||||
CompleteComponentCommand createComponentCompleteCommand(const QList<NodeInstance> &instanceList) const;
|
||||
|
||||
@@ -29,7 +29,8 @@
|
||||
|
||||
#include <createinstancescommand.h>
|
||||
#include <createscenecommand.h>
|
||||
#include <change3dviewcommand.h>
|
||||
#include <update3dviewstatecommand.h>
|
||||
#include <enable3dviewcommand.h>
|
||||
#include <changevaluescommand.h>
|
||||
#include <changebindingscommand.h>
|
||||
#include <changeauxiliarycommand.h>
|
||||
@@ -651,7 +652,12 @@ void NodeInstanceServerProxy::clearScene(const ClearSceneCommand &command)
|
||||
writeCommand(QVariant::fromValue(command));
|
||||
}
|
||||
|
||||
void NodeInstanceServerProxy::change3DView(const Change3DViewCommand &command)
|
||||
void NodeInstanceServerProxy::update3DViewState(const Update3dViewStateCommand &command)
|
||||
{
|
||||
writeCommand(QVariant::fromValue(command));
|
||||
}
|
||||
|
||||
void NodeInstanceServerProxy::enable3DView(const Enable3DViewCommand &command)
|
||||
{
|
||||
writeCommand(QVariant::fromValue(command));
|
||||
}
|
||||
|
||||
@@ -67,7 +67,8 @@ public:
|
||||
void createInstances(const CreateInstancesCommand &command) override;
|
||||
void changeFileUrl(const ChangeFileUrlCommand &command) override;
|
||||
void createScene(const CreateSceneCommand &command) override;
|
||||
void change3DView(const Change3DViewCommand &command) override;
|
||||
void update3DViewState(const Update3dViewStateCommand &command) override;
|
||||
void enable3DView(const Enable3DViewCommand &command) override;
|
||||
void clearScene(const ClearSceneCommand &command) override;
|
||||
void removeInstances(const RemoveInstancesCommand &command) override;
|
||||
void changeSelection(const ChangeSelectionCommand &command) override;
|
||||
|
||||
@@ -48,7 +48,8 @@
|
||||
#include "clearscenecommand.h"
|
||||
#include "changefileurlcommand.h"
|
||||
#include "reparentinstancescommand.h"
|
||||
#include "change3dviewcommand.h"
|
||||
#include "update3dviewstatecommand.h"
|
||||
#include "enable3dviewcommand.h"
|
||||
#include "changevaluescommand.h"
|
||||
#include "changeauxiliarycommand.h"
|
||||
#include "changebindingscommand.h"
|
||||
@@ -979,20 +980,6 @@ ClearSceneCommand NodeInstanceView::createClearSceneCommand() const
|
||||
return {};
|
||||
}
|
||||
|
||||
Change3DViewCommand NodeInstanceView::createChange3DViewCommand(ViewAction action, const QPoint &pos, const QSize &size) const
|
||||
{
|
||||
InformationName informationName = InformationName::ShowView;
|
||||
|
||||
if (action == ViewAction::Move)
|
||||
informationName = InformationName::MoveView;
|
||||
else if (action == ViewAction::Hide)
|
||||
informationName = InformationName::HideView;
|
||||
|
||||
const qint32 instanceId = 0;
|
||||
|
||||
return Change3DViewCommand({ InformationContainer(instanceId, informationName, pos, size) });
|
||||
}
|
||||
|
||||
CompleteComponentCommand NodeInstanceView::createComponentCompleteCommand(const QList<NodeInstance> &instanceList) const
|
||||
{
|
||||
QVector<qint32> containerList;
|
||||
@@ -1465,21 +1452,22 @@ void NodeInstanceView::selectedNodesChanged(const QList<ModelNode> &selectedNode
|
||||
nodeInstanceServer()->changeSelection(createChangeSelectionCommand(selectedNodeList));
|
||||
}
|
||||
|
||||
void NodeInstanceView::move3DView(const QPoint &position)
|
||||
void NodeInstanceView::mainWindowStateChanged(Qt::WindowStates previousStates, Qt::WindowStates currentStates)
|
||||
{
|
||||
nodeInstanceServer()->change3DView(createChange3DViewCommand(ViewAction::Move, position));
|
||||
if (nodeInstanceServer())
|
||||
nodeInstanceServer()->update3DViewState(Update3dViewStateCommand(previousStates, currentStates));
|
||||
}
|
||||
|
||||
void NodeInstanceView::hide3DView()
|
||||
void NodeInstanceView::mainWindowActiveChanged(bool active, bool hasPopup)
|
||||
{
|
||||
nodeInstanceServer()->change3DView(createChange3DViewCommand(ViewAction::Hide));
|
||||
if (nodeInstanceServer())
|
||||
nodeInstanceServer()->update3DViewState(Update3dViewStateCommand(active, hasPopup));
|
||||
}
|
||||
|
||||
void NodeInstanceView::show3DView(const QRect &rect)
|
||||
// enable / disable 3D edit View
|
||||
void NodeInstanceView::enable3DView(bool enable)
|
||||
{
|
||||
nodeInstanceServer()->change3DView(createChange3DViewCommand(ViewAction::Show,
|
||||
rect.topLeft(),
|
||||
rect.size()));
|
||||
nodeInstanceServer()->enable3DView(Enable3DViewCommand(enable));
|
||||
}
|
||||
|
||||
void NodeInstanceView::timerEvent(QTimerEvent *event)
|
||||
|
||||
@@ -644,6 +644,16 @@ QList<BindingProperty> ModelNode::bindingProperties() const
|
||||
return propertyList;
|
||||
}
|
||||
|
||||
QList<SignalHandlerProperty> ModelNode::signalProperties() const
|
||||
{
|
||||
QList<SignalHandlerProperty> propertyList;
|
||||
|
||||
foreach (const AbstractProperty &property, properties())
|
||||
if (property.isSignalHandlerProperty())
|
||||
propertyList.append(property.toSignalHandlerProperty());
|
||||
return propertyList;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief removes a property from this node
|
||||
\param name name of the property
|
||||
|
||||
@@ -57,34 +57,6 @@ bool QmlItemNode::isItemOrWindow(const ModelNode &modelNode)
|
||||
return false;
|
||||
}
|
||||
|
||||
static QmlItemNode createQmlItemNodeFromSource(AbstractView *view, const QString &source, const QPointF &position)
|
||||
{
|
||||
QScopedPointer<Model> inputModel(Model::create("QtQuick.Item", 1, 0, view->model()));
|
||||
inputModel->setFileUrl(view->model()->fileUrl());
|
||||
QPlainTextEdit textEdit;
|
||||
|
||||
textEdit.setPlainText(source);
|
||||
NotIndentingTextEditModifier modifier(&textEdit);
|
||||
|
||||
QScopedPointer<RewriterView> rewriterView(new RewriterView(RewriterView::Amend, nullptr));
|
||||
rewriterView->setCheckSemanticErrors(false);
|
||||
rewriterView->setTextModifier(&modifier);
|
||||
inputModel->setRewriterView(rewriterView.data());
|
||||
|
||||
if (rewriterView->errors().isEmpty() && rewriterView->rootModelNode().isValid()) {
|
||||
ModelNode rootModelNode = rewriterView->rootModelNode();
|
||||
inputModel->detachView(rewriterView.data());
|
||||
|
||||
rootModelNode.variantProperty("x").setValue(qRound(position.x()));
|
||||
rootModelNode.variantProperty("y").setValue(qRound(position.y()));
|
||||
|
||||
ModelMerger merger(view);
|
||||
return merger.insertModel(rootModelNode);
|
||||
}
|
||||
|
||||
return QmlItemNode();
|
||||
}
|
||||
|
||||
QmlItemNode QmlItemNode::createQmlItemNode(AbstractView *view,
|
||||
const ItemLibraryEntry &itemLibraryEntry,
|
||||
const QPointF &position,
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "designmodecontext.h"
|
||||
#include "openuiqmlfiledialog.h"
|
||||
#include "generateresource.h"
|
||||
#include "nodeinstanceview.h"
|
||||
|
||||
#include <metainfo.h>
|
||||
#include <connectionview.h>
|
||||
@@ -249,6 +250,16 @@ void QmlDesignerPlugin::extensionsInitialized()
|
||||
connect(Core::ICore::instance(), &Core::ICore::coreAboutToOpen, this, [this] {
|
||||
integrateIntoQtCreator(&d->mainWidget);
|
||||
});
|
||||
|
||||
connect(Core::ICore::instance(), &Core::ICore::windowStateChanged, this,
|
||||
[this] (Qt::WindowStates previousStates, Qt::WindowStates currentStates) {
|
||||
d->viewManager.nodeInstanceView()->mainWindowStateChanged(previousStates, currentStates);
|
||||
});
|
||||
|
||||
connect(Core::ICore::instance(), &Core::ICore::windowActivationChanged, this,
|
||||
[this] (bool isActive, bool hasPopup) {
|
||||
d->viewManager.nodeInstanceView()->mainWindowActiveChanged(isActive, hasPopup);
|
||||
});
|
||||
}
|
||||
|
||||
static QStringList allUiQmlFilesforCurrentProject(const Utils::FilePath &fileName)
|
||||
|
||||
@@ -171,8 +171,10 @@ Project {
|
||||
"commands/changeselectioncommand.h",
|
||||
"commands/drop3dlibraryitemcommand.cpp",
|
||||
"commands/drop3dlibraryitemcommand.h",
|
||||
"commands/change3dviewcommand.cpp",
|
||||
"commands/change3dviewcommand.h",
|
||||
"commands/update3dviewstatecommand.cpp",
|
||||
"commands/update3dviewstatecommand.h",
|
||||
"commands/enable3dviewcommand.cpp",
|
||||
"commands/enable3dviewcommand.h",
|
||||
"container/addimportcontainer.cpp",
|
||||
"container/addimportcontainer.h",
|
||||
"container/idcontainer.cpp",
|
||||
@@ -454,8 +456,6 @@ Project {
|
||||
"formeditor/controlelement.h",
|
||||
"formeditor/dragtool.cpp",
|
||||
"formeditor/dragtool.h",
|
||||
"formeditor/editview3dproxydialog.cpp",
|
||||
"formeditor/editview3dproxydialog.h",
|
||||
"formeditor/formeditor.qrc",
|
||||
"formeditor/formeditorgraphicsview.cpp",
|
||||
"formeditor/formeditorgraphicsview.h",
|
||||
|
||||
@@ -42,6 +42,8 @@ class QmlProjectItem;
|
||||
|
||||
class QmlBuildSystem : public ProjectExplorer::BuildSystem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit QmlBuildSystem(ProjectExplorer::Target *target);
|
||||
~QmlBuildSystem();
|
||||
|
||||
@@ -384,7 +384,7 @@ QString QmlProjectRunConfiguration::commandLineArguments() const
|
||||
const OsType osType = device ? device->osType() : HostOsInfo::hostOs();
|
||||
|
||||
// arguments from .qmlproject file
|
||||
const QmlBuildSystem *bs = static_cast<QmlBuildSystem *>(target()->buildSystem());
|
||||
const QmlBuildSystem *bs = qobject_cast<QmlBuildSystem *>(target()->buildSystem());
|
||||
foreach (const QString &importPath,
|
||||
QmlBuildSystem::makeAbsolute(bs->targetDirectory(), bs->customImportPaths())) {
|
||||
QtcProcess::addArg(&args, "-I", osType);
|
||||
|
||||
@@ -69,17 +69,7 @@ QnxRunConfiguration::QnxRunConfiguration(Target *target, Core::Id id)
|
||||
libAspect->setLabelText(tr("Path to Qt libraries on device"));
|
||||
libAspect->setDisplayStyle(BaseStringAspect::LineEditDisplay);
|
||||
|
||||
setUpdater([this, target, exeAspect, symbolsAspect] {
|
||||
|
||||
const BuildTargetInfo bti = buildTargetInfo();
|
||||
const FilePath localExecutable = bti.targetFilePath;
|
||||
const DeployableFile depFile = target->deploymentData().deployableForLocalFile(localExecutable);
|
||||
|
||||
exeAspect->setExecutable(FilePath::fromString(depFile.remoteFilePath()));
|
||||
symbolsAspect->setFilePath(localExecutable);
|
||||
|
||||
emit enabledChanged();
|
||||
});
|
||||
setUpdater([this] { updateTargetInformation(); });
|
||||
|
||||
connect(target, &Target::buildSystemUpdated, this, &RunConfiguration::update);
|
||||
}
|
||||
@@ -98,6 +88,22 @@ Runnable QnxRunConfiguration::runnable() const
|
||||
return r;
|
||||
}
|
||||
|
||||
void QnxRunConfiguration::doAdditionalSetup(const RunConfigurationCreationInfo &)
|
||||
{
|
||||
updateTargetInformation();
|
||||
}
|
||||
|
||||
void QnxRunConfiguration::updateTargetInformation()
|
||||
{
|
||||
const BuildTargetInfo bti = buildTargetInfo();
|
||||
const FilePath localExecutable = bti.targetFilePath;
|
||||
const DeployableFile depFile = target()->deploymentData()
|
||||
.deployableForLocalFile(localExecutable);
|
||||
aspect<ExecutableAspect>()->setExecutable(FilePath::fromString(depFile.remoteFilePath()));
|
||||
aspect<SymbolFileAspect>()->setFilePath(localExecutable);
|
||||
emit enabledChanged();
|
||||
}
|
||||
|
||||
// QnxRunConfigurationFactory
|
||||
|
||||
QnxRunConfigurationFactory::QnxRunConfigurationFactory()
|
||||
|
||||
@@ -48,6 +48,9 @@ public:
|
||||
|
||||
private:
|
||||
ProjectExplorer::Runnable runnable() const override;
|
||||
void doAdditionalSetup(const ProjectExplorer::RunConfigurationCreationInfo &) override;
|
||||
|
||||
void updateTargetInformation();
|
||||
};
|
||||
|
||||
class QnxRunConfigurationFactory final : public ProjectExplorer::RunConfigurationFactory
|
||||
|
||||
@@ -69,21 +69,17 @@ RemoteLinuxRunConfiguration::RemoteLinuxRunConfiguration(Target *target, Core::I
|
||||
if (HostOsInfo::isAnyUnixHost())
|
||||
addAspect<X11ForwardingAspect>();
|
||||
|
||||
setUpdater([this, target, exeAspect, symbolsAspect] {
|
||||
BuildTargetInfo bti = buildTargetInfo();
|
||||
const FilePath localExecutable = bti.targetFilePath;
|
||||
DeployableFile depFile = target->deploymentData().deployableForLocalFile(localExecutable);
|
||||
|
||||
exeAspect->setExecutable(FilePath::fromString(depFile.remoteFilePath()));
|
||||
symbolsAspect->setFilePath(localExecutable);
|
||||
|
||||
emit enabledChanged();
|
||||
});
|
||||
setUpdater([this] { updateTargetInformation(); });
|
||||
|
||||
connect(target, &Target::buildSystemUpdated, this, &RunConfiguration::update);
|
||||
connect(target, &Target::kitChanged, this, &RunConfiguration::update);
|
||||
}
|
||||
|
||||
void RemoteLinuxRunConfiguration::doAdditionalSetup(const RunConfigurationCreationInfo &)
|
||||
{
|
||||
updateTargetInformation();
|
||||
}
|
||||
|
||||
Runnable RemoteLinuxRunConfiguration::runnable() const
|
||||
{
|
||||
Runnable r = RunConfiguration::runnable();
|
||||
@@ -93,6 +89,17 @@ Runnable RemoteLinuxRunConfiguration::runnable() const
|
||||
return r;
|
||||
}
|
||||
|
||||
void RemoteLinuxRunConfiguration::updateTargetInformation()
|
||||
{
|
||||
BuildTargetInfo bti = buildTargetInfo();
|
||||
const FilePath localExecutable = bti.targetFilePath;
|
||||
DeployableFile depFile = target()->deploymentData().deployableForLocalFile(localExecutable);
|
||||
|
||||
aspect<ExecutableAspect>()->setExecutable(FilePath::fromString(depFile.remoteFilePath()));
|
||||
aspect<SymbolFileAspect>()->setFilePath(localExecutable);
|
||||
|
||||
emit enabledChanged();
|
||||
}
|
||||
|
||||
// RemoteLinuxRunConfigurationFactory
|
||||
|
||||
|
||||
@@ -39,8 +39,10 @@ class RemoteLinuxRunConfiguration final : public ProjectExplorer::RunConfigurati
|
||||
public:
|
||||
RemoteLinuxRunConfiguration(ProjectExplorer::Target *target, Core::Id id);
|
||||
|
||||
protected:
|
||||
private:
|
||||
void doAdditionalSetup(const ProjectExplorer::RunConfigurationCreationInfo &) override;
|
||||
ProjectExplorer::Runnable runnable() const override;
|
||||
void updateTargetInformation();
|
||||
};
|
||||
|
||||
class RemoteLinuxRunConfigurationFactory final : public ProjectExplorer::RunConfigurationFactory
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
#include <projectexplorer/devicesupport/devicemanager.h>
|
||||
#include <projectexplorer/kitmanager.h>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
@@ -80,7 +81,9 @@ bool WebAssemblyPlugin::initialize(const QStringList& arguments, QString* errorS
|
||||
|
||||
void WebAssemblyPlugin::extensionsInitialized()
|
||||
{
|
||||
ProjectExplorer::DeviceManager::instance()->addDevice(WebAssemblyDevice::create());
|
||||
connect(KitManager::instance(), &KitManager::kitsLoaded, this, [] {
|
||||
DeviceManager::instance()->addDevice(WebAssemblyDevice::create());
|
||||
});
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -46,7 +46,8 @@ extend_qtc_executable(qml2puppet
|
||||
tokencommand.cpp tokencommand.h
|
||||
changeselectioncommand.cpp changeselectioncommand.h
|
||||
drop3dlibraryitemcommand.cpp drop3dlibraryitemcommand.h
|
||||
change3dviewcommand.cpp change3dviewcommand.h
|
||||
update3dviewstatecommand.cpp update3dviewstatecommand.h
|
||||
enable3dviewcommand.cpp enable3dviewcommand.h
|
||||
valueschangedcommand.cpp
|
||||
)
|
||||
|
||||
|
||||
@@ -97,8 +97,10 @@ QtcTool {
|
||||
"commands/changeselectioncommand.h",
|
||||
"commands/drop3dlibraryitemcommand.cpp",
|
||||
"commands/drop3dlibraryitemcommand.h",
|
||||
"commands/change3dviewcommand.cpp",
|
||||
"commands/change3dviewcommand.h",
|
||||
"commands/update3dviewstatecommand.cpp",
|
||||
"commands/update3dviewstatecommand.h",
|
||||
"commands/enable3dviewcommand.cpp",
|
||||
"commands/enable3dviewcommand.h",
|
||||
"container/addimportcontainer.cpp",
|
||||
"container/addimportcontainer.h",
|
||||
"container/idcontainer.cpp",
|
||||
|
||||
Reference in New Issue
Block a user