Public Types | Signals | Public Member Functions | Protected Member Functions | List of all members
pqKeyEventFilter Class Reference

: A class to handle QKeyEvent in an eventFilter and send high level signals. More...

#include <pqKeyEventFilter.h>

Inherits QObject.

Public Types

enum  KeyCategory {
  Accept, Reject, TextInput, Motion,
  Focus
}
 An enum for the key events categories. More...
 

Signals

void textChanged (int key)
 Emited on text key pressed, without modifier. More...
 
void accepted (bool modified)
 Emited on enter or return pressed modified is true if Shift is pressed. More...
 
void rejected ()
 Emited on Escape. More...
 
void motion (int key)
 Emited on a motion key was pressed. More...
 
void focusChanged ()
 Emited on Tab press. More...
 

Public Member Functions

 pqKeyEventFilter (QObject *parent)
 
 ~pqKeyEventFilter () override
 
void filter (QObject *monitored)
 install event filter on monitored object. More...
 
void forwardTypes (QObject *monitored, QList< int > types)
 Filter monitored object but still forward event that fall under the given type. More...
 
void forwardType (QObject *monitored, int type)
 Filter monitored object but still forward event that fall under the given type. More...
 

Protected Member Functions

bool eventFilter (QObject *obj, QEvent *event) override
 Reimplemented to handled QKeyEvent. More...
 

Detailed Description

: A class to handle QKeyEvent in an eventFilter and send high level signals.

: pqKeyEventFilter is a configurable class that reimplements eventFilter() and emit high level signals to communicate about key events.

This is specially useful when a container widget wants to know about key events regardless of which of its child receive the event.

Definition at line 26 of file pqKeyEventFilter.h.

Member Enumeration Documentation

◆ KeyCategory

An enum for the key events categories.

Enumerator
Accept 
Reject 
TextInput 
Motion 
Focus 

Definition at line 38 of file pqKeyEventFilter.h.

Constructor & Destructor Documentation

◆ pqKeyEventFilter()

pqKeyEventFilter::pqKeyEventFilter ( QObject *  parent)

◆ ~pqKeyEventFilter()

pqKeyEventFilter::~pqKeyEventFilter ( )
override

Member Function Documentation

◆ filter()

void pqKeyEventFilter::filter ( QObject *  monitored)

install event filter on monitored object.

◆ forwardTypes()

void pqKeyEventFilter::forwardTypes ( QObject *  monitored,
QList< int types 
)

Filter monitored object but still forward event that fall under the given type.

◆ forwardType()

void pqKeyEventFilter::forwardType ( QObject *  monitored,
int  type 
)

Filter monitored object but still forward event that fall under the given type.

◆ textChanged

void pqKeyEventFilter::textChanged ( int  key)
signal

Emited on text key pressed, without modifier.

Text keys:

  • numbers
  • letters
  • space
  • backspace

As defined by QChar::isLetterOrNumber and QChar::isSpace

◆ accepted

void pqKeyEventFilter::accepted ( bool  modified)
signal

Emited on enter or return pressed modified is true if Shift is pressed.

◆ rejected

void pqKeyEventFilter::rejected ( )
signal

Emited on Escape.

◆ motion

void pqKeyEventFilter::motion ( int  key)
signal

Emited on a motion key was pressed.

Motion keys: the four arrows, home, end, page down and page up.

◆ focusChanged

void pqKeyEventFilter::focusChanged ( )
signal

Emited on Tab press.

reverse is true on Shift + Tab.

◆ eventFilter()

bool pqKeyEventFilter::eventFilter ( QObject *  obj,
QEvent *  event 
)
overrideprotected

Reimplemented to handled QKeyEvent.


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