To use QKeySequence or an alternative to it



  • I have a current need that I need to be able to construct key sequences as and when a key is pressed (that includes the modifier). Currently QKeySequence does not handle my requirement but am using it such that its being constructed everytime a key is pressed or released. Also another thing that I noticed is that when only the modifiers are pressed (which is a valid case in my requirement), I should be able to generate a valid QKeySequence, however it does not until there is a non-modifier key (anything other than Ctrl/Shift/Alt/Meta).
    Also it would be ideal to say have QKeySequence::addKey(key) [that will add a key to the current sequence] and QKeySequence::removeKey(key) [that would remove an existing key from the key sequence] to extend it.

    It would be great if anyone could let me know to get this work with QKeySequence or an alternative.

    Thanks.



  • or in other words, I need a simple key container which can be used straight in mapping to actions (not QAction, just a function call maybe)

    @if (seq1) do this
    else if (seq2) do that
    ...
    @



  • maybe reimplementing
    "keyPressEvent":http://doc-snapshot.qt-project.org/4.8/qwidget.html#keyPressEvent

    will help you...



  • yup, already re-implmented keyPressEvent, still needed a simpler container to map the key sequence (order does not really matter).


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.