QKeyEvent and getting all 'F' key presses
Hi,
Just wondering if there is a way to single out all the 'F' keys (F1 through to F12) in one go when I have a keyPressEvent(QKeyEvent *k) without having to list then all like this
if(k->key() == Qt::Key_F1)
if(k->key() == Qt::Key_F2)
etc...
Thank you very much :)
Re: QKeyEvent and getting all 'F' key presses
Code:
if(k->key() >= Qt::Key_F1 && k->key() <= Qt::Key_F12)
Re: QKeyEvent and getting all 'F' key presses
Thank you very much. I was unsure if the < > could be used in this case.
cheers!!
Re: QKeyEvent and getting all 'F' key presses
In this case you can. If the set of tested values is discontinuous, you can define static QVector<int> with all values and use the QVector::indexOf method