mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 21:43:03 +02:00
Fix keyboard in tablet custom query dialog
This commit is contained in:
parent
fc0c36d0c0
commit
9e458fd180
1 changed files with 119 additions and 112 deletions
|
@ -20,7 +20,9 @@ TabletModalWindow {
|
||||||
id: root;
|
id: root;
|
||||||
HifiConstants { id: hifi; }
|
HifiConstants { id: hifi; }
|
||||||
|
|
||||||
y: hifi.dimensions.tabletMenuHeader
|
anchors.fill: parent
|
||||||
|
width: parent.width
|
||||||
|
height: parent.height
|
||||||
|
|
||||||
title: ""
|
title: ""
|
||||||
visible: true;
|
visible: true;
|
||||||
|
@ -108,7 +110,7 @@ TabletModalWindow {
|
||||||
|
|
||||||
TabletModalFrame {
|
TabletModalFrame {
|
||||||
id: modalWindowItem
|
id: modalWindowItem
|
||||||
width: parent.width - 12
|
width: parent.width - 6
|
||||||
height: 240
|
height: 240
|
||||||
anchors {
|
anchors {
|
||||||
verticalCenter: parent.verticalCenter
|
verticalCenter: parent.verticalCenter
|
||||||
|
@ -119,7 +121,7 @@ TabletModalWindow {
|
||||||
id: d;
|
id: d;
|
||||||
readonly property int minWidth: 470
|
readonly property int minWidth: 470
|
||||||
readonly property int maxWidth: 470
|
readonly property int maxWidth: 470
|
||||||
readonly property int minHeight: 240
|
readonly property int minHeight: 120
|
||||||
readonly property int maxHeight: 720
|
readonly property int maxHeight: 720
|
||||||
|
|
||||||
function resize() {
|
function resize() {
|
||||||
|
@ -130,8 +132,8 @@ TabletModalWindow {
|
||||||
((keyboardEnabled && keyboardRaised) ? (keyboard.raisedHeight + hifi.dimensions.contentSpacing.y) : 0);
|
((keyboardEnabled && keyboardRaised) ? (keyboard.raisedHeight + 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) ?
|
modalWindowItem.height = (targetHeight < d.minHeight) ? d.minHeight : ((targetHeight > d.maxHeight) ?
|
||||||
d.maxHeight : targetHeight);
|
d.maxHeight : targetHeight);
|
||||||
if (checkBoxField.visible && comboBoxField.visible) {
|
if (checkBoxField.visible && comboBoxField.visible) {
|
||||||
checkBoxField.width = extraInputs.width / 2;
|
checkBoxField.width = extraInputs.width / 2;
|
||||||
comboBoxField.width = extraInputs.width / 2;
|
comboBoxField.width = extraInputs.width / 2;
|
||||||
|
@ -140,14 +142,16 @@ TabletModalWindow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Item {
|
|
||||||
// anchors {
|
Item {
|
||||||
// // top: parent.top;
|
anchors {
|
||||||
// // bottom: extraInputs.visible ? extraInputs.top : buttons.top;
|
top: parent.top;
|
||||||
// left: parent.left;
|
bottom: extraInputs.visible ? extraInputs.top : buttons.top;
|
||||||
// right: parent.right;
|
left: parent.left;
|
||||||
// topMargin: 20
|
right: parent.right;
|
||||||
// }
|
leftMargin: 12
|
||||||
|
rightMargin: 12
|
||||||
|
}
|
||||||
|
|
||||||
// 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
|
||||||
ControlsUIT.TextField {
|
ControlsUIT.TextField {
|
||||||
|
@ -156,14 +160,16 @@ TabletModalWindow {
|
||||||
focus: root.textInput ? true : false;
|
focus: root.textInput ? true : false;
|
||||||
visible: root.textInput ? true : false;
|
visible: root.textInput ? true : false;
|
||||||
anchors {
|
anchors {
|
||||||
top: parent.top
|
|
||||||
left: parent.left;
|
left: parent.left;
|
||||||
right: parent.right;
|
right: parent.right;
|
||||||
leftMargin: 5; rightMargin: 5;
|
bottom: keyboard.top;
|
||||||
topMargin: textField.controlHeight - textField.height + 5
|
bottomMargin: hifi.dimensions.contentSpacing.y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
property alias keyboardOverride: root.keyboardOverride
|
||||||
|
property alias keyboardRaised: root.keyboardRaised
|
||||||
|
property alias punctuationMode: root.punctuationMode
|
||||||
ControlsUIT.Keyboard {
|
ControlsUIT.Keyboard {
|
||||||
id: keyboard
|
id: keyboard
|
||||||
raised: keyboardEnabled && keyboardRaised
|
raised: keyboardEnabled && keyboardRaised
|
||||||
|
@ -171,110 +177,111 @@ TabletModalWindow {
|
||||||
anchors {
|
anchors {
|
||||||
left: parent.left
|
left: parent.left
|
||||||
right: parent.right
|
right: parent.right
|
||||||
leftMargin: 5; rightMargin: 5;
|
bottom: parent.bottom
|
||||||
top: textField.bottom
|
bottomMargin: raised ? hifi.dimensions.contentSpacing.y : 0
|
||||||
topMargin: raised ? hifi.dimensions.contentSpacing.y : 0
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
Row {
|
Item {
|
||||||
id: extraInputs;
|
id: extraInputs;
|
||||||
visible: Boolean(root.checkBox || root.comboBox);
|
visible: Boolean(root.checkBox || root.comboBox);
|
||||||
|
anchors {
|
||||||
|
left: parent.left;
|
||||||
|
right: parent.right;
|
||||||
|
bottom: buttons.top;
|
||||||
|
bottomMargin: hifi.dimensions.contentSpacing.y;
|
||||||
|
leftMargin: 12
|
||||||
|
rightMargin: 12
|
||||||
|
}
|
||||||
|
height: comboBoxField.controlHeight;
|
||||||
|
onHeightChanged: d.resize();
|
||||||
|
onWidthChanged: d.resize();
|
||||||
|
|
||||||
|
ControlsUIT.CheckBox {
|
||||||
|
id: checkBoxField;
|
||||||
|
text: root.checkBox.label;
|
||||||
|
focus: Boolean(root.checkBox);
|
||||||
|
visible: Boolean(root.checkBox);
|
||||||
anchors {
|
anchors {
|
||||||
left: parent.left;
|
left: parent.left;
|
||||||
right: parent.right;
|
|
||||||
leftMargin: 5; rightMargin: 5;
|
|
||||||
top: keyboard.bottom;
|
|
||||||
topMargin: hifi.dimensions.contentSpacing.y + 20;
|
|
||||||
}
|
|
||||||
height: comboBoxField.controlHeight;
|
|
||||||
onHeightChanged: d.resize();
|
|
||||||
onWidthChanged: d.resize();
|
|
||||||
|
|
||||||
ControlsUIT.CheckBox {
|
|
||||||
id: checkBoxField;
|
|
||||||
text: root.checkBox.label;
|
|
||||||
focus: Boolean(root.checkBox);
|
|
||||||
visible: Boolean(root.checkBox);
|
|
||||||
// anchors {
|
|
||||||
// left: parent.left;
|
|
||||||
// bottom: parent.bottom;
|
|
||||||
// leftMargin: 6; // Magic number to align with warning icon
|
|
||||||
// bottomMargin: 6;
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
ControlsUIT.ComboBox {
|
|
||||||
id: comboBoxField;
|
|
||||||
label: root.comboBox.label;
|
|
||||||
focus: Boolean(root.comboBox);
|
|
||||||
visible: Boolean(root.comboBox);
|
|
||||||
// anchors {
|
|
||||||
// right: parent.right;
|
|
||||||
// bottom: parent.bottom;
|
|
||||||
// }
|
|
||||||
model: root.comboBox ? root.comboBox.items : [];
|
|
||||||
onAccepted: {
|
|
||||||
updateCheckbox();
|
|
||||||
focus = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Row {
|
|
||||||
id: buttons;
|
|
||||||
focus: true;
|
|
||||||
spacing: hifi.dimensions.contentSpacing.x;
|
|
||||||
layoutDirection: Qt.RightToLeft;
|
|
||||||
onHeightChanged: d.resize();
|
|
||||||
onWidthChanged: {
|
|
||||||
d.resize();
|
|
||||||
resizeWarningText();
|
|
||||||
}
|
|
||||||
|
|
||||||
anchors {
|
|
||||||
bottom: parent.bottom;
|
bottom: parent.bottom;
|
||||||
left: parent.left;
|
leftMargin: 6; // Magic number to align with warning icon
|
||||||
right: parent.right;
|
bottomMargin: 6;
|
||||||
bottomMargin: hifi.dimensions.contentSpacing.y;
|
|
||||||
leftMargin: 5; rightMargin: 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
function resizeWarningText() {
|
|
||||||
var rowWidth = buttons.width;
|
|
||||||
var buttonsWidth = acceptButton.width + cancelButton.width + hifi.dimensions.contentSpacing.x * 2;
|
|
||||||
var warningIconWidth = warningIcon.width + hifi.dimensions.contentSpacing.x;
|
|
||||||
warningText.width = rowWidth - buttonsWidth - warningIconWidth;
|
|
||||||
}
|
|
||||||
|
|
||||||
ControlsUIT.Button {
|
|
||||||
id: cancelButton;
|
|
||||||
action: cancelAction;
|
|
||||||
}
|
|
||||||
|
|
||||||
ControlsUIT.Button {
|
|
||||||
id: acceptButton;
|
|
||||||
action: acceptAction;
|
|
||||||
}
|
|
||||||
|
|
||||||
Text {
|
|
||||||
id: warningText;
|
|
||||||
visible: Boolean(root.warning);
|
|
||||||
text: root.warning;
|
|
||||||
wrapMode: Text.WordWrap;
|
|
||||||
font.italic: true;
|
|
||||||
maximumLineCount: 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
HiFiGlyphs {
|
|
||||||
id: warningIcon;
|
|
||||||
visible: Boolean(root.warning);
|
|
||||||
text: hifi.glyphs.alert;
|
|
||||||
size: hifi.dimensions.controlLineHeight;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// }//column
|
|
||||||
|
ControlsUIT.ComboBox {
|
||||||
|
id: comboBoxField;
|
||||||
|
label: root.comboBox.label;
|
||||||
|
focus: Boolean(root.comboBox);
|
||||||
|
visible: Boolean(root.comboBox);
|
||||||
|
anchors {
|
||||||
|
right: parent.right;
|
||||||
|
bottom: parent.bottom;
|
||||||
|
}
|
||||||
|
model: root.comboBox ? root.comboBox.items : [];
|
||||||
|
onAccepted: {
|
||||||
|
updateCheckbox();
|
||||||
|
focus = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
id: buttons;
|
||||||
|
focus: true;
|
||||||
|
spacing: hifi.dimensions.contentSpacing.x;
|
||||||
|
layoutDirection: Qt.RightToLeft;
|
||||||
|
onHeightChanged: d.resize();
|
||||||
|
onWidthChanged: {
|
||||||
|
d.resize();
|
||||||
|
resizeWarningText();
|
||||||
|
}
|
||||||
|
|
||||||
|
anchors {
|
||||||
|
bottom: parent.bottom;
|
||||||
|
left: parent.left;
|
||||||
|
right: parent.right;
|
||||||
|
bottomMargin: hifi.dimensions.contentSpacing.y;
|
||||||
|
leftMargin: 12
|
||||||
|
rightMargin: 12
|
||||||
|
}
|
||||||
|
|
||||||
|
function resizeWarningText() {
|
||||||
|
var rowWidth = buttons.width;
|
||||||
|
var buttonsWidth = acceptButton.width + cancelButton.width + hifi.dimensions.contentSpacing.x * 2;
|
||||||
|
var warningIconWidth = warningIcon.width + hifi.dimensions.contentSpacing.x;
|
||||||
|
warningText.width = rowWidth - buttonsWidth - warningIconWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
ControlsUIT.Button {
|
||||||
|
id: cancelButton;
|
||||||
|
action: cancelAction;
|
||||||
|
}
|
||||||
|
|
||||||
|
ControlsUIT.Button {
|
||||||
|
id: acceptButton;
|
||||||
|
action: acceptAction;
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: warningText;
|
||||||
|
visible: Boolean(root.warning);
|
||||||
|
text: root.warning;
|
||||||
|
wrapMode: Text.WordWrap;
|
||||||
|
font.italic: true;
|
||||||
|
maximumLineCount: 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
HiFiGlyphs {
|
||||||
|
id: warningIcon;
|
||||||
|
visible: Boolean(root.warning);
|
||||||
|
text: hifi.glyphs.alert;
|
||||||
|
size: hifi.dimensions.controlLineHeight;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Action {
|
Action {
|
||||||
id: cancelAction;
|
id: cancelAction;
|
||||||
text: qsTr("Cancel");
|
text: qsTr("Cancel");
|
||||||
|
|
Loading…
Reference in a new issue