Skip to content

Commit 6138b97

Browse files
committed
Slightly improved guide appearance
1 parent e718f92 commit 6138b97

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

src/core/layout/qgslayoutguidecollection.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ QgsLayoutGuide::QgsLayoutGuide( Orientation orientation, const QgsLayoutMeasurem
3131
{
3232
mLineItem->hide();
3333
mLineItem->setZValue( QgsLayout::ZGuide );
34-
QPen linePen( Qt::SolidLine );
34+
QPen linePen( Qt::DotLine );
3535
linePen.setColor( Qt::red );
3636
// use a pen width of 0, since this activates a cosmetic pen
3737
// which doesn't scale with the composer and keeps a constant size

src/gui/layout/qgslayoutruler.cpp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,8 @@ void QgsLayoutRuler::createTemporaryGuideItem()
265265
mGuideItem.reset( new QGraphicsLineItem() );
266266

267267
mGuideItem->setZValue( QgsLayout::ZGuide );
268-
QPen linePen( Qt::DashLine );
269-
linePen.setColor( Qt::red );
268+
QPen linePen( Qt::DotLine );
269+
linePen.setColor( QColor( 255, 0, 0, 150 ) );
270270
linePen.setWidthF( 0 );
271271
mGuideItem->setPen( linePen );
272272

@@ -456,6 +456,17 @@ void QgsLayoutRuler::mouseMoveEvent( QMouseEvent *event )
456456
QgsLayout *layout = mView->currentLayout();
457457
int pageNo = layout->pageCollection()->pageNumberForPoint( displayPos );
458458
QgsLayoutItemPage *page = layout->pageCollection()->page( pageNo );
459+
QPen linePen = mGuideItem->pen();
460+
// if guide preview is outside a page draw it a lot fainter, to indicate it's invalid
461+
if ( !layout->pageCollection()->pageAtPoint( displayPos ) )
462+
{
463+
linePen.setColor( QColor( 255, 0, 0, 150 ) );
464+
}
465+
else
466+
{
467+
linePen.setColor( QColor( 255, 0, 0, 225 ) );
468+
}
469+
mGuideItem->setPen( linePen );
459470

460471
switch ( mOrientation )
461472
{

0 commit comments

Comments
 (0)