diff --git a/limereport/bands/lrgroupbands.h b/limereport/bands/lrgroupbands.h index 85269ed..5ab89f3 100644 --- a/limereport/bands/lrgroupbands.h +++ b/limereport/bands/lrgroupbands.h @@ -81,7 +81,7 @@ private: bool m_resetPageNumber; QString m_condition; QString m_conditionValue; - Qt::SortOrder m_sortFieldNameBy; + Qt::SortOrder m_sortFieldNameBy = Qt::AscendingOrder; }; class GroupBandFooter : public BandDesignIntf{ diff --git a/limereport/lrdatadesignintf.cpp b/limereport/lrdatadesignintf.cpp index f7b2b0c..fce6071 100644 --- a/limereport/lrdatadesignintf.cpp +++ b/limereport/lrdatadesignintf.cpp @@ -199,6 +199,7 @@ ModelToDataSource::ModelToDataSource(QAbstractItemModel* model, bool owned) model->fetchMore(QModelIndex()); if (model->rowCount() <= 0) break; } + connect(model, SIGNAL(destroyed()), this, SLOT(slotModelDestroed())); connect(model, SIGNAL(modelReset()), this, SIGNAL(modelStateChanged())); } @@ -306,6 +307,12 @@ int ModelToDataSource::columnCount() return m_model->columnCount(); } +int ModelToDataSource::rowCount() +{ + if (isInvalid()) return 0; + return m_model->rowCount(); +} + QString ModelToDataSource::columnNameByIndex(int columnIndex) { if (isInvalid()) return ""; diff --git a/limereport/lrdatadesignintf.h b/limereport/lrdatadesignintf.h index f070f7a..ab0b4df 100644 --- a/limereport/lrdatadesignintf.h +++ b/limereport/lrdatadesignintf.h @@ -107,7 +107,7 @@ public: void setPort(QString port); public: static QString connectionNameForUser(const QString& connectionName); - static QString connectionNameForReport(const QString& connectionName); + static QString connectionNameForReport(const QString& connectionName); signals: void nameChanged(const QString& oldName,const QString& newName); private: @@ -325,7 +325,7 @@ private: QString m_name; }; -class MasterDetailProxyModel : public QSortFilterProxyModel{ +class MasterDetailProxyModel : public QSortFilterProxyModel{ Q_OBJECT public: MasterDetailProxyModel(DataSourceManager* dataManager):m_maps(0),m_dataManager(dataManager){} @@ -392,6 +392,7 @@ public: QVariant dataByRowIndex(const QString &columnName, int rowIndex, const QString &roleName); QVariant dataByKeyField(const QString& columnName, const QString& keyColumnName, QVariant keyData); int columnCount(); + int rowCount(); QString columnNameByIndex(int columnIndex); int columnIndexByName(QString name); QVariant headerData(const QString &columnName, const QString &roleName); diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index 22d01c5..b7ef936 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -181,6 +181,7 @@ void ReportRender::initDatasources(){ void ReportRender::initDatasource(const QString& name){ try{ if (datasources()->containsDatasource(name)){ + if(m_dataSourceSorted)return; IDataSource* ds = datasources()->dataSource(name); if (ds) ds->first(); @@ -259,8 +260,10 @@ void ReportRender::renderPage(PageItemDesignIntf* patternPage, bool isTOC, bool clearPageMap(); try{ + datasources()->setAllDatasourcesToFirst(); datasources()->clearGroupFuntionsExpressions(); + } catch(ReportError &exception){ //TODO possible should thow exeption QMessageBox::critical(0,tr("Error"),exception.what()); @@ -274,6 +277,7 @@ void ReportRender::renderPage(PageItemDesignIntf* patternPage, bool isTOC, bool m_dataSourceSorted = false; BandDesignIntf* lastRenderedBand = 0; for (int i=0;idataBandCount() && !m_renderCanceled; i++){ + lastRenderedBand = m_patternPageItem->dataBandAt(i); initDatasource(lastRenderedBand->datasourceName()); renderDataBand(lastRenderedBand); @@ -696,7 +700,6 @@ void ReportRender::renderDataBand(BandDesignIntf *dataBand) IDataSource* bandDatasource = 0; m_lastRenderedFooter = 0; - if (!dataBand->datasourceName().isEmpty()) bandDatasource = datasources()->dataSource(dataBand->datasourceName()); @@ -968,10 +971,12 @@ void ReportRender::renderGroupHeader(BandDesignIntf *parentBand, IDataSource* da GroupBandHeader *group = dynamic_cast(parentBand); if(dataSource->model() && group && !group->groupFieldName().isEmpty() && !m_dataSourceSorted) { + MasterDetailProxyModel *proxyModel = static_cast(dataSource->model()); + if(proxyModel) { - proxyModel->setSortCaseSensitivity(Qt::CaseInsensitive); + //proxyModel->setSortCaseSensitivity(Qt::CaseInsensitive); proxyModel->sort(dataSource->columnIndexByName(group->groupFieldName()),group->SortFieldNameBy()); m_dataSourceSorted = true; diff --git a/translations/limereport_fr.ts b/translations/limereport_fr.ts index dd26c82..2762075 100644 --- a/translations/limereport_fr.ts +++ b/translations/limereport_fr.ts @@ -830,8 +830,8 @@ p, li { white-space: pre-wrap; } LimeReport::ConnectionDesc - - + + defaultConnection Connexion par défaut @@ -1946,12 +1946,12 @@ p, li { white-space: pre-wrap; } LimeReport::MasterDetailProxyModel - + Field: "%1" not found in "%2" child datasource Le champ: "%1"est introuvable dans la source de donnée enfant "%2" - + Field: "%1" not found in "%2" master datasource Le champ: "%1"est introuvable dans la source de donnée principale "%2" @@ -1959,7 +1959,7 @@ p, li { white-space: pre-wrap; } LimeReport::ModelToDataSource - + model is destroyed Le modèle a été supprimé @@ -2398,7 +2398,7 @@ p, li { white-space: pre-wrap; } LimeReport::ProxyHolder - + Datasource has been invalidated La source de donnée n'a pas été validée @@ -3604,25 +3604,25 @@ Cet aperçu n'est plus valide. LimeReport::ReportRender - - + + Error Erreur - + page index out of range Indice de la page dépassé - - + + Databand "%1" not found Bande de données "%1 introuvable - - + + Wrong using function %1 Utilisation incorrecte de la fonction "%1" @@ -4543,27 +4543,27 @@ Cet aperçu n'est plus valide. Connexion invalidé %1 - + Master datasource "%1" not found! Source de donnée principale "%1" introuvable! - + Master datasouce "%1" not found! Source de donnée principale "%1" introuvable! - + Child Enfant - + and child est enfant - + datasouce "%1" not found! Source de donnée "%1" introuvable! diff --git a/translations/limereport_pl.ts b/translations/limereport_pl.ts index 68b21be..a83ea82 100644 --- a/translations/limereport_pl.ts +++ b/translations/limereport_pl.ts @@ -842,8 +842,8 @@ p, li { white-space: pre-wrap; } LimeReport::ConnectionDesc - - + + defaultConnection Domyślne połączenie @@ -1958,12 +1958,12 @@ p, li { white-space: pre-wrap; } LimeReport::MasterDetailProxyModel - + Field: "%1" not found in "%2" child datasource Pole: "%1" nie znalezione w "%2" źródle danch dziecka - + Field: "%1" not found in "%2" master datasource Pole: "%1" nie znalezione w "%2" głównym źródle danch @@ -1971,7 +1971,7 @@ p, li { white-space: pre-wrap; } LimeReport::ModelToDataSource - + model is destroyed Model danych jest zniszczony @@ -2410,7 +2410,7 @@ p, li { white-space: pre-wrap; } LimeReport::ProxyHolder - + Datasource has been invalidated Źródło danych zostało unieważnione @@ -3616,25 +3616,25 @@ Ten podgląd nie jest już prawidłowy. LimeReport::ReportRender - - + + Error Błąd - + page index out of range indeks strony poza zakresem - - + + Databand "%1" not found Sekcja danych "%1" nie znaleziona - - + + Wrong using function %1 Złe użycie funkcji %1 @@ -4555,27 +4555,27 @@ Ten podgląd nie jest już prawidłowy. Nieprawidłowe połączenie! %1 - + Master datasource "%1" not found! Nie znaleziono głównego źródła danych "%1"! - + Master datasouce "%1" not found! Nie znaleziono głównego źródła danych "%1"! - + Child Dziecko - + and child i dziecko - + datasouce "%1" not found! nie znaleziono źródła danych "%1"!