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
 
}
相关推荐
cch89187 小时前
PHP五大后台框架横向对比
开发语言·php
天真萌泪7 小时前
JS逆向自用
开发语言·javascript·ecmascript
野生技术架构师7 小时前
一线大厂Java面试八股文全栈通关手册(含源码级详解)
java·开发语言·面试
Q一件事8 小时前
R语言制图-相关性及关系网络图
开发语言·r语言
坊钰8 小时前
Java 死锁问题及其解决方案
java·开发语言·数据库
地下核武8 小时前
Ubuntu 24.04 在线安装 Qt 6.10.2 后 Qt Creator 无法启动问题记录与解决
linux·qt·ubuntu
551只玄猫9 小时前
【数学建模 matlab 实验报告1】
开发语言·数学建模·matlab·课程设计·实验报告
史蒂芬_丁9 小时前
Qt, C++数据类型扩展问题
数据库·c++·qt
三道渊10 小时前
C语言:文件I/O
c语言·开发语言·数据结构·c++
hnlgzb10 小时前
安卓app kotlin语法,Hilt是什么东西?
android·开发语言·kotlin