Skip to content
Permalink
Browse files

[composer] Add method for overriding page break location in multi fra…

…me items (sponsored by City of Uster, Switzerland)
  • Loading branch information
nyalldawson committed Apr 28, 2014
1 parent c37b848 commit 4885289c46ab8c6a9e41431a0774d913adce7fc7
Showing with 9 additions and 1 deletion.
  1. +2 −1 src/core/composer/qgscomposermultiframe.cpp
  2. +7 −0 src/core/composer/qgscomposermultiframe.h
@@ -91,6 +91,7 @@ void QgsComposerMultiFrame::recalculateFrameSizes()
}
else
{
currentHeight = findNearbyPageBreak( currentY + currentHeight ) - currentY;
currentItem->setContentSection( QRectF( 0, currentY, currentItem->rect().width(), currentHeight ) );
}
currentItem->update();
@@ -103,7 +104,7 @@ void QgsComposerMultiFrame::recalculateFrameSizes()
while (( mResizeMode == RepeatOnEveryPage ) || currentY < totalHeight )
{
//find out on which page the lower left point of the last frame is
int page = qFloor( (currentItem->pos().y() + currentItem->rect().height()) / ( mComposition->paperHeight() + mComposition->spaceBetweenPages() ) ) + 1;
int page = qFloor(( currentItem->pos().y() + currentItem->rect().height() ) / ( mComposition->paperHeight() + mComposition->spaceBetweenPages() ) ) + 1;

if ( mResizeMode == RepeatOnEveryPage )
{
@@ -48,6 +48,13 @@ class CORE_EXPORT QgsComposerMultiFrame: public QObject

virtual void addFrame( QgsComposerFrame* frame, bool recalcFrameSizes = true ) = 0;

/**Finds the optimal position to break a frame at.
* @param yPos maximum vertical position for break
* @returns the optimal breakable position which occurs in the multi frame close
* to and before the specified yPos
* Note: added in version 2.3*/
virtual double findNearbyPageBreak( double yPos ) { return yPos; }

void removeFrame( int i );

void update();

0 comments on commit 4885289

Please sign in to comment.
You can’t perform that action at this time.