QmlDesigner: Fix minor edit 3D view ui issues in mac

Change-Id: Ia86b5f828d147ca0c3593da7f7dcb77696fdeead
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Miikka Heikkinen
2019-12-13 15:28:15 +02:00
parent f97de35dd4
commit 82f2667ab3
3 changed files with 42 additions and 30 deletions

View File

@@ -479,48 +479,48 @@ Window {
Rectangle { // top controls bar Rectangle { // top controls bar
color: "#aa000000" color: "#aa000000"
width: 265 width: 290
height: btnPerspective.height + 10 height: btnPerspective.height + 10
anchors.top: parent.top anchors.top: parent.top
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: 100 anchors.rightMargin: 100
ToggleButton { Row {
id: btnPerspective padding: 5
anchors.top: parent.top anchors.fill: parent
anchors.topMargin: 5 ToggleButton {
anchors.left: parent.left id: btnPerspective
anchors.leftMargin: 5 width: 105
tooltip: qsTr("Toggle Perspective / Orthographic Projection") tooltip: qsTr("Toggle Perspective / Orthographic Projection")
states: [{iconId: "ortho", text: qsTr("Orthographic")}, {iconId: "persp", text: qsTr("Perspective")}] 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 { Text {
id: helpText id: helpText
property string modKey: _generalHelper.isMacOS ? qsTr("Option") : qsTr("Alt")
color: "white" 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 anchors.bottom: parent.bottom
} }
} }

View File

@@ -222,6 +222,15 @@ QQuick3DNode *GeneralHelper::resolvePick(QQuick3DNode *pickNode)
return pickNode; return pickNode;
} }
bool GeneralHelper::isMacOS() const
{
#ifdef Q_OS_MACOS
return true;
#else
return false;
#endif
}
} }
} }

View File

@@ -45,6 +45,7 @@ namespace Internal {
class GeneralHelper : public QObject class GeneralHelper : public QObject
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(bool isMacOS READ isMacOS CONSTANT)
public: public:
GeneralHelper(); GeneralHelper();
@@ -70,6 +71,8 @@ public:
Q_INVOKABLE QQuick3DNode *resolvePick(QQuick3DNode *pickNode); Q_INVOKABLE QQuick3DNode *resolvePick(QQuick3DNode *pickNode);
bool isMacOS() const;
signals: signals:
void overlayUpdateNeeded(); void overlayUpdateNeeded();