A event filter catching all scanner events and emitting signals for them. More...
#include <bpsscannerfilter.h>
Signals | |
| void | scanned (char aCode, const QString &aData) |
| This signal is emitted when scanner input is available. | |
Public Member Functions | |
| BpsScannerFilter (QObject *aParent=0) | |
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
| BpsScannerFilter::BpsScannerFilter | ( | QObject * | aParent = 0 | ) |
| [in] | aParent | The parent object. |
| void BpsScannerFilter::scanned | ( | char | aCode, |
| const QString & | aData | ||
| ) | [signal] |
This signal is emitted when scanner input is available.
| [in] | aCode | The scanned code type identifier. |
| [in] | aData | The scanned code without prefix, suffix and code type identifier. |