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
 
}
相关推荐
_洋2 小时前
Three.js加载 .obj文件 和 .gltf文件
开发语言·javascript·ecmascript
wjs20242 小时前
Font Awesome 性别图标
开发语言
SmartBrain2 小时前
AI全栈开发(SDD):慢病管理系统工程级设计
java·大数据·开发语言·人工智能·架构·aigc
lsx2024062 小时前
选择(Selectable)
开发语言
漠效2 小时前
随机代理‌IP访问脚本
开发语言·python
SilentSamsara2 小时前
元类与 __init_subclass__:类是如何被“创建“出来的
开发语言·python·青少年编程
小a杰.2 小时前
Ascend C算子开发实战 - 从零开始写算子
c语言·开发语言
雪度娃娃2 小时前
Asio异步读写——连接的安全回收问题
开发语言·c++·安全·php
baivfhpwxf20233 小时前
c# 中对像之间频繁的转换会慢吗?
开发语言·c#
SilentSamsara3 小时前
concurrent.futures 实战:进程池与线程池的统一抽象
运维·开发语言·python·青少年编程