![]() |
University of Murcia, Spain ![]() |
QVApplication Class ReferenceMain class for QVision applications.
More...
|
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 | setTerminateOnLastWorker (bool terminate) |
Makes an application finish or not when its last worker 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. | |
Static Public Member Functions | |
static QVApplication * | instance () |
Gets a pointer to the only QVApplication instance. |
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 QVWorker, QVCamera, QVImageCanvas, or the QVDefaultGUI object. This objects opens the cameras and sets worker parameters from the command line, and has similar responsabilities as the QApplication object in Qt applications not based on QVision.
Definition at line 51 of file qvapplication.h.
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.
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 38 of file qvapplication.cpp.
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 QVWorkers's. Finally, if everything was initialized OK, the GUI main loop starts executing, showing every graphical element, and finally all the created QVWorkers also start their executions.
Definition at line 61 of file qvapplication.cpp.
void QVApplication::setTerminateOnLastWorker | ( | bool | terminate | ) | [inline] |
Makes an application finish or not when its last worker finishes.
Call this function to decide if you want your application to finish when its last worker does. Default behaviour is TRUE (the application finishes with its last worker, unless qApp->setTerminateOnLastWorker(FALSE) has been explicitly called by the programmer.
terminate | flag to indicate desired behaviour. |
Definition at line 95 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().
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 259 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().
returns | List of unused arguments as a QStringList. |
Definition at line 256 of file qvapplication.cpp.
bool QVApplication::isRunning | ( | ) | [inline] |
Tells if a QVApplication is already in the exec() loop.
Definition at line 124 of file qvapplication.h.
bool QVApplication::forHelp | ( | ) | [inline] |
Tells if a QVApplication is called for print help.
Definition at line 128 of file qvapplication.h.
static QVApplication* QVApplication::instance | ( | ) | [inline, static] |
Gets a pointer to the only QVApplication instance.
Definition at line 132 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 114 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 QVWorkers and closes all the open QVCameras.
Definition at line 179 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 172 of file qvapplication.cpp.