0
0
mirror of https://github.com/fralx/LimeReport.git synced 2025-10-04 04:06:43 +03:00

added proxyModel to filter datasource for groupHeader

This commit is contained in:
yanis60
2024-05-29 08:26:18 +01:00
parent 7b7d4add4e
commit 8915075561
13 changed files with 260 additions and 47 deletions

View File

@@ -514,11 +514,14 @@ TextItem::TextPtr TextItem::textDocument() const
QString content = m_trimValue ? m_strText.trimmed() : m_strText;
if (allowHTML())
{
if (isReplaceCarriageReturns()){
text->setHtml(replaceReturns(content));
} else {
text->setHtml(content);
}
}
else
text->setPlainText(content);
@@ -533,7 +536,7 @@ TextItem::TextPtr TextItem::textDocument() const
to.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
else to.setWrapMode(QTextOption::NoWrap);
text->setDocumentMargin(0);
text->setDocumentMargin(marginSize());
text->setDefaultTextOption(to);
QFont _font = transformToSceneFont(font());

View File

@@ -99,7 +99,7 @@ bool QueryHolder::runQuery(IDataSource::DatasourceMode mode)
if (m_dataSource)
m_dataSource.clear();
setLastError(model->lastError().text());
delete model;
//delete model;
return false;
} else { setLastError("");}

View File

@@ -329,6 +329,7 @@ bool DataSourceManager::addModel(const QString &name, QAbstractItemModel *model,
} catch (ReportError &e){
putError(e.what());
setLastError(e.what());
delete model;
return false;
}
emit datasourcesChanged();

View File

@@ -968,9 +968,14 @@ void ReportRender::renderGroupHeader(BandDesignIntf *parentBand, IDataSource* da
GroupBandHeader *group = dynamic_cast<GroupBandHeader*>(parentBand);
if(dataSource->model() && group && !group->groupFieldName().isEmpty() && !m_dataSourceSorted)
{
dataSource->model()->sort(dataSource->columnIndexByName(group->groupFieldName()),group->SortFieldNameBy());
qDebug()<<"sorted;";
m_dataSourceSorted = true;
MasterDetailProxyModel *proxyModel = static_cast<MasterDetailProxyModel*>(dataSource->model());
if(proxyModel)
{
proxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
proxyModel->sort(dataSource->columnIndexByName(group->groupFieldName()),group->SortFieldNameBy());
m_dataSourceSorted = true;
}
}
foreach(BandDesignIntf* band,parentBand->childrenByType(BandDesignIntf::GroupHeader)){