mirror of
https://github.com/fralx/LimeReport.git
synced 2025-10-09 05:57:14 +03:00
The update of data sources was added if they contain changed variables
This commit is contained in:
@@ -228,6 +228,16 @@ DataSourceManager::DataSourceManager(QObject *parent) :
|
||||
setSystemVariable(QLatin1String("#PAGE_COUNT"),0,SecondPass);
|
||||
setSystemVariable(QLatin1String("#IS_LAST_PAGEFOOTER"),false,FirstPass);
|
||||
setSystemVariable(QLatin1String("#IS_FIRST_PAGEFOOTER"),false,FirstPass);
|
||||
|
||||
connect(&m_reportVariables, SIGNAL(variableHasBeenAdded(QString)),
|
||||
this, SLOT(slotVariableHasBeenAdded(QString)) );
|
||||
connect(&m_reportVariables, SIGNAL(variableHasBeenChanged(QString)),
|
||||
this, SLOT(slotVariableHasBeenChanged(QString)));
|
||||
connect(&m_userVariables, SIGNAL(variableHasBeenAdded(QString)),
|
||||
this, SLOT(slotVariableHasBeenAdded(QString)) );
|
||||
connect(&m_userVariables, SIGNAL(variableHasBeenChanged(QString)),
|
||||
this, SLOT(slotVariableHasBeenChanged(QString)));
|
||||
|
||||
m_datasourcesModel.setDataSourceManager(this);
|
||||
}
|
||||
|
||||
@@ -1235,6 +1245,32 @@ void DataSourceManager::slotQueryTextChanged(const QString &queryName, const QSt
|
||||
}
|
||||
}
|
||||
|
||||
void DataSourceManager::invalidateQueriesContainsVariable(const QString& variableName)
|
||||
{
|
||||
if (!variableIsSystem(variableName)){
|
||||
foreach (const QString& datasourceName, dataSourceNames()){
|
||||
QueryHolder* holder = dynamic_cast<QueryHolder*>(m_datasources.value(datasourceName));
|
||||
if (holder){
|
||||
QRegExp rx(QString(Const::NAMED_VARIABLE_RX).arg(variableName));
|
||||
if (holder->queryText().contains(rx))
|
||||
holder->invalidate(designTime()?IDataSource::DESIGN_MODE:IDataSource::RENDER_MODE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DataSourceManager::slotVariableHasBeenAdded(const QString& variableName)
|
||||
{
|
||||
//qDebug()<< "variable has been added"<< variableName;
|
||||
invalidateQueriesContainsVariable(variableName);
|
||||
}
|
||||
|
||||
void DataSourceManager::slotVariableHasBeenChanged(const QString& variableName)
|
||||
{
|
||||
//qDebug()<< "variable has been changed"<< variableName;
|
||||
invalidateQueriesContainsVariable(variableName);
|
||||
}
|
||||
|
||||
void DataSourceManager::clear(ClearMethod method)
|
||||
{
|
||||
DataSourcesMap::iterator dit;
|
||||
|
Reference in New Issue
Block a user