| 1 | // Copyright (C) 2016 The Qt Company Ltd. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
| 3 | |
| 4 | #include <QtVirtualKeyboard/private/enterkeyaction_p.h> |
| 5 | #include <QtVirtualKeyboard/private/enterkeyactionattachedtype_p.h> |
| 6 | |
| 7 | QT_BEGIN_NAMESPACE |
| 8 | namespace QtVirtualKeyboard { |
| 9 | |
| 10 | /*! |
| 11 | \qmltype EnterKeyAction |
| 12 | \inqmlmodule QtQuick.VirtualKeyboard |
| 13 | \ingroup qmlclass |
| 14 | \ingroup qtvirtualkeyboard-qml |
| 15 | \brief Provides attached properties for customizing the enter key. |
| 16 | |
| 17 | The EnterKeyAction type provides attached properties which allows |
| 18 | customizing the enter key button of the keyboard. |
| 19 | |
| 20 | The EnterKeyAction must be used directly inside the item |
| 21 | receiving input focus, e.g. TextInput. |
| 22 | |
| 23 | For example: |
| 24 | \code |
| 25 | TextInput { |
| 26 | id: myInput |
| 27 | EnterKeyAction.enabled: myInput.text.length > 0 || myInput.inputMethodComposing |
| 28 | EnterKeyAction.label: "Next" |
| 29 | Keys.onReleased: { |
| 30 | if (event.key === Qt.Key_Return) { |
| 31 | // execute action |
| 32 | } |
| 33 | } |
| 34 | } |
| 35 | \endcode |
| 36 | */ |
| 37 | |
| 38 | /*! |
| 39 | \class QtVirtualKeyboard::EnterKeyAction |
| 40 | \internal |
| 41 | */ |
| 42 | |
| 43 | /*! |
| 44 | \internal |
| 45 | */ |
| 46 | EnterKeyActionAttachedType *EnterKeyAction::qmlAttachedProperties(QObject *object) |
| 47 | { |
| 48 | return new EnterKeyActionAttachedType(object); |
| 49 | } |
| 50 | |
| 51 | /*! |
| 52 | \qmlattachedproperty int EnterKeyAction::actionId |
| 53 | |
| 54 | Sets the action id for the enter key in virtual keyboard. |
| 55 | When the action id is set, it takes preference over the label |
| 56 | and sets the icon for the enter key. |
| 57 | |
| 58 | \list |
| 59 | \li \c EnterKeyAction.None No action defined. |
| 60 | \li \c EnterKeyAction.Go Action performs go operation. |
| 61 | For example taking user to the entered url. |
| 62 | \li \c EnterKeyAction.Search Action performs search operation. |
| 63 | \li \c EnterKeyAction.Send Action sends the entered text. |
| 64 | \li \c EnterKeyAction.Next Action moves the input focus to |
| 65 | the next field accepting text input. |
| 66 | \li \c EnterKeyAction.Done Same as \c EnterKeyAction.Next, |
| 67 | except all the text input is done. |
| 68 | \endlist |
| 69 | */ |
| 70 | |
| 71 | /*! |
| 72 | \qmlattachedproperty string EnterKeyAction::label |
| 73 | |
| 74 | Sets the label for the enter key in virtual keyboard. |
| 75 | */ |
| 76 | |
| 77 | /*! |
| 78 | \qmlattachedproperty bool EnterKeyAction::enabled |
| 79 | |
| 80 | Enables or disables the enter key button in virtual keyboard. |
| 81 | */ |
| 82 | |
| 83 | } // namespace QtVirtualKeyboard |
| 84 | QT_END_NAMESPACE |
| 85 | |