From c4079ef585f3efdedc64d961d8ef2bd90cedb7fc Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Mon, 13 Aug 2018 11:08:47 +0200 Subject: Doc: improve integration documentation, especially regarding Wayland MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Id27ebb78001ff060d67917e9ac69f75682a885ac Reviewed-by: Johan Helsing Reviewed-by: Topi Reiniƶ --- src/virtualkeyboard/doc/qtvirtualkeyboard.qdocconf | 2 +- src/virtualkeyboard/doc/src/deployment-guide.qdoc | 56 +++++++++++++++++----- .../doc/src/qtvirtualkeyboard-index.qdoc | 1 + 3 files changed, 47 insertions(+), 12 deletions(-) diff --git a/src/virtualkeyboard/doc/qtvirtualkeyboard.qdocconf b/src/virtualkeyboard/doc/qtvirtualkeyboard.qdocconf index 71697785..3a50346d 100644 --- a/src/virtualkeyboard/doc/qtvirtualkeyboard.qdocconf +++ b/src/virtualkeyboard/doc/qtvirtualkeyboard.qdocconf @@ -24,7 +24,7 @@ manifestmeta.highlighted.names = "QtVirtualKeyboard/Qt Quick Virtual Keyboard - imagedirs += images -depends += qtdoc qtcore qtgui qtqml qtquick +depends += qtdoc qtcore qtgui qtwidgets qtwayland qtqml qtquick qhp.projects = QtVirtualKeyboard diff --git a/src/virtualkeyboard/doc/src/deployment-guide.qdoc b/src/virtualkeyboard/doc/src/deployment-guide.qdoc index b5bcb938..01823e15 100644 --- a/src/virtualkeyboard/doc/src/deployment-guide.qdoc +++ b/src/virtualkeyboard/doc/src/deployment-guide.qdoc @@ -67,19 +67,21 @@ Qt Virtual Keyboard currently supports two alternative integration methods for using the plugin: \list - \li \c Desktop: Qt Virtual Keyboard is integrated with Qt 5 and requires no - changes to existing applications. The Qt Virtual Keyboard input method - is available to all of the Qt 5 applications in the system. + \li \c Desktop: requires no changes to existing applications. + The virtual keyboard is available to all of the Qt 5 applications + in the system. In this integration method, the keyboard is shown in a dedicated top-level window. - \li \c Application: Qt Virtual Keyboard is integrated with Qt 5, but - requires changes to particular applications using Qt Virtual Keyboard. - This method is mandatory in a Boot2Qt environment, but can be used in - desktop applications too. + \li \c Application: the virtual keyboard is embedded within the Qt + application itself by instantiating an \l InputPanel item in QML. - In this integration method, the keyboard is shown in the same Qt Quick - scene as the application. + This method is mandatory in environments where there is no support + for multiple top-level windows (such as embedded devices), but can + be used in desktop applications too. + + This method can also be used by Qt Wayland compositors in order to + provide a server-side virtual keyboard. See the section below for details. \endlist The integration method is automatically selected by the project files. @@ -87,8 +89,40 @@ However, in desktop environments, it is possible to override the desktop integration method and use the application integration method instead, by adding \c CONFIG+=disable-desktop to the \c qmake command line. -\note The desktop integration method is not currently available in Boot2Qt -environments. +\section2 Using Qt Virtual Keyboard with Qt Wayland + +This section explains how to use Qt Virtual Keyboard to interact with the +\l {Line Edits Example}{Qt Widgets Line Edits example} using the +\l {Qt Wayland Compositor Examples - Pure QML}{Pure QML example} +as a compositor. + +We will be using Ubuntu 18.04 to run the example, using the X11 as the +windowing system. The example compositor (\c pure-qml) will open +as a window within an X11 session. + +\list 1 + \li Start the compositor: + \badcode +QT_XCB_GL_INTEGRATION=xcb_egl QT_WAYLAND_CLIENT_BUFFER_INTEGRATION=xcomposite-egl QT_IM_MODULE=qtvirtualkeyboard ./pure-qml -platform xcb + \endcode + \li Before running the client application, ensure that QT_IM_MODULE is unset: + \badcode +unset QT_IM_MODULE + \endcode + \li Start the Line Edits example as the client: + \badcode +./lineedits -platform wayland + \endcode + \li Click on a line edit and Qt Virtual Keyboard's input panel will open. +\endlist + +If issues are encountered, the following environment variables can be set +when running the compositor to get debug output that can help diagnose the issue: + +\badcode +WAYLAND_DEBUG=1 +QT_LOGGING_RULES="qt.virtualkeyboard=true;qt.qpa.wayland*=true" +\endcode \section1 Loading the Plugin diff --git a/src/virtualkeyboard/doc/src/qtvirtualkeyboard-index.qdoc b/src/virtualkeyboard/doc/src/qtvirtualkeyboard-index.qdoc index 35eb60b1..4b42bb7a 100644 --- a/src/virtualkeyboard/doc/src/qtvirtualkeyboard-index.qdoc +++ b/src/virtualkeyboard/doc/src/qtvirtualkeyboard-index.qdoc @@ -56,6 +56,7 @@ \li \l {Handwriting Recognition}{Handwriting support}, with gestures for fullscreen input. \li Audio feedback. \li Cross-platform functionality. + \li Supports both \l {Integration Method}{Qt Quick and Qt Widgets applications}. \endlist \section1 Supported Languages -- cgit v1.2.3 From 28a0caf8b244c5ed6003896c5a31ad85030751e5 Mon Sep 17 00:00:00 2001 From: Jarkko Koivikko Date: Mon, 27 Aug 2018 13:34:52 +0300 Subject: Fix duplicated selection handle on desktop integration SelectionControl on the InputPanel was not disabled when using desktop integration. This caused duplicated handles to appear on screen. This change disables the SelectionControl when desktop integration is used. Task-number: QTBUG-60321 Change-Id: Icf7cab4bdeacade16bbe2b1eb2078baceb955d5e Reviewed-by: Frederik Gladhorn --- src/virtualkeyboard/content/InputPanel.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/virtualkeyboard/content/InputPanel.qml b/src/virtualkeyboard/content/InputPanel.qml index e41756a7..cedec2f8 100644 --- a/src/virtualkeyboard/content/InputPanel.qml +++ b/src/virtualkeyboard/content/InputPanel.qml @@ -118,7 +118,7 @@ Item { objectName: "selectionControl" x: -parent.x y: -parent.y - enabled: active && !keyboard.fullScreenMode + enabled: active && !keyboard.fullScreenMode && !__isRootItem } implicitHeight: keyboard.height -- cgit v1.2.3 From 4a92afe75bfb7886ecb1b3282b05b2985c39fe3c Mon Sep 17 00:00:00 2001 From: Jarkko Koivikko Date: Mon, 27 Aug 2018 11:19:29 +0300 Subject: Disable layout mirroring for virtual keyboard When layout mirroring is enabled for an application using virtual keyboard, the keyboard layout is also mirrored. This change disables layout mirroring for virtual keyboard. Task-number: QTBUG-70041 Change-Id: I097ae7fe907a463ef53e5f39f357c61d57bbb9c0 Reviewed-by: Frederik Gladhorn --- src/virtualkeyboard/content/HandwritingInputPanel.qml | 3 +++ src/virtualkeyboard/content/InputPanel.qml | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/virtualkeyboard/content/HandwritingInputPanel.qml b/src/virtualkeyboard/content/HandwritingInputPanel.qml index 8582f721..b91c59c7 100644 --- a/src/virtualkeyboard/content/HandwritingInputPanel.qml +++ b/src/virtualkeyboard/content/HandwritingInputPanel.qml @@ -91,6 +91,9 @@ Item { enabled: inputPanel.keyboard.isHandwritingAvailable() visible: enabled && available && active && Qt.inputMethod.visible + LayoutMirroring.enabled: false + LayoutMirroring.childrenInherit: true + Item { id: keyboard property var style: inputPanel && inputPanel.hasOwnProperty ? inputPanel.keyboard.style : null diff --git a/src/virtualkeyboard/content/InputPanel.qml b/src/virtualkeyboard/content/InputPanel.qml index cedec2f8..c88cccc2 100644 --- a/src/virtualkeyboard/content/InputPanel.qml +++ b/src/virtualkeyboard/content/InputPanel.qml @@ -114,6 +114,9 @@ Item { /*! \internal */ readonly property bool __isRootItem: inputPanel.parent != null && inputPanel.parent.parent == null + LayoutMirroring.enabled: false + LayoutMirroring.childrenInherit: true + SelectionControl { objectName: "selectionControl" x: -parent.x -- cgit v1.2.3 From 30479f9771e60938dc0f6e325e3b16fb52663796 Mon Sep 17 00:00:00 2001 From: Jarkko Koivikko Date: Wed, 29 Aug 2018 09:42:16 +0300 Subject: Fix possible crash in PlatformInputContext::update Under some condition, QPlatformInputContext::update is called before our (QML) input context is created. This will result in crash if desktop integration is also enabled, since null pointer check is missing. [ChangeLog] Fixed possible crash in PlatformInputContext::update. Task-number: QTBUG-67595 Change-Id: I19c78dbf19cf3c2a72193c2e2a60f46995c1f6ad Reviewed-by: Simon Hausmann --- src/virtualkeyboard/platforminputcontext.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/virtualkeyboard/platforminputcontext.cpp b/src/virtualkeyboard/platforminputcontext.cpp index 6d555160..8b5ce99b 100644 --- a/src/virtualkeyboard/platforminputcontext.cpp +++ b/src/virtualkeyboard/platforminputcontext.cpp @@ -84,18 +84,17 @@ void PlatformInputContext::commit() void PlatformInputContext::update(Qt::InputMethodQueries queries) { VIRTUALKEYBOARD_DEBUG() << "PlatformInputContext::update():" << queries; - bool enabled = inputMethodQuery(Qt::ImEnabled).toBool(); -#ifdef QT_VIRTUALKEYBOARD_DESKTOP - if (enabled && !m_inputPanel) { - m_inputPanel = new DesktopInputPanel(this); - m_inputPanel->createView(); - m_selectionControl = new DesktopInputSelectionControl(this, m_inputContext); - m_selectionControl->createHandles(); - } -#endif - if (m_inputContext) { + bool enabled = inputMethodQuery(Qt::ImEnabled).toBool(); if (enabled) { +#ifdef QT_VIRTUALKEYBOARD_DESKTOP + if (!m_inputPanel) { + m_inputPanel = new DesktopInputPanel(this); + m_inputPanel->createView(); + m_selectionControl = new DesktopInputSelectionControl(this, m_inputContext); + m_selectionControl->createHandles(); + } +#endif m_inputContext->update(queries); if (m_visible) updateInputPanelVisible(); -- cgit v1.2.3