aboutsummaryrefslogtreecommitdiffstats
path: root/src/virtualkeyboard/shifthandler.cpp
Commit message (Collapse)AuthorAgeFilesLines
* ShiftHandler: simplify sentenceEndingCharacters initializationHEADdevMarc Mutz49 min.1-1/+3
| | | | | | | | | | | | Just spell out ¿ and ¡ in a QStringLiteral instead of building up a string by runtime concatenation. Amends a3e56451e63a1f39ba089c1a422c3dda72557e5a. Pick-to: 6.8 6.7 6.5 Change-Id: I21a5dd77d5b9fea1f417ade6cce34ad59bfc396a Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* Port from container::count() and length() to size()Marc Mutz2022-10-061-1/+1
| | | | | | | | | | | | | | | | | | | | | This is a semantic patch using ClangTidyTransformator as in qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8: auto QtContainerClass = anyOf( expr(hasType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes))))).bind(o), expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o)); makeRule(cxxMemberCallExpr(on(QtContainerClass), callee(cxxMethodDecl(hasAnyName({"count", "length"), parameterCountIs(0))))), changeTo(cat(access(o, cat("size"), "()"))), cat("use 'size()' instead of 'count()/length()'")) a.k.a qt-port-to-std-compatible-api with config Scope: 'Container', with the extended set of container classes recognized. Done-with: Jarkko Koivikko <jarkko.koivikko@code-q.fi> Change-Id: I28ad3f9b59bcfd2db9401c8d4ecc0800c57a3b17 Reviewed-by: Jarkko Koivikko <jarkko.koivikko@code-q.fi>
* Use SPDX license identifiersLucie Gérard2022-06-141-28/+2
| | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. License files are organized under LICENSES directory. Pick-to: 6.4 Task-number: QTBUG-67283 Change-Id: Iaeb3cb05cd781031a35e40f712805fa265116076 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Update documentationJarkko Koivikko2022-04-251-1/+1
| | | | | | | Task-number: QTBUG-100783 Change-Id: If48efba10aa9cfd856e54b0a8154c1a78389d5a9 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
* Add Stroke and Romaji values to the InputMode enumerationJarkko Koivikko2021-03-051-1/+1
| | | | | | | | [ChangeLog] Added Stroke and Romaji values to the InputMode enumeration. Pick-to: 6.1 Change-Id: I03d131c78fae7bf52b8778f7286267d5fc60af94 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Work around compiler bug on macOS 10.14Lars Knoll2020-10-211-0/+6
| | | | | Change-Id: I550e6b084738cdd03930df71489d087905da981b Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Qt6: Port QtVirtualKeyboard from QStringRef to QStringViewKarsten Heimrich2020-06-111-1/+1
| | | | | | Task-number: QTBUG-84319 Change-Id: I6a39bbe0eea86c3e1e4b3a640dcc5951fb90ecbc Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Auto-capitalize only after space following a sentence-ending characterv5.15.0-beta3Volker Hilsheimer2020-03-261-5/+5
| | | | | | | | | | | | | | | A dot alone should not change to capital letters, only the space following the dot. This is standard behavior on mobile platforms. In inputmethods that support auto-completion and auto-space-insertion, we need to watch out if the auto-inserted space triggered auto- capitalization. If so, then the inserted text needs to be capitalized even though the keyboard will have shown lower-case characters. Fixes: QTBUG-77673 Change-Id: Icd907055d6557a7756468318fba5669eb8f62a28 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Allow shift toggle with Qt::ImhNoAutoUppercaseSamuli Piippo2019-12-091-2/+1
| | | | | | | | | | | | | | | Qt::ImhNoAutoUppercase means that the input method should not try to automatically switch to upper case when a sentence ends. QtVKB was using it also to make shift work as caps lock. Change the behavior so that the shift key affects only the next character. [ChangeLog] Using Qt::ImhNoAutoUppercase hint (used also with password fields) no longer makes shift key function as a caps lock. Change-Id: I231c8d192a67e19f04bc4d3fcf0bc9c676a12830 Task-number: QTBUG-80058 Reviewed-by: Jarkko Koivikko <jarkko.koivikko@code-q.fi> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Doc: Fix documentation warningsTopi Reinio2019-11-131-0/+1
| | | | | | | | | | | | | | Mark documented member functions of \internal classes also as \internal as QDoc fails to match function documentation to internal classes otherwise. QDoc's QML parser has trouble parsing method arguments that define a default value. Switch to use \e instead of \a for affected argument names. Fixes: QTBUG-79832 Change-Id: I91c177d00d149775bd0825d5a17a0372e76e3895 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Enable virtualkeyboard key events and shiftkey without focusMikko Seppänen2019-06-201-1/+1
| | | | | | | | | | | | | | | | This patch enables creation of virtual keyboard that functions with all X11 applications, including the ones that do not provide focus information from text input fields. The patch introdudes usage of an environment variable. When this variable is set, virtualkeyboard shift key is enabled and virtualkeyboard is able to send key events without a focus object. [ChangeLog] Added QT_VIRTUAL_KEYBOARD_FORCE_EVENTS_WITHOUT_FOCUS environment variable to allow Qt Virtual Keyboard to send key events and enable Shift key without a focused input object. Change-Id: I89b3cff0f019a12daf6c6b0474b39758ffea7c65 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Convert uses of QTime as a timer to QElapsedTimerEdward Welbourne2019-06-121-4/+4
| | | | | Change-Id: I59877565c0f82552a04d41f2f3c2a657b5be4fe2 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Qtify new APIMitch Curtis2018-09-271-27/+27
| | | | | | | | | | | | | | | Add "is" to C++ getter functions returning bool (where applicable). Add "Active" to "shift" and "capsLock" QML properties, etc. By making these names more explicit, it's clearer what they do and also future-proofs the API by allowing us to add related properties in the future if necessary. [ChangeLog][InputContext] Deprecated shift and capsLock properties in favor of shiftActive and capsLockActive. Change-Id: I66f2c85b50622a6e5fe6b25fb24f13be27acaf9d Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Use enum class in the public APIJarkko Koivikko2018-08-281-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change was suggested in the API review. All the "old" enums are backwards compatible in QML, since unscoped values are enabled by default. Added the following new enum values maintaining compatibility (in QML): - QVirtualKeyboardInputEngine::PatternRecognitionMode::None (same as PatternRecognitionDisabled) - QVirtualKeyboardInputEngine::PatternRecognitionMode::Handwriting (same as HandwritingRecoginition) - QVirtualKeyboardSelectionListModel::Role::Display (same as DisplayRole) - QVirtualKeyboardSelectionListModel::Role::WordCompletionLength (same as WordCompletionLengthRole) Renamed the following enum values (new in 5.12): - QVirtualKeyboardSelectionListModel::Role::Dictionary (was DictionaryTypeRole) - QVirtualKeyboardSelectionListModel::Role::CanRemoveSuggestion (was CanRemoveSuggestionRole) - QVirtualKeyboardSelectionListModel::DictionaryType::Default (was DefaultDictionary) - QVirtualKeyboardSelectionListModel::DictionaryType::User (was UserDictionary) Added missing Q_DECLARE_METATYPE for: - QVirtualKeyboardInputEngine::PatternRecognitionMode - QVirtualKeyboardInputEngine::ReselectFlag - QVirtualKeyboardSelectionListModel::DictionaryType The enums can be found in: - src/virtualkeyboard/qvirtualkeyboardinputengine.h - src/virtualkeyboard/qvirtualkeyboardselectionlistmodel.h Added a test case for verifying QML enum values. Change-Id: I16749af71aadd762e9c303b5c682b2888afaa672 Reviewed-by: Jarkko Koivikko <jarkko.koivikko@code-q.fi> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* Prefix non-namespaced header file names with qvirtualkeyboardJarkko Koivikko2018-08-271-3/+3
| | | | | | Change-Id: Idf2447736ef72fa0fb4dfeacc3386ed7b4fe41c9 Reviewed-by: Jarkko Koivikko <jarkko.koivikko@code-q.fi> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* Remove QtVirtualKeyboard namespace from the public APIJarkko Koivikko2018-08-271-9/+9
| | | | | | | | | | | | | | | | | This change removes the QtVirtualKeyboard namespace from the public API. This change was suggested in the API review. Use of namespace is uncommon in a public Qt module. Prefixed names are preferred instead. [ChangeLog] Removed QtVirtualKeyboard namespace from the public C++ API and prefixed class names with QVirtualKeyboard. The new class names are QVirtualKeyboardAbstractInputMethod, QVirtualKeyboardInputContext, QVirtualKeyboardInputEngine, QVirtualKeyboardSelectionListModel and QVirtualKeyboardTrace. Change-Id: I52d35090b544dc7e8c8c8e5632ce24c455730755 Reviewed-by: Jarkko Koivikko <jarkko.koivikko@code-q.fi> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* Trim InputContext APIJarkko Koivikko2018-08-271-39/+80
| | | | | | | | | | | | | | | | | The purpose of this change is to reduce the number of public API in the virtual keyboard. This change moves a lot of stuff from InputContext to ShiftHandler and InputContextPrivate and exposes the private API to QML through InputContext.priv property. Almost all the unrelevant APIs were moved away, except some properties and methods needed by selection control. These were left intact because moving them is not trivial. Change-Id: I1f23f5f54bc21c68996cb220a66d16d34b5d14ce Reviewed-by: Jarkko Koivikko <jarkko.koivikko@code-q.fi> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* Add Thai keyboard layoutJarkko Koivikko2018-08-161-1/+1
| | | | | | | [ChangeLog] Added Thai keyboard layout Change-Id: Ie527524f110a02729e2c81fa97408a00464eda4f Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Use module include path instead of local include pathJarkko Koivikko2018-08-071-2/+2
| | | | | | | | Include all the virtual keyboard header files using module include path. Change-Id: I93eada70edeb66313b05df6cecf6a9412d7bc0c4 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Fix zero as null pointer constantJarkko Koivikko2018-08-061-1/+1
| | | | | Change-Id: If41bd31f1fcec5647197ca6834909f4011fe87fa Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Doc: Add C++ API for the extension pluginsJarkko Koivikko2018-08-061-2/+2
| | | | | | | | | | | | Needed for the new virtualkeyboard module, which will expose C++ interface to the virtual keyboard extension plugins. This change contains also some improvements to the existing documentation, mainly to the Techical Guide. Task-number: QTBUG-57602 Change-Id: I85194e205479deab0535f14867464b4d2ab15b89 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Modularize virtual keyboard and add an extension interfaceJarkko Koivikko2018-08-061-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With the extension interface it is possible to add new input method and/or languages without recompiling the Qt Virtual Keyboard plugin itself. The existing input methods are now isolated into plugins. So installing a new input method is a matter of copying the corresponding extension plugin to the plugins/virtualkeyboard directory (and any collateral required by the extension plugin itself). This change also renames the HunspellInputMethod to DefaultInputMethod. This change is necessary because some other extension plugin may want to provide the default input method instead. Implementation plan =================== [x] Create virtualkeyboard-private module [x] Create plugin library [x] Define interface for input method plugin [x] Define interface for keyboard layouts [x] Move existing input methods and layouts to plugins [x] HangulInputMethod [x] HunspellInputMethod [x] Maybe create a private library for sharing between HunspellInputMethod and LipiInputMethod [x] LipiInputMethod [x] OpenWnnInputMethod [x] PinyinInputMethod [x] T9WriteInputMethod [x] TCInputMethod [o] Rename some C++ classes (too generic name?) [x] Think again replacing the QtVirtualKeyboard namespace [x] Update documentation [x] General instructions for creating a plugin [x] For the C++ interfaces too (previously removed) [ChangeLog][Important Behavior Changes] Introduce an extension interface for the virtual keyboard. All the current input methods and some special keyboard layouts (e.g. Hunspell, OpenWnn, etc.) have been moved to extensions. The extension interface allows third party to create a new input method without having to modify or rebuild the virtual keyboard. In addition, this change makes it possible to add features and languages independently by copying the desired extension to the system. [ChangeLog][Important Behavior Changes] Introduce a virtualkeyboard module, which can be linked against an extension plugin. This module provides the C++ API necessary for creating an input method. [ChangeLog][Important Behavior Changes] Wrap the entire virtual keyboard API into Qt namespace (e.g. QT_BEGIN_NAMESPACE/QT_END_NAMESPACE). Task-number: QTBUG-57602 Change-Id: I449f4429109f596a7a1df7517c81f97d4aada27c Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Add Hebrew keyboard layoutJarkko Koivikko2017-08-241-1/+1
| | | | | | | [ChangeLog] Added Hebrew keyboard layout. Change-Id: I7779db4e5ac3c5a99937a0d7b7e572db65f0d811 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Clear toggle shift timer when appropriateJarkko Koivikko2017-08-241-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The timer in the ShiftHandler is used for detecting double click events for shift key. A double click event will trigger caps lock if the initial shift state is lower case. However, the implementation did not handle a case where the keyboard layout changes between the first and second press. This can be done with multitouch. The second problem was with the automatic test cases, where the test code toggles the shift to see if there is a secondary layout triggered by the shift key, e.g. in Arabic and Farsi. However, if the keyboard layout does not contain secondary layout, rapid shift state change will trigger caps lock instead. This issue was identified with certain test case for Hebrew layout. This change fixes the issue by clearing the shift toggle timer when the layout changes and in the automatic tests while checking for the secondary layout with the shift key. Also, update test code so that the shift press is simulated with mouse. This will ensure the key exists in the layout and that the key is enabled. Change-Id: I2a528f1b82c30e8b8d9746d380b32ee370b38004 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Add support for Japanese handwriting (T9 Write CJK)Jarkko Koivikko2017-07-081-1/+1
| | | | | | | This change adds handwriting support for Japanese. Change-Id: Ifc8f0e32c8b3211c13aee8be5cb2e05fae09d3b7 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Add support for Korean handwriting (T9 Write CJK)Jarkko Koivikko2017-07-081-1/+1
| | | | | | | This change adds handwriting support for Korean. Change-Id: I77eb322020c39259d9609051100c40b271a62c04 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Add support for T9 Write CJKJarkko Koivikko2017-07-081-1/+1
| | | | | | | | | | | | | This change adds support for handwriting in Simplified Chinese. The integration is based on T9 Write CJK SDK v7.8.1. [ChangeLog] Added support for CJK (Chinese/Japanese/Korean) handwriting via T9 Write. Change-Id: I18481cfd897987ecb471c49ecfcac62ea0c3489c Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Liang Qi <liang.qi@qt.io>
* Consistently check qApp and equivalents before using themUlf Hermann2017-05-051-2/+7
| | | | | | | | | | | We might run an event loop after destroying qApp and additional events may be generated from that. Therefore we should not access qApp unchecked from event handlers. In most places we did already check qApp for null. Now we do it everywhere. Task-number: QTBUG-60000 Change-Id: Id72bbf133989e4f8127d85ee63cba64f915d3649 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Merge remote-tracking branch 'origin/5.8' into devLiang Qi2017-01-251-0/+17
|\ | | | | | | | | | | | | | | Conflicts: .qmake.conf src/virtualkeyboard/shifthandler.cpp Change-Id: I1f95238b9ac5deed3bec6d85f7433cafe219f7ea
| * Defer shift state change until input panel becomes visibleJarkko Koivikko2016-12-191-0/+18
| | | | | | | | | | | | | | | | | | Monitor the visible state of the QInputMethod and defer shift state handling until it becomes visible. Task-number: QTBUG-57082 Change-Id: I6e63e57e2630de37d49a522f05257c9c4dd72286 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Merge remote-tracking branch 'origin/5.8' into devLiang Qi2016-12-121-4/+8
|\| | | | | | | | | | | | | | | Conflicts: src/config.pri tests/auto/inputpanel/data/tst_inputpanel.qml Change-Id: Ib84bbfee8097cf807dbdffb37dfdfc344fc2dbbf
| * Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-11-251-3/+5
| |\ | | | | | | | | | | | | | | | | | | Conflicts: src/virtualkeyboard/content/InputPanel.qml Change-Id: I6839198e123f682a88132f8efbed0bdaf8835e7e
| | * Fix duplicate shift state change when focus object changesJarkko Koivikko2016-11-251-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously the shift state could be set twice when focus object changed, first in reset() method and then in autoCapitalize() method. This change eliminates the initial shift state in reset() method. Task-number: QTBUG-57082 Change-Id: I4bba5c85aae1d0d631e7e30577d0d4068c9cc582 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
| * | Doc: Mark the remaining C++ API \internalLeena Miettinen2016-10-141-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Hide the C++ classes entry from the help file (.qdocconf) - Remove link to the C++ classes from the module front page - Mark classes and namespace \internal - Mark the C++ module page \internal Change-Id: I07b04af84b45d048c5cbb133bd5d70f8b38f25dd Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
| * | Doc: Use standard documentation structure for the moduleLeena Miettinen2016-10-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Link to separate QML types and C++ classes topics from front page (instead of listing the types there) - Turn the \page topic that lists all QML types into the \qmlmodule topic for the module - Add a \module topic to list C++ classes - Add \ingroup, \title, and \brief commands to \qmlmodule topics to display the docs correctly in tables - Add standard content to \qmlmodule topics - Remove unused \qmlmodule topics - Fix \inmodule commands as necessary Change-Id: I6f6538264fff2ad38994114a2fed7212495a18c2 Reviewed-by: Jarkko Koivikko <jarkko.koivikko@code-q.fi> Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
* | | Implemented proper double click behavior of shift handlerBramastyo Harimukti2016-09-271-1/+17
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, there is nothing to separate whether the button command is a single click or a double click. Every time we click the shift button, it always look for the second click and always activate the caps lock. There is no time limit to specify if there will be a second click and always recognized the upcoming click to activate the caps lock. The correct be- havior of a shift button is that a single click is used to enable the upper-case and automatically turned into lower case when the next letter is typed. Another case, within a specific time, if a second click comes, the caps-lock is activated and keep the upper-case mode, otherwise the upcoming click is used to abort the upper-case and change the keyboard mode back to lower-case. Unit test is also updated. [ChangeLog] Changed behavior of shift handler to only activate caps lock if the shift key is double-clicked. Change-Id: Ia04a61ca6df5407f37eb73b9de65c6ccd0128547 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Remove 'enterprise' from QML imports and QRC prefixesMitch Curtis2016-04-261-1/+1
| | | | | | | | | | | | | | | | | | [ChangeLog] Renamed QML import from "import QtQuick.Enterprise.VirtualKeyboard" to "import QtQuick.VirtualKeyboard", as the module is now open-source. Change-Id: I240a3c1b598ca4aa41d2aad02b6e548622308833 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | License updateKalle Viironen2016-01-121-9/+17
|/ | | | | | Change-Id: I0dc6af72a3ae52a0b97b704df84fb1a8197aeeb8 Reviewed-by: Jani Heikkinen <jani.heikkinen@theqtcompany.com> Reviewed-by: Rainer Keller <rainer.keller@theqtcompany.com>
* Add Zhuyin input method for Traditional ChineseJarkko Koivikko2015-11-271-2/+2
| | | | | | | | | | | | | Zhuyin can be enabled with CONFIG+=tcime or CONFIG+=zhuyin qmake flags. Note that CONFIG+=tcime enables both Cangjie and Zhuyin input methods. You can also enable the Cangjie input method with CONFIG+=cangjie, in which case the Zhuyin input method will not be activated, unless the config contains CONFIG+=zhuyin also. Change-Id: Iddea01f3e3d7f1dafff80e17da5b7cf89d4cfc55 Task-number: QTRD-3726 Reviewed-by: Rainer Keller <rainer.keller@theqtcompany.com> Reviewed-by: Liang Qi <liang.qi@theqtcompany.com>
* Refactor class namesJarkko Koivikko2015-10-281-0/+322
Since the virtual keyboard C++ interface is wrapped inside a namespace, it is possible to get rid of "Declarative" name in the class names, that would otherwise conflict with the QML namespace in the documentation. - Rename DeclarativeSettings to VirtualKeyboardSettings - Remove "Declarative" from class names The rationale for this change is that the name Declarative refers to now obsolete QtQuick1 module. Also, the class names are now the same in C++ and QML name spaces. Change-Id: Ide050d47110443d894d95d35dddf0df5891587be Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>