QT报表Limereport v1.5.35编译及使用

1、编译说明

下载后QT CREATER中打开limereport.pro然后直接编译就可以了。编译后结果如下图:

一次编译可以得到库文件和DEMO执行程序。

2、使用说明

拷贝如下图编译后的lib目录到自己的工程目录中。 release版本的重新命名为librelease.

PRO文件中配置

QT +=printsupport

QT +=qml

同时增加

INCLUDEPATH += $$PWD/lib/include

CONFIG(debug, debug|release) {

LIBS += $$PWD/lib/liblimereportd.a

LIBS += $$PWD/lib/libQtZintd.a

}

else

{

LIBS += $$PWD/librelease/liblimereport.a

LIBS += $$PWD/librelease/libQtZint.a

}

.H文件中

cpp 复制代码
#include "lrreportengine.h"   //to add report engine
#include "lrcallbackdatasourceintf.h"   //if you want use callback datasources

.CPP文件中简单示例

cpp 复制代码
void MainWindow::on_pushButtonreport_clicked()
{
 
    QStringList simpleData;
    simpleData << "value1" << "value2" << "value3";
    QStringListModel* stringListModel = new QStringListModel();
    stringListModel->setStringList(simpleData);
 
    report = new LimeReport::ReportEngine(this);  //to create reportengine
    report->dataManager()->addModel("string_list",stringListModel,true);  //to add datasource to report engine
    report->loadFromFile("dialogDemo.lrxml");  //to load report template file
    //设计报表
    report->designReport();
    //直接打印
    //report->previewReport();  //to generate report and preview
    //report->printReport(); //to print report
 
}
相关推荐
xcyxiner12 分钟前
DicomViewer (编译以及优化)8
qt
旖-旎14 分钟前
QT界面优化(6)
开发语言·c++·qt
AI科技星15 分钟前
基于超复数广义分形流形的电磁耦合与缪子反常磁矩几何理论
开发语言·平面·重构·概率论·量子计算·乖乖数学·全域数学
组合缺一20 分钟前
用 ChatModel 构建 LLM 驱动的 Java 应用
java·开发语言·ai·llm·solon·rag
特立独行的猫a28 分钟前
为 HarmonyOS/OpenHarmony 构建第三方库的解决方案(转自Qt官方Blog)
qt·华为·harmonyos·三方库·鸿蒙pc
零点零一35 分钟前
QT 5升级到 Qt 6 使用 Clazy 检查将 C++ 应用程序移植到 Qt 6
开发语言·c++·qt
初阳78535 分钟前
【Qt】系统相关(1)——事件
qt
caimouse40 分钟前
reactos 测试安装32位微信失败的日志
开发语言·微信
爱奥尼欧44 分钟前
轻量级可扩展日志框架-异步日志与系统集成
开发语言·数据库·c++·学习
尘中远1 小时前
【Qwt 7.0 系列】高级科学图表 —— 光谱图、向量场、K线图与极坐标绘图
qt·数据可视化·qwt·工业软件·科学绘图·云图·向量场