Matching keyEvent against Standard key sequences
Solved
General and Desktop
-
Is this correct (e.g.)
const QKeySequence received(keyEvent->key() | keyEvent->modifiers()); // // Does the received key sequence match any of the key sequences for // "Select All" // const QList<QKeySequence> selectAll{ QKeySequence::keyBindings(QKeySequence::SelectAll) }; for (i = 0; i < selectAll.size(); i++) { // // Does the key sequence (or single key) we received // match one of the platform specific key sequences // for "Select All" // if (received == selectAll[i]) { // Do something return true; } }
Thanks
D. -
Looks like it should work, did you try it? I assume you are not showing the whole function and have a
return false;
at the end if the key sequence did not match. If it's not working, I would check to see that yourselectAll
list is not empty for some reason (and/or add debugging output).