QtRPT and QtRptDesigner
Main Documents History Download Announcements Customers Sourceforge WebDesigner  
Contents
QtRptName
QtRPT
RptPageObject
RptBandObject
RptFieldObject
 
QtRPT Project API
QtRPT Class | QtRptProject 2.0.0

QtRPT Class

The QtRPT class is the base class of the QtRPT. More...

Header: #include <QtRPT>

Public Functions

QtRPT(QObject * parent = 0)
~QtRPT()
void clearObject()
bool loadReport(QString fileName)
bool loadReport(QDomDocument xmlDoc)
void printExec(bool maximum = false, bool direct = false, QString printerName = QString())
void printHTML(const QString & filePath, bool open = true)
void printODT(const QString & filePath, bool open = true)
void printPDF(const QString & filePath, bool open = true)
void setBackgroundImage(QPixmap & image)
void setBackgroundImage(QPixmap image)
bool setPainter(QPainter * painter)
bool setPrinter(QPrinter * printer)
void setResolution(QPrinter::PrinterMode resolution)
void setSqlQuery(QString sqlString)

Public Slots

void printPreview(QPrinter * printer)

Signals

void newPage(int page)
void setField(RptFieldObject & fieldObject)
void setValue(const int recNo, const QString paramName, QVariant & paramValue, const int reportPage)
void setValueDiagram(Chart & chart)
void setValueImage(const int recNo, const QString paramName, QImage & paramValue, const int reportPage)

Static Public Members

QList<FieldType> getDrawingFields()
FieldType getFieldType(QDomElement e)
QString getFieldTypeName(FieldType type)
Qt::PenStyle getPenStyle(QString value)

Protected Functions

bool eventFilter(QObject * obj, QEvent * e)

Detailed Description

The QtRPT class is the base class of the QtRPT.

QtRPT is the easy-to-use print report engine written in C++ QtToolkit. It allows combining several reports in one XML file.

For separately taken field, you can specify some condition depending on which this field will display in different font and background color, etc.

Member Function Documentation

QtRPT::QtRPT(QObject * parent = 0)

Constructs a QtRPT object with the given parent.

QtRPT::~QtRPT()

Destroys the object, deleting all its child objects.

void QtRPT::clearObject()

Destroy all objects and clear the report.

[protected] bool QtRPT::eventFilter(QObject * obj, QEvent * e)

Filters events if this object has been installed as an event filter for the obj.

In your reimplementation of this function, if you want to filter the e out, i.e. stop it b

Returns value from reimplemented function.

Reimplemented from QObject::eventFilter()

[static] QList<FieldType> QtRPT::getDrawingFields()

Return the QList contains the type of fields which acts as a drawing fields. The following fields are a drawing:

  • Circle
  • Triangle
  • Rhombus
  • RoundedReactangle
  • Reactangle

[static] FieldType QtRPT::getFieldType(QDomElement e)

Return field's type of given QDomElement e which represents a field

See also getFieldTypeName().

[static] QString QtRPT::getFieldTypeName(FieldType type)

Return the field's type name for given type

See also getFieldType().

[static] Qt::PenStyle QtRPT::getPenStyle(QString value)

Convert and return Pen style of field for given value

bool QtRPT::loadReport(QString fileName)

Loads report from XML file with fileName. Returns true if loading is success

bool QtRPT::loadReport(QDomDocument xmlDoc)

This is an overloaded function.

Loads report from QDomDocument xmlDoc. Returns true if loading is success

[signal] void QtRPT::newPage(int page)

This signal is emitted when the new page generated. page is a number of new page.

void QtRPT::printExec(bool maximum = false, bool direct = false, QString printerName = QString())

Open preview of the report in maximize or fitted mode. Or you can print report without preview. To open preview in maximize mode, set maximum to true.

report->printExec(true,false);

To direct printing without preview dialog, set direct to true.

report->printExec(true,true);

If printer with the printerName is not valid, the default printer will be used.

See also printPDF(), printHTML(), and printODT().

void QtRPT::printHTML(const QString & filePath, bool open = true)

Print report direct to HTML file by filePath. Second param open indicates open or not after printing a pdf file.

See also printExec(), printPDF(), and printODT().

void QtRPT::printODT(const QString & filePath, bool open = true)

Print report direct to ODT file by filePath. Second param open indicates open or not after printing a pdf file.

Warning: This function Under construction!

See also printExec(), printHTML(), and printPDF().

void QtRPT::printPDF(const QString & filePath, bool open = true)

Print report direct to PDF file by filePath. Second param open indicates open or not after printing a pdf file.

See also printExec(), printHTML(), and printODT().

[slot] void QtRPT::printPreview(QPrinter * printer)

Starts print or draw report at printer. Commonly, the purpose of this slot is using with QPrintPreviewWidget

Example:

QPrinter *printer = new QPrinter;
printer->setOutputFormat(QPrinter::PdfFormat);
printer->setOrientation(QPrinter::Portrait);
printer->setPaperSize(QPrinter::A4);
printer->setFullPage(true);

QPrintPreviewWidget *preview = new QPrintPreviewWidget(printer, this);
connect(preview, SIGNAL(paintRequested(QPrinter*)), report, SLOT(printPreview(QPrinter*)));

void QtRPT::setBackgroundImage(QPixmap & image)

Sets background image from image

void QtRPT::setBackgroundImage(QPixmap image)

This is an overloaded function.

Sets background image from image

[signal] void QtRPT::setField( RptFieldObject & fieldObject)

This signal is emitted when QtRPT request a Field's data from user application. Pass fieldObject to user's application as a reference to requested RptFieldObject. User should set the appropriate properties of the fieldObject. This signal is emitted before following signals: setValue, setValueImage, setValueDiagram

See also setValue(), setValueImage(), setValueDiagram(), and RptFieldObject.

bool QtRPT::setPainter(QPainter * painter)

Set the painter that will be used for the report to draw. Returns true if assignment is success

bool QtRPT::setPrinter(QPrinter * printer)

Set the printer that will be used for the report to printing. Returns true if assignment is success

void QtRPT::setResolution(QPrinter::PrinterMode resolution)

Sets resolution of the printer

void QtRPT::setSqlQuery(QString sqlString)

Sets SQL query sqlString. If in XML was defiened SQL query, it will be replaced.

[signal] void QtRPT::setValue(const int recNo, const QString paramName, QVariant & paramValue, const int reportPage)

This signal is emitted when QtRPT request a Field's data from user application. And pass to the user's application the following variables

  • recNo - record number (if field placed on DataBand)
  • paramName - name of requested field
  • reportPage - number of the report

From user's applications, QtRPT expects the data in the variable paramValue, which acts as a references

  • paramValue - data, which will processed by QtRPT and printed

This signal is emitted after following signal: setField()

See also setField(), setValueImage(), and setValueDiagram().

[signal] void QtRPT::setValueDiagram(Chart & chart)

This signal is emitted when QtRPT request a Chart's data from user application. Pass chart to user's application as a reference to requested Chart object. User should set the appropriate properties of the chart. This signal is emitted after following signal: setField()

See also setField(), setValue(), and setValueImage().

[signal] void QtRPT::setValueImage(const int recNo, const QString paramName, QImage & paramValue, const int reportPage)

This signal is emitted when QtRPT request a Field's data from user application. And pass to the user's application the following variables

  • recNo - record number (if field placed on DataBand)
  • paramName - name of requested field
  • reportPage - number of the report

From user's applications, QtRPT expects the QImage in the variable paramValue, which acts as a references

  • paramValue - QImage, which will processed by QtRPT and printed

This signal is emitted after following signal: setField()

See also setField(), setValue(), and setValueDiagram().