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 分钟前
JavaScript事件循环
开发语言·前端·javascript
驰羽3 分钟前
[GO]gin框架:ShouldBindJSON与其他常见绑定方法
开发语言·golang·gin
程序员大雄学编程9 分钟前
「用Python来学微积分」5. 曲线的极坐标方程
开发语言·python·微积分
Jose_lz1 小时前
C#开发学习杂笔(更新中)
开发语言·学习·c#
QT 小鲜肉1 小时前
【个人成长笔记】Qt 中 SkipEmptyParts 编译错误解决方案及版本兼容性指南
数据库·c++·笔记·qt·学习·学习方法
OneSea1 小时前
Debian编译Qt5
linux·qt
一位代码1 小时前
python | requests爬虫如何正确获取网页编码?
开发语言·爬虫·python
看到我,请让我去学习1 小时前
Qt 控件 QSS 样式大全(通用属性篇)
开发语言·c++·qt
筱砚.2 小时前
【STL——vector容器】
开发语言·c++
lly2024062 小时前
数据访问对象模式(Data Access Object Pattern)
开发语言