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.