BPS Report Object. More...
#include <bpsreport.h>
Inheritance diagram for BpsReport:Public Slots | |
| BpsReportPage * | addPage () |
| Adds a new page to the report. | |
| BpsReportSection * | createSection (const QString &aName) |
| Creates a new section with the properties of a named section element. | |
| BpsReportPage * | pageAt (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. | |
| BpsScriptEngine * | engine () |
| 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. | |
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.
| BpsReport::BpsReport | ( | QObject * | aParent = 0 | ) |
Default constructor.
| [in] | aParent | The parent widget. |
| BpsReport::BpsReport | ( | const BpsReportElement & | aReportElement, |
| QObject * | aParent = 0 |
||
| ) |
Constructor using the properties of an existing report element.
| [in] | aReportElement | The report element to use |
| [in] | aParent | The parent widget. |
| BpsException | If report element is not of TypeReport. |
| BpsReportPage* BpsReport::addPage | ( | ) | [slot] |
Adds a new page to the report.
| void BpsReport::beginLoad | ( | int | aCount | ) | [signal] |
This signal is emitted after calling setItemsCount(int).
| [in] | aCount | The estimated number of items to load. |
| void BpsReport::beginPrint | ( | int | aCount | ) | [signal] |
This signal is emitted when printing begins.
| [in] | aCount | The number of pages to print. |
| BpsReportSection* BpsReport::createSection | ( | const QString & | aName | ) | [slot] |
Creates a new section with the properties of a named section element.
| [in] | aName | Name of the section element cloned. |
| BpsException | When no section element with this name is found. |
| void BpsReport::endLoad | ( | int | aCount | ) | [signal] |
This signal is emitted when loading has completed.
| [in] | aCount | The number of items loaded. |
| void BpsReport::endPrint | ( | int | aCount | ) | [signal] |
This signal is emitted when printing has completed.
| [in] | aCount | The number of pages printed. |
| BpsScriptEngine* BpsReport::engine | ( | ) |
Get the engine used to process the report script.
| void BpsReport::execute | ( | ) |
Execute the report script.
| BpsException | Thrown when execution fails for any reason |
| void BpsReport::itemsLoaded | ( | int | aCount | ) | [signal] |
This signal is emitted after calling setLoadedItems(int).
| [in] | aCount | The 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.
| [in] | aDatastore | The database to load from. |
| [in] | aKey | The database key from t_reports.c_key. |
| BpsException | Thrown 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.
| [in] | aDatastore | The database to load from. |
| [in] | aPath | The database path of the report. |
| BpsException | Thrown 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.
| [in] | aPath | The file system path of the report. |
| BpsException | Thrown when loading fails for any reason |
| BpsReportPage* BpsReport::pageAt | ( | int | aIndex | ) | const [slot] |
Get the page at a certain index position.
| [in] | aIndex | The index position 0 ... pageCount()-1 |
| BpsException | Thrown when index is invalid. |
| int BpsReport::pageCount | ( | ) | const [slot] |
Get the number of pages in the report.
| 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.
| [in] | aCount | The 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.
| [in] | aCount | The number of pages printed. |
| void BpsReport::percentLoaded | ( | int | aPercent | ) | [signal] |
This signal is emitted after calling setLoadedItems(int).
| [in] | aPercent | The items processed, calculated to percent. |
| void BpsReport::print | ( | QPrinter * | aPrinter | ) | [slot] |
Print the report.
| [in] | aPrinter | This 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.
| [in] | aPrinter | The printer object, after settings were made by user in QPrintDialog. |
| [in] | aFirstPage | The first page number printed. |
| [in] | aLastPage | The last page number printed. |
| qreal BpsReport::printHeight | ( | ) | const [slot] |
Returns the height in millimeters available for printing.
This is essentially the page size minus top and bottom margins.
| void BpsReport::scriptDebug | ( | const QString & | aLine | ) | const [protected] |
Write the script debug() output.
The default implementation sends the string using qDebug.
| [in] | aLine | The line to write. |
| void BpsReport::scriptPerror | ( | const QString & | aLine | ) | const [protected] |
Write the script perror() output.
The default implementation sends the string using qDebug.
| [in] | aLine | The line to write. |
| void BpsReport::scriptPrint | ( | const QString & | aLine | ) | const [protected] |
Write the script print() output.
The default implementation sends the string using qDebug.
| [in] | aLine | The 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.
| [in] | aCount | The 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.
| [in] | aCount | The number of items loaded. |
| void BpsReport::setPrinterDefaults | ( | QPrinter * | aPrinter | ) | [slot] |
Setup the defaults for the printer.
| [in] | aPrinter | The printer to setup. |