Callback interface has been simplified

From now on if slot getCallbackData(const LimeReport::CallbackInfo& info, QVariant& data) returns row count then there is no more need to implement second slot changePos(const LimeReport::CallbackInfo::ChangePosType& type, bool& result);
This commit is contained in:
Arin Alexander
2016-03-27 10:40:13 +03:00
parent 517bf8357e
commit 9d9f1f4d98
5 changed files with 92 additions and 36 deletions

View File

@@ -91,6 +91,10 @@ MainWindow::MainWindow(QWidget *parent) :
stringListModel->setStringList(simpleData);
report->dataManager()->addModel("string_list",stringListModel,true);
QStringList strList;
strList<<"value1"<<"value2";
QScriptValue value = qScriptValueFromSequence(report->scriptManager()->scriptEngine(),strList);
report->scriptManager()->scriptEngine()->globalObject().setProperty("test_list",value);
}
@@ -152,6 +156,9 @@ void MainWindow::renderFinished()
void MainWindow::prepareData(QSqlQuery* ds, LimeReport::CallbackInfo info, QVariant &data)
{
switch (info.dataType) {
case LimeReport::CallbackInfo::ColumnCount:
data = ds->record().count();
break;
case LimeReport::CallbackInfo::IsEmpty:
data = !ds->first();
break;