diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/EditView3D.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/EditView3D.qml
index 19443113ee3..56faf67ec41 100644
--- a/share/qtcreator/qml/qmlpuppet/mockfiles/EditView3D.qml
+++ b/share/qtcreator/qml/qmlpuppet/mockfiles/EditView3D.qml
@@ -300,7 +300,8 @@ Window {
spacing: 5
padding: 5
- property var group: [btnSelectItem, btnSelectGroup, btnMove, btnRotate, btnScale]
+ property var groupSelect: [btnSelectGroup, btnSelectItem]
+ property var groupTransform: [btnMove, btnRotate, btnScale]
ToolBarButton {
id: btnSelectItem
@@ -309,7 +310,7 @@ Window {
shortcut: "Q"
currentShortcut: selected ? "" : shortcut
tool: "item_selection"
- buttonsGroup: col.group
+ buttonsGroup: col.groupSelect
}
ToolBarButton {
@@ -318,7 +319,7 @@ Window {
shortcut: "Q"
currentShortcut: btnSelectItem.currentShortcut === shortcut ? "" : shortcut
tool: "group_selection"
- buttonsGroup: col.group
+ buttonsGroup: col.groupSelect
}
Rectangle { // separator
@@ -330,11 +331,12 @@ Window {
ToolBarButton {
id: btnMove
+ selected: true
tooltip: qsTr("Move current selection")
- shortcut: "M"
+ shortcut: "W"
currentShortcut: shortcut
tool: "move"
- buttonsGroup: col.group
+ buttonsGroup: col.groupTransform
}
ToolBarButton {
@@ -343,16 +345,37 @@ Window {
shortcut: "E"
currentShortcut: shortcut
tool: "rotate"
- buttonsGroup: col.group
+ buttonsGroup: col.groupTransform
}
ToolBarButton {
id: btnScale
tooltip: qsTr("Scale current selection")
- shortcut: "T"
+ shortcut: "R"
currentShortcut: shortcut
tool: "scale"
- buttonsGroup: col.group
+ buttonsGroup: col.groupTransform
+ }
+
+ Rectangle { // separator
+ width: 25
+ height: 1
+ color: "#f1f1f1"
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+
+ ToolBarButton {
+ id: btnFit
+ tooltip: qsTr("Fit camera to current selection")
+ shortcut: "F"
+ currentShortcut: shortcut
+ tool: "fit"
+ togglable: false
+
+ onSelectedChanged: {
+ if (selected)
+ cameraControl.fitObject(viewWindow.selectedNode, editView.camera.rotation);
+ }
}
}
}
diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/ToolBarButton.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/ToolBarButton.qml
index cbc450ed2bc..38a8608e475 100644
--- a/share/qtcreator/qml/qmlpuppet/mockfiles/ToolBarButton.qml
+++ b/share/qtcreator/qml/qmlpuppet/mockfiles/ToolBarButton.qml
@@ -34,6 +34,7 @@ Rectangle {
property string currentShortcut
property string tool
property variant buttonsGroup: []
+ property bool togglable: true
id: root
width: img.width + 5
@@ -71,6 +72,11 @@ Rectangle {
root.buttonsGroup[i].selected = false;
root.selected = true;
+
+ if (!root.togglable) {
+ // Deselect button after a short while (selection acts as simple click indicator)
+ _generalHelper.delayedPropertySet(root, 200, "selected", false);
+ }
}
}
}
diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/images/fit_active.png b/share/qtcreator/qml/qmlpuppet/mockfiles/images/fit_active.png
new file mode 100644
index 00000000000..056e9ec3c8b
Binary files /dev/null and b/share/qtcreator/qml/qmlpuppet/mockfiles/images/fit_active.png differ
diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/images/fit_active@2x.png b/share/qtcreator/qml/qmlpuppet/mockfiles/images/fit_active@2x.png
new file mode 100644
index 00000000000..4b05f83d460
Binary files /dev/null and b/share/qtcreator/qml/qmlpuppet/mockfiles/images/fit_active@2x.png differ
diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/images/fit_selected.png b/share/qtcreator/qml/qmlpuppet/mockfiles/images/fit_selected.png
new file mode 100644
index 00000000000..b8f98d9f120
Binary files /dev/null and b/share/qtcreator/qml/qmlpuppet/mockfiles/images/fit_selected.png differ
diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/images/fit_selected@2x.png b/share/qtcreator/qml/qmlpuppet/mockfiles/images/fit_selected@2x.png
new file mode 100644
index 00000000000..eac43612532
Binary files /dev/null and b/share/qtcreator/qml/qmlpuppet/mockfiles/images/fit_selected@2x.png differ
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.cpp
index e7b091504ff..30be47d2dca 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.cpp
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.cpp
@@ -185,6 +185,14 @@ QVector4D GeneralHelper::fitObjectToCamera(QQuick3DCamera *camera, float default
zoomCamera(camera, 0, defaultLookAtDistance, lookAt, newZoomFactor, false));
}
+void GeneralHelper::delayedPropertySet(QObject *obj, int delay, const QString &property,
+ const QVariant &value)
+{
+ QTimer::singleShot(delay, [obj, property, value]() {
+ obj->setProperty(property.toLatin1().constData(), value);
+ });
+}
+
}
}
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.h b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.h
index f667a974423..8a1cbe7001d 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.h
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.h
@@ -57,6 +57,8 @@ public:
float zoomFactor, bool relative);
Q_INVOKABLE QVector4D fitObjectToCamera(QQuick3DCamera *camera, float defaultLookAtDistance,
QQuick3DNode *targetObject, QQuick3DViewport *viewPort);
+ Q_INVOKABLE void delayedPropertySet(QObject *obj, int delay, const QString &property,
+ const QVariant& value);
signals:
void overlayUpdateNeeded();
diff --git a/share/qtcreator/qml/qmlpuppet/qmlpuppet.qrc b/share/qtcreator/qml/qmlpuppet/qmlpuppet.qrc
index c82164c1ff9..fcb510ccf08 100644
--- a/share/qtcreator/qml/qmlpuppet/qmlpuppet.qrc
+++ b/share/qtcreator/qml/qmlpuppet/qmlpuppet.qrc
@@ -64,5 +64,9 @@
mockfiles/images/point_light_gradient@2x.png
mockfiles/images/area_light_gradient.png
mockfiles/images/area_light_gradient@2x.png
+ mockfiles/images/fit_active.png
+ mockfiles/images/fit_active@2x.png
+ mockfiles/images/fit_selected.png
+ mockfiles/images/fit_selected@2x.png