mirror of
https://github.com/fralx/LimeReport.git
synced 2024-12-25 00:54:39 +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){
|
if (items.at(0)->type()==Variable){
|
||||||
result->setText("variable:$V{"+items.at(0)->text(0)+"}");
|
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;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,6 +208,11 @@ void DataSourceModel::updateModel()
|
|||||||
foreach (QString name, m_dataManager->variableNames()){
|
foreach (QString name, m_dataManager->variableNames()){
|
||||||
vars->addChild(name,DataNode::Variable,QIcon(":/report/images/value"));
|
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) :
|
DataSourceManager::DataSourceManager(QObject *parent) :
|
||||||
@ -1217,8 +1222,9 @@ QVariant DataSourceManager::variable(const QString &variableName)
|
|||||||
|
|
||||||
RenderPass DataSourceManager::variablePass(const QString &name)
|
RenderPass DataSourceManager::variablePass(const QString &name)
|
||||||
{
|
{
|
||||||
|
if (m_userVariables.containsVariable(name))
|
||||||
return (m_reportVariables.variablePass(name)==FirstPass)?FirstPass:SecondPass;
|
return m_userVariables.variablePass(name);
|
||||||
|
return m_reportVariables.variablePass(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DataSourceManager::variableIsSystem(const QString &name)
|
bool DataSourceManager::variableIsSystem(const QString &name)
|
||||||
|
@ -172,6 +172,7 @@ QString ContentItemDesignIntf::expandUserVariables(QString context, RenderPass p
|
|||||||
QString variable=rx.cap(1);
|
QString variable=rx.cap(1);
|
||||||
pos += rx.matchedLength();
|
pos += rx.matchedLength();
|
||||||
if (dataManager->containsVariable(variable) ){
|
if (dataManager->containsVariable(variable) ){
|
||||||
|
try {
|
||||||
if (pass==dataManager->variablePass(variable)){
|
if (pass==dataManager->variablePass(variable)){
|
||||||
m_varValue = dataManager->variable(variable);
|
m_varValue = dataManager->variable(variable);
|
||||||
switch (expandType){
|
switch (expandType){
|
||||||
@ -187,6 +188,13 @@ QString ContentItemDesignIntf::expandUserVariables(QString context, RenderPass p
|
|||||||
}
|
}
|
||||||
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 {
|
} else {
|
||||||
QString error;
|
QString error;
|
||||||
error = tr("Variable %1 not found").arg(variable);
|
error = tr("Variable %1 not found").arg(variable);
|
||||||
|
Loading…
Reference in New Issue
Block a user