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
 
}
相关推荐
froginwe1111 小时前
Foundation 顶部导航栏详解
开发语言
沐知全栈开发11 小时前
MySQL 运算符详解
开发语言
java修仙传12 小时前
Java 实习日记:断面分析基态限额为空问题的排查与修复
java·开发语言·bug·实习
njsgcs12 小时前
我仓库内cad python 有哪些应用到聚类的方法
开发语言·python·聚类
web3.088899912 小时前
电商数据化运营:速卖通API+Python打造竞品监控与选品利器
开发语言·python
小小编程路12 小时前
C++ 常用逻辑运算符
开发语言·c++·算法
眷蓝天12 小时前
Prometheus介绍及监控平台部署
java·开发语言
五月君_12 小时前
Rust 重写 AI 味太浓,Bun 被 yt-dlp 封版本、Electrobun 直接解绑
开发语言·后端·rust
y = xⁿ13 小时前
JUC:锁机制/关键字
java·开发语言
legendary_16313 小时前
Type-C浪潮席卷小家电:SINK芯片如何成为快充高压的“心脏“
c语言·开发语言