Documents > BPS V2 C++ API

This class represents a BPS report element. More...

#include <bpsreportelement.h>

+ Inheritance diagram for BpsReportElement:

List of all members.

Public Types

enum  Type {
  TypeUnknown,
  TypeReport,
  TypeSection,
  TypeSimpletext,
  TypeRichtext,
  TypeLine,
  TypeRectangle,
  TypeEllipse,
  TypeBarcode,
  TypePixmap
}
 Element type enumeration. More...

Public Slots

virtual bool setProperty (const char *aName, const QVariant &aValue)
 Set the value of a named property.

Public Member Functions

 BpsReportElement (Type aType, QObject *aParent=0)
 Constructor for BpsReportElement.
 BpsReportElement (const BpsReportElement &aElement, QObject *aParent=0, bool aCopyChilds=true)
 Copy-constructor for BpsReportElement.
BpsReportElementchildElement (const QString &aName) const
 Get the named child element.
QGraphicsItem * createGraphicsItem (int aResolution, const QPointF &aOffset) const
 Creates a graphics item for external use.
BpsReportElementfirstChild () const
 Get first child element.
QGraphicsItem * graphicsItem () const
 Get a pointer to the internal graphics item.
QLineF handleLine () const
 Get the line where the handles should be placed on for single selection.
QRectF handleRect () const
 Get the rectangle where the sizing handles should be placed on.
void insertChild (int aIndex, BpsReportElement *aChild)
 Insert a child at the specified position in the list.
BpsReportElementlastChild () const
 Get last child element.
QPointF offset () const
 Get the current drawing offset.
BpsReportElementparentElement () const
 Get the parent element.
int resolution () const
 Get current drawing resolution.
void setOffset (const QPointF &aOffset)
 Set the drawing offset in millimeters.
void setResolution (int aResolution)
 Sets the resolution as number of points per inch.
Type type () const
Type typeByName (const QString &aTypeName) const
QString typeName () const

Protected Member Functions

virtual BpsPropertyObjectxmlCreateObject (const QString &aTagName, int aLevel) const
 Create a new object while processing loadXml().
virtual QString xmlTagName (int aLevel) const
 Define a XML tag for the element of the level.

Detailed Description

This class represents a BPS report element.

A report is represented by three layers of elements:

  • The top level is one element of TypeReport.
  • The middle layer (children of report) is a list of TypeSection.
  • The bottom level (children of section) is a list of items such as TypeText, TypeRectangle, etc.

Property Matrix:

NameType/valuesReportSectionSimpletextRichtextLineRectangleEllipseBarcodePixmap
alignmentBps::Alignmentnonoyesnononononoyes
application (*)QStringyesnononononononono
autogrowboolnoyesnonononononono
barcodetypeBpsGraphicsBarcodeItem::BarcodeTypenononononononoyesno
brushQBrushnonoyesyesnoyesyesnono
colorQColornonoyesyesnononoyesno
datastore (*)BpsDatastoreyesnononononononono
directionBps::Directionnonoyesyesnononoyesno
emptyokboolyesnononononononono
fontQFontnonoyesyesnononoyesno
heightqreal (mm)noyesnonononononono
marginsBpsMargins (mm)yesnoyesyesnonononono
moduleqreal (mm)nononononononoyesno
nameQStringyesyesyesyesyesyesyesyesyes
orientationQPrinter::Orientationyesnononononononono
p1QPointFnonononoyesnononono
p2QPointFnonononoyesnononono
paperQPrinter::Papersizeyesnononononononono
papersizeQSizeF (mm)yesnononononononono
penQPennonoyesyesyesyesyesnono
pixmapQPixmapnonononononononoyes
posQPointFnonoyesyesnoyesyesyesyes
positionBps::VerticalAlignmentnoyesnonononononono
ppiint (points per inch)nonononononononoyes
rotationBps::Rotationnonononononononoyes
roundedboolnonononoyesnononono
roundnessint (0% - 100%)nonoyesyesnoyesnonono
scriptQStringyesnononononononono
selections (*)QMap<QString,QVariantList>yesnononononononono
sid (*)QStringyesnononononononono
sizeQSizeFnonoyesnonoyesyesyesyes
sizingBpsGraphicsPixmapItem::Sizingnonononononononoyes
spanAngleqreal (degree)nonononononoyesnono
startAngleqreal (degree)nonononononoyesnono
textQStringnonoyesyesnononoyesno
textprintedboolnononononononoyesno
title (*)QStringyesnononononononono
usedselectionsQStringyesnononononononono
widthqreal (mm)nononoyesnonononono
zvalueintnonoyesyesyesyesyesyesyes

(*) Dynamically applied at runtime before executing the report script:

  • Application is a unique name per application such as "designer", "articles", "partners" or "ordertrips" for example.
  • Title is taken from the current report settings (t_reportsettings.c_title). In the report designer it is the base filename instead.
  • Selection is an object with each property name being a table name, and holding an array of keys of currently selected rows.
  • SID is unique per application and report setting, for example "ordertrips_57". It may be used as key to save and restore settings.

Member Enumeration Documentation

Element type enumeration.

Enumerator:
TypeUnknown 

The type in unknown. Used to signal errors.

TypeReport 

Report element, top level.

TypeSection 

Section element.

TypeSimpletext 

Simple text item element.

TypeRichtext 

Rich text item element.

TypeLine 

Line item element.

TypeRectangle 

Rectangle item element.

TypeEllipse 

Ellipse item element.

TypeBarcode 

Bar code item element.

TypePixmap 

Pixmap item element.


Constructor & Destructor Documentation

BpsReportElement::BpsReportElement ( Type  aType,
QObject *  aParent = 0 
)

Constructor for BpsReportElement.

Parameters:
[in]aTypeThe element type.
[in]aParentThe parent widget.
BpsReportElement::BpsReportElement ( const BpsReportElement aElement,
QObject *  aParent = 0,
bool  aCopyChilds = true 
)

Copy-constructor for BpsReportElement.

Parameters:
[in]aElementThe element to clone.
[in]aParentThe parent widget.
[in]aCopyChildsWhen true, a deep copy is performed where all children are also cloned.

Member Function Documentation

BpsReportElement* BpsReportElement::childElement ( const QString &  aName) const

Get the named child element.

Parameters:
[in]aNameThe name of the element.
Returns:
The parent element, or 0 if there is none.
Exceptions:
BpsExceptionThrown when no such child element is found.
QGraphicsItem* BpsReportElement::createGraphicsItem ( int  aResolution,
const QPointF &  aOffset 
) const

Creates a graphics item for external use.

The item will be owned by the caller, so the application is responsible for deleting the item when no longer needed. Compared to graphicsItem(), this one is static copy which will not get updated when changing the element properties.

Note:
For reports and sections a null pointer is returned.
Parameters:
[in]aResolutionResolution to scale to.
[in]aOffsetThe drawing offset, added to the items normal position.
Returns:
Pointer to a new graphics item (not owned by the element).
BpsReportElement* BpsReportElement::firstChild ( ) const

Get first child element.

Returns:
Returns pointer to first child, or 0 if there is none.
QGraphicsItem* BpsReportElement::graphicsItem ( ) const

Get a pointer to the internal graphics item.

This can be used for interactive applications like the report designer, where updating the element properties will be reflected immediately. For other uses such as printing it may be better to use createGraphicsItem() instead. The item is owned by the report element. In case you use it on a graphics scene, you have to make sure it is not getting deleted by the scenes destructor (e.g. remove it in the scene destructor).

Note:
For reports and sections a null pointer is returned.
Returns:
Pointer to QGraphicsItem for item elements.
QLineF BpsReportElement::handleLine ( ) const

Get the line where the handles should be placed on for single selection.

The values are in mm. For any other element except line, this will return a null QLineF.

Returns:
The handle line.
QRectF BpsReportElement::handleRect ( ) const

Get the rectangle where the sizing handles should be placed on.

The values are in mm.

For reports and sections a null QRectF is returned. For lines this is used to calculate the overall handle positions when multiple items are selected.

Returns:
The rectangle to place the sizing handles on.
void BpsReportElement::insertChild ( int  aIndex,
BpsReportElement aChild 
)

Insert a child at the specified position in the list.

Parameters:
[in]aIndexThe position to insert at.
[in]aChildPointer to the child to be inserted.
BpsReportElement* BpsReportElement::lastChild ( ) const

Get last child element.

Returns:
Returns pointer to last child, or 0 if there is none.
QPointF BpsReportElement::offset ( ) const

Get the current drawing offset.

Returns:
Returns the drawing offset in mm.
BpsReportElement* BpsReportElement::parentElement ( ) const

Get the parent element.

Returns:
The parent element, or 0 if there is none.
int BpsReportElement::resolution ( ) const

Get current drawing resolution.

Returns:
Returns the current drawing resolution.
void BpsReportElement::setOffset ( const QPointF &  aOffset)

Set the drawing offset in millimeters.

The default is (0,0). Setting the offset will propagate automatically to child elements.

Parameters:
[in]aOffsetThe new drawing offset.
virtual bool BpsReportElement::setProperty ( const char *  aName,
const QVariant &  aValue 
) [virtual, slot]

Set the value of a named property.

Attempts to set the value of a not existing property, or a property with the attribute readOnly are ignored.

Parameters:
[in]aNameName of the property.
[in]aValueThe new value.
Returns:
True if the value was modified.

Reimplemented from BpsPropertyObject.

void BpsReportElement::setResolution ( int  aResolution)

Sets the resolution as number of points per inch.

The default is set to the screen resolution. Setting the resolution will propagate automatically to child elements.

Parameters:
[in]aResolutionThe new resolution to set. Must be >= 1.
Exceptions:
BpsExceptionThrown when setting a resolution < 1.
Type BpsReportElement::type ( ) const
Returns:
The type of the current element.
Type BpsReportElement::typeByName ( const QString &  aTypeName) const
Parameters:
[in]aTypeNameThe type name.
Returns:
Get type of the current element by the name.
QString BpsReportElement::typeName ( ) const
Returns:
The tag name of the current element type.
virtual BpsPropertyObject* BpsReportElement::xmlCreateObject ( const QString &  aTagName,
int  aLevel 
) const [protected, virtual]

Create a new object while processing loadXml().

Parameters:
[in]aTagNameTag name of the element to be created.
[in]aLevelElement level.
Returns:
A BpsPropertyObject*, or a thereof derived object. Returns 0 for unknown tag names and other levels than 1 and 2.

Reimplemented from BpsPropertyObject.

virtual QString BpsReportElement::xmlTagName ( int  aLevel) const [protected, virtual]

Define a XML tag for the element of the level.

Parameters:
[in]aLevelElement level. The top level is 0.
Returns:
The tag name of the current element.

Reimplemented from BpsPropertyObject.


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