Skip to content
Permalink
Browse files

Fix repositioning guides on pages > 1

  • Loading branch information
nyalldawson committed Dec 19, 2017
1 parent b594ecd commit e9c0d29ff19a947e7f0498b3b24be94cdc2fc0bf
Showing with 9 additions and 6 deletions.
  1. +4 −4 src/app/layout/qgslayoutguidewidget.cpp
  2. +5 −2 src/core/layout/qgslayoutguidecollection.cpp
@@ -41,11 +41,11 @@ QgsLayoutGuideWidget::QgsLayoutGuideWidget( QWidget *parent, QgsLayout *layout,
mVertGuidesTableView->setEditTriggers( QAbstractItemView::AllEditTriggers );


mHozGuidesTableView->setItemDelegateForColumn( 0, new QgsLayoutGuidePositionDelegate( mHozGuidesTableView, mLayout, mHozProxyModel ) );
mHozGuidesTableView->setItemDelegateForColumn( 1, new QgsLayoutGuideUnitDelegate( mHozGuidesTableView, mLayout, mHozProxyModel ) );
mHozGuidesTableView->setItemDelegateForColumn( 0, new QgsLayoutGuidePositionDelegate( mHozGuidesTableView, mLayout, &mLayout->guides() ) );
mHozGuidesTableView->setItemDelegateForColumn( 1, new QgsLayoutGuideUnitDelegate( mHozGuidesTableView, mLayout, &mLayout->guides() ) );

mVertGuidesTableView->setItemDelegateForColumn( 0, new QgsLayoutGuidePositionDelegate( mVertGuidesTableView, mLayout, mVertProxyModel ) );
mVertGuidesTableView->setItemDelegateForColumn( 1, new QgsLayoutGuideUnitDelegate( mVertGuidesTableView, mLayout, mVertProxyModel ) );
mVertGuidesTableView->setItemDelegateForColumn( 0, new QgsLayoutGuidePositionDelegate( mVertGuidesTableView, mLayout, &mLayout->guides() ) );
mVertGuidesTableView->setItemDelegateForColumn( 1, new QgsLayoutGuideUnitDelegate( mVertGuidesTableView, mLayout, &mLayout->guides() ) );

connect( mAddHozGuideButton, &QPushButton::clicked, this, &QgsLayoutGuideWidget::addHorizontalGuide );
connect( mAddVertGuideButton, &QPushButton::clicked, this, &QgsLayoutGuideWidget::addVerticalGuide );
@@ -140,11 +140,11 @@ void QgsLayoutGuide::setLayoutPosition( double position )
switch ( mOrientation )
{
case Qt::Horizontal:
p = mLineItem->mapFromScene( QPointF( 0, position ) ).y();
p = mPage->mapFromScene( QPointF( 0, position ) ).y();
break;

case Qt::Vertical:
p = mLineItem->mapFromScene( QPointF( position, 0 ) ).x();
p = mPage->mapFromScene( QPointF( position, 0 ) ).x();
break;
}
mPosition = mLayout->convertFromLayoutUnits( p, mPosition.units() );
@@ -299,6 +299,9 @@ bool QgsLayoutGuideCollection::setData( const QModelIndex &index, const QVariant
return false;

QgsLayoutMeasurement m = guide->position();
if ( m.length() == newPos )
return true;

m.setLength( newPos );
mLayout->undoStack()->beginCommand( mPageCollection, tr( "Move Guide" ), Move + index.row() );
whileBlocking( guide )->setPosition( m );

0 comments on commit e9c0d29

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