add onscreen keyboard into 'Calibration' tab of Settings=>Controls dialog

This commit is contained in:
Alexander Ivash 2018-09-07 17:53:45 +03:00
parent 7da440a886
commit a9ff1f4ecd
2 changed files with 45 additions and 0 deletions

View file

@ -9,6 +9,7 @@
import QtQuick 2.7 import QtQuick 2.7
import QtQuick.Controls 2.2 import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3 import QtQuick.Layouts 1.3
import QtQuick.Window 2.2
import QtGraphicalEffects 1.0 import QtGraphicalEffects 1.0
import Qt.labs.settings 1.0 import Qt.labs.settings 1.0
import stylesUit 1.0 import stylesUit 1.0
@ -72,6 +73,11 @@ Item {
initialItem: inputConfiguration initialItem: inputConfiguration
property alias messageVisible: imageMessageBox.visible property alias messageVisible: imageMessageBox.visible
property string selectedPlugin: "" property string selectedPlugin: ""
property bool keyboardEnabled: false
property bool keyboardRaised: false
property bool punctuationMode: false
Rectangle { Rectangle {
id: inputConfiguration id: inputConfiguration
anchors { anchors {
@ -227,6 +233,8 @@ Item {
anchors.right: parent.right anchors.right: parent.right
anchors.top: inputConfiguration.bottom anchors.top: inputConfiguration.bottom
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.bottomMargin: keyboard.height
Loader { Loader {
id: loader id: loader
asynchronous: false 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() { function inputPlugins() {
if (checkBox.checked) { if (checkBox.checked) {

View file

@ -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: { Component.onCompleted: {
page = config.createObject(flick.contentItem); page = config.createObject(flick.contentItem);
} }
@ -39,6 +51,8 @@ Flickable {
id: config id: config
Rectangle { Rectangle {
id: openVrConfiguration id: openVrConfiguration
anchors.fill: parent
property int leftMargin: 75 property int leftMargin: 75
property int countDown: 0 property int countDown: 0
property string pluginName: "" property string pluginName: ""