BPS C++ API  2.24.4
BpsReport Class Reference

BPS Report Object. More...

#include <bpsreport.h>

+ Inheritance diagram for BpsReport:

Public Slots

BpsReportPageaddPage ()
 Adds a new page to the report. More...
 
BpsReportSectioncreateSection (const QString &aName)
 Creates a new section with the properties of a named section element. More...
 
BpsReportPagepageAt (int aIndex) const
 Get the page at a certain index position. More...
 
int pageCount () const
 Get the number of pages in the report. More...
 
void print (QPrinter *aPrinter)
 Print the report. More...
 
int printedPages (QPrinter *aPrinter, int &aFirstPage= *new int, int &aLastPage= *new int) const
 Get the number and range of printed pages. More...
 
qreal printHeight () const
 Returns the height in millimeters available for printing. More...
 
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. More...
 
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. More...
 
void setPrinterDefaults (QPrinter *aPrinter)
 Setup the defaults for the printer. More...
 
- Public Slots inherited from BpsReportElement
virtual bool setProperty (const char *aName, const QVariant &aValue)
 Set the value of a named property. More...
 
- Public Slots inherited from BpsPropertyObject
void setModified (bool aModified=true)
 Set or clear the modification status. More...
 
virtual bool setProperty (const char *aName, const QVariant &aValue)
 Set the value of a property. More...
 
bool setPropertyAsString (const char *aName, const QString &aValue)
 Set the value of a property by converting from a string. More...
 

Signals

void beginLoad (int aCount)
 This signal is emitted after calling setItemsCount(int). More...
 
void beginPrint (int aCount)
 This signal is emitted when printing begins. More...
 
void endLoad (int aCount)
 This signal is emitted when loading has completed. More...
 
void endPrint (int aCount)
 This signal is emitted when printing has completed. More...
 
void itemsLoaded (int aCount)
 This signal is emitted after calling setLoadedItems(int). More...
 
void pagesAdded (int aCount)
 This signal is emitted after a new page is added while loading the report. More...
 
void pagesPrinted (int aCount)
 This signal is emitted when a page is completed while printing the report. More...
 
void percentLoaded (int aPercent)
 This signal is emitted after calling setLoadedItems(int). More...
 
- Signals inherited from BpsPropertyObject
void childInserted (int aIndex, BpsPropertyObject *aChild)
 This signal is emitted when a new child is inserted. More...
 
void childMoved (int aOldIndex, int aNewIndex)
 This signal is emitted when a child is moved. More...
 
void childRemoved (int aIndex, BpsPropertyObject *aChild)
 This signal is emitted when a child is removed. More...
 
void modifiedChanged (bool aModified)
 This signal is emitted when the modification status is changed. More...
 
void objectChanged ()
 This signal is emitted whenever anything in the object or any of its descendants (children, grandchildren, ...) is changed. More...
 
void propertyChanged (const QByteArray &aName, const QVariant &aNewValue, const QVariant &aOldValue)
 This signal is emitted whenever a property changes, or after emitValues(). More...
 

Public Member Functions

 BpsReport (const BpsReportElement &aReportElement, QObject *aParent=nullptr)
 Constructor using the properties of an existing report element. More...
 
 BpsReport (QObject *aParent=nullptr)
 Default constructor. More...
 
BpsScriptEngineengine ()
 Get the engine used to process the report script. More...
 
void execute ()
 Execute the report script. More...
 
void load (BpsDatastore *aDatastore, const QString &aPath)
 Loads a report from database when the path name is known. More...
 
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. More...
 
void load (const QString &aPath)
 Loads a report from file. More...
 
- Public Member Functions inherited from BpsReportElement
 BpsReportElement (const BpsReportElement &aElement, QObject *aParent=nullptr, bool aCopyChilds=true)
 Copy-constructor for BpsReportElement. More...
 
 BpsReportElement (Type aType, QObject *aParent=nullptr)
 Constructor for BpsReportElement. More...
 
BpsReportElementchildElement (const QString &aName) const
 Get the named child element. More...
 
QGraphicsItemcreateGraphicsItem (int aResolution, const QPointF &aOffset) const
 Creates a graphics item for external use. More...
 
BpsReportElementfirstChild () const
 Get first child element. More...
 
QGraphicsItemgraphicsItem () const
 Get a pointer to the internal graphics item. More...
 
QLineF handleLine () const
 Get the line where the handles should be placed on for single selection. More...
 
QRectF handleRect () const
 Get the rectangle where the sizing handles should be placed on. More...
 
void insertChild (int aIndex, BpsReportElement *aChild)
 Insert a child at the specified position in the list. More...
 
BpsReportElementlastChild () const
 Get last child element. More...
 
QPointF offset () const
 Get the current drawing offset. More...
 
BpsReportElementparentElement () const
 Get the parent element. More...
 
int resolution () const
 Get current drawing resolution. More...
 
void setOffset (const QPointF &aOffset)
 Set the drawing offset in millimeters. More...
 
void setResolution (int aResolution)
 Sets the resolution as number of points per inch. More...
 
Type type () const
 
Type typeByName (const QString &aTypeName) const
 
QString typeName () const
 
- Public Member Functions inherited from BpsPropertyObject
void addAttribute (const char *aProperty, const char *aAttribute, const QVariant &aValue=true)
 Adds or remove an attribute to/from an existing property. More...
 
void addProperty (const char *aName, const QVariant &aValue)
 Add or remove a property. More...
 
void appendChild (BpsPropertyObject *aChild)
 Appends a child to the end of the children list. More...
 
QVariant attribute (const char *aProperty, const char *aAttribute) const
 Get the attributes value. More...
 
QList< QByteArrayattributeNames (const char *aProperty) const
 Get a list of all attributes defined for a certain property. More...
 
 BpsPropertyObject (const BpsPropertyObject &aOther)
 Copy-constructor for BpsPropertyObject. More...
 
 BpsPropertyObject (const QString &aName, QObject *aParent=nullptr)
 Constructor for BpsPropertyObject. More...
 
 BpsPropertyObject (QObject *aParent=nullptr)
 Constructor for BpsPropertyObject. More...
 
BpsPropertyObjectchildAt (int aIndex) const
 Get pointer to indexed child element. More...
 
int childCount () const
 
int childIndex (BpsPropertyObject *aChild) const
 Get index of a child. More...
 
QList< BpsPropertyObject * > children () const
 
void clear ()
 Removes all dynamic properties and deletes all children. More...
 
void emitValues ()
 Emits valueChanged() for all properties.
 
bool hasProperty (const char *aName) const
 Check if a property with given name has been added by BpsPropertyObject::addProperty(). More...
 
void insertChild (int aIndex, BpsPropertyObject *aChild)
 Insert a child at the specified position in the children list. More...
 
bool isModified () const
 
bool isValid (BpsPropertyObject *aObject) const
 
void loadXml (const QString &aDocType, const QString &aXml)
 Load the object from XML. More...
 
QString makeXml (const QString &aDocType, bool aFormat=false) const
 Creates XML to save the object and its children. More...
 
void moveChild (int aOldIndex, int aNewIndex)
 Move a child in the list. More...
 
BpsPropertyObjectoperator= (const BpsPropertyObject &aOther)
 Assignment operator. More...
 
BpsPropertyObjectparent () const
 Get the parent of this object. More...
 
QString propertyAsString (const char *aName) const
 Gets a string representation of the value. More...
 
BpsPropertyObjectremoveChild (BpsPropertyObject *aChild)
 Remove a child. More...
 
BpsPropertyObjectremoveChild (int aIndex)
 Remove a child. More...
 
- Public Member Functions inherited from QObject
bool blockSignals (bool block)
 
const QObjectListchildren () const const
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectInfo ()
 
void dumpObjectInfo () const const
 
void dumpObjectTree ()
 
void dumpObjectTree () const const
 
QList< QByteArraydynamicPropertyNames () const const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegExp &regExp, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
bool inherits (const char *className) const const
 
void installEventFilter (QObject *filterObj)
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const const
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
QVariant property (const char *name) const const
 
 Q_CLASSINFO (Name, Value)
 
 Q_DISABLE_COPY (Class)
 
 Q_DISABLE_COPY_MOVE (Class)
 
 Q_DISABLE_MOVE (Class)
 
 Q_EMIT Q_EMIT
 
 Q_ENUM (...)
 
 Q_ENUM_NS (...)
 
 Q_ENUMS (...)
 
 Q_FLAG (...)
 
 Q_FLAG_NS (...)
 
 Q_FLAGS (...)
 
 Q_GADGET Q_GADGET
 
 Q_INTERFACES (...)
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_NAMESPACE Q_NAMESPACE
 
 Q_NAMESPACE_EXPORT (EXPORT_MACRO)
 
 Q_OBJECT Q_OBJECT
 
 Q_PROPERTY (...)
 
 Q_REVISION Q_REVISION
 
 Q_SET_OBJECT_NAME (Object)
 
 Q_SIGNAL Q_SIGNAL
 
 Q_SIGNALS Q_SIGNALS
 
 Q_SLOT Q_SLOT
 
 Q_SLOTS Q_SLOTS
 
qFindChild (const QObject *obj, const QString &name)
 
QList< T > qFindChildren (const QObject *obj, const QRegExp &regExp)
 
QList< T > qFindChildren (const QObject *obj, const QString &name)
 
 QObject (QObject *parent)
 
qobject_cast (const QObject *object)
 
qobject_cast (QObject *object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const const
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds time, Qt::TimerType timerType)
 
QThreadthread () const const
 

Protected Member Functions

void scriptDebug (const QString &aLine) const
 Write the script debug() output. More...
 
void scriptPerror (const QString &aLine) const
 Write the script perror() output. More...
 
void scriptPrint (const QString &aLine) const
 Write the script print() output. More...
 
- Protected Member Functions inherited from BpsReportElement
virtual BpsPropertyObjectxmlCreateObject (const QString &aTagName, int aLevel) const
 Create a new object while processing loadXml(). More...
 
virtual QString xmlTagName (int aLevel) const
 Define a XML tag for the element of the level. More...
 
- Protected Member Functions inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
int receivers (const char *signal) const const
 
QObjectsender () const const
 
int senderSignalIndex () const const
 
virtual void timerEvent (QTimerEvent *event)
 

Additional Inherited Members

- Public Types inherited from BpsReportElement
enum  Type { TypeUnknown , TypeReport , TypeSection , TypeSimpletext , TypeRichtext , TypeLine , TypeRectangle , TypeEllipse , TypeBarcode , TypePixmap }
 Element type enumeration. More...
 
- Static Public Member Functions inherited from QObject
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
- Public Attributes inherited from QObject
typedef QObjectList
 
- Properties inherited from QObject
 objectName
 

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() [1/2]

BpsReport::BpsReport ( QObject aParent = nullptr)

Default constructor.

Parameters
aParentThe parent widget.

◆ BpsReport() [2/2]

BpsReport::BpsReport ( const BpsReportElement aReportElement,
QObject aParent = nullptr 
)

Constructor using the properties of an existing report element.

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

Member Function Documentation

◆ addPage

BpsReportPage* BpsReport::addPage ( )
slot

Adds a new page to the report.

Returns
Returns pointer to the new page.

◆ beginLoad

void BpsReport::beginLoad ( int  aCount)
signal

This signal is emitted after calling setItemsCount(int).

Parameters
aCountThe estimated number of items to load.

◆ beginPrint

void BpsReport::beginPrint ( int  aCount)
signal

This signal is emitted when printing begins.

Parameters
aCountThe number of pages to print.

◆ createSection

BpsReportSection* BpsReport::createSection ( const QString aName)
slot

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

Parameters
aNameName of the section element cloned.
Returns
Returns pointer to the cloned section.
Exceptions
BpsExceptionWhen no section element with this name is found.

◆ endLoad

void BpsReport::endLoad ( int  aCount)
signal

This signal is emitted when loading has completed.

Parameters
aCountThe number of items loaded.

◆ endPrint

void BpsReport::endPrint ( int  aCount)
signal

This signal is emitted when printing has completed.

Parameters
aCountThe number of pages printed.

◆ engine()

BpsScriptEngine* BpsReport::engine ( )

Get the engine used to process the report script.

Returns
Pointer to the script engine.

◆ execute()

void BpsReport::execute ( )

Execute the report script.

Exceptions
BpsExceptionThrown when execution fails for any reason

◆ itemsLoaded

void BpsReport::itemsLoaded ( int  aCount)
signal

This signal is emitted after calling setLoadedItems(int).

Parameters
aCountThe items processed.

◆ load() [1/3]

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
aDatastoreThe database to load from.
aPathThe database path of the report.
Exceptions
BpsExceptionThrown when loading fails for any reason

◆ load() [2/3]

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
aDatastoreThe database to load from.
aKeyThe database key from t_reports.c_key.
Exceptions
BpsExceptionThrown when loading fails for any reason

◆ load() [3/3]

void BpsReport::load ( const QString aPath)

Loads a report from file.

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

Parameters
aPathThe file system path of the report.
Exceptions
BpsExceptionThrown when loading fails for any reason

◆ pageAt

BpsReportPage* BpsReport::pageAt ( int  aIndex) const
slot

Get the page at a certain index position.

Parameters
aIndexThe index position 0 ... pageCount()-1
Returns
Returns page pointer.
Exceptions
BpsExceptionThrown when index is invalid.

◆ pageCount

int BpsReport::pageCount ( ) const
slot

Get the number of pages in the report.

Returns
Number of pages.

◆ pagesAdded

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
aCountThe number of pages added.

◆ pagesPrinted

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
aCountThe number of pages printed.

◆ percentLoaded

void BpsReport::percentLoaded ( int  aPercent)
signal

This signal is emitted after calling setLoadedItems(int).

Parameters
aPercentThe items processed, calculated to percent.

◆ print

void BpsReport::print ( QPrinter *  aPrinter)
slot

Print the report.

Parameters
aPrinterThis printer object to print on.

◆ printedPages

int BpsReport::printedPages ( QPrinter *  aPrinter,
int &  aFirstPage = *new int,
int &  aLastPage = *new int 
) const
slot

Get the number and range of printed pages.

Parameters
aPrinterThe printer object, after settings were made by user in QPrintDialog.
aFirstPageThe first page number printed.
aLastPageThe last page number printed.
Returns
The number of pages to print.

◆ printHeight

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.

◆ scriptDebug()

void BpsReport::scriptDebug ( const QString aLine) const
protected

Write the script debug() output.

The default implementation sends the string using qDebug.

Parameters
aLineThe line to write.

◆ scriptPerror()

void BpsReport::scriptPerror ( const QString aLine) const
protected

Write the script perror() output.

The default implementation sends the string using qDebug.

Parameters
aLineThe line to write.

◆ scriptPrint()

void BpsReport::scriptPrint ( const QString aLine) const
protected

Write the script print() output.

The default implementation sends the string using qDebug.

Parameters
aLineThe line to write.

◆ setItemsCount

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
aCountThe total number of items to process.

◆ setLoadedItems

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
aCountThe number of items loaded.

◆ setPrinterDefaults

void BpsReport::setPrinterDefaults ( QPrinter *  aPrinter)
slot

Setup the defaults for the printer.

Parameters
aPrinterThe printer to setup.

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