diff options
author | Liang Qi <liang.qi@qt.io> | 2017-11-20 13:18:27 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2017-11-20 13:18:27 +0100 |
commit | f2347407964bed0e88826f3eb8303bbad46297db (patch) | |
tree | 6c19acffbb126ca3ca9580e898aa2f1c399e623a /src | |
parent | d5fdcd65620f9215b0b123c25219b6c8f540e626 (diff) | |
parent | 2dabbf20b81fa0c85dbcd4f31f7c45819caca2d2 (diff) |
Merge remote-tracking branch 'origin/5.10' into dev
Change-Id: I5a7bd61e95ee062299b28e27aad22858d9b1d052
Diffstat (limited to 'src')
-rw-r--r-- | src/virtualkeyboard/3rdparty/pinyin/pinyin.pro | 2 | ||||
-rw-r--r-- | src/virtualkeyboard/content/styles/default/style.qml | 4 | ||||
-rw-r--r-- | src/virtualkeyboard/content/styles/retro/style.qml | 2 | ||||
-rw-r--r-- | src/virtualkeyboard/doc/src/qtvirtualkeyboard-examples.qdoc | 43 | ||||
-rw-r--r-- | src/virtualkeyboard/handwritinggesturerecognizer.cpp | 3 | ||||
-rw-r--r-- | src/virtualkeyboard/inputengine.cpp | 3 | ||||
-rw-r--r-- | src/virtualkeyboard/selectionlistmodel.cpp | 3 |
7 files changed, 49 insertions, 11 deletions
diff --git a/src/virtualkeyboard/3rdparty/pinyin/pinyin.pro b/src/virtualkeyboard/3rdparty/pinyin/pinyin.pro index 485ee5dc..9ad9a318 100644 --- a/src/virtualkeyboard/3rdparty/pinyin/pinyin.pro +++ b/src/virtualkeyboard/3rdparty/pinyin/pinyin.pro @@ -55,5 +55,5 @@ win32 { CONFIG += qt QT = core } else { - LIBS += -pthread + CONFIG *= thread } diff --git a/src/virtualkeyboard/content/styles/default/style.qml b/src/virtualkeyboard/content/styles/default/style.qml index 002bc5d6..6c49ee67 100644 --- a/src/virtualkeyboard/content/styles/default/style.qml +++ b/src/virtualkeyboard/content/styles/default/style.qml @@ -263,7 +263,7 @@ KeyboardStyle { Text { id: enterKeyText visible: text.length !== 0 - text: control.actionId !== EnterKeyAction.None ? "" : control.displayText + text: control.actionId !== EnterKeyAction.None ? control.displayText : "" clip: true fontSizeMode: Text.HorizontalFit horizontalAlignment: Text.AlignHCenter @@ -309,7 +309,7 @@ KeyboardStyle { } PropertyChanges { target: enterKeyText - opacity: 0.05 + opacity: 0.2 } } ] diff --git a/src/virtualkeyboard/content/styles/retro/style.qml b/src/virtualkeyboard/content/styles/retro/style.qml index 0a76a7e7..c22338ba 100644 --- a/src/virtualkeyboard/content/styles/retro/style.qml +++ b/src/virtualkeyboard/content/styles/retro/style.qml @@ -295,7 +295,7 @@ KeyboardStyle { Text { id: enterKeyText visible: text.length !== 0 - text: control.actionId !== EnterKeyAction.None ? "" : control.displayText + text: control.actionId !== EnterKeyAction.None ? control.displayText : "" clip: true fontSizeMode: Text.HorizontalFit horizontalAlignment: Text.AlignHCenter diff --git a/src/virtualkeyboard/doc/src/qtvirtualkeyboard-examples.qdoc b/src/virtualkeyboard/doc/src/qtvirtualkeyboard-examples.qdoc index 61b11d26..ef2bf69f 100644 --- a/src/virtualkeyboard/doc/src/qtvirtualkeyboard-examples.qdoc +++ b/src/virtualkeyboard/doc/src/qtvirtualkeyboard-examples.qdoc @@ -40,7 +40,44 @@ \ingroup qtvirtualkeyboard-examples \image basic-example.png - The example shows how to build a virtual keyboard UI with support for - multiple keyboard layouts using QML, and a QPlatformInputContext bridge - for communicating between the keyboard and focused text editor in C++. + The example has two implementations: one for the desktop + platforms and another for the embedded platforms. The former version + enables text input into several text fields using the virtual keyboard, + whereas the latter version uses the same UI but with a custom virtual + keyboard InputPanel. The following snippet from + \c basic.pro shows how the qmake project is set up to choose the + appropriate implementation based on the CONFIG options: + + \quotefromfile basic/basic.pro + \skipto android-embedded + \printuntil /^\}$/ + + The example enables the virtual keyboard by setting the \c QT_IM_MODULE + environment variable before loading the \c .qml file: + + \quotefromfile basic/main.cpp + \skipto #include + \printuntil } + + Besides this, it uses custom TextField and TextArea items to configure the + \e[ENTER] key behavior using the EnterKeyAction attached property. + + \quotefromfile basic/Basic.qml + \skipto import + \printuntil Rectangle + \dots + \skipto TextField + \printuntil } + \dots + \skipto TextArea + \printuntil } + \skipto /^\}$/ + \printuntil } + + The TextField and TextArea are inherited from the TextBase custom type, + which has \c enterKeyEnabled, \c enterKeyText, and \c enterKeyAction + properties. The TextField and TextArea instances in the snippet can + set these properties to change the default behavior. + + \include examples-run.qdocinc */ diff --git a/src/virtualkeyboard/handwritinggesturerecognizer.cpp b/src/virtualkeyboard/handwritinggesturerecognizer.cpp index fa3838aa..23ac63e9 100644 --- a/src/virtualkeyboard/handwritinggesturerecognizer.cpp +++ b/src/virtualkeyboard/handwritinggesturerecognizer.cpp @@ -182,7 +182,8 @@ QVariantMap HandwritingGestureRecognizer::recognize(const QList<Trace *> traceLi swipeAngle = 2 * M_PI - swipeAngle; // Calculate an average length of the vector - for (++swipeVector; swipeVector != swipeVectors.end(); ++swipeVector) + ++swipeVector; + for (const auto cend = swipeVectors.cend(); swipeVector != cend; ++swipeVector) swipeLength += swipeVector->length(); swipeLength /= traceCount; diff --git a/src/virtualkeyboard/inputengine.cpp b/src/virtualkeyboard/inputengine.cpp index 43b0c1cc..e825f05b 100644 --- a/src/virtualkeyboard/inputengine.cpp +++ b/src/virtualkeyboard/inputengine.cpp @@ -378,9 +378,8 @@ void InputEngine::setInputMethod(AbstractInputMethod *inputMethod) // Set current text case d->inputMethod->setTextCase(d->textCase); - - updateSelectionListModels(); } + updateSelectionListModels(); emit inputMethodChanged(); emit patternRecognitionModesChanged(); } diff --git a/src/virtualkeyboard/selectionlistmodel.cpp b/src/virtualkeyboard/selectionlistmodel.cpp index 7606a1c6..78316465 100644 --- a/src/virtualkeyboard/selectionlistmodel.cpp +++ b/src/virtualkeyboard/selectionlistmodel.cpp @@ -31,6 +31,7 @@ #include "abstractinputmethod.h" #include "settings.h" #include <QtCore/private/qabstractitemmodel_p.h> +#include <QtCore/qpointer.h> namespace QtVirtualKeyboard { @@ -47,7 +48,7 @@ public: } QHash<int, QByteArray> roles; - AbstractInputMethod *dataSource; + QPointer<AbstractInputMethod> dataSource; SelectionListModel::Type type; int rowCount; bool wclAutoCommitWord; |