on xenial help sign in
move textArea up automatically when inputmethod popup
commit6cd57b28027c9182c0f657b2c20af95b19c1bbfd authorGary.Wzl <Gary.Wang@canonical.com> dateFri 7 Aug 2015, 11:49 (11 years ago) parentaf2af67
2 files changed+46
qml/Dash/Previews/PreviewCommentInput.qml+23 qml/Dash/Previews/PreviewRatingInput.qml+23
qml/Dash/Previews/PreviewCommentInput.qml+23
@@ -38,6 +38,29 @@ PreviewWidget {
3838 TextArea {
3939 id: commentTextArea
4040 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+
4164 anchors {
4265 top: parent.top
4366 left: parent.left
qml/Dash/Previews/PreviewRatingInput.qml+23
@@ -143,6 +143,29 @@ PreviewWidget {
143143 TextArea {
144144 id: reviewTextArea
145145 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+
146169 anchors {
147170 top: parent.top
148171 left: parent.left