diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/EditView3D.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/EditView3D.qml index 024c8c5d1b8..bed8dd3f9a8 100644 --- a/share/qtcreator/qml/qmlpuppet/mockfiles/EditView3D.qml +++ b/share/qtcreator/qml/qmlpuppet/mockfiles/EditView3D.qml @@ -118,7 +118,7 @@ Window { position: viewWindow.selectedNode ? viewWindow.selectedNode.scenePosition : Qt.vector3d(0, 0, 0) globalOrientation: globalControl.checked - visible: selectedNode && moveToolControl.checked + visible: selectedNode && btnMove.selected view3D: overlayView onPositionCommit: viewWindow.commitObjectProperty(selectedNode, "position") @@ -133,7 +133,7 @@ Window { position: viewWindow.selectedNode ? viewWindow.selectedNode.scenePosition : Qt.vector3d(0, 0, 0) globalOrientation: globalControl.checked - visible: selectedNode && scaleToolControl.checked + visible: selectedNode && btnScale.selected view3D: overlayView 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 { y: 8 + anchors.right: parent.right CheckBox { id: editLightCheckbox checked: false @@ -285,19 +355,6 @@ Window { text: qsTr("Use Global Orientation") 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 { diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/ToolBarButton.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/ToolBarButton.qml new file mode 100644 index 00000000000..cbc450ed2bc --- /dev/null +++ b/share/qtcreator/qml/qmlpuppet/mockfiles/ToolBarButton.qml @@ -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; + } + } + } +} + + diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/images/group_selection_active.png b/share/qtcreator/qml/qmlpuppet/mockfiles/images/group_selection_active.png new file mode 100644 index 00000000000..c5801b34654 Binary files /dev/null and b/share/qtcreator/qml/qmlpuppet/mockfiles/images/group_selection_active.png differ diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/images/group_selection_active@2x.png b/share/qtcreator/qml/qmlpuppet/mockfiles/images/group_selection_active@2x.png new file mode 100644 index 00000000000..85851c7c130 Binary files /dev/null and b/share/qtcreator/qml/qmlpuppet/mockfiles/images/group_selection_active@2x.png differ diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/images/group_selection_selected.png b/share/qtcreator/qml/qmlpuppet/mockfiles/images/group_selection_selected.png new file mode 100644 index 00000000000..bfb848aa384 Binary files /dev/null and b/share/qtcreator/qml/qmlpuppet/mockfiles/images/group_selection_selected.png differ diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/images/group_selection_selected@2x.png b/share/qtcreator/qml/qmlpuppet/mockfiles/images/group_selection_selected@2x.png new file mode 100644 index 00000000000..f18895dc440 Binary files /dev/null and b/share/qtcreator/qml/qmlpuppet/mockfiles/images/group_selection_selected@2x.png differ diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/images/item_selection_active.png b/share/qtcreator/qml/qmlpuppet/mockfiles/images/item_selection_active.png new file mode 100644 index 00000000000..5fa81302cde Binary files /dev/null and b/share/qtcreator/qml/qmlpuppet/mockfiles/images/item_selection_active.png differ diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/images/item_selection_active@2x.png b/share/qtcreator/qml/qmlpuppet/mockfiles/images/item_selection_active@2x.png new file mode 100644 index 00000000000..566da2ef1af Binary files /dev/null and b/share/qtcreator/qml/qmlpuppet/mockfiles/images/item_selection_active@2x.png differ diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/images/item_selection_selected.png b/share/qtcreator/qml/qmlpuppet/mockfiles/images/item_selection_selected.png new file mode 100644 index 00000000000..2b685d3d00a Binary files /dev/null and b/share/qtcreator/qml/qmlpuppet/mockfiles/images/item_selection_selected.png differ diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/images/item_selection_selected@2x.png b/share/qtcreator/qml/qmlpuppet/mockfiles/images/item_selection_selected@2x.png new file mode 100644 index 00000000000..eb0051a606e Binary files /dev/null and b/share/qtcreator/qml/qmlpuppet/mockfiles/images/item_selection_selected@2x.png differ diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/images/move_active.png b/share/qtcreator/qml/qmlpuppet/mockfiles/images/move_active.png new file mode 100644 index 00000000000..d21d290349c Binary files /dev/null and b/share/qtcreator/qml/qmlpuppet/mockfiles/images/move_active.png differ diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/images/move_active@2x.png b/share/qtcreator/qml/qmlpuppet/mockfiles/images/move_active@2x.png new file mode 100644 index 00000000000..bd0827f918c Binary files /dev/null and b/share/qtcreator/qml/qmlpuppet/mockfiles/images/move_active@2x.png differ diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/images/move_selected.png b/share/qtcreator/qml/qmlpuppet/mockfiles/images/move_selected.png new file mode 100644 index 00000000000..5c8ce42a758 Binary files /dev/null and b/share/qtcreator/qml/qmlpuppet/mockfiles/images/move_selected.png differ diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/images/move_selected@2x.png b/share/qtcreator/qml/qmlpuppet/mockfiles/images/move_selected@2x.png new file mode 100644 index 00000000000..fad362a3e6a Binary files /dev/null and b/share/qtcreator/qml/qmlpuppet/mockfiles/images/move_selected@2x.png differ diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/images/rotate_active.png b/share/qtcreator/qml/qmlpuppet/mockfiles/images/rotate_active.png new file mode 100644 index 00000000000..bdabaf30285 Binary files /dev/null and b/share/qtcreator/qml/qmlpuppet/mockfiles/images/rotate_active.png differ diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/images/rotate_active@2x.png b/share/qtcreator/qml/qmlpuppet/mockfiles/images/rotate_active@2x.png new file mode 100644 index 00000000000..8c81f409d32 Binary files /dev/null and b/share/qtcreator/qml/qmlpuppet/mockfiles/images/rotate_active@2x.png differ diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/images/rotate_selected.png b/share/qtcreator/qml/qmlpuppet/mockfiles/images/rotate_selected.png new file mode 100644 index 00000000000..42dc2763ce4 Binary files /dev/null and b/share/qtcreator/qml/qmlpuppet/mockfiles/images/rotate_selected.png differ diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/images/rotate_selected@2x.png b/share/qtcreator/qml/qmlpuppet/mockfiles/images/rotate_selected@2x.png new file mode 100644 index 00000000000..b6cc48c0533 Binary files /dev/null and b/share/qtcreator/qml/qmlpuppet/mockfiles/images/rotate_selected@2x.png differ diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/images/scale_active.png b/share/qtcreator/qml/qmlpuppet/mockfiles/images/scale_active.png new file mode 100644 index 00000000000..cd63c1d03bc Binary files /dev/null and b/share/qtcreator/qml/qmlpuppet/mockfiles/images/scale_active.png differ diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/images/scale_active@2x.png b/share/qtcreator/qml/qmlpuppet/mockfiles/images/scale_active@2x.png new file mode 100644 index 00000000000..0d95e8e8913 Binary files /dev/null and b/share/qtcreator/qml/qmlpuppet/mockfiles/images/scale_active@2x.png differ diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/images/scale_selected.png b/share/qtcreator/qml/qmlpuppet/mockfiles/images/scale_selected.png new file mode 100644 index 00000000000..4cca7726170 Binary files /dev/null and b/share/qtcreator/qml/qmlpuppet/mockfiles/images/scale_selected.png differ diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/images/scale_selected@2x.png b/share/qtcreator/qml/qmlpuppet/mockfiles/images/scale_selected@2x.png new file mode 100644 index 00000000000..690cf5f924f Binary files /dev/null and b/share/qtcreator/qml/qmlpuppet/mockfiles/images/scale_selected@2x.png differ diff --git a/share/qtcreator/qml/qmlpuppet/qmlpuppet.qrc b/share/qtcreator/qml/qmlpuppet/qmlpuppet.qrc index fd17d551d8a..1a1c4b2cd26 100644 --- a/share/qtcreator/qml/qmlpuppet/qmlpuppet.qrc +++ b/share/qtcreator/qml/qmlpuppet/qmlpuppet.qrc @@ -21,11 +21,32 @@ mockfiles/PlanarScaleHandle.qml mockfiles/ScaleRod.qml mockfiles/ScaleGizmo.qml + mockfiles/ToolbarButton.qml mockfiles/meshes/arrow.mesh mockfiles/meshes/scalerod.mesh mockfiles/images/camera-pick-icon.png mockfiles/images/camera-pick-icon@2x.png mockfiles/images/light-pick-icon.png mockfiles/images/light-pick-icon@2x.png + mockfiles/images/item_selection_active.png + mockfiles/images/item_selection_active@2x.png + mockfiles/images/item_selection_selected.png + mockfiles/images/item_selection_selected@2x.png + mockfiles/images/group_selection_selected.png + mockfiles/images/group_selection_selected@2x.png + mockfiles/images/group_selection_active.png + mockfiles/images/group_selection_active@2x.png + mockfiles/images/move_active.png + mockfiles/images/move_active@2x.png + mockfiles/images/move_selected.png + mockfiles/images/move_selected@2x.png + mockfiles/images/rotate_active.png + mockfiles/images/rotate_active@2x.png + mockfiles/images/rotate_selected.png + mockfiles/images/rotate_selected@2x.png + mockfiles/images/scale_active.png + mockfiles/images/scale_active@2x.png + mockfiles/images/scale_selected.png + mockfiles/images/scale_selected@2x.png