docs.kde.org
Using Kugar classes for reporting
Prev
Next

Using Kugar classes for reporting

The Kugar library includes two widgets for use.

The KReportViewer class is designed for KDE developers. It supports a KDE printing system and UNIX® localization via i18n() calls.

The MReportViewer class is designed for Qt™ developers and provides real crossplatforming. It can be used not only on UNIX® platforms, but also on Windows® and Mac® OS.

In order to build a program that uses the Kugar library, it should be linked with libkugar.so shared library, which is provided with the Kugar distribution on all UNIX® platforms.

Include files are kugarqt.h and kugar.h for Qt™ and KDE programs respectively.

For a detailed example of how Kugar classes can be used, look in the /shell folder in the Kugar sources.

MReportViewer (and KReportViewer too) contains several public methods that can be used.

void renderReport();

Renders the report onto a screen.

void printReport();

Calls the print dialog to print the report.

void clearReport();

Clears the report on a screen and frees report data.
Call this before opening the new report.
bool setReportData(data_file_name); 
const QString & data_file_name;
Sets report data from data_file_name file.
bool setReportData(data_io_device); 
const QIODevice & data_io_device;
Sets report data from data_io_device file.
IO device can be any successor of the QIODevice class.
For example, to fetch records directly from the database,
create a QIODevice successor and redefine all necessary
functionality.
bool setReportTemplate(template_file_name); 
const QString & template_file_name;
Sets report template from template_file_name file.
bool setReportTemplate(template_io_device); 
const QIODevice & template_io_device;
Sets report template from template_io_device file.
IO device can be any successor of the QIODevice class.
For example, to obtain a report template from network storage or database,
create a QIODevice successor and redefine all necessary functionality.
Prev
Next
Home


docs.kde.org