[Development] QInputMethod woes

Uwe Rathmann Uwe.Rathmann at tigertal.de
Thu Jun 14 08:42:37 CEST 2018


Hi Simon,

> While it's true that show(), etc. don't have the focus object as a
> parameter, you do have a three ways ....

Yes, sure: show() is not the problem.

( We also have situations, where the virtual keyboard is started by 
pressing a button, while the input should go to some sort of label - but 
let's forget about them here )

> I'm missing something then, why is your virtual keyboard hidden...

It isn't.

> ... when the
> focus object transitions from an element in the regular UI to an element
> in your virtual keyboard?

Our keyboard is a container item having the tabFence/focusProxy flags 
being enabled. It is shown on QInputMethod::show and automatically gets 
the focus.

Automatically transferring the focus on hide/show of popups ( = items 
with tabFence/focusProxy ) is part of the qskinny framework. 

( in case you are looking for ideas for Qt6: almost every EGLFS 
application needs some sort of replacement for what a window manager does 
with regular windows )

But anyway - the text input loses the focus and one of the buttons inside 
the virtual keyboard receives it:

then the first thing that needs to managed is, that whenever the focus 
changes - f.e when the focus gets transferred to the virtual keyboard, or 
simply when navigating along the buttons inside the keyboard - the input 
context receives QInputMethod::commit() requests.

--

But let's also have a look at QQuickTextInput: it automatically calls  
QInputMethod::show, when receiving the focus.

This makes the focus tab chain almost unusable, as the virtual keyboard 
pops up, only when trying to navigate over a text input - always stealing 
the focus.

Then when closing the virtual keybaord and the focus returns to the text 
input: it immediately reopens the virtual keyboard.

Automatically calling QInputMethod::show can be avoided by disabling the 
focusOnPress ( = Qt::ClickFocus ) property, but what to do, when it is 
needed ?

So without hacking QQuickTextInput ( = accessing private headers ) on the 
C++ side you can't get any proper focus management working.

Uwe




More information about the Development mailing list