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
 
}
相关推荐
瑞雪兆丰年兮42 分钟前
JavaWeb-day14-SpringBootWeb原理篇
java·开发语言·spring boot·spring·bean·mybatis·javaweb
SomeOtherTime2 小时前
Rust生命周期介绍(AI回答)
开发语言·后端·rust
程序猿打工仔2 小时前
计算机基础(C语言)考编、专技岗
c语言·开发语言·算法
喵本喵叁肆3 小时前
Rényi 差分隐私:把隐私损失看成一族矩(英文原题:Rényi Differential Privacy (CSF 2017))
开发语言·r语言
Hvitur4 小时前
Java - Lambda
java·开发语言·python
xiaoye-duck4 小时前
《C++ 项目:手写大模型接入 SDK》DataManager数据管理模块:SQLite持久化存储
开发语言·数据库·c++·sqlite
Evand J4 小时前
【MATLAB例程,PMSM19】永磁同步电机(PMSM)基于多速率无迹卡尔曼滤波(UKF)的转速与转子位置估计。测量缺失、状态预测与恢复性能分析
开发语言·matlab·电机·ekf·卡尔曼·电机滤波
喵了几个咪4 小时前
GoWind Flow 拆解:一个 Go 工作流引擎与它的双模式设计器
开发语言·人工智能·后端·golang
꧁细听勿语情꧂4 小时前
二叉树余题,排序、直接插入排序、希尔排序
c语言·开发语言·数据结构·算法
是main不是漫5 小时前
【C++——类和对象(上)】筑基篇:以封装奠定面向对象之基
c语言·开发语言·c++