Kugar library includes two widgets for use.
KReportViewer class is designed for KDE developers. It supports a KDE printing system and UNIX® localization via i18n() calls.
MReportViewer class is designed for Qt™ developers and provide real crossplatforming. It can be used not only on UNIX® platforms. but on Windows® and Mac® too.
In order to build program that uses kugar library, it should be linked with libkugar.so shared library, that is provided with kugar distribution on all UNIX® plaforms.
Include files are kugarqt.h and kugar.h for Qt™ and KDE programs accordingly.
For a detailed example of how Kugar classes can be used, see /shell directory in the Kugar sources.
The MReportViewer (and KReportViewer too) contains several public methods that can be used.
void renderReport
();
Renders the report onto a screen.
void printReport
();
Calls 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 succesor of QIODevice class.
For example, to fetch records directly from the database,
create a QIODevice successor and redefine all nessesary
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 succesor of QIODevice class.
For example, to obtail report template from network storage or database,
create a QIODevice successor and redefine all nessesary functionality.