Implement EditView3D's toolbar
Move and scale shortcuts are temporarily set to (M) and (T) instead of (W) and (R) to avoid interference with the WASD RF controller Task-number: QDS-1201 Change-Id: Ia7ebb6c0d39880be6b87b12d0a4a1d16638fd141 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
@@ -118,7 +118,7 @@ Window {
|
|||||||
position: viewWindow.selectedNode ? viewWindow.selectedNode.scenePosition
|
position: viewWindow.selectedNode ? viewWindow.selectedNode.scenePosition
|
||||||
: Qt.vector3d(0, 0, 0)
|
: Qt.vector3d(0, 0, 0)
|
||||||
globalOrientation: globalControl.checked
|
globalOrientation: globalControl.checked
|
||||||
visible: selectedNode && moveToolControl.checked
|
visible: selectedNode && btnMove.selected
|
||||||
view3D: overlayView
|
view3D: overlayView
|
||||||
|
|
||||||
onPositionCommit: viewWindow.commitObjectProperty(selectedNode, "position")
|
onPositionCommit: viewWindow.commitObjectProperty(selectedNode, "position")
|
||||||
@@ -133,7 +133,7 @@ Window {
|
|||||||
position: viewWindow.selectedNode ? viewWindow.selectedNode.scenePosition
|
position: viewWindow.selectedNode ? viewWindow.selectedNode.scenePosition
|
||||||
: Qt.vector3d(0, 0, 0)
|
: Qt.vector3d(0, 0, 0)
|
||||||
globalOrientation: globalControl.checked
|
globalOrientation: globalControl.checked
|
||||||
visible: selectedNode && scaleToolControl.checked
|
visible: selectedNode && btnScale.selected
|
||||||
view3D: overlayView
|
view3D: overlayView
|
||||||
|
|
||||||
onScaleCommit: viewWindow.commitObjectProperty(selectedNode, "scale")
|
onScaleCommit: viewWindow.commitObjectProperty(selectedNode, "scale")
|
||||||
@@ -263,8 +263,78 @@ Window {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Rectangle { // toolbar
|
||||||
|
id: toolbar
|
||||||
|
color: "#9F000000"
|
||||||
|
width: 35
|
||||||
|
height: col.height
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: col
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
spacing: 5
|
||||||
|
padding: 5
|
||||||
|
|
||||||
|
property var group: [btnSelectItem, btnSelectGroup, btnMove, btnRotate, btnScale]
|
||||||
|
|
||||||
|
ToolbarButton {
|
||||||
|
id: btnSelectItem
|
||||||
|
selected: true
|
||||||
|
tooltip: qsTr("Select Item")
|
||||||
|
shortcut: "Q"
|
||||||
|
currentShortcut: selected ? "" : shortcut
|
||||||
|
tool: "item_selection"
|
||||||
|
buttonsGroup: col.group
|
||||||
|
}
|
||||||
|
|
||||||
|
ToolbarButton {
|
||||||
|
id: btnSelectGroup
|
||||||
|
tooltip: qsTr("Select Group")
|
||||||
|
shortcut: "Q"
|
||||||
|
currentShortcut: btnSelectItem.currentShortcut === shortcut ? "" : shortcut
|
||||||
|
tool: "group_selection"
|
||||||
|
buttonsGroup: col.group
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle { // separator
|
||||||
|
width: 25
|
||||||
|
height: 1
|
||||||
|
color: "#f1f1f1"
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
ToolbarButton {
|
||||||
|
id: btnMove
|
||||||
|
tooltip: qsTr("Move current selection")
|
||||||
|
shortcut: "M"
|
||||||
|
currentShortcut: shortcut
|
||||||
|
tool: "move"
|
||||||
|
buttonsGroup: col.group
|
||||||
|
}
|
||||||
|
|
||||||
|
ToolbarButton {
|
||||||
|
id: btnRotate
|
||||||
|
tooltip: qsTr("Rotate current selection")
|
||||||
|
shortcut: "E"
|
||||||
|
currentShortcut: shortcut
|
||||||
|
tool: "rotate"
|
||||||
|
buttonsGroup: col.group
|
||||||
|
}
|
||||||
|
|
||||||
|
ToolbarButton {
|
||||||
|
id: btnScale
|
||||||
|
tooltip: qsTr("Scale current selection")
|
||||||
|
shortcut: "T"
|
||||||
|
currentShortcut: shortcut
|
||||||
|
tool: "scale"
|
||||||
|
buttonsGroup: col.group
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
y: 8
|
y: 8
|
||||||
|
anchors.right: parent.right
|
||||||
CheckBox {
|
CheckBox {
|
||||||
id: editLightCheckbox
|
id: editLightCheckbox
|
||||||
checked: false
|
checked: false
|
||||||
@@ -285,19 +355,6 @@ Window {
|
|||||||
text: qsTr("Use Global Orientation")
|
text: qsTr("Use Global Orientation")
|
||||||
onCheckedChanged: cameraControl.forceActiveFocus()
|
onCheckedChanged: cameraControl.forceActiveFocus()
|
||||||
}
|
}
|
||||||
Column {
|
|
||||||
x: 8
|
|
||||||
RadioButton {
|
|
||||||
id: moveToolControl
|
|
||||||
checked: true
|
|
||||||
text: qsTr("Move Tool")
|
|
||||||
}
|
|
||||||
RadioButton {
|
|
||||||
id: scaleToolControl
|
|
||||||
checked: false
|
|
||||||
text: qsTr("Scale Tool")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
|
79
share/qtcreator/qml/qmlpuppet/mockfiles/ToolBarButton.qml
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** 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.
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
import QtQuick 2.12
|
||||||
|
import QtQuick 2.0
|
||||||
|
import QtQuick.Controls 2.0
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
property bool selected: false
|
||||||
|
property string tooltip
|
||||||
|
property string shortcut
|
||||||
|
property string currentShortcut
|
||||||
|
property string tool
|
||||||
|
property variant buttonsGroup: []
|
||||||
|
|
||||||
|
id: root
|
||||||
|
width: img.width + 5
|
||||||
|
height: img.height + 5
|
||||||
|
color: root.selected ? "#aa000000" : (mouseArea.containsMouse ? "#44000000" : "#00000000")
|
||||||
|
radius: 3
|
||||||
|
|
||||||
|
ToolTip {
|
||||||
|
text: root.tooltip + " (" + root.shortcut + ")"
|
||||||
|
visible: mouseArea.containsMouse
|
||||||
|
delay: 1000
|
||||||
|
}
|
||||||
|
|
||||||
|
Image {
|
||||||
|
id: img
|
||||||
|
anchors.centerIn: parent
|
||||||
|
source: root.selected ? "qrc:///qtquickplugin/mockfiles/images/" + root.tool + "_selected.png"
|
||||||
|
: "qrc:///qtquickplugin/mockfiles/images/" + root.tool + "_active.png"
|
||||||
|
}
|
||||||
|
|
||||||
|
Shortcut {
|
||||||
|
sequence: root.currentShortcut
|
||||||
|
onActivated: mouseArea.onClicked(null)
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: mouseArea
|
||||||
|
cursorShape: "PointingHandCursor"
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
if (!root.selected) {
|
||||||
|
for (var i = 0; i < root.buttonsGroup.length; ++i)
|
||||||
|
root.buttonsGroup[i].selected = false;
|
||||||
|
|
||||||
|
root.selected = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
After Width: | Height: | Size: 404 B |
After Width: | Height: | Size: 779 B |
After Width: | Height: | Size: 438 B |
After Width: | Height: | Size: 904 B |
After Width: | Height: | Size: 353 B |
After Width: | Height: | Size: 657 B |
After Width: | Height: | Size: 355 B |
After Width: | Height: | Size: 661 B |
BIN
share/qtcreator/qml/qmlpuppet/mockfiles/images/move_active.png
Normal file
After Width: | Height: | Size: 294 B |
After Width: | Height: | Size: 303 B |
BIN
share/qtcreator/qml/qmlpuppet/mockfiles/images/move_selected.png
Normal file
After Width: | Height: | Size: 191 B |
After Width: | Height: | Size: 272 B |
BIN
share/qtcreator/qml/qmlpuppet/mockfiles/images/rotate_active.png
Normal file
After Width: | Height: | Size: 451 B |
After Width: | Height: | Size: 869 B |
After Width: | Height: | Size: 478 B |
After Width: | Height: | Size: 906 B |
BIN
share/qtcreator/qml/qmlpuppet/mockfiles/images/scale_active.png
Normal file
After Width: | Height: | Size: 242 B |
After Width: | Height: | Size: 338 B |
After Width: | Height: | Size: 277 B |
After Width: | Height: | Size: 364 B |
@@ -21,11 +21,32 @@
|
|||||||
<file>mockfiles/PlanarScaleHandle.qml</file>
|
<file>mockfiles/PlanarScaleHandle.qml</file>
|
||||||
<file>mockfiles/ScaleRod.qml</file>
|
<file>mockfiles/ScaleRod.qml</file>
|
||||||
<file>mockfiles/ScaleGizmo.qml</file>
|
<file>mockfiles/ScaleGizmo.qml</file>
|
||||||
|
<file>mockfiles/ToolbarButton.qml</file>
|
||||||
<file>mockfiles/meshes/arrow.mesh</file>
|
<file>mockfiles/meshes/arrow.mesh</file>
|
||||||
<file>mockfiles/meshes/scalerod.mesh</file>
|
<file>mockfiles/meshes/scalerod.mesh</file>
|
||||||
<file>mockfiles/images/camera-pick-icon.png</file>
|
<file>mockfiles/images/camera-pick-icon.png</file>
|
||||||
<file>mockfiles/images/camera-pick-icon@2x.png</file>
|
<file>mockfiles/images/camera-pick-icon@2x.png</file>
|
||||||
<file>mockfiles/images/light-pick-icon.png</file>
|
<file>mockfiles/images/light-pick-icon.png</file>
|
||||||
<file>mockfiles/images/light-pick-icon@2x.png</file>
|
<file>mockfiles/images/light-pick-icon@2x.png</file>
|
||||||
|
<file>mockfiles/images/item_selection_active.png</file>
|
||||||
|
<file>mockfiles/images/item_selection_active@2x.png</file>
|
||||||
|
<file>mockfiles/images/item_selection_selected.png</file>
|
||||||
|
<file>mockfiles/images/item_selection_selected@2x.png</file>
|
||||||
|
<file>mockfiles/images/group_selection_selected.png</file>
|
||||||
|
<file>mockfiles/images/group_selection_selected@2x.png</file>
|
||||||
|
<file>mockfiles/images/group_selection_active.png</file>
|
||||||
|
<file>mockfiles/images/group_selection_active@2x.png</file>
|
||||||
|
<file>mockfiles/images/move_active.png</file>
|
||||||
|
<file>mockfiles/images/move_active@2x.png</file>
|
||||||
|
<file>mockfiles/images/move_selected.png</file>
|
||||||
|
<file>mockfiles/images/move_selected@2x.png</file>
|
||||||
|
<file>mockfiles/images/rotate_active.png</file>
|
||||||
|
<file>mockfiles/images/rotate_active@2x.png</file>
|
||||||
|
<file>mockfiles/images/rotate_selected.png</file>
|
||||||
|
<file>mockfiles/images/rotate_selected@2x.png</file>
|
||||||
|
<file>mockfiles/images/scale_active.png</file>
|
||||||
|
<file>mockfiles/images/scale_active@2x.png</file>
|
||||||
|
<file>mockfiles/images/scale_selected.png</file>
|
||||||
|
<file>mockfiles/images/scale_selected@2x.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|