From a9fe3596cf4a8ab025e31a60e92faf49acabf6a3 Mon Sep 17 00:00:00 2001 From: beholder Date: Fri, 27 Oct 2017 20:39:43 +0300 Subject: [PATCH 1/8] 4684 Add collapse button on the virtual keyboard --- interface/resources/images/lowerKeyboard.png | Bin 0 -> 1053 bytes interface/resources/qml/controls-uit/Key.qml | 12 +- .../resources/qml/controls-uit/Keyboard.qml | 121 ++++++++++++++++-- libraries/ui/src/ui/OffscreenQmlSurface.cpp | 12 ++ libraries/ui/src/ui/OffscreenQmlSurface.h | 1 + 5 files changed, 125 insertions(+), 21 deletions(-) create mode 100644 interface/resources/images/lowerKeyboard.png diff --git a/interface/resources/images/lowerKeyboard.png b/interface/resources/images/lowerKeyboard.png new file mode 100644 index 0000000000000000000000000000000000000000..d379b028abf829efd35f3e78a7fb90db40636d5d GIT binary patch literal 1053 zcmV+&1mgRNP)tFHbFs&rYpO%1FH^loSdkut1DSVGXCX3uuo4szP~rIhvcBwXLM21Wip% zI668)XJ@A#85zO)`Z^8|4;43)fPcva1pD~-NM#Wj8L3lJQczo4i-LjzarMT=20T1G zpbQJTva%A{+1W@>PZyTP#>PMbW@l%yy1J@vZf=CR-%J4S%^4UNsEH#dCkGTYDJcoN zySw7(@$qrNb#QQ?l)t~fs2ULwp))cvke8Q-;^Jb2g@s{dWd$=cGeQLC>FKG#{=0I3 zV4agp&?97O<`eS0q5uEifhHiK|w)M%9cgU1|1z8 zEt~7=>cj;X7Z=#v+!XM=y}ejlTT@)mQutegmv?t}*96Mi)0#;w@f z+f(=V_d<@nW1oRr0IX180x}d55)x2fUoWBH=H^D$Fh4(!*49>Wg9$@9nByl)!9JO3 z=ZcC75r$w{v$QksM1}YF_eI_JGU^p@dj%~U5wP_!1_eLH|8{nE(9zL>fq?;rA=oAu zEZ-G~_9FQB_~@9J7&J6ApscJ+!iybtHhRMlETwh;*ScG?hzqGMsFXljXb+yo(}{@*QHRQK-&+Lm92XZC zn4YWi^YevBs?7hmpDl<9ZHQF2x3{l?%8`Km67ZJ5($90COFad1+}0?d|R25WXZCmL!hnefRiQ;P#iZ!iMQjRr!)?Y-|)& z=?q$)Dl(aA=a!ZhEH5uVx5uA;DE%1lw>kn-J~1&-*VNSTR{+!grY%Yv{A@CR#RY!= XNdg&R^>QXW00000NkvXXu0mjff;Z>0 literal 0 HcmV?d00001 diff --git a/interface/resources/qml/controls-uit/Key.qml b/interface/resources/qml/controls-uit/Key.qml index e54250c872..586a9c0225 100644 --- a/interface/resources/qml/controls-uit/Key.qml +++ b/interface/resources/qml/controls-uit/Key.qml @@ -5,6 +5,8 @@ Item { id: keyItem width: 45 height: 50 + + property int contentPadding: 4 property string glyph: "a" property bool toggle: false // does this button have the toggle behaivor? property bool toggled: false // is this button currently toggled? @@ -105,14 +107,8 @@ Item { color: "#121212" radius: 2 border.color: "#00000000" - anchors.right: parent.right - anchors.rightMargin: 4 - anchors.left: parent.left - anchors.leftMargin: 4 - anchors.bottom: parent.bottom - anchors.bottomMargin: 4 - anchors.top: parent.top - anchors.topMargin: 4 + anchors.fill: parent + anchors.margins: contentPadding } Text { diff --git a/interface/resources/qml/controls-uit/Keyboard.qml b/interface/resources/qml/controls-uit/Keyboard.qml index 66a61742c9..7f73538c19 100644 --- a/interface/resources/qml/controls-uit/Keyboard.qml +++ b/interface/resources/qml/controls-uit/Keyboard.qml @@ -8,7 +8,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -import QtQuick 2.0 +import QtQuick 2.7 +import QtGraphicalEffects 1.0 import "." Rectangle { @@ -112,8 +113,6 @@ Rectangle { } Rectangle { - y: 0 - x: 0 height: showMirrorText ? mirrorTextHeight : 0 width: keyboardWidth color: "#252525" @@ -122,13 +121,18 @@ Rectangle { TextInput { id: mirrorText visible: showMirrorText - FontLoader { id: ralewaySemiBold; source: "../../fonts/Raleway-SemiBold.ttf"; } - font.family: ralewaySemiBold.name - font.pointSize: 13.5 + FontLoader { id: font; source: "../../fonts/FiraSans-Regular.ttf"; } + font.family: font.name + font.pixelSize: 20 verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - color: "#FFFFFF"; - anchors.fill: parent + horizontalAlignment: Text.AlignLeft + color: "#00B4EF"; + anchors.left: parent.left + anchors.leftMargin: 10 + anchors.right: lowerKeyboard.left + anchors.top: parent.top + anchors.bottom: parent.bottom + wrapMode: Text.WordWrap readOnly: false // we need this to allow control to accept QKeyEvent selectByMouse: false @@ -140,16 +144,107 @@ Rectangle { event.accepted = true; } } + + MouseArea { // ... and we need this mouse area to prevent mirrorText from getting mouse events to ensure it will never get focus + anchors.fill: parent + } } - MouseArea { // ... and we need this mouse area to prevent mirrorText from getting mouse events to ensure it will never get focus - anchors.fill: parent + Item { + id: lowerKeyboard + anchors.right: parent.right + anchors.rightMargin: keyboardRect.width - (key_Backspace.x + key_Backspace.width + key_Backspace.contentPadding) + width: key_Backspace.width * 2 + height: parent.height + + Rectangle { + id: roundedRect + color: "#121212" + radius: 6 + border.color: "#00000000" + anchors.fill: parent + anchors.margins: 4 + + MouseArea { + id: mouseArea + anchors.fill: parent + hoverEnabled: true + + onClicked: { + webEntity.lowerKeyboard(); + } + + onEntered: { + roundedRect.state = "mouseOver"; + } + + onExited: { + roundedRect.state = ""; + } + + onPressed: { + roundedRect.state = "mouseClicked"; + } + + onReleased: { + if (containsMouse) { + roundedRect.state = "mouseOver"; + } else { + roundedRect.state = ""; + } + } + } + + states: [ + State { + name: "mouseOver" + PropertyChanges { + target: roundedRect + color: "#121212" + border.width: 2 + border.color: "#00b4ef" + } + }, + State { + name: "mouseClicked" + PropertyChanges { + target: roundedRect + border.width: 2 + border.color: "#00b4ef" + } + PropertyChanges { + target: colorOverlay + color: '#00B4EF' + } + }, + State { + name: "mouseDepressed" + PropertyChanges { + target: roundedRect + color: "#0578b1" + border.width: 0 + } + } + ] + + Image { + id: buttonImage + anchors.centerIn: parent + source: "../../images/lowerKeyboard.png" // "file:///D:/AI/hifi-elderorb-vs2/interface/resources/images/lowerKeyboard.png"; + } + + ColorOverlay { + id: colorOverlay + anchors.fill: buttonImage + source: buttonImage + color: 'white' + } + } } } Rectangle { id: keyboardRect - x: 0 y: showMirrorText ? mirrorTextHeight : 0 width: keyboardWidth height: raisedHeight @@ -180,7 +275,7 @@ Rectangle { Key { width: 43; glyph: "i"; } Key { width: 43; glyph: "o"; } Key { width: 43; glyph: "p"; } - Key { width: 43; glyph: "←"; } + Key { width: 43; glyph: "←"; id: key_Backspace } } Row { diff --git a/libraries/ui/src/ui/OffscreenQmlSurface.cpp b/libraries/ui/src/ui/OffscreenQmlSurface.cpp index ecd07a5874..8333e87799 100644 --- a/libraries/ui/src/ui/OffscreenQmlSurface.cpp +++ b/libraries/ui/src/ui/OffscreenQmlSurface.cpp @@ -1082,7 +1082,19 @@ void OffscreenQmlSurface::synthesizeKeyPress(QString key, QObject* targetOverrid } } +void OffscreenQmlSurface::lowerKeyboard() { + + QSignalBlocker blocker(_quickWindow); + + if (_currentFocusItem) { + _currentFocusItem->setFocus(false); + setKeyboardRaised(_currentFocusItem, false); + } +} + void OffscreenQmlSurface::setKeyboardRaised(QObject* object, bool raised, bool numeric, bool passwordField) { + qCDebug(uiLogging) << "setKeyboardRaised: " << object << ", raised: " << raised << ", numeric: " << numeric << ", password: " << passwordField; + #if Q_OS_ANDROID return; #endif diff --git a/libraries/ui/src/ui/OffscreenQmlSurface.h b/libraries/ui/src/ui/OffscreenQmlSurface.h index 12ee9e59a1..5acdeb4f40 100644 --- a/libraries/ui/src/ui/OffscreenQmlSurface.h +++ b/libraries/ui/src/ui/OffscreenQmlSurface.h @@ -84,6 +84,7 @@ public: void setKeyboardRaised(QObject* object, bool raised, bool numeric = false, bool passwordField = false); Q_INVOKABLE void synthesizeKeyPress(QString key, QObject* targetOverride = nullptr); + Q_INVOKABLE void lowerKeyboard(); using TextureAndFence = std::pair; // Checks to see if a new texture is available. If one is, the function returns true and From fb14e4dc4d32db910efe383e4031602a8fb55b2e Mon Sep 17 00:00:00 2001 From: beholder Date: Sun, 29 Oct 2017 19:00:03 +0300 Subject: [PATCH 2/8] Fixed programmatical lowering of 'TabletAddressDialog' --- interface/resources/qml/hifi/tablet/TabletAddressDialog.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml b/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml index 4d9a83817a..649a8e6259 100644 --- a/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml +++ b/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml @@ -366,7 +366,7 @@ StackView { HifiControls.Keyboard { id: keyboard - raised: parent.keyboardEnabled + raised: parent.keyboardEnabled && parent.keyboardRaised numeric: parent.punctuationMode anchors { bottom: parent.bottom From eb4214fb4c840bb74fb1dec56e9b8f18b3b94370 Mon Sep 17 00:00:00 2001 From: beholder Date: Thu, 2 Nov 2017 03:35:32 +0300 Subject: [PATCH 3/8] add API for unfocusing input fields in HTML, unfocus WebEngine-based QML items on lowering keyboard --- interface/resources/qml/controls/FlickableWebViewCore.qml | 6 ++++++ interface/resources/qml/controls/TabletWebScreen.qml | 5 +++++ interface/resources/qml/controls/TabletWebView.qml | 5 +++++ interface/resources/qml/controls/WebView.qml | 5 +++++ 4 files changed, 21 insertions(+) diff --git a/interface/resources/qml/controls/FlickableWebViewCore.qml b/interface/resources/qml/controls/FlickableWebViewCore.qml index cbc4d19334..29944781c1 100644 --- a/interface/resources/qml/controls/FlickableWebViewCore.qml +++ b/interface/resources/qml/controls/FlickableWebViewCore.qml @@ -27,6 +27,12 @@ Item { id: hifi } + function unfocus() { + webViewCore.runJavaScript("if (document.activeElement) document.activeElement.blur();", function(result) { + console.log('unfocus completed: ', result); + }); + } + function onLoadingChanged(loadRequest) { if (WebEngineView.LoadStartedStatus === loadRequest.status) { diff --git a/interface/resources/qml/controls/TabletWebScreen.qml b/interface/resources/qml/controls/TabletWebScreen.qml index e06ff51569..501e321f0d 100644 --- a/interface/resources/qml/controls/TabletWebScreen.qml +++ b/interface/resources/qml/controls/TabletWebScreen.qml @@ -10,6 +10,11 @@ Item { property alias urlTag: webroot.urlTag property bool keyboardEnabled: true // FIXME - Keyboard HMD only: Default to false property bool keyboardRaised: false + onKeyboardRaisedChanged: { + if(!keyboardRaised) { + webroot.unfocus(); + } + } property bool punctuationMode: false // FIXME - Keyboard HMD only: Make Interface either set keyboardRaised property directly in OffscreenQmlSurface diff --git a/interface/resources/qml/controls/TabletWebView.qml b/interface/resources/qml/controls/TabletWebView.qml index 8cd61bc90b..477422cfa1 100644 --- a/interface/resources/qml/controls/TabletWebView.qml +++ b/interface/resources/qml/controls/TabletWebView.qml @@ -15,6 +15,11 @@ Item { property string scriptURL property bool keyboardEnabled: false property bool keyboardRaised: false + onKeyboardRaisedChanged: { + if(!keyboardRaised) { + webroot.unfocus(); + } + } property bool punctuationMode: false property bool passwordField: false property bool isDesktop: false diff --git a/interface/resources/qml/controls/WebView.qml b/interface/resources/qml/controls/WebView.qml index 923c8f3fa1..931c64e1ef 100644 --- a/interface/resources/qml/controls/WebView.qml +++ b/interface/resources/qml/controls/WebView.qml @@ -12,6 +12,11 @@ Item { property alias urlTag: webroot.urlTag property bool keyboardEnabled: true // FIXME - Keyboard HMD only: Default to false property bool keyboardRaised: false + onKeyboardRaisedChanged: { + if(!keyboardRaised) { + webroot.unfocus(); + } + } property bool punctuationMode: false property bool passwordField: false property alias flickable: webroot.interactive From db3ed81513f0cbe14cb24fe479de297b26cca6ec Mon Sep 17 00:00:00 2001 From: beholder Date: Tue, 7 Nov 2017 13:45:27 +0300 Subject: [PATCH 4/8] adjust to changed requirements: 1. The keyboard collapse button is moved to the lower right, replacing the keys there 2. The button next to m is a hyphen instead of a underscore, it turns to a underscore when the user clicks on shift 3. The input text at the top occupies the full width and is center aligned, when you start typing the text moves in both directions the left and the right --- interface/resources/fonts/hifi-glyphs.ttf | Bin 30784 -> 31232 bytes interface/resources/qml/controls-uit/Key.qml | 1 + .../resources/qml/controls-uit/Keyboard.qml | 120 +++--------------- libraries/ui/src/ui/OffscreenQmlSurface.cpp | 4 + 4 files changed, 24 insertions(+), 101 deletions(-) diff --git a/interface/resources/fonts/hifi-glyphs.ttf b/interface/resources/fonts/hifi-glyphs.ttf index 3db48602b1eb845238497d2f3750fa7d281ccfbc..4cc5a0fe4f098a287c1df067c8bff37695f96d34 100644 GIT binary patch delta 802 zcmYjPO-vI}5dNk=lmNR(TfuH?y6rZQ(hzJ5t)>v;U-eJ~fe_RvE~V1Y)-Ducn~31S zXcQB}swWP5@J5ZMUQ9Tk(VIpNN(}MPgE8PmWAp$qt?5FvlQ-{uGjF~xGs!IfpxIwE z0|LNc7HaeagZ*9UTZM-}<_iGJ@uSCrc!3Ha^BMr(-Ph{rUJ6M74FVVlCq$`#_~T78`Ub5Y_&1FvHhyD8}rnuoujj`$cO1PxpE8Sr9J^D z&7rtOkpYcBtso0DbOJyXDxpG2@oL_gcNL3@wk?l;82kl=QHfVTj#GQon)Wpy7pmAj zcE|z&C+P!4p@t6CsD%LyFvEr>xX=nO{0QJ6g6P6IBruLCWH60uxQ;o@J0LVPRF%x=XM(dq_x=_JE_g*wR!6IQoa0L=bUNqdUh&|0kV=`pec?M z%w~t#>?i|yJ;Ue=TXhUm_s42&wpyJ$->e)b&#(ReB);&*WVf3rV6u}?SY(U_mIAE7 zz#idwr^0k?)2!AlJ;My_h@SGa$2Lvn#&KLzSX)*7fNL{`np&oGn^DBMq0wj acwCfH5qa}6Pq$?*&DE?nX4iK%Wc@Fk$FR}> delta 432 zcmYL^%`0pH7{-6^oHGX*-PHKVoqT11ntaA6w{&AHeAd0bA{-2p3@2yGna!oUWTShm z#D6e~&W5tEw6L&Xqq~@HT}demHd3QGl(*jAr=GW8&$IC)XOFUu0C{YnFc=R1?6YzX ztHG)Q0^OZmVUE$jQi1Y;A9albr@hM{qrmWNOgG~DSG(Z31kcQZZW`${3aq^X*$YdF z`P=;8ouKu?qCXnZ=Y045L%?64B^r&a>uSBEK>R>eG#0nYj*1>Y4naznR%Z2*sa79& zn?Z_Wx@B-DlOUl?pk+N4d2GEH24fn;F;>j@`Hr;@tA6nQcgqP(Z;xzGeQAFt*F$Em zZ?)w6^=QdI^3A&?<9xNh%b3(Sd(tF58CUt(fQvyUP+S#2m5xk5vU%tIO4X#(F1aGb zhr<2UICCnMM#UM`3KpHb)m+JHAViQhyUeUr8$!W0yU*N_E$5$ED9%g#K($X2<+5qt LBuadrIkn^)$9!hA diff --git a/interface/resources/qml/controls-uit/Key.qml b/interface/resources/qml/controls-uit/Key.qml index 586a9c0225..ebdfff36c0 100644 --- a/interface/resources/qml/controls-uit/Key.qml +++ b/interface/resources/qml/controls-uit/Key.qml @@ -11,6 +11,7 @@ Item { property bool toggle: false // does this button have the toggle behaivor? property bool toggled: false // is this button currently toggled? property alias mouseArea: mouseArea1 + property alias fontFamily: letter.font.family; function resetToggledMode(mode) { toggled = mode; diff --git a/interface/resources/qml/controls-uit/Keyboard.qml b/interface/resources/qml/controls-uit/Keyboard.qml index 7f73538c19..5974ffe7bc 100644 --- a/interface/resources/qml/controls-uit/Keyboard.qml +++ b/interface/resources/qml/controls-uit/Keyboard.qml @@ -56,6 +56,8 @@ Rectangle { return ">"; } else if (str === "/") { return "?"; + } else if (str === "-") { + return "_"; } else { return str.toUpperCase(str); } @@ -68,6 +70,8 @@ Rectangle { return "."; } else if (str === "?") { return "/"; + } else if (str === "_") { + return "-"; } else { return str.toLowerCase(str); } @@ -86,7 +90,7 @@ Rectangle { onShiftModeChanged: { forEachKey(function (key) { - if (/[a-z]/i.test(key.glyph)) { + if (/[a-z-_]/i.test(key.glyph)) { if (shiftMode) { key.glyph = keyboardBase.toUpper(key.glyph); } else { @@ -125,11 +129,11 @@ Rectangle { font.family: font.name font.pixelSize: 20 verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignLeft + horizontalAlignment: Text.AlignHCenter color: "#00B4EF"; anchors.left: parent.left anchors.leftMargin: 10 - anchors.right: lowerKeyboard.left + anchors.right: parent.right anchors.top: parent.top anchors.bottom: parent.bottom @@ -149,98 +153,6 @@ Rectangle { anchors.fill: parent } } - - Item { - id: lowerKeyboard - anchors.right: parent.right - anchors.rightMargin: keyboardRect.width - (key_Backspace.x + key_Backspace.width + key_Backspace.contentPadding) - width: key_Backspace.width * 2 - height: parent.height - - Rectangle { - id: roundedRect - color: "#121212" - radius: 6 - border.color: "#00000000" - anchors.fill: parent - anchors.margins: 4 - - MouseArea { - id: mouseArea - anchors.fill: parent - hoverEnabled: true - - onClicked: { - webEntity.lowerKeyboard(); - } - - onEntered: { - roundedRect.state = "mouseOver"; - } - - onExited: { - roundedRect.state = ""; - } - - onPressed: { - roundedRect.state = "mouseClicked"; - } - - onReleased: { - if (containsMouse) { - roundedRect.state = "mouseOver"; - } else { - roundedRect.state = ""; - } - } - } - - states: [ - State { - name: "mouseOver" - PropertyChanges { - target: roundedRect - color: "#121212" - border.width: 2 - border.color: "#00b4ef" - } - }, - State { - name: "mouseClicked" - PropertyChanges { - target: roundedRect - border.width: 2 - border.color: "#00b4ef" - } - PropertyChanges { - target: colorOverlay - color: '#00B4EF' - } - }, - State { - name: "mouseDepressed" - PropertyChanges { - target: roundedRect - color: "#0578b1" - border.width: 0 - } - } - ] - - Image { - id: buttonImage - anchors.centerIn: parent - source: "../../images/lowerKeyboard.png" // "file:///D:/AI/hifi-elderorb-vs2/interface/resources/images/lowerKeyboard.png"; - } - - ColorOverlay { - id: colorOverlay - anchors.fill: buttonImage - source: buttonImage - color: 'white' - } - } - } } Rectangle { @@ -253,6 +165,8 @@ Rectangle { anchors.bottom: parent.bottom anchors.bottomMargin: 0 + FontLoader { id: hiFiGlyphs; source: pathToFonts + "fonts/hifi-glyphs.ttf"; } + Column { id: columnAlpha width: keyboardWidth @@ -275,7 +189,7 @@ Rectangle { Key { width: 43; glyph: "i"; } Key { width: 43; glyph: "o"; } Key { width: 43; glyph: "p"; } - Key { width: 43; glyph: "←"; id: key_Backspace } + Key { width: 43; glyph: "←"; } } Row { @@ -316,7 +230,7 @@ Rectangle { Key { width: 43; glyph: "b"; } Key { width: 43; glyph: "n"; } Key { width: 43; glyph: "m"; } - Key { width: 43; glyph: "_"; } + Key { width: 43; glyph: "-"; } Key { width: 43; glyph: "/"; } Key { width: 43; glyph: "?"; } } @@ -335,8 +249,10 @@ Rectangle { Key { width: 231; glyph: " "; } Key { width: 43; glyph: ","; } Key { width: 43; glyph: "."; } - Key { width: 43; glyph: "\u276C"; } - Key { width: 43; glyph: "\u276D"; } + Key { + fontFamily: hiFiGlyphs.name; + width: 86; glyph: "\ue02b"; + } } } @@ -423,8 +339,10 @@ Rectangle { Key { width: 231; glyph: " "; } Key { width: 43; glyph: ","; } Key { width: 43; glyph: "."; } - Key { width: 43; glyph: "\u276C"; } - Key { width: 43; glyph: "\u276D"; } + Key { + fontFamily: hiFiGlyphs.name; + width: 86; glyph: "\ue02b"; + } } } } diff --git a/libraries/ui/src/ui/OffscreenQmlSurface.cpp b/libraries/ui/src/ui/OffscreenQmlSurface.cpp index 8333e87799..24e1006083 100644 --- a/libraries/ui/src/ui/OffscreenQmlSurface.cpp +++ b/libraries/ui/src/ui/OffscreenQmlSurface.cpp @@ -1038,6 +1038,7 @@ static const uint8_t BACKSPACE_SYMBOL[] = { 0xE2, 0x86, 0x90, 0x00 }; static const uint8_t LEFT_ARROW[] = { 0xE2, 0x9D, 0xAC, 0x00 }; static const uint8_t RIGHT_ARROW[] = { 0xE2, 0x9D, 0xAD, 0x00 }; static const uint8_t RETURN_SYMBOL[] = { 0xE2, 0x8F, 0x8E, 0x00 }; +static const uint8_t COLLAPSE_KEYBOARD[] = { 0xEE, 0x80, 0xAB, 0x00 }; static const char PUNCTUATION_STRING[] = "123"; static const char ALPHABET_STRING[] = "abc"; @@ -1061,6 +1062,9 @@ void OffscreenQmlSurface::synthesizeKeyPress(QString key, QObject* targetOverrid if (equals(utf8Key, SHIFT_ARROW) || equals(utf8Key, NUMERIC_SHIFT_ARROW) || equals(utf8Key, (uint8_t*)PUNCTUATION_STRING) || equals(utf8Key, (uint8_t*)ALPHABET_STRING)) { return; // ignore + } else if (equals(utf8Key, COLLAPSE_KEYBOARD)) { + lowerKeyboard(); + return; } else if (equals(utf8Key, BACKSPACE_SYMBOL)) { scanCode = Qt::Key_Backspace; keyString = "\x08"; From 4d11f9a434eb2530f3a5d3e413d256d779bdfea2 Mon Sep 17 00:00:00 2001 From: beholder Date: Tue, 7 Nov 2017 23:13:29 +0300 Subject: [PATCH 5/8] increase font pixel size for 'collapse keyboard' to 34px --- interface/resources/qml/controls-uit/Key.qml | 1 + interface/resources/qml/controls-uit/Keyboard.qml | 2 ++ 2 files changed, 3 insertions(+) diff --git a/interface/resources/qml/controls-uit/Key.qml b/interface/resources/qml/controls-uit/Key.qml index ebdfff36c0..314149ca6e 100644 --- a/interface/resources/qml/controls-uit/Key.qml +++ b/interface/resources/qml/controls-uit/Key.qml @@ -12,6 +12,7 @@ Item { property bool toggled: false // is this button currently toggled? property alias mouseArea: mouseArea1 property alias fontFamily: letter.font.family; + property alias fontPixelSize: letter.font.pixelSize function resetToggledMode(mode) { toggled = mode; diff --git a/interface/resources/qml/controls-uit/Keyboard.qml b/interface/resources/qml/controls-uit/Keyboard.qml index 5974ffe7bc..1865e437e5 100644 --- a/interface/resources/qml/controls-uit/Keyboard.qml +++ b/interface/resources/qml/controls-uit/Keyboard.qml @@ -251,6 +251,7 @@ Rectangle { Key { width: 43; glyph: "."; } Key { fontFamily: hiFiGlyphs.name; + fontPixelSize: 34; width: 86; glyph: "\ue02b"; } } @@ -341,6 +342,7 @@ Rectangle { Key { width: 43; glyph: "."; } Key { fontFamily: hiFiGlyphs.name; + fontPixelSize: 34; width: 86; glyph: "\ue02b"; } } From 0bc95998c498dcd1de8fdb766fe97392c8f7e2ee Mon Sep 17 00:00:00 2001 From: beholder Date: Wed, 8 Nov 2017 02:05:58 +0300 Subject: [PATCH 6/8] a few more adjustments based on discussion with Mukul --- interface/resources/qml/controls-uit/Key.qml | 2 ++ interface/resources/qml/controls-uit/Keyboard.qml | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/interface/resources/qml/controls-uit/Key.qml b/interface/resources/qml/controls-uit/Key.qml index 314149ca6e..b0e965e79f 100644 --- a/interface/resources/qml/controls-uit/Key.qml +++ b/interface/resources/qml/controls-uit/Key.qml @@ -13,6 +13,8 @@ Item { property alias mouseArea: mouseArea1 property alias fontFamily: letter.font.family; property alias fontPixelSize: letter.font.pixelSize + property alias verticalAlignment: letter.verticalAlignment + property alias letterAnchors: letter.anchors function resetToggledMode(mode) { toggled = mode; diff --git a/interface/resources/qml/controls-uit/Keyboard.qml b/interface/resources/qml/controls-uit/Keyboard.qml index 1865e437e5..76b66178d4 100644 --- a/interface/resources/qml/controls-uit/Keyboard.qml +++ b/interface/resources/qml/controls-uit/Keyboard.qml @@ -251,7 +251,9 @@ Rectangle { Key { width: 43; glyph: "."; } Key { fontFamily: hiFiGlyphs.name; - fontPixelSize: 34; + fontPixelSize: 48; + letterAnchors.topMargin: -4; + verticalAlignment: Text.AlignVCenter; width: 86; glyph: "\ue02b"; } } @@ -342,7 +344,9 @@ Rectangle { Key { width: 43; glyph: "."; } Key { fontFamily: hiFiGlyphs.name; - fontPixelSize: 34; + fontPixelSize: 48; + letterAnchors.topMargin: -4; + verticalAlignment: Text.AlignVCenter; width: 86; glyph: "\ue02b"; } } From d1969d649a0e7f8a22791181a48e1d87fe77b460 Mon Sep 17 00:00:00 2001 From: beholder Date: Thu, 9 Nov 2017 22:33:16 +0300 Subject: [PATCH 7/8] fix not collapsing keyboard --- .../resources/qml/hifi/dialogs/TabletRunningScripts.qml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/interface/resources/qml/hifi/dialogs/TabletRunningScripts.qml b/interface/resources/qml/hifi/dialogs/TabletRunningScripts.qml index 80c1b58444..83f91c78c5 100644 --- a/interface/resources/qml/hifi/dialogs/TabletRunningScripts.qml +++ b/interface/resources/qml/hifi/dialogs/TabletRunningScripts.qml @@ -32,6 +32,8 @@ Rectangle { color: hifi.colors.baseGray + property bool keyboardEnabled: HMD.active + property bool keyboardRaised: false LetterboxMessage { id: letterBoxMessage @@ -380,7 +382,7 @@ Rectangle { Component.onCompleted: scriptsModel.filterRegExp = new RegExp("^.*$", "i") onActiveFocusChanged: { // raise the keyboard - keyboard.raised = activeFocus; + root.keyboardRaised = activeFocus; // scroll to the bottom of the content area. if (activeFocus) { @@ -481,7 +483,7 @@ Rectangle { HifiControls.Keyboard { id: keyboard - raised: false + raised: parent.keyboardEnabled && parent.keyboardRaised numeric: false anchors { bottom: parent.bottom From 5fcde1186afb2dd3cb48dbb1b9e05c8f7771ce12 Mon Sep 17 00:00:00 2001 From: beholder Date: Fri, 10 Nov 2017 03:54:03 +0300 Subject: [PATCH 8/8] hide keyboard before showing to solve clearing 'mirrorText' on jumping between input fields without hiding keyboard --- libraries/ui/src/ui/OffscreenQmlSurface.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libraries/ui/src/ui/OffscreenQmlSurface.cpp b/libraries/ui/src/ui/OffscreenQmlSurface.cpp index 24e1006083..01f8f4580a 100644 --- a/libraries/ui/src/ui/OffscreenQmlSurface.cpp +++ b/libraries/ui/src/ui/OffscreenQmlSurface.cpp @@ -1133,6 +1133,10 @@ void OffscreenQmlSurface::setKeyboardRaised(QObject* object, bool raised, bool n item->setProperty("passwordField", QVariant(passwordField)); } + if (raised) { + item->setProperty("keyboardRaised", QVariant(!raised)); + } + item->setProperty("keyboardRaised", QVariant(raised)); return; }