Skip to content

Commit b45d8cb

Browse files
committed
Snap to paper items and consider multipage compositions when showing snap lines
1 parent f4c5bc8 commit b45d8cb

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/core/composer/qgscomposeritem.cpp

+7-1
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,13 @@ void QgsComposerItem::changeItemRectangle( const QPointF& currentPosition,
639639
if ( alignX != -1 )
640640
{
641641
QGraphicsLineItem* item = hAlignSnapItem();
642-
item->setLine( QLineF( alignX, 0, alignX, mComposition->paperHeight() ) );
642+
int numPages = mComposition->numPages();
643+
double yLineCoord = 300; //default in case there is no single page
644+
if ( numPages > 0 )
645+
{
646+
yLineCoord = mComposition->paperHeight() * numPages + mComposition->spaceBetweenPages() * ( numPages - 1 );
647+
}
648+
item->setLine( QLineF( alignX, 0, alignX, yLineCoord ) );
643649
item->show();
644650
}
645651
else

src/core/composer/qgscomposition.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1735,7 +1735,7 @@ void QgsComposition::collectAlignCoordinates( QMap< double, const QgsComposerIte
17351735
const QgsComposerItem* currentItem = dynamic_cast<const QgsComposerItem *>( *itemIt );
17361736
if ( excludeItem )
17371737
{
1738-
if ( !currentItem || currentItem == excludeItem || currentItem->type() == QgsComposerItem::ComposerPaper )
1738+
if ( !currentItem || currentItem == excludeItem )
17391739
{
17401740
continue;
17411741
}

0 commit comments

Comments
 (0)