mirror of
https://github.com/python-LimeReport/LimeReport.git
synced 2024-12-24 12:34:39 +03:00
Field list for CallbackDatasource in TextItem has been fixed
This commit is contained in:
parent
93393186b3
commit
6a25ac752f
@ -119,6 +119,8 @@ void TextItemEditor::initUI()
|
|||||||
se.setDataManager(dm);
|
se.setDataManager(dm);
|
||||||
|
|
||||||
if (dm){
|
if (dm){
|
||||||
|
if (dm->isNeedUpdateDatasourceModel())
|
||||||
|
dm->updateDatasourceModel();
|
||||||
ui->twData->setModel(dm->datasourcesModel());
|
ui->twData->setModel(dm->datasourcesModel());
|
||||||
ui->twScriptEngine->setModel(se.model());
|
ui->twScriptEngine->setModel(se.model());
|
||||||
|
|
||||||
|
@ -211,7 +211,7 @@ void DataSourceModel::updateModel()
|
|||||||
}
|
}
|
||||||
|
|
||||||
DataSourceManager::DataSourceManager(QObject *parent) :
|
DataSourceManager::DataSourceManager(QObject *parent) :
|
||||||
QObject(parent), m_lastError(""), m_designTime(true)
|
QObject(parent), m_lastError(""), m_designTime(true), m_needUpdate(false)
|
||||||
{
|
{
|
||||||
m_groupFunctionFactory.registerFunctionCreator(QLatin1String("COUNT"),new ConstructorGroupFunctionCreator<CountGroupFunction>);
|
m_groupFunctionFactory.registerFunctionCreator(QLatin1String("COUNT"),new ConstructorGroupFunctionCreator<CountGroupFunction>);
|
||||||
m_groupFunctionFactory.registerFunctionCreator(QLatin1String("SUM"),new ConstructorGroupFunctionCreator<SumGroupFunction>);
|
m_groupFunctionFactory.registerFunctionCreator(QLatin1String("SUM"),new ConstructorGroupFunctionCreator<SumGroupFunction>);
|
||||||
@ -281,6 +281,7 @@ ICallbackDatasource *DataSourceManager::createCallbackDatasouce(const QString& n
|
|||||||
IDataSourceHolder* holder = new CallbackDatasourceHolder(dynamic_cast<IDataSource*>(ds),true);
|
IDataSourceHolder* holder = new CallbackDatasourceHolder(dynamic_cast<IDataSource*>(ds),true);
|
||||||
putHolder(name,holder);
|
putHolder(name,holder);
|
||||||
emit datasourcesChanged();
|
emit datasourcesChanged();
|
||||||
|
m_needUpdate = true;
|
||||||
return ds;
|
return ds;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -333,6 +334,12 @@ QSharedPointer<QAbstractItemModel>DataSourceManager::previewSQL(const QString &c
|
|||||||
return QSharedPointer<QAbstractItemModel>(0);
|
return QSharedPointer<QAbstractItemModel>(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DataSourceManager::updateDatasourceModel()
|
||||||
|
{
|
||||||
|
m_datasourcesModel.updateModel();
|
||||||
|
m_needUpdate = false;
|
||||||
|
}
|
||||||
|
|
||||||
QString DataSourceManager::extractField(QString source)
|
QString DataSourceManager::extractField(QString source)
|
||||||
{
|
{
|
||||||
if (source.contains('.')) {
|
if (source.contains('.')) {
|
||||||
|
@ -70,6 +70,7 @@ private:
|
|||||||
|
|
||||||
class DataSourceModel : public QAbstractItemModel{
|
class DataSourceModel : public QAbstractItemModel{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
friend class DataSourceManager;
|
||||||
public:
|
public:
|
||||||
DataSourceModel():m_rootNode(new DataNode()){}
|
DataSourceModel():m_rootNode(new DataNode()){}
|
||||||
DataSourceModel(DataSourceManager* dataManager);
|
DataSourceModel(DataSourceManager* dataManager);
|
||||||
@ -184,7 +185,8 @@ public:
|
|||||||
QString replaceVariables(QString value);
|
QString replaceVariables(QString value);
|
||||||
QString replaceFields(QString query, QMap<QString, QString> &aliasesToParam, QString masterDatasource = "");
|
QString replaceFields(QString query, QMap<QString, QString> &aliasesToParam, QString masterDatasource = "");
|
||||||
QSharedPointer<QAbstractItemModel> previewSQL(const QString& connectionName, const QString& sqlText, QString masterDatasource="");
|
QSharedPointer<QAbstractItemModel> previewSQL(const QString& connectionName, const QString& sqlText, QString masterDatasource="");
|
||||||
|
void updateDatasourceModel();
|
||||||
|
bool isNeedUpdateDatasourceModel(){ return m_needUpdate;}
|
||||||
signals:
|
signals:
|
||||||
void loadCollectionFinished(const QString& collectionName);
|
void loadCollectionFinished(const QString& collectionName);
|
||||||
void cleared();
|
void cleared();
|
||||||
@ -231,6 +233,7 @@ private:
|
|||||||
QString m_lastError;
|
QString m_lastError;
|
||||||
QStringList m_errorsList;
|
QStringList m_errorsList;
|
||||||
bool m_designTime;
|
bool m_designTime;
|
||||||
|
bool m_needUpdate;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user