Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Backspace with a virtual keyboard in combination with WebView

    Qt WebKit
    1
    1
    850
    Loading More Posts
    • 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.
    • M
      MisjanePane last edited by

      Hi,

      I have written a virtyual keyboard to edit/enter text. This was not specific for WebView only but it only fails to work with WebView. It does work for instance for TextEdit.

      What already works with a WebView

      • I'm able to show and hide the virtual keyboard
      • I'm able to add (append) text.

      What doesn't work

      • removing text with the backspace button on my virtual keyboard. This does work on TextEdit {...} but not for WebView

      When I click a button the qml calls some C++ code - a qml plugin - that sends an event to the focused object.

      Code:

      @ void VirtualkeyboardKeys::keyPressed(QString character) {

      QObject* focusObject = QGuiApplication::focusObject();
      QInputMethodEvent ev;

      if (character == QString("backspace")) {
         ev.setCommitString("",-1,1);
         QCoreApplication::sendEvent(focusObject,&ev);
      } else {
            ev.setCommitString(character);
            QCoreApplication::sendEvent(focusObject,&ev);
      }
      

      }
      @

      I'm using Qt 5.2.1

      Any ideas? Thanks for the help

      1 Reply Last reply Reply Quote 0
      • First post
        Last post