Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
6.2.4
-
None
-
OS: Windows 10 Pro 10.0.19045 Build 19045
Processor: 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz, 1690 Mhz, 4 Core(s), 8 Logical Processor(s)
RAM: 12 GB
IDE: Qt Creator 9.0.2
Description
I am trying to simulate user input to close a window. I try to use QTest::keyClick(Qt::key::Key_F4, myWidget, Qt::KeyboardModifiers
{ Qt::KeyboardModifier::AltModifier }); to simulate the user clicking the Alt+F4 keyboard combo, but it does not work. I step through the code and it seems like keyClick and similar functions only support ASCII characters. Is there a way to simulate keyClicks that are control characters?
For more detail into my use case, I want to pop-up a message box when someone closes the window. I have an event filter that handles this. I have code to check whether the message box is created, but the test case fails because the event filter fails to determine the event. I think it has something to do with what I pass into keyClick, but I am unsure.