Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt WebKit
  4. Backspace with a virtual keyboard in combination with WebView
QtWS25 Last Chance

Backspace with a virtual keyboard in combination with WebView

Scheduled Pinned Locked Moved Qt WebKit
1 Posts 1 Posters 979 Views
  • 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 Offline
    M Offline
    MisjanePane
    wrote on last edited by
    #1

    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
    0

    • Login

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