What is needed - KDAB€¦ · When a virtual keyboard is shown it might overlap some parts of the...
Transcript of What is needed - KDAB€¦ · When a virtual keyboard is shown it might overlap some parts of the...
UsingVirtualKeyboardsonQtEmbeddedDevices
JanArnePetersen,SeniorSoftwareEngineeratKDAB
Whatisneeded
Whatisneeded p.2
Whatisneeded
WhatisprovidedbyQt
UseQtinputmethodAPIinQtapplications
Whatkindoftextneedstobeinputted?
Whatisneeded p.3
JustsomePINoraWLANpassword
Machinenameorsimplesetup
Fulltextinputforsearchorediting
Supportforbrowser/3rdpartyapplications
Whatkindofembeddeddevice?
Whatisneeded p.4
Whatkindofscreen?
Whathardwarebutton?
Whatotherkindsofinputs?
WhatisprovidedbyQt
WhatisprovidedbyQt p.5
Whatisneeded
WhatisprovidedbyQtInputMethodAPIQPAplatformsQtVirtualKeyboard
UseQtinputmethodAPIinQtapplications
WhatisprovidedbyQt
InputMethodAPI p.6
InputMethodAPI
QPAplatforms
QtVirtualKeyboard
QtInputMethodAPI
InputMethodAPI p.7
VirtualKeyboardsareintegratedinQtviatheInputMethodAPI:
QInputMethod-accessvirtualkeyboardfromapplication
QPlatformInputContext-virtualkeyboardside
QInputMethodQueryEvent-sendinformationfromapplicationtovirtualkeyboard
QInputMethodEventandQKeyEvent-sendinputeventsfromvirtualkeyboardtoapplication
InputMethodsinQt-Overview
InputMethodAPI p.8
WhatisprovidedbyQt
QPAplatforms p.9
InputMethodAPI
QPAplatforms
QtVirtualKeyboard
QPlatformInputContext
QPAplatforms p.10
VirtualkeyboardsideofAPI
PartofQtPlatformAbstraction
TwokindsofQPlatformInputContextforvirtualkeyboardsNativeprovidedbyplatformCustomviaQPlatformInputContextFactory
NativeVirtualKeyboards
QPAplatforms p.11
Usesthevirtualkeyboardprovidedbythesystem
SupportedQPAplatforms:androidiosqnxwaylandwindows
CustomVirtualKeyboards
QPAplatforms p.12
QPlatformInputContextFactory
SupportedQPAplatforms(inQt5.11):bsdfbcocoadirectfb/linuxfbeglfsintegritymirclientvncwaylandwindowsxcb
QPlatformInputContextFactory
QPAplatforms p.13
PluginisdefinedviaQT_IM_MODULE
InputcontextcreationharmonizedinQt5.6null:defaultplatformcontextempty:nocontextset:setone,ifitexistsandisvalid(otherwisenocontext)
1 QStringicStr=QPlatformInputContextFactory::requested();2 if(!icStr.isNull()){3 mInputContext.reset(QPlatformInputContextFactory::create(icStr));4 }else{5 QPlatformInputContext*ctx=newQWaylandInputContext(mDisplay.data());6 mInputContext.reset(ctx);7 }
Wayland
QPAplatforms p.14
Thedefaultplatformcontextusesthekeyboardprovidedbythecompositorviathe"text-input"protocol
Nextofficialversioninwayland-protocolwillbe"text-input-unstable-v3"
WhenusingaQtWaylandcompositorthedefaultcontextforwardstheQtInputMethodAPIfromtheapplicationtothecompositorsothatonecanjustuseanyQPlatformInputContextoncompositorside
Thereisalsothe"input-method"protocolforout-of-processvirtualkeyboards(notsupportedinQtWaylandyet)1 importQtQuick2.02 importQtWayland.Compositor1.134 WaylandCompositor{5 ...6 TextInputManager{7 }89 }
Embeddingkeyboardinapplication
QPAplatforms p.15
Somevirtualkeyboards(likeQtVirtualKeyboard)allowembeddinginanapplication
Especiallyusefulforplatformswithoutmultiplewindowmanagementlikeeglfs
WithpreviouslymentionedpatchitcanbeusedinaQtWaylandcompositortoembedtheQtVirtualKeyboardinthecompositor1 importQtQuick2.52 importQtQuick.VirtualKeyboard2.134 InputPanel{5 id:inputPanel6 visible:active7 y:active?parent.height-inputPanel.height:parent.height8 anchors.left:parent.left9 anchors.right:parent.right
10 }
EmbeddingkeyboardinQtWaylandcompositor
QPAplatforms p.16
WhatisprovidedbyQt
QtVirtualKeyboard p.17
InputMethodAPI
QPAplatforms
QtVirtualKeyboard
QtVirtualKeyboard
QtVirtualKeyboard p.18
CommercialandGPL
Forxcbplatformitdisplaysautomaticallyinaseparatewindow
ForotherQPAplatformsitallowsembeddinginapplicationwindow
UsesQML
Supportsmultiplelanguageslike:English,French,German,Russian,Arabic,...
SupportsChinese,JapaneseandKorean
Supportstextcorrection(hunspell)
Supportshandwriting(Lipitoolkit)
QtVirtualKeyboard
QtVirtualKeyboard p.19
QT_IM_MODULE=qtvirtualkeyboard
QtVirtualKeyboard
QtVirtualKeyboard p.20
Supportsadditionalcommercialengines
KDABworkedtogetherwithMyScriptandTheQtCompanytosupportMyScript’s handwritinginputtechnologyintheQtVirtualKeyboardfortheQtAutomotiveSuite.
ShouldbeincludedinQt5.11
MyScriptbackground
QtVirtualKeyboard p.21
ProblemstosolveOvercometheHMIComplexityDecreasetheDriverDistraction
MyScriptataglance19yearsofexpertise120employeeso/w25PhDsand75engineersOver400MusersintheworldOver200valueaddedpartners:OEM,ISVandSystemIntegratorsMillionsofcarsontheroaduseMyScript2007:1stConceptCar(Audi,Tokyocarshow)2010:1stCarontheroadwiththeAudi2013:1stMercedes2014:1stTesla2015:1stPorscheand1stVW2016:1stOEMAutomotiveAppwithVW
MyScripttechnology
QtVirtualKeyboard p.22
TheMostflexibleenginewithcarefreewritingstylesSupportcursiveLatinwritinginalllanguages
AutomaticspaceinsertionbetweenwordsFlexibleletteralignmentWritewordsorpartofwordsontopofeachotherSameengineandAPIsupporthandwritingrecognitionandkeyboardTransliterationPredictionSpellingcorrection
Supportofupto65languagesforwordrecognition99languagesforcharacter-by-characterrecognition
TodaysupportsallavailablelanguagesoftheQtvirtualkeyboards
UseQtinputmethodAPIinQtapplications
UseQtinputmethodAPIinQtapplications p.23
Whatisneeded
WhatisprovidedbyQt
UseQtinputmethodAPIinQtapplications
Improvetheuserexperience
UseQtinputmethodAPIinQtapplications p.24
QtinputfieldshavebuiltinsupportfortheinputmethodAPIbuttherearestillwaysforapplicationdeveloperstoimprovetheuserexperiencewithvirtualkeyboards:
DefinepurposeoftextinputfieldsAlterapperanceofReturnkeyChangeUIdependingonkeyboard
Definepurposeoftextinputfields
UseQtinputmethodAPIinQtapplications p.25
Thekeyboardcanchangethelayoutdependingonthepurposeofthetextfield
Forexampleenteringdigits,emails,phonenumbers
Qt::InputMethodHintsenumandQt::ImHintsQt::InputMethodQuery
Forexample:Qt::ImhNone-NohintsQt::ImhHiddenText-TheinputmethodshouldnotshowthecharacterswhiletypingQt::ImhDigitsOnly-OnlydigitsareallowedQt::ImhFormattedNumbersOnly-OnlynumberinputisallowedQt::ImhDialableCharactersOnly-OnlycharacterssuitableforphonedialingareallowedQt::ImhEmailCharactersOnly-Onlycharacterssuitableforemailaddressesareallowed
Multiplehintscanbecombined.Forexampleforpasswordfields:Qt.ImhNoAutoUppercase|Qt.ImhNoPredictiveText|Qt.ImhSensitiveData|Qt.ImhHiddenText
Definepurposeoftextinputfields-example
UseQtinputmethodAPIinQtapplications p.26
1 TextInput{2 id:input34 inputMethodHints:Qt.ImhFormattedNumbersOnly5 }
AlterapperanceofReturnkey
UseQtinputmethodAPIinQtapplications p.27
CanbeusedtodisplayalternativekeyinsteadofReturn
Qt::EnterKeyTypeenumandQt::ImEnterKeyTypeQt::InputMethodQuery
Forexample:Qt::EnterKeyDone-Showa"Done"buttonQt::EnterKeySend-Showa"Send"buttonQt::EnterKeySearch-Showa"Search"buttonQt::EnterKeyReturn-ShowaReturnbuttonthatinsertsanewlineQt::EnterKeyNext-Showa"Next"buttonwhichshouldbeusedtonavigatetonextinputfield
Notallofthesevaluesaresupportedonallplatforms.Forunsupportedvaluesthedefaultkeywillbeusedinstead.
Future(Qt5.11?):Qt::ImEnterKeyLabelandQt::ImEnterKeyEnabled
AlterapperanceofReturnkey-Example
UseQtinputmethodAPIinQtapplications p.28
1 TextInput{2 id:input34 EnterKey.type:Qt.EnterKeySearch//Showa"Search"button5 }
ChangeUIdependingonkeyboard
UseQtinputmethodAPIinQtapplications p.29
Whenavirtualkeyboardisshownitmightoverlapsomepartsoftheapplication
Inparticularnotsonicetooverlapthefocusedinputfield
QInputMethod::visiblepropertycanbeusedtofigureoutifavirtualkeyboardisdisplayed
QInputMethod::keyboardRectanglepropertyholdsthevirtualkeyboard'sgeometryinwindowcoordinates
Questions
p.30
Questions
MaliitFramework/Keyboard(basedonUbuntuKeyboard)
p.31
OpenSource:LGPL-3
Keyboardrunsinaseparateprocess
UsesQML
Supportsmultiplelanguageslike:English,French,German,Russian,Arabic,...
SupportsChinese,Japanese,Korean
Supportstextcorrectionandprediction
MaliitKeyboard
p.32