Documents > BPS V2 C++ API

BPS Report Object. More...

#include <bpsreport.h>

+ Inheritance diagram for BpsReport:

List of all members.

Public Slots

BpsReportPageaddPage ()
 Adds a new page to the report.
BpsReportSectioncreateSection (const QString &aName)
 Creates a new section with the properties of a named section element.
BpsReportPagepageAt (int aIndex) const
 Get the page at a certain index position.
int pageCount () const
 Get the number of pages in the report.
void print (QPrinter *aPrinter)
 Print the report.
int printedPages (QPrinter *aPrinter, int &aFirstPage=*new int, int &aLastPage=*new int) const
 Get the number and range of printed pages.
qreal printHeight () const
 Returns the height in millimeters available for printing.
void setItemsCount (int aCount)
 The script should set the number of items that need to be processed at begin of script execution, so progress displays can show an accurate estimate of processing time.
void setLoadedItems (int aCount)
 The script should set the number of loaded items after every item that got processed, so progress displays can show an accurate estimate of processing time.
void setPrinterDefaults (QPrinter *aPrinter)
 Setup the defaults for the printer.

Signals

void beginLoad (int aCount)
 This signal is emitted after calling setItemsCount(int).
void beginPrint (int aCount)
 This signal is emitted when printing begins.
void endLoad (int aCount)
 This signal is emitted when loading has completed.
void endPrint (int aCount)
 This signal is emitted when printing has completed.
void itemsLoaded (int aCount)
 This signal is emitted after calling setLoadedItems(int).
void pagesAdded (int aCount)
 This signal is emitted after a new page is added while loading the report.
void pagesPrinted (int aCount)
 This signal is emitted when a page is completed while printing the report.
void percentLoaded (int aPercent)
 This signal is emitted after calling setLoadedItems(int).

Public Member Functions

 BpsReport (QObject *aParent=0)
 Default constructor.
 BpsReport (const BpsReportElement &aReportElement, QObject *aParent=0)
 Constructor using the properties of an existing report element.
BpsScriptEngineengine ()
 Get the engine used to process the report script.
void execute ()
 Execute the report script.
void load (BpsDatastore *aDatastore, const QVariant &aKey)
 Loads a report from database when the key t_reports.c_key is known This method is used with objects created with the default constructor.
void load (BpsDatastore *aDatastore, const QString &aPath)
 Loads a report from database when the path name is known.
void load (const QString &aPath)
 Loads a report from file.

Protected Member Functions

void scriptDebug (const QString &aLine) const
 Write the script debug() output.
void scriptPerror (const QString &aLine) const
 Write the script perror() output.
void scriptPrint (const QString &aLine) const
 Write the script print() output.

Detailed Description

BPS Report Object.

When loading a report, the script can provide additional progress information by first calling setItemsCount(int) to announce the number of items that need to be processed, and then calling setLoadedItems(int) to actually signal the progress.

If setItemsCount(int) is not called before the first page is added, the signal setItemsCount(100) will automatically get called, and itemsLoaded(int) will be emitted after every page add like pagesAdded(int). Should the page count exceed itemsCount() during the load process, setItemsCount(itemsCount()*2) will be executed. This automatism allows to still signal progress when the script does not provide such information, although not that exact.


Constructor & Destructor Documentation

BpsReport::BpsReport ( QObject *  aParent = 0)

Default constructor.

Parameters:
[in]aParentThe parent widget.
BpsReport::BpsReport ( const BpsReportElement aReportElement,
QObject *  aParent = 0 
)

Constructor using the properties of an existing report element.

Parameters:
[in]aReportElementThe report element to use
[in]aParentThe parent widget.
Exceptions:
BpsExceptionIf report element is not of TypeReport.

Member Function Documentation

BpsReportPage* BpsReport::addPage ( ) [slot]

Adds a new page to the report.

Returns:
Returns pointer to the new page.
void BpsReport::beginLoad ( int  aCount) [signal]

This signal is emitted after calling setItemsCount(int).

Parameters:
[in]aCountThe estimated number of items to load.
void BpsReport::beginPrint ( int  aCount) [signal]

This signal is emitted when printing begins.

Parameters:
[in]aCountThe number of pages to print.
BpsReportSection* BpsReport::createSection ( const QString &  aName) [slot]

Creates a new section with the properties of a named section element.

Parameters:
[in]aNameName of the section element cloned.
Returns:
Returns pointer to the cloned section.
Exceptions:
BpsExceptionWhen no section element with this name is found.
void BpsReport::endLoad ( int  aCount) [signal]

This signal is emitted when loading has completed.

Parameters:
[in]aCountThe number of items loaded.
void BpsReport::endPrint ( int  aCount) [signal]

This signal is emitted when printing has completed.

Parameters:
[in]aCountThe number of pages printed.
BpsScriptEngine* BpsReport::engine ( )

Get the engine used to process the report script.

Returns:
Pointer to the script engine.
void BpsReport::execute ( )

Execute the report script.

Exceptions:
BpsExceptionThrown when execution fails for any reason
void BpsReport::itemsLoaded ( int  aCount) [signal]

This signal is emitted after calling setLoadedItems(int).

Parameters:
[in]aCountThe items processed.
void BpsReport::load ( BpsDatastore aDatastore,
const QVariant &  aKey 
)

Loads a report from database when the key t_reports.c_key is known This method is used with objects created with the default constructor.

Parameters:
[in]aDatastoreThe database to load from.
[in]aKeyThe database key from t_reports.c_key.
Exceptions:
BpsExceptionThrown when loading fails for any reason
void BpsReport::load ( BpsDatastore aDatastore,
const QString &  aPath 
)

Loads a report from database when the path name is known.

This method is used with objects created with the default constructor.

Parameters:
[in]aDatastoreThe database to load from.
[in]aPathThe database path of the report.
Exceptions:
BpsExceptionThrown when loading fails for any reason
void BpsReport::load ( const QString &  aPath)

Loads a report from file.

This method is used with objects created with the default constructor.

Parameters:
[in]aPathThe file system path of the report.
Exceptions:
BpsExceptionThrown when loading fails for any reason
BpsReportPage* BpsReport::pageAt ( int  aIndex) const [slot]

Get the page at a certain index position.

Parameters:
[in]aIndexThe index position 0 ... pageCount()-1
Returns:
Returns page pointer.
Exceptions:
BpsExceptionThrown when index is invalid.
int BpsReport::pageCount ( ) const [slot]

Get the number of pages in the report.

Returns:
Number of pages.
void BpsReport::pagesAdded ( int  aCount) [signal]

This signal is emitted after a new page is added while loading the report.

It may be of use to show progress when several pages are created in the script.

Parameters:
[in]aCountThe number of pages added.
void BpsReport::pagesPrinted ( int  aCount) [signal]

This signal is emitted when a page is completed while printing the report.

It may be of use to show progress when a multi page report is printed.

Parameters:
[in]aCountThe number of pages printed.
void BpsReport::percentLoaded ( int  aPercent) [signal]

This signal is emitted after calling setLoadedItems(int).

Parameters:
[in]aPercentThe items processed, calculated to percent.
void BpsReport::print ( QPrinter *  aPrinter) [slot]

Print the report.

Parameters:
[in]aPrinterThis printer object to print on.
int BpsReport::printedPages ( QPrinter *  aPrinter,
int &  aFirstPage = *new int,
int &  aLastPage = *new int 
) const [slot]

Get the number and range of printed pages.

Parameters:
[in]aPrinterThe printer object, after settings were made by user in QPrintDialog.
[in]aFirstPageThe first page number printed.
[in]aLastPageThe last page number printed.
Returns:
The number of pages to print.
qreal BpsReport::printHeight ( ) const [slot]

Returns the height in millimeters available for printing.

This is essentially the page size minus top and bottom margins.

Returns:
The height available printing.
void BpsReport::scriptDebug ( const QString &  aLine) const [protected]

Write the script debug() output.

The default implementation sends the string using qDebug.

Parameters:
[in]aLineThe line to write.
void BpsReport::scriptPerror ( const QString &  aLine) const [protected]

Write the script perror() output.

The default implementation sends the string using qDebug.

Parameters:
[in]aLineThe line to write.
void BpsReport::scriptPrint ( const QString &  aLine) const [protected]

Write the script print() output.

The default implementation sends the string using qDebug.

Parameters:
[in]aLineThe line to write.
void BpsReport::setItemsCount ( int  aCount) [slot]

The script should set the number of items that need to be processed at begin of script execution, so progress displays can show an accurate estimate of processing time.

Parameters:
[in]aCountThe total number of items to process.
void BpsReport::setLoadedItems ( int  aCount) [slot]

The script should set the number of loaded items after every item that got processed, so progress displays can show an accurate estimate of processing time.

Parameters:
[in]aCountThe number of items loaded.
void BpsReport::setPrinterDefaults ( QPrinter *  aPrinter) [slot]

Setup the defaults for the printer.

Parameters:
[in]aPrinterThe printer to setup.

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