Documents > BPS V2 C++ API
BpsScannerFilter Class Reference

A event filter catching all scanner events and emitting signals for them. More...

#include <bpsscannerfilter.h>

List of all members.

Signals

void scanned (char aCode, const QString &aData)
 This signal is emitted when scanner input is available.

Public Member Functions

 BpsScannerFilter (QObject *aParent=0)

Detailed Description

A event filter catching all scanner events and emitting signals for them.

To make a widget catch and process scanner events, you must install the filter on all input widgets. Typically in the widget constructor after creating all the child widgets you would as last step create and apply the filter:

 MyWidget::MyWidget(QWidget* aParent) : QWidget(aParent)
 {
     // create the child widgets and add them to the layout
     // ...

     // create scanner filter and install it on children
     BpsScannerFilter* scannerFilter = new BpsScannerFilter(this);
     foreach (QWidget* w, findChildren<QWidget*>())
         w->installEventFilter(scannerFilter);
     // ...

     // make connections
     // ...
     connect(scannerFilter, SIGNAL(scanned(char,QString)), this, SLOT(scanned(char,QString)));
     // ...
 } // constructor

 void MyWidget::scanned(char aCode, const QString& aData)
 {
     BpsBarcode barcode(mDatastore, aCode, aData);
     QString data = barcode.lotData(false);
     if (!data.isEmpty()) {
         // search for the scanned lot ID in data
         // .....
 } // scanned

Constructor & Destructor Documentation

BpsScannerFilter::BpsScannerFilter ( QObject *  aParent = 0)
Parameters:
[in]aParentThe parent object.

Member Function Documentation

void BpsScannerFilter::scanned ( char  aCode,
const QString &  aData 
) [signal]

This signal is emitted when scanner input is available.

Parameters:
[in]aCodeThe scanned code type identifier.
[in]aDataThe scanned code without prefix, suffix and code type identifier.

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