MCPcopy Create free account
hub / github.com/ckaiser/Lightscreen / nativeEvent

Method nativeEvent

dialogs/optionsdialog.cpp:484–495  ·  view source on GitHub ↗

Qt does not send the print screen key as a regular QKeyPress event, so we must use the Windows API

Source from the content-addressed store, hash-verified

482#ifdef Q_OS_WIN
483// Qt does not send the print screen key as a regular QKeyPress event, so we must use the Windows API
484bool OptionsDialog::nativeEvent(const QByteArray &eventType, void *message, long *result)
485{
486 if (eventType == "windows_generic_MSG") {
487 MSG *m = static_cast<MSG *>(message);
488
489 if ((m->message == WM_KEYUP || m->message == WM_SYSKEYUP) && m->wParam == VK_SNAPSHOT) {
490 qApp->postEvent(qApp->focusWidget(), new QKeyEvent(QEvent::KeyPress, Qt::Key_Print, qApp->queryKeyboardModifiers()));
491 }
492 }
493
494 return QDialog::nativeEvent(eventType, message, result);
495}
496#endif
497
498//

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected