diff options
Diffstat (limited to 'share/qtcreator')
-rw-r--r-- | share/qtcreator/qml/qmlpuppet/mockfiles/EditView3D.qml | 39 | ||||
-rw-r--r-- | share/qtcreator/qml/qmlpuppet/mockfiles/ToolBarButton.qml | 6 | ||||
-rw-r--r-- | share/qtcreator/qml/qmlpuppet/mockfiles/images/fit_active.png | bin | 0 -> 266 bytes | |||
-rw-r--r-- | share/qtcreator/qml/qmlpuppet/mockfiles/images/fit_active@2x.png | bin | 0 -> 386 bytes | |||
-rw-r--r-- | share/qtcreator/qml/qmlpuppet/mockfiles/images/fit_selected.png | bin | 0 -> 266 bytes | |||
-rw-r--r-- | share/qtcreator/qml/qmlpuppet/mockfiles/images/fit_selected@2x.png | bin | 0 -> 386 bytes | |||
-rw-r--r-- | share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.cpp | 8 | ||||
-rw-r--r-- | share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.h | 2 | ||||
-rw-r--r-- | share/qtcreator/qml/qmlpuppet/qmlpuppet.qrc | 4 |
9 files changed, 51 insertions, 8 deletions
diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/EditView3D.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/EditView3D.qml index 19443113ee..56faf67ec4 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 cbc450ed2b..38a8608e47 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 Binary files differnew file mode 100644 index 0000000000..056e9ec3c8 --- /dev/null +++ b/share/qtcreator/qml/qmlpuppet/mockfiles/images/fit_active.png diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/images/fit_active@2x.png b/share/qtcreator/qml/qmlpuppet/mockfiles/images/fit_active@2x.png Binary files differnew file mode 100644 index 0000000000..4b05f83d46 --- /dev/null +++ b/share/qtcreator/qml/qmlpuppet/mockfiles/images/fit_active@2x.png diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/images/fit_selected.png b/share/qtcreator/qml/qmlpuppet/mockfiles/images/fit_selected.png Binary files differnew file mode 100644 index 0000000000..b8f98d9f12 --- /dev/null +++ b/share/qtcreator/qml/qmlpuppet/mockfiles/images/fit_selected.png diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/images/fit_selected@2x.png b/share/qtcreator/qml/qmlpuppet/mockfiles/images/fit_selected@2x.png Binary files differnew file mode 100644 index 0000000000..eac4361253 --- /dev/null +++ b/share/qtcreator/qml/qmlpuppet/mockfiles/images/fit_selected@2x.png diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.cpp index e7b091504f..30be47d2dc 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 f667a97442..8a1cbe7001 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 c82164c1ff..fcb510ccf0 100644 --- a/share/qtcreator/qml/qmlpuppet/qmlpuppet.qrc +++ b/share/qtcreator/qml/qmlpuppet/qmlpuppet.qrc @@ -64,5 +64,9 @@ <file>mockfiles/images/point_light_gradient@2x.png</file> <file>mockfiles/images/area_light_gradient.png</file> <file>mockfiles/images/area_light_gradient@2x.png</file> + <file>mockfiles/images/fit_active.png</file> + <file>mockfiles/images/fit_active@2x.png</file> + <file>mockfiles/images/fit_selected.png</file> + <file>mockfiles/images/fit_selected@2x.png</file> </qresource> </RCC> |