[Development] Sending key events on Qt 5.5.0

Christian.Paffhausen at ehrhardt-partner.com Christian.Paffhausen at ehrhardt-partner.com
Thu Sep 17 12:16:55 CEST 2015


Hi Bo Thorsen,

thanks for that. But it's a little bit more complicated. There is no
PushButton. We record all keyboard input events, buffer them in a own key
event class, which is derived by QKeyEvent, and accepting the original
events. So the original key event will never reach the action. If our
internal states say ready for keyboard input, we sending our key event via
QApplication::sendEvent. In this part of the code, i know nothing about a
action somewhere. I only know about incoming key events and resending them.

The PushButton was only a demonstrator :-)

Regards
Christian

Mit freundlichen Grüßen / Best regards

Ehrhardt + Partner GmbH & Co. KG

i.A. Christian Paffhausen
Software Developer

Development Group User Interfaces

******************************************
Ehrhardt + Partner GmbH & Co. KG
Software - Systeme für Warehouse - Logistik
Alte Roemerstrasse 3
D-56154 Boppard-Buchholz
Handelsregister Koblenz HRA 4605
GF Marco Ehrhardt
Tel. : (+49) 67 42 / 87 27 0
Fax : (+49) 67 42 / 87 27 50
E-Mail: info at ehrhardt-partner.com
Internet: www.ehrhardt-partner.com

(Embedded image moved to file: pic13977.jpg)




From:	Bo Thorsen <bo at vikingsoft.eu>
To:	development at qt-project.org
Date:	17.09.2015 11:37
Subject:	Re: [Development] Sending key events on Qt 5.5.0
Sent by:	development-bounces
            +christian.paffhausen=ehrhardt-partner.com at qt-project.org



Den 17-09-2015 kl. 11:21 skrev Christian.Paffhausen at ehrhardt-partner.com:
> i have a problem with manually sending key events and shortcuts on Qt
> 5.5.0.
>
> In our application, we have a QAction with a F5 shortcut in a toolbar.
When
> i press the toolbutton everything works fine. When i press the F5 key on
my
> keyboard too.
> But when i press a pushbutton, where the connected slot generate a
> QKeyEvent and send this event via QApplication::sendEvent nothing will
> happen.
> With Qt 5.4.1 it works, but with 5.5.0 not.
>
> I have attached a small example app, which describes my problem.
>
> Is this problem already known? Have you a patch or work around for me?

Hi Christian,

The solution: tAction->trigger()

I'm not trying to be cute or anything. This is what you should do.
Abusing the short cut system to send messages between widgets is a bad
idea.

That said, I also think you should report this as a bug. The behaviour
change between 5.4 and 5.5 is bad. But I've seen 5.5 behaviour change
bug reports closed as invalid for weird reasons, so you might not have
any luck.

I hope this helps.

Bo Thorsen,
Director, Viking Software.

--
Viking Software
Qt and C++ developers for hire
http://www.vikingsoft.eu
_______________________________________________
Development mailing list
Development at qt-project.org
http://lists.qt-project.org/mailman/listinfo/development
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pic13977.jpg
Type: image/jpeg
Size: 41363 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/development/attachments/20150917/832cc020/attachment.jpg>


More information about the Development mailing list