mirror of
https://github.com/python-LimeReport/LimeReport.git
synced 2025-10-09 05:57:15 +03:00
Merge branch '1.4' into 1.4_QJSEngine
# Conflicts: # limereport/lritemdesignintf.cpp # limereport/lrreportrender.cpp # limereport/lrscriptenginemanager.cpp
This commit is contained in:
@@ -33,8 +33,8 @@
|
||||
#include <QMessageBox>
|
||||
#include <QtSql/QSqlQuery>
|
||||
#include <QtSql/QSqlRecord>
|
||||
#include "lrreportengine.h"
|
||||
#include "lrcallbackdatasourceintf.h"
|
||||
#include <LimeReport>
|
||||
#include <LRCallbackDS>
|
||||
#include <QDebug>
|
||||
#include <QStringListModel>
|
||||
|
||||
@@ -76,14 +76,16 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
this, SLOT(slotGetCallbackData(LimeReport::CallbackInfo,QVariant&)));
|
||||
connect(callbackDatasource, SIGNAL(changePos(const LimeReport::CallbackInfo::ChangePosType&,bool&)),
|
||||
this, SLOT(slotChangePos(const LimeReport::CallbackInfo::ChangePosType&,bool&)));
|
||||
//report->dataManager()->addCallbackDatasource(callbackDatasource,"master");
|
||||
|
||||
callbackDatasource = report->dataManager()->createCallbackDatasouce("detail");
|
||||
connect(callbackDatasource, SIGNAL(getCallbackData(LimeReport::CallbackInfo,QVariant&)),
|
||||
this, SLOT(slotGetCallbackChildData(LimeReport::CallbackInfo,QVariant&)));
|
||||
connect(callbackDatasource, SIGNAL(changePos(const LimeReport::CallbackInfo::ChangePosType&,bool&)),
|
||||
this, SLOT(slotChangeChildPos(const LimeReport::CallbackInfo::ChangePosType&,bool&)));
|
||||
//report->dataManager()->addCallbackDatasource(callbackDatasource,"detail");
|
||||
|
||||
callbackDatasource = report->dataManager()->createCallbackDatasouce("oneSlotDS");
|
||||
connect(callbackDatasource, SIGNAL(getCallbackData(LimeReport::CallbackInfo,QVariant&)),
|
||||
this, SLOT(slotOneSlotDS(LimeReport::CallbackInfo,QVariant&)));
|
||||
|
||||
QStringList simpleData;
|
||||
simpleData << "value1" << "value2" << "value3";
|
||||
@@ -102,6 +104,8 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
delete ui;
|
||||
delete m_customers;
|
||||
delete m_orders;
|
||||
}
|
||||
|
||||
void MainWindow::on_pushButton_clicked()
|
||||
@@ -208,3 +212,32 @@ void MainWindow::slotChangeChildPos(const LimeReport::CallbackInfo::ChangePosTyp
|
||||
if (type == LimeReport::CallbackInfo::First) result = ds->first();
|
||||
else result = ds->next();
|
||||
}
|
||||
|
||||
void MainWindow::slotOneSlotDS(LimeReport::CallbackInfo info, QVariant &data)
|
||||
{
|
||||
QStringList columns;
|
||||
columns << "Name" << "Value" << "Image";
|
||||
switch (info.dataType) {
|
||||
case LimeReport::CallbackInfo::RowCount:
|
||||
data = 4;
|
||||
break;
|
||||
case LimeReport::CallbackInfo::ColumnCount:
|
||||
data = columns.size();
|
||||
break;
|
||||
// case LimeReport::CallbackInfo::IsEmpty:
|
||||
// data = false;
|
||||
// break;
|
||||
case LimeReport::CallbackInfo::ColumnHeaderData: {
|
||||
data = columns.at(info.index);
|
||||
break;
|
||||
}
|
||||
case LimeReport::CallbackInfo::ColumnData:
|
||||
if (info.columnName == "Image")
|
||||
data = QImage(":/report//images/logo32");
|
||||
else {
|
||||
data = info.columnName+" "+QString::number(info.index);
|
||||
}
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user