Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. TextField and custom virtual keyboard not compatible ?
Forum Updated to NodeBB v4.3 + New Features

TextField and custom virtual keyboard not compatible ?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 1 Posters 374 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    DavidM29
    wrote on last edited by
    #1

    Hello,

    I'm making a Virtual Keyboard because I can't use the one provided with Qt (because my target is an embedded system that does not support it).

    The keyboard seems to works fine but I have an issue when I use a TextField as destination of Keyboard input.

    My first attempt was on a TextEdit. But I want to use it on a TextField as well. But it does not work.

    Here is how my virtual keyboard is working :

    I implemented a cpp method that send an Event, here is a sample of what I'm sending :

        event = new QKeyEvent(QEvent::KeyPress, k, Qt::NoModifier, lbl);
    
       QCoreApplication::sendEvent(target, event);
    

    On the qml side I have a TextField, once I gain focus on the TextField I update my "target" in order to send the event to the focused field.

    onFocusChanged: if (focus) keyboard.setTarget(this, false) //If focus on the TextField the textfield become the newTarget, the boolean is a value I use to know is my field is numeric or not
    

    This seems to be enough on TextEdit but not on TextField do you have any idea what can cause this difference ?

    If you need any more element please ask me I'll provide it.

    Thank you for any help.

    1 Reply Last reply
    0
    • D Offline
      D Offline
      DavidM29
      wrote on last edited by
      #2

      I believe I just found out why. From the info I found the TextField contains a TextEdit, that means that once I focus the TextField I do not focus the TextEdit and I can't send events to the right target.

      Is there anyway to focus the textEdit inside a TextField ?

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved