MCPcopy Create free account
hub / github.com/SeaEpoch/MouseClick / keyPressEvent

Method keyPressEvent

src/modules/hotkeylineedit.cpp:74–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72}
73
74void HotkeyLineEdit::keyPressEvent(QKeyEvent* event)
75{
76 int key = event->key(); // 获取按键编码
77 Qt::KeyboardModifiers modifiers = event->modifiers();
78
79 if (key != Qt::Key_unknown && key != Qt::Key_Control && key != Qt::Key_Shift &&
80 key != Qt::Key_Alt && key != Qt::Key_Meta) {
81 _key_sequence = QKeySequence(modifiers | key).toString();
82 } else {
83 _key_sequence = QKeySequence(modifiers).toString();
84 }
85
86 setText(_key_sequence);
87
88 _pressed_keys.insert(key);
89
90 QLineEdit::keyPressEvent(event);
91}
92
93void HotkeyLineEdit::keyReleaseEvent(QKeyEvent* event)
94{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected