Documents > BPS V2 C++ API
BpsKeyFilter Class Reference

Event filter catching key press/release events and emitting signals for them. More...

#include <bpskeyfilter.h>

List of all members.

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.

Detailed Description

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)));

Member Enumeration Documentation

anonymous enum

Key specifiers.

Enumerator:
Enter 

Enter.

F1 

F1.

F2 

F2.

F3 

F3.

F4 

F4.

F5 

F5.

F6 

F6.

F7 

F7.

F8 

F8.

F9 

F9.

F10 

F10.

F11 

F11.

F12 

F12.

CtrlEnter 

Ctrl and Enter.

CtrlF1 

Ctrl and F1.

CtrlF2 

Ctrl and F2.

CtrlF3 

Ctrl and F3.

CtrlF4 

Ctrl and F4.

CtrlF5 

Ctrl and F5.

CtrlF6 

Ctrl and F6.

CtrlF7 

Ctrl and F7.

CtrlF8 

Ctrl and F8.

CtrlF9 

Ctrl and F9.

CtrlF10 

Ctrl and F10.

CtrlF11 

Ctrl and F11.

CtrlF12 

Ctrl and F12.

AltEnter 

Alt and Enter.

AltF1 

Alt and F1.

AltF2 

Alt and F2.

AltF3 

Alt and F3.

AltF4 

Alt and F4.

AltF5 

Alt and F5.

AltF6 

Alt and F6.

AltF7 

Alt and F7.

AltF8 

Alt and F8.

AltF9 

Alt and F9.

AltF10 

Alt and F10.

AltF11 

Alt and F11.

AltF12 

Alt and F12.


Constructor & Destructor Documentation

BpsKeyFilter::BpsKeyFilter ( int  aKey,
QObject *  aParent = 0 
)

Filter for a single given key.

Parameters:
[in]aKeyThe key to handle (see key specifiers).
[in]aParentThe parent object.
BpsKeyFilter::BpsKeyFilter ( const QSet< int > &  aKeys,
QObject *  aParent = 0 
)

Filter for list of given keys.

Parameters:
[in]aKeysA set of keys to handle (see key specifiers).
[in]aParentThe parent object.

Member Function Documentation

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.

Parameters:
[in]aKeyThe 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.

Parameters:
[in]aKeyThe key that was released (see key specifiers).

The documentation for this class was generated from the following file: