on xenial help sign in
move textArea up automatically when inputmethod popup
6cd57b2Gary.Wzl
qml/Dash/Previews/PreviewCommentInput.qml+23
@@ -38,6 +38,29 @@ PreviewWidget {
38 TextArea {
38 TextArea {
39 id: commentTextArea
39 id: commentTextArea
40 objectName: "commentTextArea"
40 objectName: "commentTextArea"
41+
42+ property var flickableItem: null;
43+ property bool inputMethodVisible: Qt.inputMethod.visible;
44+ onInputMethodVisibleChanged: {
45+ //A workaround to automatically move textArea up on u-touch
46+ if (inputMethodVisible && commentTextArea.activeFocus) {
47+ var obj = root.parent.parent.parent;
48+ if (obj.objectName.indexOf("previewListRow") === 0) {
49+ flickableItem = obj;
50+
51+ var textAreaPos = commentTextArea.mapToItem(flickableItem, 0, 0);
52+ var textAreaGlobalHeight = textAreaPos.y + commentTextArea.implicitHeight
53+ + flickableItem.height / 2.0;
54+
55+ if (textAreaGlobalHeight > flickableItem.height) {
56+ flickableItem.contentY += textAreaGlobalHeight - flickableItem.height;
57+ }
58+ }
59+ } else {
60+ flickableItem = null;
61+ }
62+ }
63+
41 anchors {
64 anchors {
42 top: parent.top
65 top: parent.top
43 left: parent.left
66 left: parent.left
qml/Dash/Previews/PreviewRatingInput.qml+23
@@ -143,6 +143,29 @@ PreviewWidget {
143 TextArea {
143 TextArea {
144 id: reviewTextArea
144 id: reviewTextArea
145 objectName: "reviewTextArea"
145 objectName: "reviewTextArea"
146+
147+ property var flickableItem: null;
148+ property bool inputMethodVisible: Qt.inputMethod.visible;
149+ onInputMethodVisibleChanged: {
150+ //A workaround to automatically move textArea up on u-touch
151+ if (inputMethodVisible && reviewTextArea.activeFocus) {
152+ var obj = root.parent.parent.parent;
153+ if (obj.objectName.indexOf("previewListRow") === 0) {
154+ flickableItem = obj;
155+
156+ var textAreaPos = reviewSubmitContainer.mapToItem(flickableItem, 0, 0);
157+ var textAreaGlobalHeight = textAreaPos.y + reviewSubmitContainer.implicitHeight
158+ + flickableItem.height / 2.0;
159+
160+ if (textAreaGlobalHeight > flickableItem.height) {
161+ flickableItem.contentY += textAreaGlobalHeight - flickableItem.height;
162+ }
163+ }
164+ } else {
165+ flickableItem = null;
166+ }
167+ }
168+
146 anchors {
169 anchors {
147 top: parent.top
170 top: parent.top
148 left: parent.left
171 left: parent.left