mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-04 00:44:12 +02:00
Add keyboard to custom query dialog
This commit is contained in:
parent
023efe05f0
commit
7d1d71084d
2 changed files with 56 additions and 12 deletions
|
@ -22,6 +22,7 @@ ModalWindow {
|
|||
implicitWidth: 640;
|
||||
implicitHeight: 320;
|
||||
visible: true;
|
||||
keyboardEnabled: false // Disable ModalWindow's keyboard.
|
||||
|
||||
signal selected(var result);
|
||||
signal canceled();
|
||||
|
@ -50,6 +51,10 @@ ModalWindow {
|
|||
}
|
||||
}
|
||||
|
||||
property bool keyboardRaised: false
|
||||
property bool punctuationMode: false
|
||||
onKeyboardRaisedChanged: d.resize();
|
||||
|
||||
property var warning: "";
|
||||
property var result;
|
||||
|
||||
|
@ -110,7 +115,9 @@ ModalWindow {
|
|||
var targetWidth = Math.max(titleWidth, pane.width);
|
||||
var targetHeight = (textField.visible ? textField.controlHeight + hifi.dimensions.contentSpacing.y : 0) +
|
||||
(extraInputs.visible ? extraInputs.height + hifi.dimensions.contentSpacing.y : 0) +
|
||||
(buttons.height + 3 * hifi.dimensions.contentSpacing.y);
|
||||
(buttons.height + 3 * hifi.dimensions.contentSpacing.y) +
|
||||
(root.keyboardRaised ? (200 + hifi.dimensions.contentSpacing.y) : 0);
|
||||
|
||||
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);
|
||||
|
@ -130,7 +137,6 @@ ModalWindow {
|
|||
left: parent.left;
|
||||
right: parent.right;
|
||||
margins: 0;
|
||||
bottomMargin: hifi.dimensions.contentSpacing.y;
|
||||
}
|
||||
|
||||
// FIXME make a text field type that can be bound to a history for autocompletion
|
||||
|
@ -142,7 +148,43 @@ ModalWindow {
|
|||
anchors {
|
||||
left: parent.left;
|
||||
right: parent.right;
|
||||
bottom: parent.bottom;
|
||||
bottom: keyboard.top;
|
||||
bottomMargin: hifi.dimensions.contentSpacing.y;
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
id: keyboard
|
||||
|
||||
height: keyboardRaised ? 200 : 0
|
||||
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
bottom: parent.bottom
|
||||
bottomMargin: keyboardRaised ? hifi.dimensions.contentSpacing.y : 0
|
||||
}
|
||||
|
||||
Keyboard {
|
||||
id: keyboard1
|
||||
visible: keyboardRaised && !punctuationMode
|
||||
enabled: keyboardRaised && !punctuationMode
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
bottom: parent.bottom
|
||||
}
|
||||
}
|
||||
|
||||
KeyboardPunctuation {
|
||||
id: keyboard2
|
||||
visible: keyboardRaised && punctuationMode
|
||||
enabled: keyboardRaised && punctuationMode
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
bottom: parent.bottom
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ Window {
|
|||
property var footer: Item { } // Optional static footer at the bottom of the dialog.
|
||||
readonly property var footerContentHeight: footer.height > 0 ? (footer.height + 2 * hifi.dimensions.contentSpacing.y + 3) : 0
|
||||
|
||||
property bool keyboardEnabled: true // Set false if derived control implements its own keyboard.
|
||||
property bool keyboardRaised: false
|
||||
property bool punctuationMode: false
|
||||
|
||||
|
@ -130,6 +131,7 @@ Window {
|
|||
// Optional non-scrolling footer.
|
||||
id: footerPane
|
||||
|
||||
property alias keyboardEnabled: window.keyboardEnabled
|
||||
property alias keyboardRaised: window.keyboardRaised
|
||||
property alias punctuationMode: window.punctuationMode
|
||||
|
||||
|
@ -138,9 +140,9 @@ Window {
|
|||
bottom: parent.bottom
|
||||
}
|
||||
width: parent.contentWidth
|
||||
height: footerContentHeight + (keyboardRaised ? 200 : 0)
|
||||
height: footerContentHeight + (keyboardEnabled && keyboardRaised ? 200 : 0)
|
||||
color: hifi.colors.baseGray
|
||||
visible: footer.height > 0 || keyboardRaised
|
||||
visible: footer.height > 0 || keyboardEnabled && keyboardRaised
|
||||
|
||||
Item {
|
||||
// Horizontal rule.
|
||||
|
@ -179,9 +181,9 @@ Window {
|
|||
|
||||
HiFiControls.Keyboard {
|
||||
id: keyboard1
|
||||
height: parent.keyboardRaised ? 200 : 0
|
||||
visible: parent.keyboardRaised && !parent.punctuationMode
|
||||
enabled: parent.keyboardRaised && !parent.punctuationMode
|
||||
height: parent.keyboardEnabled && parent.keyboardRaised ? 200 : 0
|
||||
visible: parent.keyboardEnabled && parent.keyboardRaised && !parent.punctuationMode
|
||||
enabled: parent.keyboardEnabled && parent.keyboardRaised && !parent.punctuationMode
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
|
@ -191,9 +193,9 @@ Window {
|
|||
|
||||
HiFiControls.KeyboardPunctuation {
|
||||
id: keyboard2
|
||||
height: parent.keyboardRaised ? 200 : 0
|
||||
visible: parent.keyboardRaised && parent.punctuationMode
|
||||
enabled: parent.keyboardRaised && parent.punctuationMode
|
||||
height: parent.keyboardEnabled && parent.keyboardRaised ? 200 : 0
|
||||
visible: parent.keyboardEnabled && parent.keyboardRaised && parent.punctuationMode
|
||||
enabled: parent.keyboardEnabled && parent.keyboardRaised && parent.punctuationMode
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
|
@ -204,7 +206,7 @@ Window {
|
|||
}
|
||||
|
||||
onKeyboardRaisedChanged: {
|
||||
if (keyboardRaised) {
|
||||
if (parent.KeyboardEnabled && keyboardRaised) {
|
||||
var delta = activator.mouseY
|
||||
- (activator.height + activator.y - 200 - footerContentHeight - hifi.dimensions.controlLineHeight);
|
||||
|
||||
|
|
Loading…
Reference in a new issue