Results 1 to 5 of 5

Thread: Showing Android keyboard from QML TextField

  1. #1
    Join Date
    Jan 2006
    Location
    Ljubljana
    Posts
    687
    Thanks
    111
    Thanked 4 Times in 4 Posts
    Qt products
    Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Showing Android keyboard from QML TextField

    Hi to all!

    Inside my Qt/QML app, based on Qt 5.5.1 Opensource Edition, which is being ported from 64bit Ubuntu 14.04 LTS to Android I have QML TextField entity. Now, when the user selects it using toucscreen on Samsung Tab 3 10.1, the Android virtual keyboard should pop up, but it does not.
    Is it possible to popup android virtual keyboard using Qt Opensource edition at all or is it possible to pop up Qt virtual keyboard only and therefore I need Qt payed edition? If the first option is possible, then here is my sample code:
    Qt Code:
    1. TextField
    2. {
    3. width: 384
    4. height: 128
    5.  
    6. placeholderText: qsTr("Android keyboard test")
    7.  
    8. focus: true
    9.  
    10. onTextChanged:
    11. {
    12. print("Text changed");
    13. } // onTextChanged
    14. } // TextField
    To copy to clipboard, switch view to plain text mode 
    Qt 5.3 Opensource & Creator 3.1.2

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Showing Android keyboard from QML TextField

    The Qt virtual keyboard is intended for systems that don't have a virtual keyboard.
    I doubt it would even work on Android which already has one.

    Have you tried "forceActiveFocus()" instead of setting the focus property?

    Is the QGuiApplicaton::focusObject() the element you think it is?

    Cheers,
    _

  3. The following user says thank you to anda_skoa for this useful post:

    MarkoSan (19th January 2016)

  4. #3
    Join Date
    Jan 2006
    Location
    Ljubljana
    Posts
    687
    Thanks
    111
    Thanked 4 Times in 4 Posts
    Qt products
    Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Showing Android keyboard from QML TextField

    I've upgraded code to:
    Qt Code:
    1. TextField
    2. {
    3. width: 384
    4. height: 128
    5.  
    6. placeholderText: qsTr("Android keyboard test")
    7.  
    8. focus: true
    9.  
    10. onTextChanged:
    11. {
    12. print("Text changed");
    13. } // onTextChanged
    14.  
    15. MouseArea
    16. {
    17. anchors.fill: parent
    18.  
    19. onClicked:
    20. {
    21. print("clicked");
    22. forceActiveFocus(Qt.MouseFocusReason);
    23. Qt.inputMethod.show();
    24. } // onClicked
    25. } // MouseArea
    26. } // TextField
    To copy to clipboard, switch view to plain text mode 
    Debug message "clicked" gets printed out once I touch onto TextField's area, but keyboard is not visible!

    Sincerely,
    Marko
    Qt 5.3 Opensource & Creator 3.1.2

  5. #4
    Join Date
    Aug 2008
    Location
    Algarve, Portugal
    Posts
    288
    Thanks
    23
    Thanked 32 Times in 28 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60

    Default Re: Showing Android keyboard from QML TextField

    Never used TextField but I have an Android app where I use TextInput and it works "out of the box".
    __________________________________________________
    My projects: calculator MathGraphica ; SuperEpicMegaHero game ; GooglePlay ; bitbucket ; github
    Like my projects ? Buy me a kofi

  6. The following user says thank you to john_god for this useful post:

    MarkoSan (20th January 2016)

  7. #5
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Showing Android keyboard from QML TextField

    Quote Originally Posted by MarkoSan View Post
    Qt Code:
    1. MouseArea
    2. {
    3. anchors.fill: parent
    4.  
    5. onClicked:
    6. {
    7. print("clicked");
    8. forceActiveFocus(Qt.MouseFocusReason);
    9. Qt.inputMethod.show();
    10. } // onClicked
    11. } // MouseArea
    12. } // TextField
    To copy to clipboard, switch view to plain text mode 
    Why would you wan the MouseAra to have keyboard focus?

    Cheers,
    _

Similar Threads

  1. Replies: 2
    Last Post: 23rd November 2015, 08:46
  2. Virtual keyboard problem in Android app
    By d_stranz in forum Qt Programming
    Replies: 0
    Last Post: 5th May 2015, 06:20
  3. Validate TextField
    By porterneon in forum Qt Quick
    Replies: 0
    Last Post: 12th November 2014, 15:57
  4. TextField Completer
    By folibis in forum Qt Quick
    Replies: 1
    Last Post: 23rd December 2013, 13:44
  5. Replies: 0
    Last Post: 24th January 2012, 07:07

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.