| 1 | /**************************************************************************** | 
| 2 | ** | 
| 3 | ** Copyright (C) 2016 The Qt Company Ltd. | 
| 4 | ** Contact: https://www.qt.io/licensing/ | 
| 5 | ** | 
| 6 | ** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit. | 
| 7 | ** | 
| 8 | ** $QT_BEGIN_LICENSE:GPL$ | 
| 9 | ** Commercial License Usage | 
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in | 
| 11 | ** accordance with the commercial license agreement provided with the | 
| 12 | ** Software or, alternatively, in accordance with the terms contained in | 
| 13 | ** a written agreement between you and The Qt Company. For licensing terms | 
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further | 
| 15 | ** information use the contact form at https://www.qt.io/contact-us. | 
| 16 | ** | 
| 17 | ** GNU General Public License Usage | 
| 18 | ** Alternatively, this file may be used under the terms of the GNU | 
| 19 | ** General Public License version 3 or (at your option) any later version | 
| 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by | 
| 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 | 
| 22 | ** included in the packaging of this file. Please review the following | 
| 23 | ** information to ensure the GNU General Public License requirements will | 
| 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. | 
| 25 | ** | 
| 26 | ** $QT_END_LICENSE$ | 
| 27 | ** | 
| 28 | ****************************************************************************/ | 
| 29 |  | 
| 30 | #include <QtVirtualKeyboard/private/enterkeyaction_p.h> | 
| 31 | #include <QtVirtualKeyboard/private/enterkeyactionattachedtype_p.h> | 
| 32 |  | 
| 33 | QT_BEGIN_NAMESPACE | 
| 34 | namespace QtVirtualKeyboard { | 
| 35 |  | 
| 36 | /*! | 
| 37 |     \qmltype EnterKeyAction | 
| 38 |     \inqmlmodule QtQuick.VirtualKeyboard | 
| 39 |     \ingroup qtvirtualkeyboard-qml | 
| 40 |     \brief Provides attached properties for customizing the enter key. | 
| 41 |  | 
| 42 |     The EnterKeyAction type provides attached properties which allows | 
| 43 |     customizing the enter key button of the keyboard. | 
| 44 |  | 
| 45 |     The EnterKeyAction must be used directly inside the item | 
| 46 |     receiving input focus, e.g. TextInput. | 
| 47 |  | 
| 48 |     For example: | 
| 49 |     \code | 
| 50 |     TextInput { | 
| 51 |         id: myInput | 
| 52 |         EnterKeyAction.enabled: myInput.text.length > 0 || myInput.inputMethodComposing | 
| 53 |         EnterKeyAction.label: "Next" | 
| 54 |         Keys.onReleased: { | 
| 55 |             if (event.key === Qt.Key_Return) { | 
| 56 |                 // execute action | 
| 57 |             } | 
| 58 |         } | 
| 59 |     } | 
| 60 |     \endcode | 
| 61 | */ | 
| 62 |  | 
| 63 | /*! | 
| 64 |     \class QtVirtualKeyboard::EnterKeyAction | 
| 65 |     \internal | 
| 66 | */ | 
| 67 |  | 
| 68 | /*! | 
| 69 |     \internal | 
| 70 | */ | 
| 71 | EnterKeyActionAttachedType *EnterKeyAction::qmlAttachedProperties(QObject *object) | 
| 72 | { | 
| 73 |     return new EnterKeyActionAttachedType(object); | 
| 74 | } | 
| 75 |  | 
| 76 | /*! | 
| 77 |     \qmlattachedproperty int EnterKeyAction::actionId | 
| 78 |  | 
| 79 |     Sets the action id for the enter key in virtual keyboard. | 
| 80 |     When the action id is set, it takes preference over the label | 
| 81 |     and sets the icon for the enter key. | 
| 82 |  | 
| 83 |     \list | 
| 84 |         \li \c EnterKeyAction.None No action defined. | 
| 85 |         \li \c EnterKeyAction.Go Action performs go operation. | 
| 86 |                For example taking user to the entered url. | 
| 87 |         \li \c EnterKeyAction.Search Action performs search operation. | 
| 88 |         \li \c EnterKeyAction.Send Action sends the entered text. | 
| 89 |         \li \c EnterKeyAction.Next Action moves the input focus to | 
| 90 |                the next field accepting text input. | 
| 91 |         \li \c EnterKeyAction.Done Same as \c EnterKeyAction.Next, | 
| 92 |                except all the text input is done. | 
| 93 |     \endlist | 
| 94 | */ | 
| 95 |  | 
| 96 | /*! | 
| 97 |     \qmlattachedproperty string EnterKeyAction::label | 
| 98 |  | 
| 99 |     Sets the label for the enter key in virtual keyboard. | 
| 100 | */ | 
| 101 |  | 
| 102 | /*! | 
| 103 |     \qmlattachedproperty bool EnterKeyAction::enabled | 
| 104 |  | 
| 105 |     Enables or disables the enter key button in virtual keyboard. | 
| 106 | */ | 
| 107 |  | 
| 108 | } // namespace QtVirtualKeyboard | 
| 109 | QT_END_NAMESPACE | 
| 110 |  |