May 7, 2012

dawidow dawidow
Lab Rat
2 posts

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.

3 replies

May 7, 2012

dawidow dawidow
Lab Rat
2 posts

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)

  1. if (seq1) do this
  2. else if (seq2) do that
  3. ...

May 7, 2012

AcerExtensa AcerExtensa
Lab Rat
628 posts

maybe reimplementing
keyPressEvent [doc-snapshot.qt-project.org]

will help you…

 Signature 

God is Real unless explicitly declared as Integer.

May 7, 2012

dawidow dawidow
Lab Rat
2 posts

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

 
  ‹‹ Fetching RGB values of a pixel      QGLWidget::setFormat not working as expected. ››

You must log in to post a reply. Not a member yet? Register here!