PARP Research Group University of Murcia, Spain


QVApplication Class Reference
[Block programming]

Main class for QVision applications. More...

#include <QVApplication>

List of all members.

Public Slots

bool startItems ()
 Start the application items.
void quitItems ()
 Terminates the application items.
void quit ()
 Terminates an application.

Public Member Functions

 QVApplication (int &argc, char **argv, QString info=QString(), bool GUIenabled=TRUE)
 Creates a QVApplication object.
int exec ()
 Starts execution of the QVApplication.
void setTerminateOnLastBlock (bool terminate)
 Makes an application finish or not when its last block finishes.
void setArgumentAsUsed (QString argument)
 Marks a given command line argument as used.
QStringList getUnusedArguments ()
 Gets the list of unprocessed arguments.
bool isRunning ()
 Tells if a QVApplication is already in the exec() loop.
bool forHelp ()
 Tells if a QVApplication is called for print help.
QString getHelp ()
 Gets help for a QVApplication.

Static Public Member Functions

static QVApplicationinstance ()
 Gets a pointer to the only QVApplication instance.


Detailed Description

Main class for QVision applications.

This is a class that should be used to create a unique application object in every QVision application, generally in the main() function.

It should exist before creating any QVProcessingBlock, QVCamera, QVImageCanvas, or the QVDefaultGUI object. This objects opens the cameras and sets block parameters from the command line, and has similar responsabilities as the QApplication object in Qt applications not based on QVision.

Definition at line 52 of file qvapplication.h.


Constructor & Destructor Documentation

QVApplication::QVApplication ( int &  argc,
char **  argv,
QString  info = QString(),
bool  GUIenabled = TRUE 
)

Creates a QVApplication object.

This constructor should receive command line arguments array from the main() function parameters, in the parameters argc and argv.

Parameters:
argc Number of command line arguments.
argv Array of arrays of chars containing command line arguments.
info Optional QString containing an informational message for the application (shown when asked for help).
GUIEnabled If FALSE, the application will run in a terminal without graphics. Note that in this case you will not be able to use any kind of graphical user interface (including the QVDefaultGUI).

Definition at line 39 of file qvapplication.cpp.


Member Function Documentation

int QVApplication::exec (  ) 

Starts execution of the QVApplication.

Before starting the application, this method checks if the user asked for help with the command line option "--help", and in that case it shows help on the application and on all the input parameters of every QVPropertyContainer created until now, and exits. Otherwise, it checks for any possible error on any QVPropertyContainer, and if finds any, shows an adequate error message and exits. Any unused command line argument will also lead to an error and the corresponding error message. This function also opens any possibly created QVCameras, letting them ready for being read by adequately linked QVProcessingBlocks's. Finally, if everything was initialized OK, the GUI main loop starts executing, showing every graphical element, and finally all the created QVProcessingBlocks also start their executions.

Returns:
The int code returned by the QVApplication.

Definition at line 64 of file qvapplication.cpp.

void QVApplication::setTerminateOnLastBlock ( bool  terminate  )  [inline]

Makes an application finish or not when its last block finishes.

Call this function to decide if you want your application to finish when its last block does. Default behaviour is TRUE (the application finishes with its last block, unless qApp->setTerminateOnLastBlock(FALSE) has been explicitly called by the programmer.

Parameters:
terminate flag to indicate desired behaviour.

Definition at line 96 of file qvapplication.h.

void QVApplication::setArgumentAsUsed ( QString  argument  ) 

Marks a given command line argument as used.

This function is useful if the programmer wish to process manually a command line argument (which is not intended to initialize any property of a QVPropertyContainer). In that case, he should call this function when the argument has been adequately processed, in order to avoid the QVApplication::exec() early termination with an "unused argument" message. Use in conjunction with QVApplication::getUnusedArguments().

Parameters:
argument QString with the argument to mark as used. Must be exactly as contained in the corresponding argv[i] (including hyphens and/or equal characters, if present).

Definition at line 277 of file qvapplication.cpp.

QStringList QVApplication::getUnusedArguments (  ) 

Gets the list of unprocessed arguments.

This function is useful if the programmer wish to process manually a command line argument (which is not intended to initialize any property of a QVPropertyContainer). In that case, he should call this function to obtain the list of unprocessed arguments, in order to process them adequately. Use in conjunction with QVApplication::setArgumentAsUsed().

Parameters:
returns List of unused arguments as a QStringList.

Definition at line 274 of file qvapplication.cpp.

bool QVApplication::isRunning (  )  [inline]

Tells if a QVApplication is already in the exec() loop.

Returns:
TRUE if the QVApplication is already in the exec() loop.

Definition at line 125 of file qvapplication.h.

bool QVApplication::forHelp (  )  [inline]

Tells if a QVApplication is called for print help.

Returns:
TRUE if the QVApplication is called for print help.

Definition at line 129 of file qvapplication.h.

QString QVApplication::getHelp (  ) 

Gets help for a QVApplication.

Returns:
A (very long, containing carriage returns) QString containing help for the application.

Definition at line 325 of file qvapplication.cpp.

static QVApplication* QVApplication::instance (  )  [inline, static]

Gets a pointer to the only QVApplication instance.

Returns:
Pointer to the only QVApplication instance (equivalent to qvApp).

Definition at line 137 of file qvapplication.h.

bool QVApplication::startItems (  )  [slot]

Start the application items.

This slot, when called, provokes the start of all the QVApplication's items.

Definition at line 117 of file qvapplication.cpp.

Referenced by exec().

void QVApplication::quitItems (  )  [slot]

Terminates the application items.

This slot, when called, provokes the termination of the QVApplication's items. Previously, it cleanly finishes all the QVProcessingBlocks and closes all the open QVCameras.

Definition at line 195 of file qvapplication.cpp.

Referenced by quit().

void QVApplication::quit (  )  [slot]

Terminates an application.

This slot, when called, provokes the termination of the QVApplication. Previously, it quitItems.

Definition at line 188 of file qvapplication.cpp.


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



QVision framework. PARP research group, copyright 2007, 2008.