mirror of
https://github.com/python-LimeReport/LimeReport.git
synced 2024-12-23 20:22:58 +03:00
OneSlotDS has been added to demo_r1
This commit is contained in:
parent
bca1019803
commit
6d31f20566
@ -76,14 +76,16 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
this, SLOT(slotGetCallbackData(LimeReport::CallbackInfo,QVariant&)));
|
this, SLOT(slotGetCallbackData(LimeReport::CallbackInfo,QVariant&)));
|
||||||
connect(callbackDatasource, SIGNAL(changePos(const LimeReport::CallbackInfo::ChangePosType&,bool&)),
|
connect(callbackDatasource, SIGNAL(changePos(const LimeReport::CallbackInfo::ChangePosType&,bool&)),
|
||||||
this, SLOT(slotChangePos(const LimeReport::CallbackInfo::ChangePosType&,bool&)));
|
this, SLOT(slotChangePos(const LimeReport::CallbackInfo::ChangePosType&,bool&)));
|
||||||
//report->dataManager()->addCallbackDatasource(callbackDatasource,"master");
|
|
||||||
|
|
||||||
callbackDatasource = report->dataManager()->createCallbackDatasouce("detail");
|
callbackDatasource = report->dataManager()->createCallbackDatasouce("detail");
|
||||||
connect(callbackDatasource, SIGNAL(getCallbackData(LimeReport::CallbackInfo,QVariant&)),
|
connect(callbackDatasource, SIGNAL(getCallbackData(LimeReport::CallbackInfo,QVariant&)),
|
||||||
this, SLOT(slotGetCallbackChildData(LimeReport::CallbackInfo,QVariant&)));
|
this, SLOT(slotGetCallbackChildData(LimeReport::CallbackInfo,QVariant&)));
|
||||||
connect(callbackDatasource, SIGNAL(changePos(const LimeReport::CallbackInfo::ChangePosType&,bool&)),
|
connect(callbackDatasource, SIGNAL(changePos(const LimeReport::CallbackInfo::ChangePosType&,bool&)),
|
||||||
this, SLOT(slotChangeChildPos(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;
|
QStringList simpleData;
|
||||||
simpleData << "value1" << "value2" << "value3";
|
simpleData << "value1" << "value2" << "value3";
|
||||||
@ -208,3 +210,32 @@ void MainWindow::slotChangeChildPos(const LimeReport::CallbackInfo::ChangePosTyp
|
|||||||
if (type == LimeReport::CallbackInfo::First) result = ds->first();
|
if (type == LimeReport::CallbackInfo::First) result = ds->first();
|
||||||
else result = ds->next();
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -57,6 +57,7 @@ private slots:
|
|||||||
void slotChangePos(const LimeReport::CallbackInfo::ChangePosType& type, bool& result);
|
void slotChangePos(const LimeReport::CallbackInfo::ChangePosType& type, bool& result);
|
||||||
void slotGetCallbackChildData(LimeReport::CallbackInfo info, QVariant& data);
|
void slotGetCallbackChildData(LimeReport::CallbackInfo info, QVariant& data);
|
||||||
void slotChangeChildPos(const LimeReport::CallbackInfo::ChangePosType& type, bool& result);
|
void slotChangeChildPos(const LimeReport::CallbackInfo::ChangePosType& type, bool& result);
|
||||||
|
void slotOneSlotDS(LimeReport::CallbackInfo info, QVariant& data);
|
||||||
private:
|
private:
|
||||||
void prepareData(QSqlQuery* ds, LimeReport::CallbackInfo info, QVariant &data);
|
void prepareData(QSqlQuery* ds, LimeReport::CallbackInfo info, QVariant &data);
|
||||||
private:
|
private:
|
||||||
|
Loading…
Reference in New Issue
Block a user