PARP Research Group Universidad de Murcia


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 processArguments ()
 Process command line arguments without executing.
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.
int getNumberOfArguments () const
 Gets the number of total arguments.
QString getArgument (const int index)
 Gets the value of an application argument.
QStringList getArguments ()
 Gets the argument values.

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.

This object should be created before any QVProcessingBlock, QVCamera, QVImageCanvas, or QVDefaultGUI object. It is similar to a QApplication object in Qt applications not based on QVision. The QVApplication object object initializes the camera block objects in the application, and sets the block parameters from the command line, amongst other things.

Definition at line 55 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 40 of file qvapplication.cpp.


Member Function Documentation

int QVApplication::processArguments (  ) 

Process command line arguments without executing.

Just as in QVApplication::exec, 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 returns. Otherwise, just as exec, it also checks for any possible error on any QVPropertyContainer, and if finds any, shows an adequate error message, and returns. Again as exec, any unused command line argument will also lead to an error and the corresponding error message. But, unlike the exec method, after parsing every argument from the command line, this method simply returns without entering any event loop. Therefore, use this method in any QVApplication in which you want to use the command line facility without having to enter a QApplication event loop.

Returns:
0, if help was asked, -1 if some error was found in the command line, +1 if everything was parsed OK.

Definition at line 65 of file qvapplication.cpp.

Referenced by exec().

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 99 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 behavior 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 behavior.

Definition at line 115 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 292 of file qvapplication.cpp.

Referenced by getArgument(), and getArguments().

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().

Returns:
List of unused arguments as a QStringList.

Definition at line 289 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 144 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 148 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 340 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 156 of file qvapplication.h.

int QVApplication::getNumberOfArguments (  )  const [inline]

Gets the number of total arguments.

This function is useful if the programmer wish to process manually a command line parameter. This method will indicate the programmer how many console line parameters were provided by the user.

Returns:
Number of command line parameters.

Definition at line 175 of file qvapplication.h.

QString QVApplication::getArgument ( const int  index  )  [inline]

Gets the value of an application argument.

This function is useful if the programmer wish to process manually a command line parameter. This method will return the command line parameter located at the index.

Parameters:
index Index for the command line parameter
Returns:
Command line parameter located at the index.

Definition at line 185 of file qvapplication.h.

QStringList QVApplication::getArguments (  )  [inline]

Gets the argument values.

This function returns the command line arguments in a QString list. It also marks all arguments as used.

Returns:
Command line parameters.

Definition at line 200 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 128 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 208 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 201 of file qvapplication.cpp.


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



QVision framework. PARP research group. Copyright © 2007, 2008, 2009, 2010, 2011.