Event filter catching key press/release events and emitting signals for them. More...
#include <bpskeyfilter.h>
Public Types | |
| enum | { Enter, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, CtrlEnter, CtrlF1, CtrlF2, CtrlF3, CtrlF4, CtrlF5, CtrlF6, CtrlF7, CtrlF8, CtrlF9, CtrlF10, CtrlF11, CtrlF12, AltEnter, AltF1, AltF2, AltF3, AltF4, AltF5, AltF6, AltF7, AltF8, AltF9, AltF10, AltF11, AltF12 } |
| Key specifiers. More... | |
Signals | |
| void | keyPressed () |
| This signal is emitted when any of the given keys was pressed. | |
| void | keyPressed (int aKey) |
| This signal is emitted when any of the given keys was pressed. | |
| void | keyReleased () |
| This signal is emitted when the key was released. | |
| void | keyReleased (int aKey) |
| This signal is emitted when any of the given keys was released. | |
Public Member Functions | |
| BpsKeyFilter (int aKey, QObject *aParent=0) | |
| Filter for a single given key. | |
| BpsKeyFilter (const QSet< int > &aKeys, QObject *aParent=0) | |
| Filter for list of given keys. | |
Event filter catching key press/release events and emitting signals for them.
// create filters BpsKeyFilter* enterKeyFilter = new BpsKeyFilter(BpsKeyFilter::Enter, this); QSet<int> fkeys; fkeys << BpsKeyFilter::F3 << BpsKeyFilter::F4 << BpsKeyFilter::F5; BpsKeyFilter* scalesKeyFilter = new BpsKeyFilter(fkeys , this); // apply filters to current widget installEventFilter(enterKeyFilter); installEventFilter(scalesKeyFilter); // make connections connect(enterKeyFilter, SIGNAL(keyPressed()), this, SLOT(weigh())); connect(scalesKeyFilter, SIGNAL(keyPressed(int)), this, SLOT(selSales(int)));
| anonymous enum |
Key specifiers.
| BpsKeyFilter::BpsKeyFilter | ( | int | aKey, |
| QObject * | aParent = 0 |
||
| ) |
Filter for a single given key.
| [in] | aKey | The key to handle (see key specifiers). |
| [in] | aParent | The parent object. |
| BpsKeyFilter::BpsKeyFilter | ( | const QSet< int > & | aKeys, |
| QObject * | aParent = 0 |
||
| ) |
Filter for list of given keys.
| [in] | aKeys | A set of keys to handle (see key specifiers). |
| [in] | aParent | The parent object. |
| void BpsKeyFilter::keyPressed | ( | ) | [signal] |
This signal is emitted when any of the given keys was pressed.
This is a convenience overload useful when only one single key is filtered.
| void BpsKeyFilter::keyPressed | ( | int | aKey | ) | [signal] |
This signal is emitted when any of the given keys was pressed.
| [in] | aKey | The key that was pressed (see key specifiers). |
| void BpsKeyFilter::keyReleased | ( | ) | [signal] |
This signal is emitted when the key was released.
This is a convenience overload useful when only one single key is filtered.
| void BpsKeyFilter::keyReleased | ( | int | aKey | ) | [signal] |
This signal is emitted when any of the given keys was released.
| [in] | aKey | The key that was released (see key specifiers). |