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

Method event

widgets/hotkeywidget.cpp:75–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73}
74
75bool HotkeyWidget::event(QEvent *event)
76{
77 if (event->type() == QEvent::LanguageChange) {
78 setHotkeyText();
79 } else if (event->type() == QEvent::KeyPress) {
80 keyPressEvent(static_cast<QKeyEvent *>(event));
81 return true;
82 } else if (event->type() == QEvent::FocusIn) {
83 QFocusEvent *focusEvent = static_cast<QFocusEvent *>(event);
84
85 if (focusEvent->reason() != Qt::TabFocusReason) {
86 setText(tr("Type your hotkey"));
87 mKeyboardFocus = false;
88 grabKeyboard();
89 } else {
90 mKeyboardFocus = true;
91 }
92 } else if (event->type() == QEvent::FocusOut) {
93 if (text() == tr("Invalid hotkey")) {
94 emit invalidHotkeyError();
95 showError();
96 }
97
98 releaseKeyboard();
99 setHotkeyText(); // Reset the text
100 } else if ((event->type() == QEvent::KeyPress || event->type() == QEvent::ShortcutOverride || event->type() == QEvent::Shortcut) && hasFocus()) {
101 event->accept();
102 return true;
103 }
104
105 return QPushButton::event(event);
106}
107
108void HotkeyWidget::keyPressEvent(QKeyEvent *event)
109{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected