From 9e458fd180b471802adddbd15d71baa46fedfc4f Mon Sep 17 00:00:00 2001 From: David Rowe Date: Thu, 16 Mar 2017 17:25:28 +1300 Subject: [PATCH 1/6] Fix keyboard in tablet custom query dialog --- .../qml/dialogs/TabletCustomQueryDialog.qml | 231 +++++++++--------- 1 file changed, 119 insertions(+), 112 deletions(-) diff --git a/interface/resources/qml/dialogs/TabletCustomQueryDialog.qml b/interface/resources/qml/dialogs/TabletCustomQueryDialog.qml index 3f6e07da4f..3f2750abe9 100644 --- a/interface/resources/qml/dialogs/TabletCustomQueryDialog.qml +++ b/interface/resources/qml/dialogs/TabletCustomQueryDialog.qml @@ -20,7 +20,9 @@ TabletModalWindow { id: root; HifiConstants { id: hifi; } - y: hifi.dimensions.tabletMenuHeader + anchors.fill: parent + width: parent.width + height: parent.height title: "" visible: true; @@ -108,7 +110,7 @@ TabletModalWindow { TabletModalFrame { id: modalWindowItem - width: parent.width - 12 + width: parent.width - 6 height: 240 anchors { verticalCenter: parent.verticalCenter @@ -119,7 +121,7 @@ TabletModalWindow { id: d; readonly property int minWidth: 470 readonly property int maxWidth: 470 - readonly property int minHeight: 240 + readonly property int minHeight: 120 readonly property int maxHeight: 720 function resize() { @@ -130,8 +132,8 @@ TabletModalWindow { ((keyboardEnabled && keyboardRaised) ? (keyboard.raisedHeight + 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); + modalWindowItem.height = (targetHeight < d.minHeight) ? d.minHeight : ((targetHeight > d.maxHeight) ? + d.maxHeight : targetHeight); if (checkBoxField.visible && comboBoxField.visible) { checkBoxField.width = extraInputs.width / 2; comboBoxField.width = extraInputs.width / 2; @@ -140,14 +142,16 @@ TabletModalWindow { } } } -// Item { -// anchors { -// // top: parent.top; -// // bottom: extraInputs.visible ? extraInputs.top : buttons.top; -// left: parent.left; -// right: parent.right; -// topMargin: 20 -// } + + Item { + anchors { + top: parent.top; + bottom: extraInputs.visible ? extraInputs.top : buttons.top; + left: parent.left; + right: parent.right; + leftMargin: 12 + rightMargin: 12 + } // FIXME make a text field type that can be bound to a history for autocompletion ControlsUIT.TextField { @@ -156,14 +160,16 @@ TabletModalWindow { focus: root.textInput ? true : false; visible: root.textInput ? true : false; anchors { - top: parent.top left: parent.left; right: parent.right; - leftMargin: 5; rightMargin: 5; - topMargin: textField.controlHeight - textField.height + 5 + bottom: keyboard.top; + bottomMargin: hifi.dimensions.contentSpacing.y; } } + property alias keyboardOverride: root.keyboardOverride + property alias keyboardRaised: root.keyboardRaised + property alias punctuationMode: root.punctuationMode ControlsUIT.Keyboard { id: keyboard raised: keyboardEnabled && keyboardRaised @@ -171,110 +177,111 @@ TabletModalWindow { anchors { left: parent.left right: parent.right - leftMargin: 5; rightMargin: 5; - top: textField.bottom - topMargin: raised ? hifi.dimensions.contentSpacing.y : 0 + bottom: parent.bottom + bottomMargin: raised ? hifi.dimensions.contentSpacing.y : 0 } } - // } + } - Row { - id: extraInputs; - visible: Boolean(root.checkBox || root.comboBox); + Item { + id: extraInputs; + 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 { 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; - left: parent.left; - right: parent.right; - 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; + leftMargin: 6; // Magic number to align with warning icon + bottomMargin: 6; } } -// }//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 { id: cancelAction; text: qsTr("Cancel"); From 7efda8bead43c2481c4dd5c686ca9af53140701f Mon Sep 17 00:00:00 2001 From: David Rowe Date: Thu, 16 Mar 2017 17:33:38 +1300 Subject: [PATCH 2/6] Make clicking on dialog background defocus current control --- interface/resources/qml/dialogs/TabletCustomQueryDialog.qml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/interface/resources/qml/dialogs/TabletCustomQueryDialog.qml b/interface/resources/qml/dialogs/TabletCustomQueryDialog.qml index 3f2750abe9..3243a50676 100644 --- a/interface/resources/qml/dialogs/TabletCustomQueryDialog.qml +++ b/interface/resources/qml/dialogs/TabletCustomQueryDialog.qml @@ -117,6 +117,12 @@ TabletModalWindow { horizontalCenter: parent.horizontalCenter } + MouseArea { + // Clicking dialog background defocuses active control. + anchors.fill: parent + onClicked: parent.forceActiveFocus(); + } + QtObject { id: d; readonly property int minWidth: 470 From 3c1506237ac0f6b3a428ed9dbdda67fea4092730 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Thu, 16 Mar 2017 17:56:13 +1300 Subject: [PATCH 3/6] Fix not all warning text displaying --- interface/resources/qml/dialogs/CustomQueryDialog.qml | 1 + interface/resources/qml/dialogs/TabletCustomQueryDialog.qml | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/interface/resources/qml/dialogs/CustomQueryDialog.qml b/interface/resources/qml/dialogs/CustomQueryDialog.qml index 97f55d087b..98aa158b1c 100644 --- a/interface/resources/qml/dialogs/CustomQueryDialog.qml +++ b/interface/resources/qml/dialogs/CustomQueryDialog.qml @@ -259,6 +259,7 @@ ModalWindow { visible: Boolean(root.warning); text: hifi.glyphs.alert; size: hifi.dimensions.controlLineHeight; + width: 20 // Line up with checkbox. } } diff --git a/interface/resources/qml/dialogs/TabletCustomQueryDialog.qml b/interface/resources/qml/dialogs/TabletCustomQueryDialog.qml index 3243a50676..00081ab16d 100644 --- a/interface/resources/qml/dialogs/TabletCustomQueryDialog.qml +++ b/interface/resources/qml/dialogs/TabletCustomQueryDialog.qml @@ -277,7 +277,7 @@ TabletModalWindow { text: root.warning; wrapMode: Text.WordWrap; font.italic: true; - maximumLineCount: 2; + maximumLineCount: 3; } HiFiGlyphs { @@ -285,6 +285,7 @@ TabletModalWindow { visible: Boolean(root.warning); text: hifi.glyphs.alert; size: hifi.dimensions.controlLineHeight; + width: 20 // Line up with checkbox. } } From 74db9dc573f4707accb287d01318c5dba60dfeac Mon Sep 17 00:00:00 2001 From: David Rowe Date: Thu, 16 Mar 2017 18:18:00 +1300 Subject: [PATCH 4/6] Fix drop-down hiding behind buttons --- interface/resources/qml/dialogs/TabletCustomQueryDialog.qml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/interface/resources/qml/dialogs/TabletCustomQueryDialog.qml b/interface/resources/qml/dialogs/TabletCustomQueryDialog.qml index 00081ab16d..d462cf00d9 100644 --- a/interface/resources/qml/dialogs/TabletCustomQueryDialog.qml +++ b/interface/resources/qml/dialogs/TabletCustomQueryDialog.qml @@ -203,6 +203,7 @@ TabletModalWindow { height: comboBoxField.controlHeight; onHeightChanged: d.resize(); onWidthChanged: d.resize(); + z: 20 ControlsUIT.CheckBox { id: checkBoxField; @@ -244,6 +245,7 @@ TabletModalWindow { d.resize(); resizeWarningText(); } + z: 10 anchors { bottom: parent.bottom; From 89eb0738557a2485d1ec5675941ed63cb499c87c Mon Sep 17 00:00:00 2001 From: David Rowe Date: Thu, 16 Mar 2017 18:24:04 +1300 Subject: [PATCH 5/6] Fix dialog height changing as drop-down value is changed --- interface/resources/qml/AssetServer.qml | 2 +- interface/resources/qml/dialogs/TabletCustomQueryDialog.qml | 2 +- interface/resources/qml/hifi/dialogs/TabletAssetServer.qml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/interface/resources/qml/AssetServer.qml b/interface/resources/qml/AssetServer.qml index cf61a2ae4a..69411edce5 100644 --- a/interface/resources/qml/AssetServer.qml +++ b/interface/resources/qml/AssetServer.qml @@ -177,7 +177,7 @@ ScrollingWindow { SHAPE_TYPE_STATIC_MESH ], checkStateOnDisable: false, - warningOnDisable: "Models with automatic collisions set to 'Exact' cannot be dynamic" + warningOnDisable: "Models with 'Exact' automatic collisions cannot be dynamic" } }); diff --git a/interface/resources/qml/dialogs/TabletCustomQueryDialog.qml b/interface/resources/qml/dialogs/TabletCustomQueryDialog.qml index d462cf00d9..8da2150c9a 100644 --- a/interface/resources/qml/dialogs/TabletCustomQueryDialog.qml +++ b/interface/resources/qml/dialogs/TabletCustomQueryDialog.qml @@ -279,7 +279,7 @@ TabletModalWindow { text: root.warning; wrapMode: Text.WordWrap; font.italic: true; - maximumLineCount: 3; + maximumLineCount: 2; } HiFiGlyphs { diff --git a/interface/resources/qml/hifi/dialogs/TabletAssetServer.qml b/interface/resources/qml/hifi/dialogs/TabletAssetServer.qml index 93e18c7aba..2460fc39d5 100644 --- a/interface/resources/qml/hifi/dialogs/TabletAssetServer.qml +++ b/interface/resources/qml/hifi/dialogs/TabletAssetServer.qml @@ -176,7 +176,7 @@ Rectangle { SHAPE_TYPE_STATIC_MESH ], checkStateOnDisable: false, - warningOnDisable: "Models with automatic collisions set to 'Exact' cannot be dynamic" + warningOnDisable: "Models with 'Exact' automatic collisions cannot be dynamic" } }); From 1080e21afd707eea654d976e3a21e659e4680f90 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Thu, 16 Mar 2017 18:27:13 +1300 Subject: [PATCH 6/6] Tidying --- .../resources/qml/dialogs/CustomQueryDialog.qml | 8 ++++---- .../qml/dialogs/TabletCustomQueryDialog.qml | 14 +++++++------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/interface/resources/qml/dialogs/CustomQueryDialog.qml b/interface/resources/qml/dialogs/CustomQueryDialog.qml index 98aa158b1c..4d6fe74bca 100644 --- a/interface/resources/qml/dialogs/CustomQueryDialog.qml +++ b/interface/resources/qml/dialogs/CustomQueryDialog.qml @@ -107,10 +107,10 @@ ModalWindow { QtObject { id: d; - readonly property int minWidth: 480; - readonly property int maxWdith: 1280; - readonly property int minHeight: 120; - readonly property int maxHeight: 720; + readonly property int minWidth: 480 + readonly property int maxWdith: 1280 + readonly property int minHeight: 120 + readonly property int maxHeight: 720 function resize() { var targetWidth = Math.max(titleWidth, pane.width); diff --git a/interface/resources/qml/dialogs/TabletCustomQueryDialog.qml b/interface/resources/qml/dialogs/TabletCustomQueryDialog.qml index 8da2150c9a..7965006b8b 100644 --- a/interface/resources/qml/dialogs/TabletCustomQueryDialog.qml +++ b/interface/resources/qml/dialogs/TabletCustomQueryDialog.qml @@ -12,7 +12,7 @@ import QtQuick 2.5 import QtQuick.Controls 1.4 import QtQuick.Dialogs 1.2 as OriginalDialogs -import "../controls-uit" as ControlsUIT +import "../controls-uit" import "../styles-uit" import "../windows" @@ -160,7 +160,7 @@ TabletModalWindow { } // FIXME make a text field type that can be bound to a history for autocompletion - ControlsUIT.TextField { + TextField { id: textField; label: root.textInput.label; focus: root.textInput ? true : false; @@ -176,7 +176,7 @@ TabletModalWindow { property alias keyboardOverride: root.keyboardOverride property alias keyboardRaised: root.keyboardRaised property alias punctuationMode: root.punctuationMode - ControlsUIT.Keyboard { + Keyboard { id: keyboard raised: keyboardEnabled && keyboardRaised numeric: punctuationMode @@ -205,7 +205,7 @@ TabletModalWindow { onWidthChanged: d.resize(); z: 20 - ControlsUIT.CheckBox { + CheckBox { id: checkBoxField; text: root.checkBox.label; focus: Boolean(root.checkBox); @@ -218,7 +218,7 @@ TabletModalWindow { } } - ControlsUIT.ComboBox { + ComboBox { id: comboBoxField; label: root.comboBox.label; focus: Boolean(root.comboBox); @@ -263,12 +263,12 @@ TabletModalWindow { warningText.width = rowWidth - buttonsWidth - warningIconWidth; } - ControlsUIT.Button { + Button { id: cancelButton; action: cancelAction; } - ControlsUIT.Button { + Button { id: acceptButton; action: acceptAction; }