QDialog form and Android virtual keyboard



  • Hi,
    Porting a Qt application from Desktop to Android, I am dealing with a tricky problem when I call a QDialog form from the QMainWindow instance.
    The dialog window is visualized normally, the cursor is set in the first field of the form within and the virtual keyboard show up but when I try to type anything there is no echo in the form fields and I got these messages from the QtCreator console:

    W/IInputConnectionWrapper( 3601): getSelectedText on inactive InputConnection
    W/IInputConnectionWrapper( 3601): requestCursorAnchorInfo on inactive InputConnection
    W/IInputConnectionWrapper( 3601): getTextBeforeCursor on inactive InputConnection
    W/IInputConnectionWrapper( 3601): getTextBeforeCursor on inactive InputConnection
    

    Looking for information about it around the Internet, I found a possible cause of the problem: Android doesn't support a second activity from the same process, so the QDialog instance is ignored by the operating system, then the keyboard doesn't work for that new activity. Not sure if this is true, but I would like to read your comments about this issue and possible workarounds.

    Thanks!

    PS: I am using other QDialogs instances, but only using mouse events and they work perfectly. My problem is only with Android keyboard interaction and QLineEdit objects.



  • Effectively, I could confirm the hypothesis about the QDialog as a second activity, at least for the keyboard events.

    What I did was this: I created a **QDockWidget ** object with a form inside and I added it into my QMainWindow. In this way, I replaced my QDialog and I didn't have to use an "external" interface to deal with the virtual keyboard.

    My test worked perfectly, I mean, I could fill the form fields with no issues. I know this is not the perfect way to solve the problem, but using the right Stylesheet this workaround is good enough for me.

    If you have a better idea to solve this issue (i.e. using intents and calling a native Android dialog), suggestions are very welcome :)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.