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
 
}
相关推荐
学逆向的6 小时前
C 堆区内存管理
c语言·开发语言·网络安全
huoyueyi7 小时前
《融天AI-APP从0到1开发实录》
开发语言·lua
OpenAnolis小助手8 小时前
PHP 两个严重漏洞曝光,龙蜥社区 24 小时完成 3 版本修复
开发语言·操作系统·php·龙蜥社区
阿尼卡~9 小时前
VS Code 配置 C 语言开发环境(Windows 10/11):从 GCC 安装到运行、断点调试,一篇搞定
c语言·开发语言·windows
hhhjhl10 小时前
Undici 跨端三方库仓颉适配全流程
java·开发语言·ubuntu
染指111010 小时前
158.Agent-LangGraph-子图(共享状态和不共享状态模式)
开发语言·人工智能·python·ui·agent·agents
wangchunyu11410 小时前
JAVA JVM内存结构与运行时数据区
java·开发语言·jvm
slongzhang_11 小时前
linux 递归删除源码文件|递归删除目录下 *.js,但排除 *.min.js
linux·开发语言·javascript
云和数据.ChenGuang12 小时前
Python 常见特殊方法详解:__new__、__init__、__del__、__str__、__repr__ 与 __getattribute__
开发语言·人工智能·python·1024程序员节
xyouyuweizhu12 小时前
字节流与字符流:Java IO 的两条主线该怎么选
java·开发语言·python