mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-04 04:13:11 +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;
|
implicitWidth: 640;
|
||||||
implicitHeight: 320;
|
implicitHeight: 320;
|
||||||
visible: true;
|
visible: true;
|
||||||
|
keyboardEnabled: false // Disable ModalWindow's keyboard.
|
||||||
|
|
||||||
signal selected(var result);
|
signal selected(var result);
|
||||||
signal canceled();
|
signal canceled();
|
||||||
|
@ -50,6 +51,10 @@ ModalWindow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
property bool keyboardRaised: false
|
||||||
|
property bool punctuationMode: false
|
||||||
|
onKeyboardRaisedChanged: d.resize();
|
||||||
|
|
||||||
property var warning: "";
|
property var warning: "";
|
||||||
property var result;
|
property var result;
|
||||||
|
|
||||||
|
@ -110,7 +115,9 @@ ModalWindow {
|
||||||
var targetWidth = Math.max(titleWidth, pane.width);
|
var targetWidth = Math.max(titleWidth, pane.width);
|
||||||
var targetHeight = (textField.visible ? textField.controlHeight + hifi.dimensions.contentSpacing.y : 0) +
|
var targetHeight = (textField.visible ? textField.controlHeight + hifi.dimensions.contentSpacing.y : 0) +
|
||||||
(extraInputs.visible ? extraInputs.height + 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.width = (targetWidth < d.minWidth) ? d.minWidth : ((targetWidth > d.maxWdith) ? d.maxWidth : targetWidth);
|
||||||
root.height = (targetHeight < d.minHeight) ? d.minHeight : ((targetHeight > d.maxHeight) ?
|
root.height = (targetHeight < d.minHeight) ? d.minHeight : ((targetHeight > d.maxHeight) ?
|
||||||
d.maxHeight : targetHeight);
|
d.maxHeight : targetHeight);
|
||||||
|
@ -130,7 +137,6 @@ ModalWindow {
|
||||||
left: parent.left;
|
left: parent.left;
|
||||||
right: parent.right;
|
right: parent.right;
|
||||||
margins: 0;
|
margins: 0;
|
||||||
bottomMargin: hifi.dimensions.contentSpacing.y;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME make a text field type that can be bound to a history for autocompletion
|
// FIXME make a text field type that can be bound to a history for autocompletion
|
||||||
|
@ -142,7 +148,43 @@ ModalWindow {
|
||||||
anchors {
|
anchors {
|
||||||
left: parent.left;
|
left: parent.left;
|
||||||
right: parent.right;
|
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.
|
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
|
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 keyboardRaised: false
|
||||||
property bool punctuationMode: false
|
property bool punctuationMode: false
|
||||||
|
|
||||||
|
@ -130,6 +131,7 @@ Window {
|
||||||
// Optional non-scrolling footer.
|
// Optional non-scrolling footer.
|
||||||
id: footerPane
|
id: footerPane
|
||||||
|
|
||||||
|
property alias keyboardEnabled: window.keyboardEnabled
|
||||||
property alias keyboardRaised: window.keyboardRaised
|
property alias keyboardRaised: window.keyboardRaised
|
||||||
property alias punctuationMode: window.punctuationMode
|
property alias punctuationMode: window.punctuationMode
|
||||||
|
|
||||||
|
@ -138,9 +140,9 @@ Window {
|
||||||
bottom: parent.bottom
|
bottom: parent.bottom
|
||||||
}
|
}
|
||||||
width: parent.contentWidth
|
width: parent.contentWidth
|
||||||
height: footerContentHeight + (keyboardRaised ? 200 : 0)
|
height: footerContentHeight + (keyboardEnabled && keyboardRaised ? 200 : 0)
|
||||||
color: hifi.colors.baseGray
|
color: hifi.colors.baseGray
|
||||||
visible: footer.height > 0 || keyboardRaised
|
visible: footer.height > 0 || keyboardEnabled && keyboardRaised
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
// Horizontal rule.
|
// Horizontal rule.
|
||||||
|
@ -179,9 +181,9 @@ Window {
|
||||||
|
|
||||||
HiFiControls.Keyboard {
|
HiFiControls.Keyboard {
|
||||||
id: keyboard1
|
id: keyboard1
|
||||||
height: parent.keyboardRaised ? 200 : 0
|
height: parent.keyboardEnabled && parent.keyboardRaised ? 200 : 0
|
||||||
visible: parent.keyboardRaised && !parent.punctuationMode
|
visible: parent.keyboardEnabled && parent.keyboardRaised && !parent.punctuationMode
|
||||||
enabled: parent.keyboardRaised && !parent.punctuationMode
|
enabled: parent.keyboardEnabled && parent.keyboardRaised && !parent.punctuationMode
|
||||||
anchors {
|
anchors {
|
||||||
left: parent.left
|
left: parent.left
|
||||||
right: parent.right
|
right: parent.right
|
||||||
|
@ -191,9 +193,9 @@ Window {
|
||||||
|
|
||||||
HiFiControls.KeyboardPunctuation {
|
HiFiControls.KeyboardPunctuation {
|
||||||
id: keyboard2
|
id: keyboard2
|
||||||
height: parent.keyboardRaised ? 200 : 0
|
height: parent.keyboardEnabled && parent.keyboardRaised ? 200 : 0
|
||||||
visible: parent.keyboardRaised && parent.punctuationMode
|
visible: parent.keyboardEnabled && parent.keyboardRaised && parent.punctuationMode
|
||||||
enabled: parent.keyboardRaised && parent.punctuationMode
|
enabled: parent.keyboardEnabled && parent.keyboardRaised && parent.punctuationMode
|
||||||
anchors {
|
anchors {
|
||||||
left: parent.left
|
left: parent.left
|
||||||
right: parent.right
|
right: parent.right
|
||||||
|
@ -204,7 +206,7 @@ Window {
|
||||||
}
|
}
|
||||||
|
|
||||||
onKeyboardRaisedChanged: {
|
onKeyboardRaisedChanged: {
|
||||||
if (keyboardRaised) {
|
if (parent.KeyboardEnabled && keyboardRaised) {
|
||||||
var delta = activator.mouseY
|
var delta = activator.mouseY
|
||||||
- (activator.height + activator.y - 200 - footerContentHeight - hifi.dimensions.controlLineHeight);
|
- (activator.height + activator.y - 200 - footerContentHeight - hifi.dimensions.controlLineHeight);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue