fralx / LimeReport

Report generator for Qt Framework
http://limereport.ru/
Other
403 stars 154 forks source link

useAlternateBackgroundColor doesn't work on for a first element in a list (e.g. on page break) #286

Closed 7ymekk closed 4 years ago

7ymekk commented 4 years ago

UseCase:

(I've put blue rectangles to hide sensitive data)

image

I noticed that following code fixes the issue but it seems to me like workaround and not the fix itself:

lrreportrender.cpp: ReportRender::renderBand

if (mode==StartNewPageAsNeeded){
    if (bandClone->columnsCount()>1 &&
        (bandClone->columnsFillDirection()==BandDesignIntf::Vertical ||
         bandClone->columnsFillDirection()==BandDesignIntf::VerticalUniform))
    {
        startNewColumn();
        if (patternBand->bandHeader() &&
            patternBand->bandHeader()->columnsCount()>1 &&
            !m_lostHeadersMoved &&
            patternBand->bandNestingLevel() == 0
        ){
            renderBand(patternBand->bandHeader(), 0, mode);
        }
    } else {
        savePage();
        startNewPage();
        if (!bandIsSliced){
            BandDesignIntf* t = renderData(patternBand);
            t->copyBookmarks(bandClone);
            t->setBackgroundColor(bandClone->backgroundColor()); //<----------------I ADDED THIS LINE
            patternBand->emitBandReRendered(bandClone, t);
            delete bandClone;
            bandClone = t;
        }
    }
fralx commented 4 years ago

The right solution, the new band have to take background color from bandClone. I have fixed it.

7ymekk commented 4 years ago

again: thanks for a quick response and fix :)