Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

QcjDataStatics.h File Reference

Convenient objects to be used by the application. These are used by all of the QcjData Classes. More...

#include <QSettings>
#include "QcjDataXML.h"

Go to the source code of this file.

Variables

QcjDataXMLpFormDef
QSettings * pConfig
QSqlDatabase db
QSqlDatabase * pDb


Detailed Description

Convenient objects to be used by the application. These are used by all of the QcjData Classes.

This file has declarations for global variables which are used by all of the QcjData Classes and the application as well.

Two of the objects need to be initialized by the main application.

Here is a generic example of code to perform the initialization which can be used in most applications.

      #include "QcjData/QcjDataStatics.h"
      #include "QcjData/QcjDataXML.h"

      QStringList appPath;
      QString appName;
      QString invoiceReportFn;
      QcjDataConfigure *pConfigDlg;
      QMap<int, QString> menuMap;

      int main( int argc, char ** argv )
      {
         QString reportPath;

         // Create the application object
         QApplication a( argc, argv );

         // Get it's path information
         appPath = a.arguments().at(0).split(QRegExp("[/\\\\]"));
         QFileInfo appInfo(a.arguments().at(0));

         // Get it's name
         appName = appInfo.baseName();

         // Get the directory where it resides
         appPath.removeLast();

         // Create a QSettings object to retrieve the configuration information from
         // Note the Company name, you will want to change this
         pConfig = new QSettings("CompanyName", appName);

         // Create the XML object searching the likely files where xml file may reside.
         pFormDef = new QcjDataXML(pConfig->readEntry("XMLConfig", QcjDataForm::findXML(appPath, appName)));

         // Create and initialize the QcjDataConfigure dialog which the user can configure the application with.
         pConfigDlg = new QcjDataConfigure;
         pConfigDlg->initialize("app");
         .
         .
         .

Definition in file QcjDataStatics.h.


Generated on Mon May 21 21:05:25 2007 for QcjClasses by  doxygen 1.4.4