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
 
}
相关推荐
bkspiderx3 小时前
Qt 插件机制:动态扩展应用功能的核心框架
开发语言·qt·元数据·qt 插件·qpluginloader
程序员老陆3 小时前
深入理解 C++ thread_local:线程私有存储的正确打开方式
开发语言·c++·程序设计
沐晓时光3 小时前
C语言入门,深入理解指针(3)
c语言·开发语言
码云数智-园园4 小时前
unique_ptr 还是 shared_ptr?C++ 智能指针选型与内存泄漏实战分析
java·开发语言
禾小西5 小时前
07丨Redis 哨兵机制:主库故障后,如何恢复服务?
java·开发语言·redis
我不是阵雨5 小时前
JDK 21虚拟线程Pinning陷阱:一文拔钉解困
java·开发语言
徐小黑ACG5 小时前
Golang 基础05 结构体struct
开发语言·算法·golang
优橙教育6 小时前
零基础学AI应用开发要多久?3个月能到什么水平
服务器·开发语言·网络·php
半杯咖啡半行码6 小时前
Qt开发实战:数据库、MV 模式、QProcess与串口通信全攻略
数据库·qt
SEO_juper6 小时前
用 Python 写一个 GEO 可见性检查脚本:你的网站现在能被 AI 引用吗
开发语言·人工智能·爬虫·python·seo·外贸独立站