0
0
mirror of https://github.com/fralx/LimeReport.git synced 2025-09-23 16:39:07 +03:00

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

@@ -366,7 +366,7 @@ private:
class CallbackDatasource :public ICallbackDatasource, public IDataSource {
Q_OBJECT
public:
CallbackDatasource(): m_currentRow(-1), m_eof(false){}
CallbackDatasource(): m_currentRow(-1), m_eof(false), m_columnCount(-1), m_rowCount(-1){}
bool next();
bool hasNext(){ if (!m_eof) return checkNextRecord(m_currentRow); else return false;}
bool prior(){ if (m_currentRow !=-1) {m_currentRow--; return true;} else return false;}
@@ -382,26 +382,14 @@ public:
QString lastError(){ return "";}
QAbstractItemModel *model(){return 0;}
private:
bool checkNextRecord(int recordNum){
QVariant result = false;
CallbackInfo info;
info.dataType = CallbackInfo::HasNext;
info.index = recordNum;
emit getCallbackData(info,result);
return result.toBool();
}
bool checkIfEmpty(){
QVariant result = true;
CallbackInfo info;
info.dataType = CallbackInfo::IsEmpty;
emit getCallbackData(info,result);
//emit getIsEmpty(result);
return result.toBool();
}
bool checkNextRecord(int recordNum);
bool checkIfEmpty();
private:
QVector<QString> m_headers;
int m_currentRow;
bool m_eof;
int m_columnCount;
int m_rowCount;
};
class CallbackDatasourceHolder :public QObject, public IDataSourceHolder{