Bug 307443 - TextInput Fails
Summary: TextInput Fails
Status: RESOLVED UNMAINTAINED
Alias: None
Product: Necessitas
Classification: Unmaintained
Component: Android Qt4 (show other bugs)
Version: alpha3
Platform: Android Android 4.x
: HI major
Target Milestone: Beta 1
Assignee: BogDan Vatra
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-09-26 15:45 UTC by cjacques
Modified: 2018-09-04 16:15 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Android input context test patch (4.24 KB, patch)
2012-09-28 18:34 UTC, BogDan Vatra
Details

Note You need to log in before you can comment on or make changes to this bug.
Description cjacques 2012-09-26 15:45:37 UTC
I'm running into a problem on the Samsung Galaxy S3 running Android 4.1, as well as another Samsung Galaxy S2 running Android 2.3.6.  When I click on the text input and try to enter text, it displays in the input, but QML doesn't know that text has been entered (I used onTextChanged to verify that this was the case).  There's also a problem where trying to backspace doesn't work either.  Once you hit the done button, the input itself becomes not selectable from that point on and QML doesn't think that you've added any text.
Comment 1 BogDan Vatra 2012-09-28 18:34:28 UTC
Created attachment 74218 [details]
Android input context test patch
Comment 2 BogDan Vatra 2012-09-28 18:39:15 UTC
Hi

Thanks for your report, I found some problems on the emulator but sadly I don't have none of your devices you mention on this bug report to check if it works, so, I'll need your help to check if the attached patch is fixing your problems.

On emulator I test it with the following qml file:

import QtQuick 1.1

Rectangle {
    id: rectangle1
    width: 360
    height: 360
    Text {
        id: text_id
        text: qsTr("Hello World")
        anchors.centerIn: parent
    }
    TextEdit {
        id: text_edit1
        width: 340
        height: 20
        text: qsTr("text edit")
        anchors.top: text_id.bottom
        anchors.topMargin: 0
        onTextChanged: {
            text_id.text=text
        }
    }
}
Comment 3 cjacques 2012-10-04 19:11:45 UTC
I made the change to the file and am trying to rebuild the source, but when I run the command 
"./android/androidconfigbuild.sh -n --directory of ndk-- -q 1 -d 1" I get the error:
"fatal error: qclass_lib_map.h: No such file or directory /n compilation terminated."

what should I do to correct this error?
Comment 4 BogDan Vatra 2012-10-05 06:13:03 UTC
Please try the followings steps:
- clone git://anongit.kde.org/android-qt.git
- switch to beta2 branch
- apply the patch attached to this bug
- edit ./android/androidconfigbuild.sh and change NDK_ROOT var if needed, make sure it's points to the NDK shipped with Necessitas SDK, not the official one !
- make sure android SDK tools are in your PATH and you have at leats 4 7 8 14 API level SDKs installed.
- run ./android/androidconfigbuild.sh -q1 -d1
- add this build to QtCreator.
- check "Deploy local qt libs" and run your application.
Comment 5 BogDan Vatra 2012-10-05 06:14:13 UTC
*** Bug 307748 has been marked as a duplicate of this bug. ***
Comment 6 tomaslov 2012-12-10 08:49:20 UTC
Hi, my collegue has tried to test this patch, but wasn't able to get a simple app up and running with deployed libs. Please see https://groups.google.com/forum/#!searchin/android-qt/dagvegar/android-qt/vPo-8K90Omk/TeZ1fBa8HfEJ for his error messages.
Comment 7 BogDan Vatra 2012-12-10 17:55:43 UTC
(In reply to comment #6)
Make sure you have enough free space on your device/emulator.
Comment 8 tomaslov 2012-12-11 13:01:51 UTC
My collegue has tested the proposed patch with the following findings: 

1. Testcase from [1], QLineEdit widgets. The proposed patch had no effect, and the text entry bug still exists. That issue will then be reopened.

2. QML testcase as proposed in comment #2. The patch gave better user input, but we still have the problem that "onTextChanged" is not fired until the user presses "space", "done" or the suggested word on the keyboard. This means that if a user does not end his user input with one of the three mentioned activators, the last word will never be picked up by the Qt classes (thus never further stored in the app).

[1] https://bugs.kde.org/show_bug.cgi?id=307748
Comment 9 Sebastian Sauer 2013-02-09 17:09:31 UTC
I can confirm the exact same behavior on my Galaxy Tab 2.0 with latest necessitas and TextInput.

My TextInput's are created dynamic using something like
var c = Qt.createComponent("TextField.qml") // contains a TextField
var e = c.createObject(parent, {})

All proper displayed, works as expected on desktop but on the device when I switch focus to one of the TextField's and input text then no onTextChanged is emitted till I add a "space".

Debug output is:
D/Qt      (17401): resetSoftwareKeyboard 
D/Qt      (17401): showSoftwareKeyboard 
D/Qt      (17401): TextField.onActiveFocusChanged
D/Qt      (17401): TextField.onFocusChanged
D/Qt      (17401): TextField.onCursorPositionChanged focus=true
W/IInputConnectionWrapper(17401): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper(17401): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper(17401): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper(17401): getTextAfterCursor on inactive InputConnection
I/Qt JAVA (17401): surfaceChanged: 600,605,600,605
D/Qt      (17401): setDisplayMetrics 
D/Qt      (17401): setDisplayMetrics done 
D/Qt      (17401): setDesktopSize 
D/Qt      (17401): setDesktopSize done 
D/dalvikvm(17401): GC_FOR_ALLOC freed 142K, 9% free 3581K/3924K, paused 44ms, total 49ms
I/dalvikvm-heap(17401): Grow heap (frag case) to 4.362MB for 726016-byte allocation
D/dalvikvm(17401): GC_FOR_ALLOC freed 0K, 8% free 4290K/4636K, paused 34ms, total 34ms
D/dalvikvm(17401): GC_CONCURRENT freed 1115K, 32% free 3176K/4636K, paused 3ms+2ms, total 45ms

D/Qt      (23622): showSoftwareKeyboard 

[ Nothing more displayed whatever I add to the TextInput but when I add a "space" following is printed]

D/Qt      (23622): TextField.onCursorPositionChangedtrue focus=true
D/Qt      (23622): TextField.onTextChanged text="a "
D/Qt      (23622): TextField.textChanged text="a "
D/Qt      (23622): TextField.onDisplayTextChanged
D/Qt      (23622): TextField.onCursorPositionChanged focus=true
D/Qt      (23622): TextField.onTextChanged text="a "
D/Qt      (23622): TextField.textChanged text="a "
D/Qt      (23622): TextField.onDisplayTextChanged

This is with a TextInput. When I replace the TextInput with a TextEdit then I earn onTextChanged but text is always empty means does NOT contain what I actually added. But once I pressed the space-key once every following onTextChanged called contains all tghe proper/correct text.

Debug output:

I focus the TextField:
D/Qt      (25933): resetSoftwareKeyboard 
D/Qt      (25933): showSoftwareKeyboard 
D/Qt      (25933): TextEdit.onActiveFocusChanged
D/Qt      (25933): TextEdit.onFocusChanged
W/IInputConnectionWrapper(25933): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper(25933): getTextAfterCursor on inactive InputConnection
D/Qt      (25933): TextEdit.onTextChanged text=""
D/Qt      (25933): TextEdit.textChanged
D/Qt      (25933): resetSoftwareKeyboard 
D/Qt      (25933): resetSoftwareKeyboard 
I/Qt JAVA (25933): surfaceChanged: 600,605,600,605
D/Qt      (25933): setDisplayMetrics 
D/Qt      (25933): setDisplayMetrics done 
D/Qt      (25933): setDesktopSize 
D/Qt      (25933): setDesktopSize done 
D/dalvikvm(25933): GC_FOR_ALLOC freed 40K, 10% free 3582K/3944K, paused 23ms, total 23ms
I/dalvikvm-heap(25933): Grow heap (frag case) to 4.363MB for 726016-byte allocation
D/dalvikvm(25933): GC_FOR_ALLOC freed 0K, 8% free 4291K/4656K, paused 19ms, total 19ms
W/IInputConnectionWrapper(25933): getTextBeforeCursor on inactive InputConnection
D/dalvikvm(25933): GC_CONCURRENT freed 1115K, 32% free 3178K/4656K, paused 2ms+2ms, total 24ms
W/IInputConnectionWrapper(25933): getTextAfterCursor on inactive InputConnection
D/Qt      (25933): TextEdit.onTextChanged text=""
D/Qt      (25933): TextEdit.textChanged
W/IInputConnectionWrapper(25933): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper(25933): getTextAfterCursor on inactive InputConnection
D/Qt      (25933): TextEdit.onTextChanged text=""
D/Qt      (25933): TextEdit.textChanged
D/Qt      (25933): TextEdit.onTextChanged text=""
D/Qt      (25933): TextEdit.textChanged

I add a "a" character:
D/Qt      (25933): TextEdit.onTextChanged text=""
D/Qt      (25933): TextEdit.textChanged

I add a space character:
D/Qt      (25933): TextEdit.onCursorPositionChanged focus=true
D/Qt      (25933): TextEdit.onTextChanged text="a "
D/Qt      (25933): TextEdit.textChanged text="a "
D/Qt      (25933): TextEdit.onCursorPositionChanged focus=true
D/Qt      (25933): TextEdit.onTextChanged text="a "
D/Qt      (25933): TextEdit.textChanged text="a "
Comment 10 Sebastian Sauer 2013-02-09 17:12:19 UTC
Reopen, will try to debug that cazse more since its the last remaining show-stopper for an application I wrote :) Please let me know what more/new/additional informations are needed. I am subscribed to the report and so will receive mails + I am highly motivated to progress on that issue :)
Comment 11 Sebastian Sauer 2013-02-09 17:19:04 UTC
and I can confirm that following proper fixes the problem:

TextInput {
    inputMethodHints: Qt.ImhNoPredictiveText
}

TextEdit {
    inputMethodHints: Qt.ImhNoPredictiveText
}

May I suggest to make that standard for TextInput/TextEdit to prevent others losing hours over hours till they run into this bugreport? Thanks in advance and fantastic work BogDan!
Comment 12 Andrew Crouthamel 2018-09-04 16:15:01 UTC
Hello! Sorry to be the bearer of bad news, but this project has been unmaintained for many years and I will be closing this bug.