From a9ff1f4ecd6356f77f794fc1d6cc9d49f36e2ae2 Mon Sep 17 00:00:00 2001 From: Alexander Ivash Date: Fri, 7 Sep 2018 17:53:45 +0300 Subject: [PATCH 1/5] add onscreen keyboard into 'Calibration' tab of Settings=>Controls dialog --- .../qml/hifi/tablet/ControllerSettings.qml | 31 +++++++++++++++++++ .../qml/hifi/tablet/OpenVrConfiguration.qml | 14 +++++++++ 2 files changed, 45 insertions(+) diff --git a/interface/resources/qml/hifi/tablet/ControllerSettings.qml b/interface/resources/qml/hifi/tablet/ControllerSettings.qml index b8bbd71f33..6727047eb0 100644 --- a/interface/resources/qml/hifi/tablet/ControllerSettings.qml +++ b/interface/resources/qml/hifi/tablet/ControllerSettings.qml @@ -9,6 +9,7 @@ import QtQuick 2.7 import QtQuick.Controls 2.2 import QtQuick.Layouts 1.3 +import QtQuick.Window 2.2 import QtGraphicalEffects 1.0 import Qt.labs.settings 1.0 import stylesUit 1.0 @@ -72,6 +73,11 @@ Item { initialItem: inputConfiguration property alias messageVisible: imageMessageBox.visible property string selectedPlugin: "" + + property bool keyboardEnabled: false + property bool keyboardRaised: false + property bool punctuationMode: false + Rectangle { id: inputConfiguration anchors { @@ -227,6 +233,8 @@ Item { anchors.right: parent.right anchors.top: inputConfiguration.bottom anchors.bottom: parent.bottom + anchors.bottomMargin: keyboard.height + Loader { id: loader asynchronous: false @@ -248,6 +256,29 @@ Item { } } + HifiControls.Keyboard { + id: keyboard + raised: parent.keyboardEnabled && parent.keyboardRaised + onRaisedChanged: { + if (raised) { + // delayed execution to allow loader and its content to adjust size + Qt.callLater(function() { + loader.item.bringToView(Window.activeFocusItem); + }) + } + } + + numeric: parent.punctuationMode + anchors { + bottom: parent.bottom + left: parent.left + right: parent.right + } + + Component.onCompleted: { + parent.keyboardEnabled = HMD.active; + } + } function inputPlugins() { if (checkBox.checked) { diff --git a/interface/resources/qml/hifi/tablet/OpenVrConfiguration.qml b/interface/resources/qml/hifi/tablet/OpenVrConfiguration.qml index 2fc5cc4196..1c629349d8 100644 --- a/interface/resources/qml/hifi/tablet/OpenVrConfiguration.qml +++ b/interface/resources/qml/hifi/tablet/OpenVrConfiguration.qml @@ -32,6 +32,18 @@ Flickable { } } + function bringToView(item) { + var yTop = item.mapToItem(contentItem, 0, 0).y; + var yBottom = yTop + item.height; + + var surfaceTop = contentY; + var surfaceBottom = contentY + height; + + if(yTop < surfaceTop || yBottom > surfaceBottom) { + contentY = yTop - height / 2 + item.height + } + } + Component.onCompleted: { page = config.createObject(flick.contentItem); } @@ -39,6 +51,8 @@ Flickable { id: config Rectangle { id: openVrConfiguration + anchors.fill: parent + property int leftMargin: 75 property int countDown: 0 property string pluginName: "" From 37bb3586eaee91eb0b1e6f202888e0ed196e0e75 Mon Sep 17 00:00:00 2001 From: Alexander Ivash Date: Tue, 13 Nov 2018 19:05:16 +0530 Subject: [PATCH 2/5] show spinbox suffix in separate control to: disallow editing it & allow to pass validator --- .../resources/qml/controlsUit/SpinBox.qml | 27 ++++++++++++++++--- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/interface/resources/qml/controlsUit/SpinBox.qml b/interface/resources/qml/controlsUit/SpinBox.qml index d24c7c5e8c..34794d80c7 100644 --- a/interface/resources/qml/controlsUit/SpinBox.qml +++ b/interface/resources/qml/controlsUit/SpinBox.qml @@ -83,8 +83,10 @@ SpinBox { } validator: DoubleValidator { - bottom: Math.min(spinBox.from, spinBox.to) - top: Math.max(spinBox.from, spinBox.to) + decimals: spinBox.decimals + bottom: Math.min(spinBox.realFrom, spinBox.realTo) + top: Math.max(spinBox.realFrom, spinBox.realTo) + notation: DoubleValidator.StandardNotation } textFromValue: function(value, locale) { @@ -97,20 +99,37 @@ SpinBox { contentItem: TextInput { + id: spinboxText z: 2 color: isLightColorScheme ? (spinBox.activeFocus ? hifi.colors.black : hifi.colors.lightGray) : (spinBox.activeFocus ? hifi.colors.white : hifi.colors.lightGrayText) selectedTextColor: hifi.colors.black selectionColor: hifi.colors.primaryHighlight - text: spinBox.textFromValue(spinBox.value, spinBox.locale) + suffix + text: spinBox.textFromValue(spinBox.value, spinBox.locale) inputMethodHints: spinBox.inputMethodHints validator: spinBox.validator verticalAlignment: Qt.AlignVCenter leftPadding: spinBoxLabelInside.visible ? 30 : hifi.dimensions.textPadding - //rightPadding: hifi.dimensions.spinnerSize width: spinBox.width - hifi.dimensions.spinnerSize onEditingFinished: spinBox.editingFinished() + + Text { + id: suffixText + x: metrics.advanceWidth(spinboxText.text + '*') + height: spinboxText.height + + FontMetrics { + id: metrics + font: spinboxText.font + } + + color: isLightColorScheme + ? (spinBox.activeFocus ? hifi.colors.black : hifi.colors.lightGray) + : (spinBox.activeFocus ? hifi.colors.white : hifi.colors.lightGrayText) + text: suffix + verticalAlignment: Qt.AlignVCenter + } } up.indicator: Item { From 95c51c2ffac2fcdd5e8ca58d58ced4220019b033 Mon Sep 17 00:00:00 2001 From: Alexander Ivash Date: Fri, 7 Sep 2018 20:46:27 +0300 Subject: [PATCH 3/5] unfocus spinboxes on finishing editing --- .../resources/qml/hifi/tablet/OpenVrConfiguration.qml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/interface/resources/qml/hifi/tablet/OpenVrConfiguration.qml b/interface/resources/qml/hifi/tablet/OpenVrConfiguration.qml index 1c629349d8..eccf456b5e 100644 --- a/interface/resources/qml/hifi/tablet/OpenVrConfiguration.qml +++ b/interface/resources/qml/hifi/tablet/OpenVrConfiguration.qml @@ -214,6 +214,7 @@ Flickable { onEditingFinished: { sendConfigurationSettings(); + openVrConfiguration.forceActiveFocus(); } } @@ -231,6 +232,7 @@ Flickable { onEditingFinished: { sendConfigurationSettings(); + openVrConfiguration.forceActiveFocus(); } } } @@ -323,6 +325,7 @@ Flickable { onEditingFinished: { sendConfigurationSettings(); + openVrConfiguration.forceActiveFocus(); } } @@ -339,6 +342,7 @@ Flickable { onEditingFinished: { sendConfigurationSettings(); + openVrConfiguration.forceActiveFocus(); } } } @@ -571,6 +575,7 @@ Flickable { onEditingFinished: { sendConfigurationSettings(); + openVrConfiguration.forceActiveFocus(); } } @@ -587,6 +592,7 @@ Flickable { onEditingFinished: { sendConfigurationSettings(); + openVrConfiguration.forceActiveFocus(); } } } @@ -765,6 +771,7 @@ Flickable { calibrationTimer.interval = realValue * 1000; openVrConfiguration.countDown = realValue; numberAnimation.duration = calibrationTimer.interval; + openVrConfiguration.forceActiveFocus(); } } From 3a62184afd227f41f6fe584a5653a63137f660b0 Mon Sep 17 00:00:00 2001 From: Alexander Ivash Date: Wed, 12 Sep 2018 02:12:05 +0300 Subject: [PATCH 4/5] specify min/max/stepsize --- .../resources/qml/hifi/tablet/OpenVrConfiguration.qml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/interface/resources/qml/hifi/tablet/OpenVrConfiguration.qml b/interface/resources/qml/hifi/tablet/OpenVrConfiguration.qml index eccf456b5e..b68a094846 100644 --- a/interface/resources/qml/hifi/tablet/OpenVrConfiguration.qml +++ b/interface/resources/qml/hifi/tablet/OpenVrConfiguration.qml @@ -568,7 +568,8 @@ Flickable { width: 160 suffix: " cm" label: "Arm Circumference" - minimumValue: 0 + minimumValue: 10.0 + maximumValue: 50.0 realStepSize: 1.0 colorScheme: hifi.colorSchemes.dark realValue: 33.0 @@ -585,6 +586,7 @@ Flickable { label: "Shoulder Width" suffix: " cm" minimumValue: 0 + maximumValue: 50.0 realStepSize: 1.0 decimals: 1 colorScheme: hifi.colorSchemes.dark @@ -763,8 +765,10 @@ Flickable { anchors.left: parent.left anchors.leftMargin: leftMargin - minimumValue: 5 + minimumValue: 0 + maximumValue: 5 realValue: 5 + realStepSize: 1.0 colorScheme: hifi.colorSchemes.dark onEditingFinished: { From b16efb2afbda71e9f54cae7971ee30f24d8b467f Mon Sep 17 00:00:00 2001 From: Alexander Ivash Date: Wed, 12 Sep 2018 02:45:30 +0300 Subject: [PATCH 5/5] set minimum shoulder width to 25 cm (based on discussion with Tony) --- interface/resources/qml/hifi/tablet/OpenVrConfiguration.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/resources/qml/hifi/tablet/OpenVrConfiguration.qml b/interface/resources/qml/hifi/tablet/OpenVrConfiguration.qml index b68a094846..e18fdea444 100644 --- a/interface/resources/qml/hifi/tablet/OpenVrConfiguration.qml +++ b/interface/resources/qml/hifi/tablet/OpenVrConfiguration.qml @@ -585,7 +585,7 @@ Flickable { width: 160 label: "Shoulder Width" suffix: " cm" - minimumValue: 0 + minimumValue: 25.0 maximumValue: 50.0 realStepSize: 1.0 decimals: 1