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 "../../controls-uit"
import "../../controls" as Controls
Preference {
id: root
@ -53,12 +54,16 @@ Preference {
Item {
id: control
property bool keyboardRaised: false
property bool punctuationMode: false
anchors {
left: parent.left
right: parent.right
bottom: parent.bottom
}
height: Math.max(dataTextField.controlHeight, button.height)
height: Math.max(dataTextField.controlHeight, button.height) + (keyboardRaised ? 200 : 0)
TextField {
id: dataTextField
@ -69,7 +74,7 @@ Preference {
left: parent.left
right: button.left
rightMargin: hifi.dimensions.contentSpacing.x
bottom: parent.bottom
bottom: keyboard1.top
}
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
property alias text: dataTextField.text
property alias placeholderText: dataTextField.placeholderText
height: control.height + hifi.dimensions.controlInterlineHeight + (keyboardRaised ? 200 : 0)
property bool keyboardRaised: false
property bool punctuationMode: false
height: control.height + hifi.dimensions.controlInterlineHeight
Component.onCompleted: {
dataTextField.text = preference.value;
@ -35,12 +32,16 @@ Preference {
Item {
id: control
property bool keyboardRaised: false
property bool punctuationMode: false
anchors {
left: parent.left
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 {
id: dataTextField
@ -49,7 +50,7 @@ Preference {
left: parent.left
right: button.left
rightMargin: hifi.dimensions.contentSpacing.x
bottom: parent.bottom
bottom: keyboard1.top
}
label: root.label
@ -80,36 +81,36 @@ 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
}
// 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
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

@ -12,10 +12,11 @@ import QtQuick 2.5
import "../../dialogs"
import "../../controls-uit"
import "../../controls" as Controls
Preference {
id: root
height: dataTextField.controlHeight + hifi.dimensions.controlInterlineHeight
height: dataTextField.controlHeight + hifi.dimensions.controlInterlineHeight + (editablePreferenceColumn.keyboardRaised ? 200 : 0)
Component.onCompleted: {
dataTextField.text = preference.value;
@ -26,16 +27,61 @@ Preference {
preference.save();
}
TextField {
id: dataTextField
placeholderText: preference.placeholderText
label: root.label
colorScheme: hifi.colorSchemes.dark
Column {
id: editablePreferenceColumn
height: dataTextField.height + (keyboardRaised ? 200 : 0)
property bool keyboardRaised: false
property bool punctuationMode: false
anchors {
left: parent.left
right: parent.right
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
}
}
}