I've been experimenting with the Crystal Reports COM engine and I've
almost succeeded in creating a small Qt4 app that uses the COM object.
I'm running into a problem using ActiveX widgets along with COM modules.
The following snippet shows the code to connect the two:
// Create a CR10 application component
crApp = new QAxObject( (QObject *)0);
crApp->setControl("CrystalRuntime.Application");
// trap exceptions
connect(crApp, SIGNAL(exception(int, const QString &, const QString &,
const QString &)), this, SLOT(exception(int, const QString &, const
QString &, const QString &)));
// Create a CR10 report component
crReport = crApp->querySubObject("OpenReport(QString, QVariant)",
"D://mcmain//smc2007//Data//wokosten.rpt", 0);
// trap exceptions
connect(crReport, SIGNAL(exception(int, const QString &, const QString
&, const QString &)), this, SLOT(exception(int, const QString &, const
QString &, const QString &)));
// Use a Ax widget from the designer file (set to CR10 ActiveX viewer)
// trap exceptions
connect(ui.axWidget, SIGNAL(exception(int, const QString &, const
QString &, const QString &)), this, SLOT(exception(int, const QString &,
const QString &, const QString &)));
// link widget source to report component
ui.axWidget->dynamicCall("SetReportSource(IUnknown*)", crReport-
>asVariant());
// view report output
ui.axWidget->dynamicCall("ViewReport()");
crystal reporter along with QT
最新推荐文章于 2022-02-16 09:56:18 发布