diff options
Diffstat (limited to 'src/virtualkeyboard/content/InputPanel.qml')
-rw-r--r-- | src/virtualkeyboard/content/InputPanel.qml | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/virtualkeyboard/content/InputPanel.qml b/src/virtualkeyboard/content/InputPanel.qml index f9d25a02..3f88bb30 100644 --- a/src/virtualkeyboard/content/InputPanel.qml +++ b/src/virtualkeyboard/content/InputPanel.qml @@ -61,6 +61,52 @@ Item { */ property alias active: keyboard.active + /*! + \qmlproperty bool InputPanel::externalLanguageSwitchEnabled + \since QtQuick.VirtualKeyboard 2.4 + + This property enables the external language switch mechanism. + When this property is \c true, the virtual keyboard will not show + the built-in language popup, but will emit the \l externalLanguageSwitch + signal instead. The application can handle this signal and show a + custom language selection dialog instead. + */ + property bool externalLanguageSwitchEnabled + + /*! + \qmlsignal InputPanel::externalLanguageSwitch(var localeList, int currentIndex) + \since QtQuick.VirtualKeyboard 2.4 + + This signal is emitted when \l externalLanguageSwitchEnabled is \c true + and the \l {user-guide-language}{language switch key} is pressed by the user. + + It serves as a hook to display a custom language dialog instead of + the built-in language popup in the virtual keyboard. + + The \a localeList parameter contains a list of locale names to choose + from. To get more information about a particular language, use the \l Qt.locale() + function. The \a currentIndex is the index of current locale in the + \a localeList. This item should be highlighted as the current item in the UI. + + To select a new language, use the \l {VirtualKeyboardSettings::locale} + {VirtualKeyboardSettings.locale} property. + + Below is an example that demonstrates a custom language dialog implementation: + + \snippet qtvirtualkeyboard-custom-language-popup.qml popup + + The dialog would then be declared: + + \snippet qtvirtualkeyboard-custom-language-popup.qml declaring + + In the application's InputPanel, add the following code: + + \snippet qtvirtualkeyboard-custom-language-popup.qml using + + The custom dialog will now be shown when the language switch key is pressed. + */ + signal externalLanguageSwitch(var localeList, int currentIndex) + /*! \internal */ property alias keyboard: keyboard |