Fix login dialog keyboard

This commit is contained in:
David Rowe 2016-10-14 14:29:14 +13:00
parent 0e3cb3eabf
commit 94e20d9a13
2 changed files with 9 additions and 20 deletions

View file

@ -33,6 +33,8 @@ ModalWindow {
property string title: "" property string title: ""
property int titleWidth: 0 property int titleWidth: 0
keyboardOverride: true // Disable ModalWindow's keyboard.
LoginDialog { LoginDialog {
id: loginDialog id: loginDialog

View file

@ -27,6 +27,7 @@ Item {
loginDialog.login(usernameField.text, passwordField.text) loginDialog.login(usernameField.text, passwordField.text)
} }
property bool keyboardEnabled: false
property bool keyboardRaised: false property bool keyboardRaised: false
property bool punctuationMode: false property bool punctuationMode: false
@ -46,7 +47,7 @@ Item {
root.width = Math.max(d.minWidth, Math.min(d.maxWidth, targetWidth)); root.width = Math.max(d.minWidth, Math.min(d.maxWidth, targetWidth));
root.height = Math.max(d.minHeight, Math.min(d.maxHeight, targetHeight)) root.height = Math.max(d.minHeight, Math.min(d.maxHeight, targetHeight))
+ (linkAccountBody.keyboardRaised ? (200 + 2 * hifi.dimensions.contentSpacing.y) : hifi.dimensions.contentSpacing.y); + (keyboardEnabled && keyboardRaised ? (200 + 2 * hifi.dimensions.contentSpacing.y) : hifi.dimensions.contentSpacing.y);
} }
} }
@ -137,28 +138,13 @@ Item {
// Override ScrollingWindow's keyboard that would be at very bottom of dialog. // Override ScrollingWindow's keyboard that would be at very bottom of dialog.
Keyboard { Keyboard {
y: parent.keyboardRaised ? parent.height : 0 raised: keyboardEnabled && keyboardRaised
height: parent.keyboardRaised ? 200 : 0 numeric: punctuationMode
visible: parent.keyboardRaised && !parent.punctuationMode
enabled: parent.keyboardRaised && !parent.punctuationMode
anchors { anchors {
left: parent.left left: parent.left
right: parent.right right: parent.right
bottom: buttons.top bottom: buttons.top
bottomMargin: parent.keyboardRaised ? 2 * hifi.dimensions.contentSpacing.y : 0 bottomMargin: keyboardRaised ? 2 * hifi.dimensions.contentSpacing.y : 0
}
}
KeyboardPunctuation {
y: parent.keyboardRaised ? parent.height : 0
height: parent.keyboardRaised ? 200 : 0
visible: parent.keyboardRaised && parent.punctuationMode
enabled: parent.keyboardRaised && parent.punctuationMode
anchors {
left: parent.left
right: parent.right
bottom: buttons.top
bottomMargin: parent.keyboardRaised ? 2 * hifi.dimensions.contentSpacing.y : 0
} }
} }
@ -195,9 +181,10 @@ Item {
Component.onCompleted: { Component.onCompleted: {
root.title = qsTr("Sign Into High Fidelity") root.title = qsTr("Sign Into High Fidelity")
root.iconText = "<" root.iconText = "<"
keyboardEnabled = HMD.active;
d.resize(); d.resize();
usernameField.forceActiveFocus() usernameField.forceActiveFocus();
} }
Connections { Connections {