BPS C++ API  2.24.4
BpsReportElement Class Reference

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

#include <bpsreportelement.h>

+ Inheritance diagram for BpsReportElement:

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. 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...
 

Public Member Functions

 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

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

- 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...
 
- 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

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 [1]QStringyesnononononononono
autogrowboolnoyesnonononononono
barcodetypeBpsGraphicsBarcodeItem::BarcodeTypenononononononoyesno
brushQBrushnonoyesyesnoyesyesnono
colorQColornonoyesyesnononoyesno
datastore [1]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
rawcodec [2]QStringyesnononononononono
rawdata [2]QStringyesnononononononono
rotationBps::Rotationnonononononononoyes
roundedboolnonononoyesnononono
roundnessint (0% - 100%)nonoyesyesnoyesnonono
scriptQStringyesnononononononono
selections [1]QMap<QString,QVariantList>yesnononononononono
sid [1]QStringyesnononononononono
sizeQSizeFnonoyesnonoyesyesyesyes
sizingBpsGraphicsPixmapItem::Sizingnonononononononoyes
spanAngleqreal (degree)nonononononoyesnono
startAngleqreal (degree)nonononononoyesnono
textQStringnonoyesyesnononoyesno
textprintedboolnononononononoyesno
title [1]QStringyesnononononononono
usedselectionsQStringyesnononononononono
widthqreal (mm)nononoyesnonononono
zvalueintnonoyesyesyesyesyesyesyes

[1] 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.

[2] Used to write directly to the printer, instead of preparing GDI content:

  • Rawdata is the data to send to the printer.
  • Rawcodec is the name of the codec used to encode the data. Default is ISO 8859-1 (Latin1). See QTextCodec for full list of available codecs. Example: "IBM 850".

Member Enumeration Documentation

◆ Type

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

BpsReportElement::BpsReportElement ( Type  aType,
QObject aParent = nullptr 
)

Constructor for BpsReportElement.

Parameters
aTypeThe element type.
aParentThe parent widget.

◆ BpsReportElement() [2/2]

BpsReportElement::BpsReportElement ( const BpsReportElement aElement,
QObject aParent = nullptr,
bool  aCopyChilds = true 
)

Copy-constructor for BpsReportElement.

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

Member Function Documentation

◆ childElement()

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

Get the named child element.

Parameters
aNameThe name of the element.
Returns
The parent element, or 0 if there is none.
Exceptions
BpsExceptionThrown when no such child element is found.

◆ createGraphicsItem()

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
aResolutionResolution to scale to.
aOffsetThe drawing offset, added to the items normal position.
Returns
Pointer to a new graphics item (not owned by the element).

◆ firstChild()

BpsReportElement* BpsReportElement::firstChild ( ) const

Get first child element.

Returns
Returns pointer to first child, or 0 if there is none.

◆ graphicsItem()

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.

◆ handleLine()

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.

◆ handleRect()

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.

◆ insertChild()

void BpsReportElement::insertChild ( int  aIndex,
BpsReportElement aChild 
)

Insert a child at the specified position in the list.

Parameters
aIndexThe position to insert at.
aChildPointer to the child to be inserted.

◆ lastChild()

BpsReportElement* BpsReportElement::lastChild ( ) const

Get last child element.

Returns
Returns pointer to last child, or 0 if there is none.

◆ offset()

QPointF BpsReportElement::offset ( ) const

Get the current drawing offset.

Returns
Returns the drawing offset in mm.

◆ parentElement()

BpsReportElement* BpsReportElement::parentElement ( ) const

Get the parent element.

Returns
The parent element, or 0 if there is none.

◆ resolution()

int BpsReportElement::resolution ( ) const

Get current drawing resolution.

Returns
Returns the current drawing resolution.

◆ setOffset()

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
aOffsetThe new drawing offset.

◆ setProperty

virtual bool BpsReportElement::setProperty ( const char *  aName,
const QVariant aValue 
)
virtualslot

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
aNameName of the property.
aValueThe new value.
Returns
True if the value was modified.

◆ setResolution()

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
aResolutionThe new resolution to set. Must be >= 1.
Exceptions
BpsExceptionThrown when setting a resolution < 1.

◆ type()

Type BpsReportElement::type ( ) const
Returns
The type of the current element.

◆ typeByName()

Type BpsReportElement::typeByName ( const QString aTypeName) const
Parameters
aTypeNameThe type name.
Returns
Get type of the current element by the name.

◆ typeName()

QString BpsReportElement::typeName ( ) const
Returns
The tag name of the current element type.

◆ xmlCreateObject()

virtual BpsPropertyObject* BpsReportElement::xmlCreateObject ( const QString aTagName,
int  aLevel 
) const
protectedvirtual

Create a new object while processing loadXml().

Parameters
aTagNameTag name of the element to be created.
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.

◆ xmlTagName()

virtual QString BpsReportElement::xmlTagName ( int  aLevel) const
protectedvirtual

Define a XML tag for the element of the level.

Parameters
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: