qml keyboard for query-dialog

This commit is contained in:
Seth Alves 2016-09-12 15:31:07 -07:00
parent 38a1556716
commit 4c370d0d32

View file

@ -15,6 +15,7 @@ import QtQuick.Dialogs 1.2 as OriginalDialogs
import "../controls-uit" import "../controls-uit"
import "../styles-uit" import "../styles-uit"
import "../windows" import "../windows"
import "../controls" as Controls
ModalWindow { ModalWindow {
id: root id: root
@ -53,11 +54,17 @@ ModalWindow {
} }
Item { Item {
id: modalWindowItem
clip: true clip: true
width: pane.width width: pane.width
height: pane.height height: pane.height
anchors.margins: 0 anchors.margins: 0
property bool keyboardRaised: false
property bool punctuationMode: false
onKeyboardRaisedChanged: d.resize();
QtObject { QtObject {
id: d id: d
readonly property int minWidth: 480 readonly property int minWidth: 480
@ -69,14 +76,14 @@ ModalWindow {
var targetWidth = Math.max(titleWidth, pane.width) var targetWidth = Math.max(titleWidth, pane.width)
var targetHeight = (items ? comboBox.controlHeight : textResult.controlHeight) + 5 * hifi.dimensions.contentSpacing.y + buttons.height var targetHeight = (items ? comboBox.controlHeight : textResult.controlHeight) + 5 * hifi.dimensions.contentSpacing.y + buttons.height
root.width = (targetWidth < d.minWidth) ? d.minWidth : ((targetWidth > d.maxWdith) ? d.maxWidth : targetWidth) root.width = (targetWidth < d.minWidth) ? d.minWidth : ((targetWidth > d.maxWdith) ? d.maxWidth : targetWidth)
root.height = (targetHeight < d.minHeight) ? d.minHeight: ((targetHeight > d.maxHeight) ? d.maxHeight : targetHeight) root.height = ((targetHeight < d.minHeight) ? d.minHeight: ((targetHeight > d.maxHeight) ? d.maxHeight : targetHeight)) + (modalWindowItem.keyboardRaised ? (200 + 2 * hifi.dimensions.contentSpacing.y) : 0)
} }
} }
Item { Item {
anchors { anchors {
top: parent.top top: parent.top
bottom: buttons.top; bottom: keyboard1.top;
left: parent.left; left: parent.left;
right: parent.right; right: parent.right;
margins: 0 margins: 0
@ -110,6 +117,35 @@ ModalWindow {
} }
} }
// 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: buttons.top
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: buttons.top
anchors.bottomMargin: 2 * hifi.dimensions.contentSpacing.y
}
Flow { Flow {
id: buttons id: buttons
focus: true focus: true