ZBar Bar Code Reader Library  version 0.10
zbar::QZBar Class Reference

barcode reader Qt4 widget. More...

Inheritance diagram for zbar::QZBar:
Collaboration diagram for zbar::QZBar:

Public Slots

void scanImage (const QImage &image)
 scan for barcodes in a QImage. More...
 
void setVideoDevice (const QString &videoDevice)
 open a new video device. More...
 
void setVideoEnabled (bool videoEnabled=true)
 enable/disable video scanning. More...
 

Signals

void decoded (int type, const QString &data)
 emitted when a barcode is decoded from an image. More...
 
void decodedText (const QString &text)
 emitted when a barcode is decoded from an image. More...
 
void videoOpened (bool videoOpened)
 emitted when when a video device is opened or closed. More...
 

Public Member Functions

 QZBar (QWidget *parent=NULL)
 constructs a barcode reader widget with the given parent More...
 
 ~QZBar ()
 
bool isVideoEnabled () const
 retrieve the current video enabled state. More...
 
bool isVideoOpened () const
 retrieve the current video opened state. More...
 
QString videoDevice () const
 retrieve the currently opened video device. More...
 
QSize sizeHint () const
 
int heightForWidth (int) const
 
QPaintEngine * paintEngine () const
 

Properties

QString videoDevice
 the currently opened video device. More...
 
bool videoEnabled
 video device streaming state. More...
 
bool videoOpened
 video device opened state. More...
 

Private Attributes

bool _attached
 
QString _videoDevice
 
bool _videoEnabled
 
QZBarThreadthread
 
void attach ()
 
void showEvent (QShowEvent *)
 
void paintEvent (QPaintEvent *)
 
void resizeEvent (QResizeEvent *)
 
void changeEvent (QEvent *)
 
void dragEnterEvent (QDragEnterEvent *)
 
void dropEvent (QDropEvent *)
 
void sizeChange ()
 

Detailed Description

barcode reader Qt4 widget.

embeds a barcode reader directly into a Qt4 based GUI. the widget can process barcodes from a video source (using the QZBar::videoDevice and QZBar::videoEnabled properties) or from individual QImages supplied to the QZBar::scanImage() slot

Since
1.5

Constructor & Destructor Documentation

QZBar::QZBar ( QWidget parent = NULL)

constructs a barcode reader widget with the given parent

References _attached, zbar::Window::attach(), decoded(), decodedText(), sizeChange(), thread, videoOpened, and zbar::QZBarThread::window.

Here is the call graph for this function:

QZBar::~QZBar ( )

References zbar::QZBarThread::Exit, zbar::QZBarThread::pushEvent(), and thread.

Here is the call graph for this function:

Member Function Documentation

void QZBar::attach ( )
protected

References _attached, _videoDevice, _videoEnabled, zbar::Window::attach(), zbar::QZBarThread::pushEvent(), thread, and zbar::QZBarThread::window.

Referenced by showEvent().

Here is the call graph for this function:

Here is the caller graph for this function:

void QZBar::changeEvent ( QEvent event)
protected

References zbar::Window::attach(), zbar::QZBarThread::mutex, thread, and zbar::QZBarThread::window.

Here is the call graph for this function:

void zbar::QZBar::decoded ( int  type,
const QString &  data 
)
signal

emitted when a barcode is decoded from an image.

the symbol type and contained data are provided as separate parameters.

Referenced by QZBar().

Here is the caller graph for this function:

void zbar::QZBar::decodedText ( const QString &  text)
signal

emitted when a barcode is decoded from an image.

the symbol type name is prefixed to the data, separated by a colon

Referenced by QZBar().

Here is the caller graph for this function:

void QZBar::dragEnterEvent ( QDragEnterEvent *  event)
protected
void QZBar::dropEvent ( QDropEvent *  event)
protected

References scan_image::image, and scanImage().

Here is the call graph for this function:

int QZBar::heightForWidth ( int  width) const
bool QZBar::isVideoEnabled ( ) const

retrieve the current video enabled state.

Returns
true if video scanning is currently enabled, false otherwise

References _videoEnabled.

bool QZBar::isVideoOpened ( ) const

retrieve the current video opened state.

Returns
true if video device is currently opened, false otherwise

References zbar::QZBarThread::_videoOpened, zbar::QZBarThread::mutex, and thread.

QPaintEngine * QZBar::paintEngine ( ) const

References _videoDevice, and videoDevice().

Here is the call graph for this function:

void QZBar::paintEvent ( QPaintEvent *  event)
protected

References zbar::Window::redraw(), thread, and zbar::QZBarThread::window.

Here is the call graph for this function:

void QZBar::resizeEvent ( QResizeEvent *  event)
protected

References zbar::Window::resize(), test_zbar::size, thread, and zbar::QZBarThread::window.

Here is the call graph for this function:

void QZBar::scanImage ( const QImage &  image)
slot

scan for barcodes in a QImage.

References zbar::QZBarThread::pushEvent(), and thread.

Referenced by dropEvent().

Here is the call graph for this function:

Here is the caller graph for this function:

void QZBar::setVideoDevice ( const QString &  videoDevice)
slot

open a new video device.

use an empty string to close a currently opened device.

Note
since opening a device may take some time, this call will return immediately and the device will be opened asynchronously

References _attached, _videoDevice, _videoEnabled, zbar::QZBarThread::pushEvent(), thread, and videoDevice().

Here is the call graph for this function:

void QZBar::setVideoEnabled ( bool  videoEnabled = true)
slot

enable/disable video scanning.

has no effect unless a video device is opened

References _videoEnabled, zbar::QZBarThread::pushEvent(), thread, and videoEnabled.

Here is the call graph for this function:

void QZBar::showEvent ( QShowEvent *  event)
protected

References _attached, attach(), and thread.

Here is the call graph for this function:

void QZBar::sizeChange ( )
protectedslot

Referenced by QZBar().

Here is the caller graph for this function:

QString zbar::QZBar::videoDevice ( ) const

retrieve the currently opened video device.

Returns
the current video device or the empty string if no device is opened

Referenced by paintEngine(), and setVideoDevice().

Here is the caller graph for this function:

void zbar::QZBar::videoOpened ( bool  videoOpened)
signal

emitted when when a video device is opened or closed.

(re)setting QZBar::videoDevice should eventually cause it to be opened or closed. any errors while streaming/scanning will also cause the device to be closed

Member Data Documentation

bool zbar::QZBar::_attached
private
QString zbar::QZBar::_videoDevice
private

Referenced by attach(), paintEngine(), and setVideoDevice().

bool zbar::QZBar::_videoEnabled
private

Property Documentation

QString QZBar::videoDevice
readwrite

the currently opened video device.

setting a new device opens it and automatically sets QZBar::videoEnabled

See also
videoDevice(), setVideoDevice()
bool zbar::QZBar::videoEnabled
readwrite

video device streaming state.

use to pause/resume video scanning.

See also
isVideoEnabled(), setVideoEnabled()

Referenced by setVideoEnabled().

bool zbar::QZBar::videoOpened
read

video device opened state.

(re)setting QZBar::videoDevice should eventually cause it to be opened or closed. any errors while streaming/scanning will also cause the device to be closed

See also
isVideoOpened()

Referenced by QZBar().


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