[Interest] Qt iOS and installEventFilter

Nuno Santos nuno.santos at imaginando.pt
Tue Nov 8 13:26:46 CET 2022


Tor,

Thanks for your reply.

I find the way qml keyboard handling works very fiddly or I simply don’t understand how it is supposed to work.

Let’s say I put some keyboard events being handled on the main window, then if another elements gets focus I don’t intercept keyboard events anymore. 

Having a global way of intercepting keyboard events also brings another challenges. For instance, in my case (a music app), I want to be able to use the keyboard to play the instrument but if the users wants to save a preset he will need to type the name of the preset and I don’t want the instrument to play in that case.

Focus of qml elements is probably the thing that confuses me the most. It is very hard to work with. Sometimes we have focus on an element but clicking/tapping outside of it does not take the focus out of it just like in a webpage. 

Best,

Nuno

> On 8 Nov 2022, at 12:10, Tor Arne Vestbø <Tor.arne.Vestbo at qt.io> wrote:
> 
> Hi,
> 
> Verify that the keyboard events are coming in as expected in [QUIView handlePresses:evenType:]
> 
> If that’s the case, the reason they are being filtered out as key events is because they are being sent as input method events to the focus object.
> 
> The iOS platform plugin doesn’t seem to implement the filterNativeEvent machinery. I’ve filed https://bugreports.qt.io/browse/QTBUG-108268 <https://bugreports.qt.io/browse/QTBUG-108268> for that
> 
> Cheers,
> Tor Arne
> 
>> On 8 Nov 2022, at 11:58, Nuno Santos <nuno.santos at imaginando.pt <mailto:nuno.santos at imaginando.pt>> wrote:
>> 
>> Hi,
>> 
>> I’m trying to find a way of intercepting keyboard events in a global and cross platform way. I don’t want this to be tied to certain element in Qml. I really want to have a global way of catching the keyboard events.
>> 
>> I have created an event filter and added this event filter to the QWindow. While this approach works on Desktop, it does not seem to work for iOS. There are events being catched on the event filter but none of those events are keyboard events. I have also event tried to install a nativeEventFilter on the QApplication but that also didn’t work.
>> 
>> Is there a way to do this on iOS?
>> 
>> Thanks!
>> 
>> Regards,
>> 
>> Nuno
>> 
>> 
>> 
>> _______________________________________________
>> Interest mailing list
>> Interest at qt-project.org <mailto:Interest at qt-project.org>
>> https://lists.qt-project.org/listinfo/interest
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20221108/5057ab88/attachment.htm>


More information about the Interest mailing list