Skip to content

Commit

Permalink
Slightly improved guide appearance
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Aug 7, 2017
1 parent e718f92 commit 6138b97
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/core/layout/qgslayoutguidecollection.cpp
Expand Up @@ -31,7 +31,7 @@ QgsLayoutGuide::QgsLayoutGuide( Orientation orientation, const QgsLayoutMeasurem
{
mLineItem->hide();
mLineItem->setZValue( QgsLayout::ZGuide );
QPen linePen( Qt::SolidLine );
QPen linePen( Qt::DotLine );
linePen.setColor( Qt::red );
// use a pen width of 0, since this activates a cosmetic pen
// which doesn't scale with the composer and keeps a constant size
Expand Down
15 changes: 13 additions & 2 deletions src/gui/layout/qgslayoutruler.cpp
Expand Up @@ -265,8 +265,8 @@ void QgsLayoutRuler::createTemporaryGuideItem()
mGuideItem.reset( new QGraphicsLineItem() );

mGuideItem->setZValue( QgsLayout::ZGuide );
QPen linePen( Qt::DashLine );
linePen.setColor( Qt::red );
QPen linePen( Qt::DotLine );
linePen.setColor( QColor( 255, 0, 0, 150 ) );
linePen.setWidthF( 0 );
mGuideItem->setPen( linePen );

Expand Down Expand Up @@ -456,6 +456,17 @@ void QgsLayoutRuler::mouseMoveEvent( QMouseEvent *event )
QgsLayout *layout = mView->currentLayout();
int pageNo = layout->pageCollection()->pageNumberForPoint( displayPos );
QgsLayoutItemPage *page = layout->pageCollection()->page( pageNo );
QPen linePen = mGuideItem->pen();
// if guide preview is outside a page draw it a lot fainter, to indicate it's invalid
if ( !layout->pageCollection()->pageAtPoint( displayPos ) )
{
linePen.setColor( QColor( 255, 0, 0, 150 ) );
}
else
{
linePen.setColor( QColor( 255, 0, 0, 225 ) );
}
mGuideItem->setPen( linePen );

switch ( mOrientation )
{
Expand Down

0 comments on commit 6138b97

Please sign in to comment.