Some additional datasource management functions have been added

This commit is contained in:
Arin Alexander 2019-01-31 22:30:41 +03:00
parent 75878b97a9
commit 22dd686470
2 changed files with 28 additions and 0 deletions

View File

@ -1797,12 +1797,28 @@ QObject* ComboBoxWrapperCreator::createWrapper(QObject *item)
return 0;
}
bool DatasourceFunctions::first(const QString& datasourceName)
{
if (m_dataManager && m_dataManager->dataSource(datasourceName)){
m_dataManager->dataSource(datasourceName)->first();
return true;
}
return false;
}
bool DatasourceFunctions::next(const QString &datasourceName){
if (m_dataManager && m_dataManager->dataSource(datasourceName))
return m_dataManager->dataSource(datasourceName)->next();
return false;
}
bool DatasourceFunctions::prior(const QString& datasourceName)
{
if (m_dataManager && m_dataManager->dataSource(datasourceName))
return m_dataManager->dataSource(datasourceName)->prior();
return false;
}
bool DatasourceFunctions::isEOF(const QString &datasourceName)
{
if (m_dataManager && m_dataManager->dataSource(datasourceName))
@ -1810,6 +1826,14 @@ bool DatasourceFunctions::isEOF(const QString &datasourceName)
return false;
}
bool DatasourceFunctions::invalidate(const QString& datasourceName)
{
if (m_dataManager && m_dataManager->dataSource(datasourceName)){
m_dataManager->dataSourceHolder(datasourceName)->invalidate(IDataSource::DatasourceMode::RENDER_MODE);
return true;
}
return false;
}
#ifndef USE_QJSENGINE
void ComboBoxPrototype::addItem(const QString &text)

View File

@ -302,8 +302,12 @@ class DatasourceFunctions : public QObject{
Q_OBJECT
public:
explicit DatasourceFunctions(IDataSourceManager* dataManager): m_dataManager(dataManager){}
Q_INVOKABLE bool first(const QString& datasourceName);
Q_INVOKABLE bool next(const QString& datasourceName);
Q_INVOKABLE bool prior(const QString& datasourceName);
Q_INVOKABLE bool isEOF(const QString& datasourceName);
Q_INVOKABLE bool invalidate(const QString& datasourceName);
private:
IDataSourceManager* m_dataManager;
};