The data group header and footer paints over the page footer on preview so i tried to add some lines from other functions to prcessGroupHeader.
This is my prcessGroupHeader:
void QtRPT::prcessGroupHeader(QPrinter *printer, int &y, bool draw, int pageReport) {
m_recNo = 0;
if (dataGroupHeader.isNull()) {
processMHeader(y,draw);
processPFooter(draw);
processMasterData(printer,y,draw,pageReport);
processMFooter(printer,y,draw);
} else {
fillListOfValue(masterData);
if (listOfPair.size() > 0) {
QDomElement e = dataGroupHeader.toElement();
QDomElement e1 = dataGroupFooter.toElement();
QString groupingField = e.attribute("groupingField");
for (int i = 0; i < recordCount.at(pageReport); i++) {
m_recNo = i;
sectionField(e, groupingField, false, true);
}
listOfGroup.clear();
mg_recNo = 0;
if (masterHeader.toElement().attribute("showInGroup").toInt() == 0)
processMHeader(y,draw);
int grpNo = 0;
for (int j = 0; j < listOfPair.size(); ++j) {
if (listOfPair.at(j).pageReport == pageReport && listOfPair.at(j).paramName == groupingField) {
bool founded = false;
for (int i=0; i < listOfGroup.size(); ++i) {
if (listOfGroup.at(i) == listOfPair.at(j).paramValue)
founded = true;
}
listIdxOfGroup.clear();
for (int k=0; k < listOfPair.size(); ++k) {
if (listOfPair.at(k).paramName == groupingField &&
listOfPair.at(k).pageReport == pageReport &&
listOfPair.at(k).paramValue.toString() == listOfPair.at(j).paramValue.toString()
) {
//fill the idx for current group
listIdxOfGroup << listOfPair.at(k).lnNo;
}
}
if (!founded) { //Start new group
grpNo += 1;
//Added codes here
int yPF = 0;
if (!pageFooter.isNull()) {
QDomElement pf = pageFooter.toElement();
yPF = pf.attribute("height").toInt();
}
int yMF = 0;
if (!masterFooter.isNull()) {
QDomElement mf = masterFooter.toElement();
yMF = mf.attribute("height").toInt();
}
//ends here
listOfGroup << listOfPair.at(j).paramValue.toString();
if (e.attribute("startNewPage").toInt() == 1 && grpNo != 1) //Start new page for each Data group
newPage(printer, y, draw);
m_recNo = listOfPair.at(j).lnNo;
//Start new numeration for group
if (e.attribute("startNewNumeration").toInt() != 0)
mg_recNo = 0;
//Added codes here
if (y + e.attribute("realHeight").toInt() > ph-mb-mt-yPF-yMF)
newPage(printer, y, draw);
//ends here
if (allowPrintPage(draw,curPage)) //Draw header of the group
drawBandRow(dataGroupHeader,y);
y += e.attribute("height").toInt();
if (masterHeader.toElement().attribute("showInGroup").toInt() == 1)
processMHeader(y,draw);
processPFooter(draw);
processMasterData(printer,y,draw,pageReport);
if (masterFooter.toElement().attribute("showInGroup").toInt() == 1)
processMFooter(printer,y,draw);
//---
m_recNo = listOfPair.at(j).lnNo;
//Added codes here
if (y + e.attribute("realHeight").toInt() > ph-mb-mt-yPF-yMF)
newPage(printer, y, draw);
//ends here
if (allowPrintPage(draw,curPage)) { //Draw footer of the group
drawBandRow(dataGroupFooter,y);
}
y += e1.attribute("height").toInt();
}
}
}
if (masterFooter.toElement().attribute("showInGroup").toInt() == 0)
processMFooter(printer,y,draw);
}
}
}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Here are the screenshots. I had to blur some confidential data and highlight the problematic areas. I also scaled down the image to make the image smaller.
Hello,
The data group header and footer paints over the page footer on preview so i tried to add some lines from other functions to prcessGroupHeader.
This is my prcessGroupHeader:
void QtRPT::prcessGroupHeader(QPrinter *printer, int &y, bool draw, int pageReport) {
m_recNo = 0;
if (dataGroupHeader.isNull()) {
}
May you make a screenshoot of preview with a bug?
Hello,
Here are the screenshots. I had to blur some confidential data and highlight the problematic areas. I also scaled down the image to make the image smaller.
Last edit: puterk 2014-11-24
Thank you for your correction. I made changes in the source code. Today evening I will upload to SVN.
Hello again,
Thanks for all your efforts.
By the way, The codes I inserted might have affected the page count (TotalPages). I don't know how to fix this one.
So please give me your xml file and if possible some example code to fill the data of the report to simulate the situatuin
Last edit: aliks-os 2014-11-25