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. TextInput and openSoftwareInputPanel on Windows
Forum Updated to NodeBB v4.3 + New Features

TextInput and openSoftwareInputPanel on Windows

Scheduled Pinned Locked Moved QML and Qt Quick
4 Posts 2 Posters 4.6k 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.
  • A Offline
    A Offline
    Aleskey78
    wrote on last edited by
    #1

    Hi,

    is it possible to open a system virtual keyboard on a desktop? Or subclass a user custom keyboard control for this (preferred variant)? That it pops up when TextInput gets a focus? For example there is a nice keyboard in Colibri library and I can create a custom TextInput control to incorporate it in but may be there is a more generic way of doing this.

    1 Reply Last reply
    0
    • A Offline
      A Offline
      Aleskey78
      wrote on last edited by
      #2

      Looks like it was already discussed: http://developer.qt.nokia.com/forums/viewthread/1486 , http://developer.qt.nokia.com/forums/viewthread/2565
      sorry...

      but with 'openSoftwareInputPanel' it is not so clear for me.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        Aleskey78
        wrote on last edited by
        #3

        Just a short summary:
        void TextInput::openSoftwareInputPanel () sends QEvent::RequestSoftwareInputPanel
        void TextInput::closeSoftwareInputPanel () sends QEvent::CloseSoftwareInputPanel

        Handle these events to show/hide a VirtualKeyboard on QML side.

        VirtualKeyboard sends keypress events calling c++ helper function:
        @public slots:
        Q_INVOKABLE void sendKey(const QString &key)
        {
        QKeyEvent event(QEvent::KeyPress, 0, Qt::NoModifier, key);
        QGraphicsItem *focusItem = scene()->focusItem();
        if (focusItem)
        scene()->sendEvent(focusItem, &event);
        }@

        @VirtualKeyboard {
        width: 360
        height: sidebar.height
        rows: 4
        columns: 11
        keys: "ABCDEFGHIJKLMNOPQRSTUVWXYZ .-+_/0123456789"
        onHideKeyboard: sidebar.show = false
        onLetterClicked: mainWindow.sendKey(letter)
        }@

        1 Reply Last reply
        0
        • M Offline
          M Offline
          martini
          wrote on last edited by
          #4

          And this is a version for the QtQuick2ApplicationViewer:

          @const QString character;
          QtQuick2ApplicationViewer *viewer;
          QKeyEvent event(QEvent::KeyPress, 0, Qt::NoModifier, character);
          if (viewer)
          viewer->sendEvent(viewer->activeFocusItem(), &event);@

          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