qml keyboard for avatar preferences dialog

This commit is contained in:
Seth Alves 2016-09-13 11:17:00 -07:00
parent 161424afaf
commit dff567054d
3 changed files with 126 additions and 44 deletions

View file

@ -12,6 +12,7 @@ import QtQuick 2.5
import "../../dialogs" import "../../dialogs"
import "../../controls-uit" import "../../controls-uit"
import "../../controls" as Controls
Preference { Preference {
id: root id: root
@ -53,12 +54,16 @@ Preference {
Item { Item {
id: control id: control
property bool keyboardRaised: false
property bool punctuationMode: false
anchors { anchors {
left: parent.left left: parent.left
right: parent.right right: parent.right
bottom: parent.bottom bottom: parent.bottom
} }
height: Math.max(dataTextField.controlHeight, button.height) height: Math.max(dataTextField.controlHeight, button.height) + (keyboardRaised ? 200 : 0)
TextField { TextField {
id: dataTextField id: dataTextField
@ -69,7 +74,7 @@ Preference {
left: parent.left left: parent.left
right: button.left right: button.left
rightMargin: hifi.dimensions.contentSpacing.x rightMargin: hifi.dimensions.contentSpacing.x
bottom: parent.bottom bottom: keyboard1.top
} }
colorScheme: hifi.colorSchemes.dark colorScheme: hifi.colorSchemes.dark
} }
@ -94,5 +99,35 @@ Preference {
} }
} }
// virtual keyboard, letters
Controls.Keyboard {
id: keyboard1
// y: parent.keyboardRaised ? parent.height : 0
height: parent.keyboardRaised ? 200 : 0
visible: parent.keyboardRaised && !parent.punctuationMode
enabled: parent.keyboardRaised && !parent.punctuationMode
anchors.right: parent.right
anchors.rightMargin: 0
anchors.left: parent.left
anchors.leftMargin: 0
anchors.bottom: parent.bottom
anchors.bottomMargin: 0
// anchors.bottomMargin: 2 * hifi.dimensions.contentSpacing.y
}
Controls.KeyboardPunctuation {
id: keyboard2
// y: parent.keyboardRaised ? parent.height : 0
height: parent.keyboardRaised ? 200 : 0
visible: parent.keyboardRaised && parent.punctuationMode
enabled: parent.keyboardRaised && parent.punctuationMode
anchors.right: parent.right
anchors.rightMargin: 0
anchors.left: parent.left
anchors.leftMargin: 0
anchors.bottom: parent.bottom
anchors.bottomMargin: 0
// anchors.bottomMargin: 2 * hifi.dimensions.contentSpacing.y
}
} }
} }

View file

@ -19,10 +19,7 @@ Preference {
id: root id: root
property alias text: dataTextField.text property alias text: dataTextField.text
property alias placeholderText: dataTextField.placeholderText property alias placeholderText: dataTextField.placeholderText
height: control.height + hifi.dimensions.controlInterlineHeight + (keyboardRaised ? 200 : 0) height: control.height + hifi.dimensions.controlInterlineHeight
property bool keyboardRaised: false
property bool punctuationMode: false
Component.onCompleted: { Component.onCompleted: {
dataTextField.text = preference.value; dataTextField.text = preference.value;
@ -35,12 +32,16 @@ Preference {
Item { Item {
id: control id: control
property bool keyboardRaised: false
property bool punctuationMode: false
anchors { anchors {
left: parent.left left: parent.left
right: parent.right right: parent.right
bottom: keyboard1.top bottom: parent.bottom
} }
height: Math.max(dataTextField.controlHeight, button.height) height: Math.max(dataTextField.controlHeight, button.height) + (keyboardRaised ? 200 : 0)
TextField { TextField {
id: dataTextField id: dataTextField
@ -49,7 +50,7 @@ Preference {
left: parent.left left: parent.left
right: button.left right: button.left
rightMargin: hifi.dimensions.contentSpacing.x rightMargin: hifi.dimensions.contentSpacing.x
bottom: parent.bottom bottom: keyboard1.top
} }
label: root.label label: root.label
@ -80,36 +81,36 @@ Preference {
}); });
} }
} }
}
// virtual keyboard, letters // virtual keyboard, letters
Controls.Keyboard { Controls.Keyboard {
id: keyboard1 id: keyboard1
// y: parent.keyboardRaised ? parent.height : 0 // y: parent.keyboardRaised ? parent.height : 0
height: parent.keyboardRaised ? 200 : 0 height: parent.keyboardRaised ? 200 : 0
visible: parent.keyboardRaised && !parent.punctuationMode visible: parent.keyboardRaised && !parent.punctuationMode
enabled: parent.keyboardRaised && !parent.punctuationMode enabled: parent.keyboardRaised && !parent.punctuationMode
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: 0 anchors.rightMargin: 0
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: 0 anchors.leftMargin: 0
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.bottomMargin: 0 anchors.bottomMargin: 0
// anchors.bottomMargin: 2 * hifi.dimensions.contentSpacing.y // anchors.bottomMargin: 2 * hifi.dimensions.contentSpacing.y
} }
Controls.KeyboardPunctuation { Controls.KeyboardPunctuation {
id: keyboard2 id: keyboard2
// y: parent.keyboardRaised ? parent.height : 0 // y: parent.keyboardRaised ? parent.height : 0
height: parent.keyboardRaised ? 200 : 0 height: parent.keyboardRaised ? 200 : 0
visible: parent.keyboardRaised && parent.punctuationMode visible: parent.keyboardRaised && parent.punctuationMode
enabled: parent.keyboardRaised && parent.punctuationMode enabled: parent.keyboardRaised && parent.punctuationMode
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: 0 anchors.rightMargin: 0
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: 0 anchors.leftMargin: 0
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.bottomMargin: 0 anchors.bottomMargin: 0
// anchors.bottomMargin: 2 * hifi.dimensions.contentSpacing.y // anchors.bottomMargin: 2 * hifi.dimensions.contentSpacing.y
}
} }
} }

View file

@ -12,10 +12,11 @@ import QtQuick 2.5
import "../../dialogs" import "../../dialogs"
import "../../controls-uit" import "../../controls-uit"
import "../../controls" as Controls
Preference { Preference {
id: root id: root
height: dataTextField.controlHeight + hifi.dimensions.controlInterlineHeight height: dataTextField.controlHeight + hifi.dimensions.controlInterlineHeight + (editablePreferenceColumn.keyboardRaised ? 200 : 0)
Component.onCompleted: { Component.onCompleted: {
dataTextField.text = preference.value; dataTextField.text = preference.value;
@ -26,16 +27,61 @@ Preference {
preference.save(); preference.save();
} }
TextField { Column {
id: dataTextField id: editablePreferenceColumn
placeholderText: preference.placeholderText height: dataTextField.height + (keyboardRaised ? 200 : 0)
label: root.label
colorScheme: hifi.colorSchemes.dark property bool keyboardRaised: false
property bool punctuationMode: false
anchors { anchors {
left: parent.left left: parent.left
right: parent.right right: parent.right
bottom: parent.bottom bottom: parent.bottom
} }
TextField {
id: dataTextField
placeholderText: preference.placeholderText
label: root.label
colorScheme: hifi.colorSchemes.dark
anchors {
left: parent.left
right: parent.right
// bottom: keyboard1.bottom
}
}
// virtual keyboard, letters
Controls.Keyboard {
id: keyboard1
// y: parent.keyboardRaised ? parent.height : 0
height: parent.keyboardRaised ? 200 : 0
visible: parent.keyboardRaised && !parent.punctuationMode
enabled: parent.keyboardRaised && !parent.punctuationMode
anchors.right: parent.right
anchors.rightMargin: 0
anchors.left: parent.left
anchors.leftMargin: 0
// anchors.bottom: parent.bottom
// anchors.bottomMargin: 0
// anchors.bottomMargin: 2 * hifi.dimensions.contentSpacing.y
}
Controls.KeyboardPunctuation {
id: keyboard2
// y: parent.keyboardRaised ? parent.height : 0
height: parent.keyboardRaised ? 200 : 0
visible: parent.keyboardRaised && parent.punctuationMode
enabled: parent.keyboardRaised && parent.punctuationMode
anchors.right: parent.right
anchors.rightMargin: 0
anchors.left: parent.left
anchors.leftMargin: 0
// anchors.bottom: parent.bottom
// anchors.bottomMargin: 0
// anchors.bottomMargin: 2 * hifi.dimensions.contentSpacing.y
}
} }
} }