void ShortcutWidget::keyPressEvent(QKeyEvent * e) { int const keyQt = e->key(); if (!keyQt) return; switch(keyQt) { case Qt::Key_AltGr: //or else we get unicode salad case Qt::Key_Shift: case Qt::Key_Control: case Qt::Key_Alt: case Qt::Key_Meta: break; default: appendToSequence(e); setText(toqstr(keysequence_.print(KeySequence::ForGui))); } }
void appendToSequence(std::string data) { appendToSequence(reinterpret_cast<const byte*>(data.c_str()), data.size() + 1); // \0 byte }