diff options
author | Liang Qi <liang.qi@qt.io> | 2016-08-01 11:02:50 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2016-08-01 11:02:55 +0200 |
commit | ad1da1a8c3be6ec804f3965b47d0762654f81731 (patch) | |
tree | 59e7e6615f57fa25b3a6d507da215642e6cf4855 | |
parent | d231a184ae3746027a0c294a88f56ae5123ca85c (diff) | |
parent | 68c30e00b0d9850643611d5ba9c29a247ccd44ec (diff) |
Merge remote-tracking branch 'origin/5.6' into 5.7
Change-Id: I90b5859bf57c5fed0256401e610ab67487eba7c7
-rw-r--r-- | src/virtualkeyboard/desktopinputpanel.cpp | 78 | ||||
-rw-r--r-- | src/virtualkeyboard/doc/src/deployment-guide.qdoc | 75 | ||||
-rw-r--r-- | src/virtualkeyboard/doc/src/user-guide.qdoc | 2 |
3 files changed, 128 insertions, 27 deletions
diff --git a/src/virtualkeyboard/desktopinputpanel.cpp b/src/virtualkeyboard/desktopinputpanel.cpp index 05fc2b96..aad97e66 100644 --- a/src/virtualkeyboard/desktopinputpanel.cpp +++ b/src/virtualkeyboard/desktopinputpanel.cpp @@ -48,19 +48,34 @@ namespace QtVirtualKeyboard { class DesktopInputPanelPrivate : public AppInputPanelPrivate { public: + enum WindowingSystem { + Windows, + Xcb, + Other, + }; + DesktopInputPanelPrivate() : AppInputPanelPrivate(), view(), keyboardRect(), previewRect(), previewVisible(false), - previewBindingActive(false) {} + previewBindingActive(false), + windowingSystem(Other) + { + const QString platformName = QGuiApplication::platformName(); + if (platformName == QLatin1String("windows")) + windowingSystem = Windows; + else if (platformName == QLatin1String("xcb")) + windowingSystem = Xcb; + } QScopedPointer<InputView> view; QRectF keyboardRect; QRectF previewRect; bool previewVisible; bool previewBindingActive; + WindowingSystem windowingSystem; }; /*! @@ -127,13 +142,14 @@ void DesktopInputPanel::createView() work in all environments. The purpose of this flag is to avoid the window from capturing focus, as well as hiding it from the task bar. */ -#if defined(Q_OS_WIN32) - d->view->setFlags(d->view->flags() | Qt::Tool); -#elif defined(QT_VIRTUALKEYBOARD_HAVE_XCB) - d->view->setFlags(d->view->flags() | Qt::Window | Qt::BypassWindowManagerHint); -#else - d->view->setFlags(d->view->flags() | Qt::ToolTip); -#endif + switch (d->windowingSystem) { + case DesktopInputPanelPrivate::Xcb: + d->view->setFlags(d->view->flags() | Qt::Window | Qt::BypassWindowManagerHint); + break; + default: + d->view->setFlags(d->view->flags() | Qt::Tool); + break; + } d->view->setColor(QColor(Qt::transparent)); d->view->setSource(QUrl("qrc:///QtQuick/VirtualKeyboard/content/InputPanel.qml")); connect(qGuiApp, SIGNAL(aboutToQuit()), SLOT(destroyView())); @@ -227,26 +243,36 @@ void DesktopInputPanel::updateInputRegion() if (!d->view->handle()) d->view->create(); + switch (d->windowingSystem) { + case DesktopInputPanelPrivate::Xcb: #if defined(QT_VIRTUALKEYBOARD_HAVE_XCB) - QVector<xcb_rectangle_t> rects; - rects.push_back(qRectToXCBRectangle(d->keyboardRect.toRect())); - if (d->previewVisible && !d->previewRect.isEmpty()) - rects.push_back(qRectToXCBRectangle(d->previewRect.toRect())); - - QWindow *window = d->view.data(); - QPlatformNativeInterface *platformNativeInterface = QGuiApplication::platformNativeInterface(); - xcb_connection_t *xbcConnection = static_cast<xcb_connection_t *>(platformNativeInterface->nativeResourceForWindow("connection", window)); - xcb_xfixes_region_t xbcRegion = xcb_generate_id(xbcConnection); - xcb_xfixes_create_region(xbcConnection, xbcRegion, rects.size(), rects.constData()); - xcb_xfixes_set_window_shape_region(xbcConnection, window->winId(), XCB_SHAPE_SK_INPUT, 0, 0, xbcRegion); - xcb_xfixes_destroy_region(xbcConnection, xbcRegion); -#else - QRegion inputRegion(d->keyboardRect.toRect()); - if (d->previewVisible && !d->previewRect.isEmpty()) - inputRegion += d->previewRect.toRect(); - - d->view->setMask(inputRegion); + { + QVector<xcb_rectangle_t> rects; + rects.push_back(qRectToXCBRectangle(d->keyboardRect.toRect())); + if (d->previewVisible && !d->previewRect.isEmpty()) + rects.push_back(qRectToXCBRectangle(d->previewRect.toRect())); + + QWindow *window = d->view.data(); + QPlatformNativeInterface *platformNativeInterface = QGuiApplication::platformNativeInterface(); + xcb_connection_t *xbcConnection = static_cast<xcb_connection_t *>(platformNativeInterface->nativeResourceForWindow("connection", window)); + xcb_xfixes_region_t xbcRegion = xcb_generate_id(xbcConnection); + xcb_xfixes_create_region(xbcConnection, xbcRegion, rects.size(), rects.constData()); + xcb_xfixes_set_window_shape_region(xbcConnection, window->winId(), XCB_SHAPE_SK_INPUT, 0, 0, xbcRegion); + xcb_xfixes_destroy_region(xbcConnection, xbcRegion); + } #endif + break; + + default: + { + QRegion inputRegion(d->keyboardRect.toRect()); + if (d->previewVisible && !d->previewRect.isEmpty()) + inputRegion += d->previewRect.toRect(); + + d->view->setMask(inputRegion); + break; + } + } } } // namespace QtVirtualKeyboard diff --git a/src/virtualkeyboard/doc/src/deployment-guide.qdoc b/src/virtualkeyboard/doc/src/deployment-guide.qdoc index 726ff8a3..4e4bfd1a 100644 --- a/src/virtualkeyboard/doc/src/deployment-guide.qdoc +++ b/src/virtualkeyboard/doc/src/deployment-guide.qdoc @@ -144,4 +144,79 @@ as it would then overlap with the contents of the application. Also, the input panel height will be automatically updated according to the available width; the aspect ratio of the input panel is constant. +\section1 Environment Variables + +There are several environment variables defined by the module that are listed below: + +\table + \header + \li Variable + \li Purpose + \row + \li QT_VIRTUALKEYBOARD_HUNSPELL_DATA_PATH + \li Overrides the location of the Hunspell data files. + + The default location depends on the value of + \c {QLibraryInfo::location(QLibraryInfo::DataPath)}. + For example, for Qt libraries built from source, + it could be \c {qtbase/qtvirtualkeyboard/hunspell}. + + See \l {Hunspell Integration} for more information. + \row + \li QT_VIRTUALKEYBOARD_PINYIN_DICTIONARY + \li Overrides the location of the Pinyin dictionary. + + The default location depends on the value of + \c {QLibraryInfo::location(QLibraryInfo::DataPath)}. + For example, for Qt libraries built from source, + it could be \c {qtbase/qtvirtualkeyboard/pinyin/dict_pinyin.dat}. + \row + \li QT_VIRTUALKEYBOARD_CANGJIE_DICTIONARY + \li Overrides the location of the Cangjie dictionary. + + The default location depends on the value of + \c {QLibraryInfo::location(QLibraryInfo::DataPath)}. + For example, for Qt libraries built from source, + it could be \c {qtbase/qtvirtualkeyboard/tcime/dict_cangjie.dat}. + \row + \li QT_VIRTUALKEYBOARD_ZHUYIN_DICTIONARY + \li Overrides the location of the Zhuyin dictionary. + + The default location depends on the value of + \c {QLibraryInfo::location(QLibraryInfo::DataPath)}. + For example, for Qt libraries built from source, + it could be \c {qtbase/qtvirtualkeyboard/tcime/dict_zhuyin.dat}. + \row + \li QT_VIRTUALKEYBOARD_PHRASE_DICTIONARY + \li Overrides the location of the phrase dictionary. + + The default location depends on the value of + \c {QLibraryInfo::location(QLibraryInfo::DataPath)}. + For example, for Qt libraries built from source, + it could be \c {qtbase/qtvirtualkeyboard/tcime/dict_phrases.dat}. + \row + \li QT_VIRTUALKEYBOARD_STYLE + \li Specifies the location of the style to use with the virtual keyboard. + + This can also be specified in QML by setting \l {VirtualKeyboardSettings::styleName}, + or at build time by using the \l {Advanced Configuration Options}{qmake configuration options}. + \row + \li LIPI_ROOT + \li Specifies the location of lipi-toolkit. + + The default location depends on the value of + \c {QLibraryInfo::location(QLibraryInfo::DataPath)}. + For example, for Qt libraries built from source, + it could be \c {qtbase/qtvirtualkeyboard/lipi_toolkit}. + \row + \li LIPI_LIB + \li Specifies the location of lipi-toolkit plugins. + + The default location depends on \c LIPI_ROOT: + \list + \li \c {LIPI_ROOT + "/lib"} if \c LIPI_ROOT is set. + \li \c {QLibraryInfo::location(QLibraryInfo::PluginsPath) + "/lipi_toolkit"} if \c LIPI_ROOT is not set. + \endlist +\endtable + */ diff --git a/src/virtualkeyboard/doc/src/user-guide.qdoc b/src/virtualkeyboard/doc/src/user-guide.qdoc index 843d78b1..c2d9d9f0 100644 --- a/src/virtualkeyboard/doc/src/user-guide.qdoc +++ b/src/virtualkeyboard/doc/src/user-guide.qdoc @@ -29,7 +29,7 @@ /*! -\page user-guide.html +\page qtvirtualkeyboard-user-guide.html \contentspage {User Guide} {Contents} \title User Guide |