From 9ec10bbb7ed406869a25e61f3af8a8d13c214925 Mon Sep 17 00:00:00 2001 From: Alexander Ivash Date: Fri, 16 Mar 2018 19:50:03 +0300 Subject: [PATCH 1/5] Make keyboard's 'raisedHeight' to include 'mirror text' height note: this is necessary becasue all the dialogs rely on 'raisedHeight', so without 'mirror text' they will use wrong keyboard geometry during calculations --- interface/resources/qml/controls-uit/Keyboard.qml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/interface/resources/qml/controls-uit/Keyboard.qml b/interface/resources/qml/controls-uit/Keyboard.qml index ea76d44aaa..9d4fd33022 100644 --- a/interface/resources/qml/controls-uit/Keyboard.qml +++ b/interface/resources/qml/controls-uit/Keyboard.qml @@ -26,15 +26,17 @@ Rectangle { readonly property int keyboardRowHeight: 50 readonly property int keyboardWidth: 480 + readonly property int keyboardHeight: 200 readonly property int mirrorTextHeight: keyboardRowHeight property bool password: false property alias mirroredText: mirrorText.text property bool showMirrorText: true - readonly property int raisedHeight: 200 - height: enabled && raised ? raisedHeight + (showMirrorText ? keyboardRowHeight : 0) : 0 + readonly property int raisedHeight: keyboardHeight + (showMirrorText ? keyboardRowHeight : 0) + + height: enabled && raised ? raisedHeight : 0 visible: enabled && raised property bool shiftMode: false @@ -158,7 +160,7 @@ Rectangle { id: keyboardRect y: showMirrorText ? mirrorTextHeight : 0 width: keyboardWidth - height: raisedHeight + height: keyboardHeight color: "#252525" anchors.horizontalCenter: parent.horizontalCenter anchors.bottom: parent.bottom @@ -167,7 +169,7 @@ Rectangle { Column { id: columnAlpha width: keyboardWidth - height: raisedHeight + height: keyboardHeight visible: !numeric Row { @@ -259,7 +261,7 @@ Rectangle { Column { id: columnNumeric width: keyboardWidth - height: raisedHeight + height: keyboardHeight visible: numeric Row { From 91488bbbeb1a9216fef8f8d8918d86363fb94a97 Mon Sep 17 00:00:00 2001 From: Alexander Ivash Date: Fri, 16 Mar 2018 22:38:39 +0300 Subject: [PATCH 2/5] align combobox to accept/cancel buttons, otherwise stretch to buttons area --- .../resources/qml/dialogs/CustomQueryDialog.qml | 15 +++++++++------ .../qml/dialogs/TabletCustomQueryDialog.qml | 15 +++++++++------ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/interface/resources/qml/dialogs/CustomQueryDialog.qml b/interface/resources/qml/dialogs/CustomQueryDialog.qml index 6e1bb4b309..10b526b371 100644 --- a/interface/resources/qml/dialogs/CustomQueryDialog.qml +++ b/interface/resources/qml/dialogs/CustomQueryDialog.qml @@ -122,12 +122,6 @@ ModalWindow { 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); - if (checkBoxField.visible && comboBoxField.visible) { - checkBoxField.width = extraInputs.width / 2; - comboBoxField.width = extraInputs.width / 2; - } else if (!checkBoxField.visible && comboBoxField.visible) { - comboBoxField.width = extraInputs.width; - } } } @@ -198,6 +192,15 @@ ModalWindow { label: root.comboBox.label; focus: Boolean(root.comboBox); visible: Boolean(root.comboBox); + Binding on x { + when: comboBoxField.visible + value: !checkBoxField.visible ? buttons.x : acceptButton.x + } + + Binding on width { + when: comboBoxField.visible + value: !checkBoxField.visible ? buttons.width : buttons.width - acceptButton.x + } anchors { right: parent.right; bottom: parent.bottom; diff --git a/interface/resources/qml/dialogs/TabletCustomQueryDialog.qml b/interface/resources/qml/dialogs/TabletCustomQueryDialog.qml index 7965006b8b..37c0b3612d 100644 --- a/interface/resources/qml/dialogs/TabletCustomQueryDialog.qml +++ b/interface/resources/qml/dialogs/TabletCustomQueryDialog.qml @@ -140,12 +140,6 @@ TabletModalWindow { root.width = (targetWidth < d.minWidth) ? d.minWidth : ((targetWidth > d.maxWdith) ? d.maxWidth : targetWidth); 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; - } else if (!checkBoxField.visible && comboBoxField.visible) { - comboBoxField.width = extraInputs.width; - } } } @@ -223,6 +217,15 @@ TabletModalWindow { label: root.comboBox.label; focus: Boolean(root.comboBox); visible: Boolean(root.comboBox); + Binding on x { + when: comboBoxField.visible + value: !checkBoxField.visible ? buttons.x : acceptButton.x + } + + Binding on width { + when: comboBoxField.visible + value: !checkBoxField.visible ? buttons.width : buttons.width - acceptButton.x + } anchors { right: parent.right; bottom: parent.bottom; From c34a6fd00006023dbccf0585f9e3d855275fbc7d Mon Sep 17 00:00:00 2001 From: Alexander Ivash Date: Fri, 16 Mar 2018 23:04:50 +0300 Subject: [PATCH 3/5] Fix styling issues - make TabletQueryDialog more consistent with TabletCustomQueryDialog --- interface/resources/qml/dialogs/TabletQueryDialog.qml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/interface/resources/qml/dialogs/TabletQueryDialog.qml b/interface/resources/qml/dialogs/TabletQueryDialog.qml index 60dbc106dc..92f6864c86 100644 --- a/interface/resources/qml/dialogs/TabletQueryDialog.qml +++ b/interface/resources/qml/dialogs/TabletQueryDialog.qml @@ -89,9 +89,9 @@ TabletModalWindow { bottom: buttons.top; left: parent.left; right: parent.right; - margins: 0 + leftMargin: 12 + rightMargin: 12 bottomMargin: 2 * hifi.dimensions.contentSpacing.y - topMargin: modalWindowItem.frameMarginTop } // FIXME make a text field type that can be bound to a history for autocompletion @@ -104,8 +104,6 @@ TabletModalWindow { left: parent.left; right: parent.right; bottom: parent.bottom - leftMargin: 5 - rightMargin: 5 } } @@ -133,8 +131,8 @@ TabletModalWindow { anchors { bottom: parent.bottom right: parent.right - margins: 0 - rightMargin: hifi.dimensions.borderRadius + leftMargin: 12 + rightMargin: 12 bottomMargin: hifi.dimensions.contentSpacing.y } Button { action: cancelAction } From 3ce00acd163d661f84050cfbb7c9eee0e6302cb3 Mon Sep 17 00:00:00 2001 From: Alexander Ivash Date: Fri, 6 Apr 2018 00:33:42 +0300 Subject: [PATCH 4/5] rebased to the master --- interface/resources/qml/dialogs/TabletQueryDialog.qml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/interface/resources/qml/dialogs/TabletQueryDialog.qml b/interface/resources/qml/dialogs/TabletQueryDialog.qml index 92f6864c86..60dbc106dc 100644 --- a/interface/resources/qml/dialogs/TabletQueryDialog.qml +++ b/interface/resources/qml/dialogs/TabletQueryDialog.qml @@ -89,9 +89,9 @@ TabletModalWindow { bottom: buttons.top; left: parent.left; right: parent.right; - leftMargin: 12 - rightMargin: 12 + margins: 0 bottomMargin: 2 * hifi.dimensions.contentSpacing.y + topMargin: modalWindowItem.frameMarginTop } // FIXME make a text field type that can be bound to a history for autocompletion @@ -104,6 +104,8 @@ TabletModalWindow { left: parent.left; right: parent.right; bottom: parent.bottom + leftMargin: 5 + rightMargin: 5 } } @@ -131,8 +133,8 @@ TabletModalWindow { anchors { bottom: parent.bottom right: parent.right - leftMargin: 12 - rightMargin: 12 + margins: 0 + rightMargin: hifi.dimensions.borderRadius bottomMargin: hifi.dimensions.contentSpacing.y } Button { action: cancelAction } From 25a44edfce2bd91241799e673376b880120ac8c8 Mon Sep 17 00:00:00 2001 From: Alexander Ivash Date: Fri, 6 Apr 2018 00:39:04 +0300 Subject: [PATCH 5/5] fix conditional bindings note: unfortunately there is no way to understand whether the item was anchored as even not anchored item has some anchors --- interface/resources/qml/controls-uit/TextField.qml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/interface/resources/qml/controls-uit/TextField.qml b/interface/resources/qml/controls-uit/TextField.qml index 6743d08275..03b4c85a8a 100644 --- a/interface/resources/qml/controls-uit/TextField.qml +++ b/interface/resources/qml/controls-uit/TextField.qml @@ -34,6 +34,11 @@ TextField { placeholderText: textField.placeholderText + property bool rightAnchorSet: false; + anchors.onRightChanged: { + rightAnchorSet = true; + } + font.family: "Fira Sans" font.pixelSize: hifi.fontSizes.textFieldInput height: implicitHeight + 3 // Make surrounding box higher so that highlight is vertically centered. @@ -165,11 +170,11 @@ TextField { anchors.left: parent.left Binding on anchors.right { - when: parent.right - value: parent.right + when: rightAnchorSet + value: textField.right } Binding on wrapMode { - when: parent.right + when: rightAnchorSet value: Text.WordWrap }