mirror of
https://github.com/fralx/LimeReport.git
synced 2024-12-24 00:33:02 +03:00
Variables access has been fixed
This commit is contained in:
parent
019d213882
commit
f7d8a5050a
@ -45,6 +45,9 @@ QMimeData *DataBrowserTree::mimeData(const QList<QTreeWidgetItem *> items) const
|
||||
if (items.at(0)->type()==Variable){
|
||||
result->setText("variable:$V{"+items.at(0)->text(0)+"}");
|
||||
}
|
||||
if (items.at(0)->type()==ExternalVariable){
|
||||
result->setText("variable:$V{"+items.at(0)->text(0)+"}");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -208,6 +208,11 @@ void DataSourceModel::updateModel()
|
||||
foreach (QString name, m_dataManager->variableNames()){
|
||||
vars->addChild(name,DataNode::Variable,QIcon(":/report/images/value"));
|
||||
}
|
||||
|
||||
vars = m_rootNode->addChild(tr("External variables"),DataNode::Variables,QIcon(":/report/images/folder"));
|
||||
foreach (QString name, m_dataManager->namesOfUserVariables()){
|
||||
vars->addChild(name,DataNode::Variable,QIcon(":/report/images/value"));
|
||||
}
|
||||
}
|
||||
|
||||
DataSourceManager::DataSourceManager(QObject *parent) :
|
||||
@ -1217,8 +1222,9 @@ QVariant DataSourceManager::variable(const QString &variableName)
|
||||
|
||||
RenderPass DataSourceManager::variablePass(const QString &name)
|
||||
{
|
||||
|
||||
return (m_reportVariables.variablePass(name)==FirstPass)?FirstPass:SecondPass;
|
||||
if (m_userVariables.containsVariable(name))
|
||||
return m_userVariables.variablePass(name);
|
||||
return m_reportVariables.variablePass(name);
|
||||
}
|
||||
|
||||
bool DataSourceManager::variableIsSystem(const QString &name)
|
||||
|
@ -172,20 +172,28 @@ QString ContentItemDesignIntf::expandUserVariables(QString context, RenderPass p
|
||||
QString variable=rx.cap(1);
|
||||
pos += rx.matchedLength();
|
||||
if (dataManager->containsVariable(variable) ){
|
||||
if (pass==dataManager->variablePass(variable)){
|
||||
m_varValue = dataManager->variable(variable);
|
||||
switch (expandType){
|
||||
case EscapeSymbols:
|
||||
context.replace(rx.cap(0),escapeSimbols(m_varValue.toString()));
|
||||
break;
|
||||
case NoEscapeSymbols:
|
||||
context.replace(rx.cap(0),m_varValue.toString());
|
||||
break;
|
||||
case ReplaceHTMLSymbols:
|
||||
context.replace(rx.cap(0),replaceHTMLSymbols(m_varValue.toString()));
|
||||
break;
|
||||
try {
|
||||
if (pass==dataManager->variablePass(variable)){
|
||||
m_varValue = dataManager->variable(variable);
|
||||
switch (expandType){
|
||||
case EscapeSymbols:
|
||||
context.replace(rx.cap(0),escapeSimbols(m_varValue.toString()));
|
||||
break;
|
||||
case NoEscapeSymbols:
|
||||
context.replace(rx.cap(0),m_varValue.toString());
|
||||
break;
|
||||
case ReplaceHTMLSymbols:
|
||||
context.replace(rx.cap(0),replaceHTMLSymbols(m_varValue.toString()));
|
||||
break;
|
||||
}
|
||||
pos=0;
|
||||
}
|
||||
pos=0;
|
||||
} catch (ReportError e){
|
||||
dataManager->putError(e.what());
|
||||
if (!reportSettings() || reportSettings()->suppressAbsentFieldsAndVarsWarnings())
|
||||
context.replace(rx.cap(0),e.what());
|
||||
else
|
||||
context.replace(rx.cap(0),"");
|
||||
}
|
||||
} else {
|
||||
QString error;
|
||||
|
Loading…
Reference in New Issue
Block a user